From ddff68a546bf6991d517182435feeb93054d0335 Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Thu, 18 Jun 2020 13:07:59 +0100 Subject: [PATCH] add ifdef guards for NR code --- srsenb/src/enb.cc | 11 ++++++++--- srsue/src/ue.cc | 8 +++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/srsenb/src/enb.cc b/srsenb/src/enb.cc index 7cace5718..3ebe3003e 100644 --- a/srsenb/src/enb.cc +++ b/srsenb/src/enb.cc @@ -20,12 +20,14 @@ */ #include "srsenb/hdr/enb.h" -#include "srsenb/hdr/phy/vnf_phy_nr.h" #include "srsenb/hdr/stack/enb_stack_lte.h" -#include "srsenb/hdr/stack/gnb_stack_nr.h" #include "srsenb/src/enb_cfg_parser.h" #include "srslte/build_info.h" #include "srslte/radio/radio_null.h" +#ifdef ENABLE_5GNR +#include "srsenb/hdr/phy/vnf_phy_nr.h" +#include "srsenb/hdr/stack/gnb_stack_nr.h" +#endif #include namespace srsenb { @@ -111,7 +113,7 @@ int enb::init(const all_args_t& args_, srslte::logger* logger_) radio = std::move(lte_radio); } else if (args.stack.type == "nr") { - +#ifdef ENABLE_5GNR std::unique_ptr nr_stack(new srsenb::gnb_stack_nr(logger)); std::unique_ptr nr_radio(new srslte::radio_null(logger)); std::unique_ptr nr_phy(new srsenb::vnf_phy_nr(logger)); @@ -143,6 +145,9 @@ int enb::init(const all_args_t& args_, srslte::logger* logger_) stack = std::move(nr_stack); phy = std::move(nr_phy); radio = std::move(nr_radio); +#else + log->error("5G NR stack not compiled. Please, activate CMAKE ENABLE_5GNR flag.\n"); +#endif } started = true; // set to true in any case to allow stopping the eNB if an error happened diff --git a/srsue/src/ue.cc b/srsue/src/ue.cc index 02b2b3ce2..4fe6b5b07 100644 --- a/srsue/src/ue.cc +++ b/srsue/src/ue.cc @@ -26,9 +26,11 @@ #include "srslte/radio/radio_null.h" #include "srslte/srslte.h" #include "srsue/hdr/phy/phy.h" -#include "srsue/hdr/phy/vnf_phy_nr.h" #include "srsue/hdr/stack/ue_stack_lte.h" +#ifdef ENABLE_5GNR +#include "srsue/hdr/phy/vnf_phy_nr.h" #include "srsue/hdr/stack/ue_stack_nr.h" +#endif #include #include #include @@ -120,6 +122,7 @@ int ue::init(const all_args_t& args_, srslte::logger* logger_) phy = std::move(lte_phy); radio = std::move(lte_radio); } else if (args.stack.type == "nr") { +#ifdef ENABLE_5GNR std::unique_ptr nr_stack(new srsue::ue_stack_nr(logger)); std::unique_ptr nr_radio(new srslte::radio_null(logger)); std::unique_ptr nr_phy(new srsue::vnf_phy_nr(logger)); @@ -151,6 +154,9 @@ int ue::init(const all_args_t& args_, srslte::logger* logger_) gw_inst = std::move(gw_ptr); phy = std::move(nr_phy); radio = std::move(nr_radio); +#else + log.error("5G NR stack not compiled. Please, activate CMAKE ENABLE_5GNR flag.\n"); +#endif } else { log.console("Invalid stack type %s. Supported values are [lte].\n", args.stack.type.c_str()); ret = SRSLTE_ERROR;