cmake: flag install() of compiled targets as OPTIONAL

This enables `make install` for partial builds of selected targets,
which otherwise fails because the omitted targets are not present.
master
Robert Falkenberg 3 years ago
parent b6d93577a0
commit 50ac1c6c0a

@ -16,7 +16,7 @@ add_library(srsran_asn1 STATIC
# ASN1 utils # ASN1 utils
add_library(asn1_utils STATIC asn1_utils.cc) add_library(asn1_utils STATIC asn1_utils.cc)
target_link_libraries(asn1_utils srsran_common) target_link_libraries(asn1_utils srsran_common)
INSTALL(TARGETS asn1_utils DESTINATION ${LIBRARY_DIR}) install(TARGETS asn1_utils DESTINATION ${LIBRARY_DIR} OPTIONAL)
# RRC ASN1 lib # RRC ASN1 lib
add_library(rrc_asn1 STATIC add_library(rrc_asn1 STATIC
@ -42,29 +42,29 @@ add_library(rrc_asn1 STATIC
# Compile RRC ASN1 optimized for size # Compile RRC ASN1 optimized for size
target_compile_options(rrc_asn1 PRIVATE "-Os") target_compile_options(rrc_asn1 PRIVATE "-Os")
target_link_libraries(rrc_asn1 asn1_utils srsran_common) target_link_libraries(rrc_asn1 asn1_utils srsran_common)
INSTALL(TARGETS rrc_asn1 DESTINATION ${LIBRARY_DIR}) install(TARGETS rrc_asn1 DESTINATION ${LIBRARY_DIR} OPTIONAL)
# S1AP ASN1 lib # S1AP ASN1 lib
add_library(s1ap_asn1 STATIC add_library(s1ap_asn1 STATIC
s1ap.cc s1ap_utils.cc) s1ap.cc s1ap_utils.cc)
target_compile_options(s1ap_asn1 PRIVATE "-Os") target_compile_options(s1ap_asn1 PRIVATE "-Os")
target_link_libraries(s1ap_asn1 asn1_utils srsran_common) target_link_libraries(s1ap_asn1 asn1_utils srsran_common)
INSTALL(TARGETS s1ap_asn1 DESTINATION ${LIBRARY_DIR}) install(TARGETS s1ap_asn1 DESTINATION ${LIBRARY_DIR} OPTIONAL)
# RRC NR ASN1 # RRC NR ASN1
add_library(rrc_nr_asn1 STATIC rrc_nr.cc rrc_nr_utils.cc) add_library(rrc_nr_asn1 STATIC rrc_nr.cc rrc_nr_utils.cc)
target_compile_options(rrc_nr_asn1 PRIVATE "-Os") target_compile_options(rrc_nr_asn1 PRIVATE "-Os")
target_link_libraries(rrc_nr_asn1 asn1_utils srsran_common) target_link_libraries(rrc_nr_asn1 asn1_utils srsran_common)
INSTALL(TARGETS rrc_nr_asn1 DESTINATION ${LIBRARY_DIR}) install(TARGETS rrc_nr_asn1 DESTINATION ${LIBRARY_DIR} OPTIONAL)
# NGAP ASN1 # NGAP ASN1
add_library(ngap_nr_asn1 STATIC ngap.cc) add_library(ngap_nr_asn1 STATIC ngap.cc)
target_compile_options(ngap_nr_asn1 PRIVATE "-Os") target_compile_options(ngap_nr_asn1 PRIVATE "-Os")
target_link_libraries(ngap_nr_asn1 asn1_utils srsran_common) target_link_libraries(ngap_nr_asn1 asn1_utils srsran_common)
INSTALL(TARGETS ngap_nr_asn1 DESTINATION ${LIBRARY_DIR}) install(TARGETS ngap_nr_asn1 DESTINATION ${LIBRARY_DIR} OPTIONAL)
# NAS 5G # NAS 5G
add_library(nas_5g_msg STATIC nas_5g_msg.cc nas_5g_ies.cc nas_5g_utils.cc) add_library(nas_5g_msg STATIC nas_5g_msg.cc nas_5g_ies.cc nas_5g_utils.cc)
target_compile_options(nas_5g_msg PRIVATE "-Os") target_compile_options(nas_5g_msg PRIVATE "-Os")
target_link_libraries(nas_5g_msg asn1_utils srsran_common) target_link_libraries(nas_5g_msg asn1_utils srsran_common)
INSTALL(TARGETS nas_5g_msg DESTINATION ${LIBRARY_DIR}) install(TARGETS nas_5g_msg DESTINATION ${LIBRARY_DIR} OPTIONAL)

@ -51,6 +51,6 @@ target_include_directories(srsran_common PUBLIC ${SEC_INCLUDE_DIRS} ${CMAKE_SOUR
target_link_libraries(srsran_common srsran_phy support srslog ${SEC_LIBRARIES} ${BACKWARD_LIBRARIES} ${SCTP_LIBRARIES}) target_link_libraries(srsran_common srsran_phy support srslog ${SEC_LIBRARIES} ${BACKWARD_LIBRARIES} ${SCTP_LIBRARIES})
target_compile_definitions(srsran_common PRIVATE ${BACKWARD_DEFINITIONS}) target_compile_definitions(srsran_common PRIVATE ${BACKWARD_DEFINITIONS})
INSTALL(TARGETS srsran_common DESTINATION ${LIBRARY_DIR}) install(TARGETS srsran_common DESTINATION ${LIBRARY_DIR} OPTIONAL)
add_subdirectory(test) add_subdirectory(test)

@ -10,4 +10,4 @@ set(SOURCES gtpu.cc)
add_library(srsran_gtpu STATIC ${SOURCES}) add_library(srsran_gtpu STATIC ${SOURCES})
target_link_libraries(srsran_gtpu srsran_common srsran_asn1 ${ATOMIC_LIBS}) target_link_libraries(srsran_gtpu srsran_common srsran_asn1 ${ATOMIC_LIBS})
INSTALL(TARGETS srsran_gtpu DESTINATION ${LIBRARY_DIR}) install(TARGETS srsran_gtpu DESTINATION ${LIBRARY_DIR} OPTIONAL)

@ -10,6 +10,6 @@ SET(SOURCES pdu.cc pdu_queue.cc mac_sch_pdu_nr.cc mac_rar_pdu_nr.cc)
add_library(srsran_mac STATIC ${SOURCES}) add_library(srsran_mac STATIC ${SOURCES})
target_link_libraries(srsran_mac srsran_common) target_link_libraries(srsran_mac srsran_common)
INSTALL(TARGETS srsran_mac DESTINATION ${LIBRARY_DIR}) install(TARGETS srsran_mac DESTINATION ${LIBRARY_DIR} OPTIONAL)
add_subdirectory(test) add_subdirectory(test)

@ -13,4 +13,4 @@ set(SOURCES pdcp.cc
add_library(srsran_pdcp STATIC ${SOURCES}) add_library(srsran_pdcp STATIC ${SOURCES})
target_link_libraries(srsran_pdcp srsran_common srsran_asn1 ${ATOMIC_LIBS}) target_link_libraries(srsran_pdcp srsran_common srsran_asn1 ${ATOMIC_LIBS})
INSTALL(TARGETS srsran_pdcp DESTINATION ${LIBRARY_DIR}) install(TARGETS srsran_pdcp DESTINATION ${LIBRARY_DIR} OPTIONAL)

@ -47,4 +47,4 @@ set(srsran_srcs $<TARGET_OBJECTS:srsran_agc>
add_library(srsran_phy STATIC ${srsran_srcs} ) add_library(srsran_phy STATIC ${srsran_srcs} )
target_link_libraries(srsran_phy pthread m ${FFT_LIBRARIES}) target_link_libraries(srsran_phy pthread m ${FFT_LIBRARIES})
INSTALL(TARGETS srsran_phy DESTINATION ${LIBRARY_DIR}) install(TARGETS srsran_phy DESTINATION ${LIBRARY_DIR} OPTIONAL)

@ -36,7 +36,7 @@ if(RF_FOUND)
list(APPEND STATIC_PLUGINS srsran_rf_uhd) list(APPEND STATIC_PLUGINS srsran_rf_uhd)
endif (ENABLE_RF_PLUGINS) endif (ENABLE_RF_PLUGINS)
target_link_libraries(srsran_rf_uhd srsran_rf_utils srsran_phy ${UHD_LIBRARIES} ${Boost_LIBRARIES}) target_link_libraries(srsran_rf_uhd srsran_rf_utils srsran_phy ${UHD_LIBRARIES} ${Boost_LIBRARIES})
install(TARGETS srsran_rf_uhd DESTINATION ${LIBRARY_DIR}) install(TARGETS srsran_rf_uhd DESTINATION ${LIBRARY_DIR} OPTIONAL)
# If found, add a macro to inform the UHD driver about the available feature # If found, add a macro to inform the UHD driver about the available feature
if (UHD_ENABLE_X300_FW_RESET) if (UHD_ENABLE_X300_FW_RESET)
@ -62,7 +62,7 @@ if(RF_FOUND)
list(APPEND STATIC_PLUGINS srsran_rf_blade) list(APPEND STATIC_PLUGINS srsran_rf_blade)
endif (ENABLE_RF_PLUGINS) endif (ENABLE_RF_PLUGINS)
target_link_libraries(srsran_rf_blade srsran_rf_utils srsran_phy ${BLADERF_LIBRARIES}) target_link_libraries(srsran_rf_blade srsran_rf_utils srsran_phy ${BLADERF_LIBRARIES})
install(TARGETS srsran_rf_blade DESTINATION ${LIBRARY_DIR}) install(TARGETS srsran_rf_blade DESTINATION ${LIBRARY_DIR} OPTIONAL)
endif (BLADERF_FOUND AND ENABLE_BLADERF) endif (BLADERF_FOUND AND ENABLE_BLADERF)
if (SOAPYSDR_FOUND AND ENABLE_SOAPYSDR) if (SOAPYSDR_FOUND AND ENABLE_SOAPYSDR)
@ -77,7 +77,7 @@ if(RF_FOUND)
list(APPEND STATIC_PLUGINS srsran_rf_soapy) list(APPEND STATIC_PLUGINS srsran_rf_soapy)
endif (ENABLE_RF_PLUGINS) endif (ENABLE_RF_PLUGINS)
target_link_libraries(srsran_rf_soapy srsran_rf_utils srsran_phy ${SOAPYSDR_LIBRARIES}) target_link_libraries(srsran_rf_soapy srsran_rf_utils srsran_phy ${SOAPYSDR_LIBRARIES})
install(TARGETS srsran_rf_soapy DESTINATION ${LIBRARY_DIR}) install(TARGETS srsran_rf_soapy DESTINATION ${LIBRARY_DIR} OPTIONAL)
endif (SOAPYSDR_FOUND AND ENABLE_SOAPYSDR) endif (SOAPYSDR_FOUND AND ENABLE_SOAPYSDR)
if(SKIQ_FOUND AND ENABLE_SKIQ) if(SKIQ_FOUND AND ENABLE_SKIQ)
@ -94,7 +94,7 @@ if(RF_FOUND)
list(APPEND STATIC_PLUGINS srsran_rf_skiq) list(APPEND STATIC_PLUGINS srsran_rf_skiq)
endif (ENABLE_RF_PLUGINS) endif (ENABLE_RF_PLUGINS)
target_link_libraries(srsran_rf_skiq srsran_rf_utils srsran_phy ${SKIQ_LIBRARIES} rt) target_link_libraries(srsran_rf_skiq srsran_rf_utils srsran_phy ${SKIQ_LIBRARIES} rt)
install(TARGETS srsran_rf_skiq DESTINATION ${LIBRARY_DIR}) install(TARGETS srsran_rf_skiq DESTINATION ${LIBRARY_DIR} OPTIONAL)
endif(SKIQ_FOUND AND ENABLE_SKIQ) endif(SKIQ_FOUND AND ENABLE_SKIQ)
if (ZEROMQ_FOUND AND ENABLE_ZEROMQ) if (ZEROMQ_FOUND AND ENABLE_ZEROMQ)
@ -109,7 +109,7 @@ if(RF_FOUND)
list(APPEND STATIC_PLUGINS srsran_rf_zmq) list(APPEND STATIC_PLUGINS srsran_rf_zmq)
endif (ENABLE_RF_PLUGINS) endif (ENABLE_RF_PLUGINS)
target_link_libraries(srsran_rf_zmq srsran_rf_utils srsran_phy ${ZEROMQ_LIBRARIES}) target_link_libraries(srsran_rf_zmq srsran_rf_utils srsran_phy ${ZEROMQ_LIBRARIES})
install(TARGETS srsran_rf_zmq DESTINATION ${LIBRARY_DIR}) install(TARGETS srsran_rf_zmq DESTINATION ${LIBRARY_DIR} OPTIONAL)
endif (ZEROMQ_FOUND AND ENABLE_ZEROMQ) endif (ZEROMQ_FOUND AND ENABLE_ZEROMQ)
# Add sources of file-based RF directly to the RF library (not as a plugin) # Add sources of file-based RF directly to the RF library (not as a plugin)
@ -148,7 +148,7 @@ if(RF_FOUND)
foreach (TOP_RF_LIB ${TOP_RF_LIBS}) foreach (TOP_RF_LIB ${TOP_RF_LIBS})
target_link_libraries(${TOP_RF_LIB} srsran_rf_utils srsran_phy) target_link_libraries(${TOP_RF_LIB} srsran_rf_utils srsran_phy)
set_target_properties(${TOP_RF_LIB} PROPERTIES VERSION ${SRSRAN_VERSION_STRING} SOVERSION ${SRSRAN_SOVERSION}) set_target_properties(${TOP_RF_LIB} PROPERTIES VERSION ${SRSRAN_VERSION_STRING} SOVERSION ${SRSRAN_SOVERSION})
install(TARGETS ${TOP_RF_LIB} DESTINATION ${LIBRARY_DIR}) install(TARGETS ${TOP_RF_LIB} DESTINATION ${LIBRARY_DIR} OPTIONAL)
endforeach () endforeach ()
# Tests # Tests

@ -9,7 +9,7 @@
if(RF_FOUND) if(RF_FOUND)
add_library(srsran_radio STATIC radio.cc channel_mapping.cc) add_library(srsran_radio STATIC radio.cc channel_mapping.cc)
target_link_libraries(srsran_radio srsran_rf srsran_common) target_link_libraries(srsran_radio srsran_rf srsran_common)
INSTALL(TARGETS srsran_radio DESTINATION ${LIBRARY_DIR}) install(TARGETS srsran_radio DESTINATION ${LIBRARY_DIR} OPTIONAL)
endif(RF_FOUND) endif(RF_FOUND)
add_subdirectory(test) add_subdirectory(test)

@ -20,4 +20,4 @@ set(SOURCES rlc.cc
add_library(srsran_rlc STATIC ${SOURCES}) add_library(srsran_rlc STATIC ${SOURCES})
target_link_libraries(srsran_rlc srsran_common ${ATOMIC_LIBS}) target_link_libraries(srsran_rlc srsran_common ${ATOMIC_LIBS})
INSTALL(TARGETS srsran_rlc DESTINATION ${LIBRARY_DIR}) install(TARGETS srsran_rlc DESTINATION ${LIBRARY_DIR} OPTIONAL)

@ -30,4 +30,4 @@ find_package(Threads REQUIRED)
add_library(srslog STATIC ${SOURCES}) add_library(srslog STATIC ${SOURCES})
target_link_libraries(srslog ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries(srslog ${CMAKE_THREAD_LIBS_INIT})
INSTALL(TARGETS srslog DESTINATION ${LIBRARY_DIR}) install(TARGETS srslog DESTINATION ${LIBRARY_DIR} OPTIONAL)

@ -54,4 +54,4 @@ else(NOT ${BUILDENB_CMD} STREQUAL "")
message(STATUS "No post-build-ENB command defined") message(STATUS "No post-build-ENB command defined")
endif (NOT ${BUILDENB_CMD} STREQUAL "") endif (NOT ${BUILDENB_CMD} STREQUAL "")
install(TARGETS srsenb DESTINATION ${RUNTIME_DIR}) install(TARGETS srsenb DESTINATION ${RUNTIME_DIR} OPTIONAL)

@ -64,5 +64,5 @@ else(NOT ${BUILDEPC_CMD} STREQUAL "")
message(STATUS "No post-build-EPC command defined") message(STATUS "No post-build-EPC command defined")
endif (NOT ${BUILDEPC_CMD} STREQUAL "") endif (NOT ${BUILDEPC_CMD} STREQUAL "")
install(TARGETS srsepc DESTINATION ${RUNTIME_DIR}) install(TARGETS srsepc DESTINATION ${RUNTIME_DIR} OPTIONAL)
install(TARGETS srsmbms DESTINATION ${RUNTIME_DIR}) install(TARGETS srsmbms DESTINATION ${RUNTIME_DIR} OPTIONAL)

@ -64,4 +64,4 @@ else(NOT ${BUILDUE_CMD} STREQUAL "")
message(STATUS "No post-build-UE command defined") message(STATUS "No post-build-UE command defined")
endif (NOT ${BUILDUE_CMD} STREQUAL "") endif (NOT ${BUILDUE_CMD} STREQUAL "")
install(TARGETS srsue DESTINATION ${RUNTIME_DIR}) install(TARGETS srsue DESTINATION ${RUNTIME_DIR} OPTIONAL)

Loading…
Cancel
Save