Skip to content

Commit 5e1d9e4

Browse files
asaezperandrepuschmann
authored andcommitted
build: don't build apps according to radio availability
1 parent 266847e commit 5e1d9e4

File tree

4 files changed

+89
-75
lines changed

4 files changed

+89
-75
lines changed

apps/examples/du/CMakeLists.txt

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,26 @@
1818
# and at http://www.gnu.org/licenses/.
1919
#
2020

21-
add_executable(du_example
22-
du_example.cpp
23-
fapi_factory.cpp
24-
phy_factory.cpp
25-
radio_factory.cpp)
21+
if (ZEROMQ_FOUND OR UHD_FOUND)
22+
add_executable(du_example
23+
du_example.cpp
24+
fapi_factory.cpp
25+
phy_factory.cpp
26+
radio_factory.cpp)
2627

27-
target_link_libraries(du_example
28-
srsran_du_high
29-
srsran_gateway
30-
mac_fapi_adaptor_factory
31-
phy_fapi_adaptor_factory
32-
srsran_fapi_message_loggers
33-
srsran_phy_support
34-
srsran_upper_phy
35-
srsran_signal_processors
36-
srsran_channel_processors
37-
srsran_channel_equalizer
38-
srsran_lower_phy
39-
srsran_radio)
28+
target_link_libraries(du_example
29+
srsran_du_high
30+
srsran_gateway
31+
mac_fapi_adaptor_factory
32+
phy_fapi_adaptor_factory
33+
srsran_fapi_message_loggers
34+
srsran_phy_support
35+
srsran_upper_phy
36+
srsran_signal_processors
37+
srsran_channel_processors
38+
srsran_channel_equalizer
39+
srsran_lower_phy
40+
srsran_radio)
4041

41-
target_include_directories(du_example PRIVATE ${CMAKE_SOURCE_DIR})
42+
target_include_directories(du_example PRIVATE ${CMAKE_SOURCE_DIR})
43+
endif (ZEROMQ_FOUND OR UHD_FOUND)

apps/examples/phy/CMakeLists.txt

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,21 @@
2020

2121
set_directory_properties(PROPERTIES LABELS "phy")
2222

23-
add_executable(radio_ssb radio_ssb.cpp lower_phy_example_factory.cpp upper_phy_ssb_example.cpp)
24-
target_link_libraries(radio_ssb
25-
srsran_radio
26-
srslog
27-
srsran_support
28-
srsran_phy_support
29-
srsran_lower_phy
30-
srsran_signal_processors
31-
srsran_channel_processors)
23+
if (ZEROMQ_FOUND OR UHD_FOUND)
3224

33-
# Add lower PHY sample loopback test with ZeroMQ only if ZeroMQ is available.
34-
if (ZEROMQ_FOUND)
35-
add_test(radio_ssb_zmq_20MHz_n7 radio_ssb -P zmq_20MHz_n7 -D 10 -L 1 -v warning)
36-
add_test(radio_ssb_zmq_20MHz_n78 radio_ssb -P zmq_20MHz_n78 -D 10 -L 1 -v warning)
37-
endif (ZEROMQ_FOUND)
25+
add_executable(radio_ssb radio_ssb.cpp lower_phy_example_factory.cpp upper_phy_ssb_example.cpp)
26+
target_link_libraries(radio_ssb
27+
srsran_radio
28+
srslog
29+
srsran_support
30+
srsran_phy_support
31+
srsran_lower_phy
32+
srsran_signal_processors
33+
srsran_channel_processors)
34+
# Add lower PHY sample loopback test with ZeroMQ only if ZeroMQ is available.
35+
if (ZEROMQ_FOUND)
36+
add_test(radio_ssb_zmq_20MHz_n7 radio_ssb -P zmq_20MHz_n7 -D 10 -L 1 -v warning)
37+
add_test(radio_ssb_zmq_20MHz_n78 radio_ssb -P zmq_20MHz_n78 -D 10 -L 1 -v warning)
38+
endif (ZEROMQ_FOUND)
39+
40+
endif (ZEROMQ_FOUND OR UHD_FOUND)

apps/examples/radio/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,7 @@
1818
# and at http://www.gnu.org/licenses/.
1919
#
2020

21-
add_executable(radio_util_sample radio_util_sample.cpp)
22-
target_link_libraries(radio_util_sample srsran_radio srslog srsran_support)
21+
if (UHD_FOUND)
22+
add_executable(radio_util_sample radio_util_sample.cpp)
23+
target_link_libraries(radio_util_sample srsran_radio srslog srsran_support)
24+
endif (UHD_FOUND)

apps/gnb/CMakeLists.txt

Lines changed: 47 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -18,47 +18,54 @@
1818
# and at http://www.gnu.org/licenses/.
1919
#
2020

21-
add_subdirectory(adapters)
21+
if (ZEROMQ_FOUND OR UHD_FOUND)
2222

23-
add_executable(gnb
24-
gnb.cpp
25-
gnb_appconfig_cli11_schema.cpp
26-
gnb_appconfig_validators.cpp
27-
gnb_appconfig_translators.cpp
28-
fapi_factory.cpp
29-
phy_factory.cpp
30-
helpers/metrics_plotter_stdout.cpp
31-
helpers/gnb_console_helper.cpp
32-
)
23+
add_subdirectory(adapters)
3324

34-
install(TARGETS gnb
35-
CONFIGURATIONS Release
36-
RUNTIME)
25+
add_executable(gnb
26+
gnb.cpp
27+
gnb_appconfig_cli11_schema.cpp
28+
gnb_appconfig_validators.cpp
29+
gnb_appconfig_translators.cpp
30+
fapi_factory.cpp
31+
phy_factory.cpp
32+
helpers/metrics_plotter_stdout.cpp
33+
helpers/gnb_console_helper.cpp
34+
)
3735

38-
target_link_libraries(gnb
39-
srsgnb_app_f1u_connector
40-
srsran_cu_up
41-
srsran_cu_cp
42-
srsran_io_broker
43-
srsran_ngap
44-
ngap_asn1
45-
srsran_du_high
46-
srsran_gateway
47-
mac_fapi_adaptor_factory
48-
phy_fapi_adaptor_factory
49-
srsran_fapi_message_loggers
50-
srsran_phy_support
51-
srsran_upper_phy
52-
srsran_signal_processors
53-
srsran_channel_processors
54-
srsran_channel_equalizer
55-
srsran_lower_phy
56-
srsran_radio
57-
srsran_pcap
58-
srsran_support
59-
srsran_build_info
60-
)
61-
add_backward(gnb)
36+
install(TARGETS gnb
37+
CONFIGURATIONS Release
38+
RUNTIME)
6239

63-
target_include_directories(gnb PRIVATE ${CMAKE_SOURCE_DIR})
64-
include_directories(${CMAKE_SOURCE_DIR}/external)
40+
target_link_libraries(gnb
41+
srsgnb_app_f1u_connector
42+
srsran_cu_up
43+
srsran_cu_cp
44+
srsran_io_broker
45+
srsran_ngap
46+
ngap_asn1
47+
srsran_du_high
48+
srsran_gateway
49+
mac_fapi_adaptor_factory
50+
phy_fapi_adaptor_factory
51+
srsran_fapi_message_loggers
52+
srsran_phy_support
53+
srsran_upper_phy
54+
srsran_signal_processors
55+
srsran_channel_processors
56+
srsran_channel_equalizer
57+
srsran_lower_phy
58+
srsran_radio
59+
srsran_pcap
60+
srsran_support
61+
srsran_build_info
62+
)
63+
add_backward(gnb)
64+
65+
target_include_directories(gnb PRIVATE ${CMAKE_SOURCE_DIR})
66+
include_directories(${CMAKE_SOURCE_DIR}/external)
67+
68+
else (ZEROMQ_FOUND OR UHD_FOUND)
69+
message(WARNING "gNB application won't be built because no radio has been found. Please enable UHD or ZEROMQ to build gNB.")
70+
71+
endif (ZEROMQ_FOUND OR UHD_FOUND)

0 commit comments

Comments
 (0)