From 5e7de0a95bebad8c75f83c3aad496fa46a00377e Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Mon, 19 Oct 2020 21:35:01 +0200 Subject: [PATCH] cmake: install individual libraries (common, phy, etc) this seems to be important for package maintainers or people who use srslte components in other projects thar require to link against static libs so besides installing headers, the apps and the RF lib, we also install all individual libraries this fixes https://github.com/srsLTE/srsLTE/issues/500# and https://github.com/softwareradiosystems/srsLTE/issues/1754 --- lib/src/asn1/CMakeLists.txt | 5 +++++ lib/src/common/CMakeLists.txt | 2 ++ lib/src/mac/CMakeLists.txt | 1 + lib/src/phy/CMakeLists.txt | 3 ++- lib/src/radio/CMakeLists.txt | 1 + lib/src/srslog/CMakeLists.txt | 1 + lib/src/upper/CMakeLists.txt | 3 ++- 7 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/src/asn1/CMakeLists.txt b/lib/src/asn1/CMakeLists.txt index 24b91cd74..f4d52afbf 100644 --- a/lib/src/asn1/CMakeLists.txt +++ b/lib/src/asn1/CMakeLists.txt @@ -28,6 +28,7 @@ add_library(srslte_asn1 STATIC # ASN1 utils add_library(asn1_utils STATIC asn1_utils.cc) target_link_libraries(asn1_utils srslte_common) +INSTALL(TARGETS asn1_utils DESTINATION ${LIBRARY_DIR}) add_library(rrc_asn1 STATIC rrc_asn1.cc @@ -38,22 +39,26 @@ add_library(rrc_asn1 STATIC # Compile RRC ASN1 optimized for size target_compile_options(rrc_asn1 PRIVATE "-Os") target_link_libraries(rrc_asn1 asn1_utils srslte_common) +INSTALL(TARGETS rrc_asn1 DESTINATION ${LIBRARY_DIR}) add_library(s1ap_asn1 STATIC s1ap_asn1.cc) target_compile_options(s1ap_asn1 PRIVATE "-Os") target_link_libraries(s1ap_asn1 asn1_utils srslte_common) +INSTALL(TARGETS s1ap_asn1 DESTINATION ${LIBRARY_DIR}) if (ENABLE_5GNR) # RRC NR ASN1 add_library(rrc_nr_asn1 STATIC rrc_nr_asn1.cc rrc_nr_asn1_utils.cc) target_compile_options(rrc_nr_asn1 PRIVATE "-Os") target_link_libraries(rrc_nr_asn1 asn1_utils srslte_common) + INSTALL(TARGETS rrc_nr_asn1 DESTINATION ${LIBRARY_DIR}) # NGAP ASN1 add_library(ngap_nr_asn1 STATIC ngap_nr_asn1.cc) target_compile_options(ngap_nr_asn1 PRIVATE "-Os") target_link_libraries(ngap_nr_asn1 asn1_utils srslte_common) + INSTALL(TARGETS ngap_nr_asn1 DESTINATION ${LIBRARY_DIR}) endif(ENABLE_5GNR) diff --git a/lib/src/common/CMakeLists.txt b/lib/src/common/CMakeLists.txt index aac227f0e..7213351ba 100644 --- a/lib/src/common/CMakeLists.txt +++ b/lib/src/common/CMakeLists.txt @@ -60,4 +60,6 @@ add_executable(arch_select arch_select.cc) target_include_directories(srslte_common PUBLIC ${SEC_INCLUDE_DIRS}) target_link_libraries(srslte_common srslte_phy srslog ${SEC_LIBRARIES}) +INSTALL(TARGETS srslte_common DESTINATION ${LIBRARY_DIR}) + add_subdirectory(test) diff --git a/lib/src/mac/CMakeLists.txt b/lib/src/mac/CMakeLists.txt index 8db9e6a71..dc355fa32 100644 --- a/lib/src/mac/CMakeLists.txt +++ b/lib/src/mac/CMakeLists.txt @@ -26,3 +26,4 @@ endif(ENABLE_5GNR) add_library(srslte_mac STATIC ${SOURCES}) target_link_libraries(srslte_mac srslte_common) +INSTALL(TARGETS srslte_mac DESTINATION ${LIBRARY_DIR}) \ No newline at end of file diff --git a/lib/src/phy/CMakeLists.txt b/lib/src/phy/CMakeLists.txt index 02da17bdb..69667625b 100644 --- a/lib/src/phy/CMakeLists.txt +++ b/lib/src/phy/CMakeLists.txt @@ -54,4 +54,5 @@ set(srslte_srcs $ ) add_library(srslte_phy STATIC ${srslte_srcs}) -target_link_libraries(srslte_phy pthread m ${FFT_LIBRARIES}) \ No newline at end of file +target_link_libraries(srslte_phy pthread m ${FFT_LIBRARIES}) +INSTALL(TARGETS srslte_phy DESTINATION ${LIBRARY_DIR}) \ No newline at end of file diff --git a/lib/src/radio/CMakeLists.txt b/lib/src/radio/CMakeLists.txt index 4f695fbcb..b779b988f 100644 --- a/lib/src/radio/CMakeLists.txt +++ b/lib/src/radio/CMakeLists.txt @@ -21,6 +21,7 @@ if(RF_FOUND) add_library(srslte_radio STATIC radio.cc radio_null.cc channel_mapping.cc) target_link_libraries(srslte_radio srslte_rf srslte_common) + INSTALL(TARGETS srslte_radio DESTINATION ${LIBRARY_DIR}) endif(RF_FOUND) add_subdirectory(test) diff --git a/lib/src/srslog/CMakeLists.txt b/lib/src/srslog/CMakeLists.txt index ffaafeca5..732b8fb63 100644 --- a/lib/src/srslog/CMakeLists.txt +++ b/lib/src/srslog/CMakeLists.txt @@ -30,3 +30,4 @@ find_package(Threads REQUIRED) add_library(srslog STATIC ${SOURCES}) target_link_libraries(srslog fmt "${CMAKE_THREAD_LIBS_INIT}") +INSTALL(TARGETS srslog DESTINATION ${LIBRARY_DIR}) diff --git a/lib/src/upper/CMakeLists.txt b/lib/src/upper/CMakeLists.txt index 363008b36..b76498546 100644 --- a/lib/src/upper/CMakeLists.txt +++ b/lib/src/upper/CMakeLists.txt @@ -34,4 +34,5 @@ if (ENABLE_5GNR) endif(ENABLE_5GNR) add_library(srslte_upper STATIC ${SOURCES}) -target_link_libraries(srslte_upper srslte_common srslte_asn1) \ No newline at end of file +target_link_libraries(srslte_upper srslte_common srslte_asn1) +INSTALL(TARGETS srslte_upper DESTINATION ${LIBRARY_DIR}) \ No newline at end of file