From 5d66e9701f546359047f33ba691e755c6b1542ab Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Tue, 30 May 2017 15:10:19 +0200 Subject: [PATCH] fixing CMake scripts and include paths --- CMakeLists.txt | 91 +++++++++++++++++++++-- lib/CMakeLists.txt | 2 +- lib/include/srslte/common/interfaces.h | 2 +- lib/include/srslte/common/mac_interface.h | 2 +- lib/include/srslte/common/phy_interface.h | 2 +- lib/include/srslte/upper/nas.h | 2 +- lib/src/CMakeLists.txt | 1 + lib/src/common/CMakeLists.txt | 1 + lib/src/common/security.cc | 2 +- lib/src/upper/CMakeLists.txt | 2 +- lib/test/common/CMakeLists.txt | 4 +- lib/test/upper/CMakeLists.txt | 14 ++-- lib/test/upper/rrc_reconfig_test.cc | 4 +- 13 files changed, 105 insertions(+), 24 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b5f708778..e7a2b2836 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,6 +74,79 @@ else(POLARSSL_FOUND) endif (MBEDTLS_FOUND) endif(POLARSSL_FOUND) +find_package(MKL) +if(MKL_FOUND) + include_directories(${MKL_INCLUDE_DIRS}) + link_directories(${MKL_LIBRARY_DIRS}) +else(MKL_FOUND) + find_package(FFTW3F REQUIRED) + if(FFTW3F_FOUND) + include_directories(${FFTW3F_INCLUDE_DIRS}) + link_directories(${FFTW3F_LIBRARY_DIRS}) + endif(FFTW3F_FOUND) +endif(MKL_FOUND) + +find_package(UHD) +if(UHD_FOUND) + include_directories(${UHD_INCLUDE_DIRS}) + link_directories(${UHD_LIBRARY_DIRS}) +endif(UHD_FOUND) + +if(NOT DisableBladeRF) + find_package(bladeRF) + if(BLADERF_FOUND) + include_directories(${BLADERF_INCLUDE_DIRS}) + link_directories(${BLADERF_LIBRARY_DIRS}) + endif(BLADERF_FOUND) +endif(NOT DisableBladeRF) + +find_package(SoapySDR) +if(SOAPYSDR_FOUND) + include_directories(${SOAPYSDR_INCLUDE_DIRS}) + link_directories(${SOAPYSDR_LIBRARY_DIRS}) +endif(SOAPYSDR_FOUND) + +find_package(LimeSDR) +if(LIMESDR_FOUND) + include_directories(${LIMESDR_INCLUDE_DIRS}) + link_directories(${LIMESDR_LIBRARY_DIRS}) +endif(LIMESDR_FOUND) + +if(BLADERF_FOUND OR UHD_FOUND OR SOAPYSDR_FOUND OR LIMESDR_FOUND) + set(RF_FOUND TRUE CACHE INTERNAL "RF frontend found") +else(BLADERF_FOUND OR UHD_FOUND OR SOAPYSDR_FOUND OR LIMESDR_FOUND) + set(RF_FOUND FALSE CACHE INTERNAL "RF frontend found") + add_definitions(-DDISABLE_RF) +endif(BLADERF_FOUND OR UHD_FOUND OR SOAPYSDR_FOUND OR LIMESDR_FOUND) + +include(CheckFunctionExistsMath) +if(${DISABLE_VOLK}) + if(${DISABLE_VOLK} EQUAL 0) + find_package(Volk) + else(${DISABLE_VOLK} EQUAL 0) + message(STATUS "VOLK library disabled (DISABLE_VOLK=1)") + endif(${DISABLE_VOLK} EQUAL 0) +else(${DISABLE_VOLK}) + find_package(Volk) +endif(${DISABLE_VOLK}) + +if(VOLK_FOUND) + include_directories(${VOLK_INCLUDE_DIRS}) + link_directories(${VOLK_LIBRARY_DIRS}) + message(STATUS " Compiling with VOLK SIMD library.") +else(VOLK_FOUND) + message(STATUS " VOLK SIMD library NOT found. Using generic implementation.") +endif(VOLK_FOUND) + +if(ENABLE_GUI) + find_package(SRSGUI) + if(SRSGUI_FOUND) + add_definitions(-DENABLE_GUI) + include_directories(${SRSGUI_INCLUDE_DIRS}) + link_directories(${SRSGUI_LIBRARY_DIRS}) + endif(SRSGUI_FOUND) +endif(ENABLE_GUI) + ######################################################################## # Install Dirs @@ -101,6 +174,14 @@ if(NOT CMAKE_BUILD_TYPE) endif(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "") +######################################################################## +# Install headers +######################################################################## +INSTALL(DIRECTORY include/ + DESTINATION "${INCLUDE_DIR}" + FILES_MATCHING PATTERN "*.h" +) + ######################################################################## # Compiler specific setup ######################################################################## @@ -201,15 +282,13 @@ message(STATUS "Building for version: ${VERSION}") ######################################################################## # Add general includes and dependencies ######################################################################## -include_directories(${PROJECT_BINARY_DIR}/srslte/include/) -include_directories(${PROJECT_SOURCE_DIR}/srslte/include/) +include_directories(${PROJECT_BINARY_DIR}/lib/include) +include_directories(${PROJECT_SOURCE_DIR}/lib/include) # Includes needed by all code previously resided in srsUE -include_directories(${PROJECT_SOURCE_DIR}/srslte/include/srslte) -include_directories(${PROJECT_SOURCE_DIR}/liblte/hdr) +include_directories(${PROJECT_SOURCE_DIR}/lib/include/srslte) ######################################################################## # Add the subdirectories ######################################################################## -add_subdirectory(liblte) -add_subdirectory(srslte) +add_subdirectory(lib) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 074409368..1f30ed290 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -113,7 +113,7 @@ endif(VOLK_FOUND) ######################################################################## # Add subdirectories ######################################################################## -add_subdirectory(lib) +add_subdirectory(src) add_subdirectory(include) add_subdirectory(examples) add_subdirectory(test) diff --git a/lib/include/srslte/common/interfaces.h b/lib/include/srslte/common/interfaces.h index 1853da67d..84a4219a3 100644 --- a/lib/include/srslte/common/interfaces.h +++ b/lib/include/srslte/common/interfaces.h @@ -33,7 +33,7 @@ #ifndef INTERFACES_H #define INTERFACES_H -#include "liblte_rrc.h" +#include "asn1/liblte_rrc.h" #include "common/interfaces_common.h" #include "common/common.h" #include "common/security.h" diff --git a/lib/include/srslte/common/mac_interface.h b/lib/include/srslte/common/mac_interface.h index 9a7128bd9..c47e59739 100644 --- a/lib/include/srslte/common/mac_interface.h +++ b/lib/include/srslte/common/mac_interface.h @@ -40,7 +40,7 @@ #include "common/interfaces_common.h" #include "common/timers.h" -#include "liblte_rrc.h" +#include "asn1/liblte_rrc.h" namespace srsue { diff --git a/lib/include/srslte/common/phy_interface.h b/lib/include/srslte/common/phy_interface.h index 108390709..272ca4c80 100644 --- a/lib/include/srslte/common/phy_interface.h +++ b/lib/include/srslte/common/phy_interface.h @@ -37,7 +37,7 @@ #include #include "srslte/srslte.h" -#include "liblte_rrc.h" +#include "asn1/liblte_rrc.h" namespace srsue { diff --git a/lib/include/srslte/upper/nas.h b/lib/include/srslte/upper/nas.h index 6ad957c28..611929ea7 100644 --- a/lib/include/srslte/upper/nas.h +++ b/lib/include/srslte/upper/nas.h @@ -32,7 +32,7 @@ #include "common/common.h" #include "common/interfaces.h" #include "common/security.h" -#include "liblte_mme.h" +#include "asn1/liblte_mme.h" using srslte::byte_buffer_t; diff --git a/lib/src/CMakeLists.txt b/lib/src/CMakeLists.txt index 0ae97c14b..f38b21bdb 100644 --- a/lib/src/CMakeLists.txt +++ b/lib/src/CMakeLists.txt @@ -18,6 +18,7 @@ # and at http://www.gnu.org/licenses/. # +add_subdirectory(asn1) add_subdirectory(common) add_subdirectory(phy) add_subdirectory(radio) diff --git a/lib/src/common/CMakeLists.txt b/lib/src/common/CMakeLists.txt index 037a6351e..4eb31e171 100644 --- a/lib/src/common/CMakeLists.txt +++ b/lib/src/common/CMakeLists.txt @@ -21,5 +21,6 @@ file(GLOB CXX_SOURCES "*.cc") file(GLOB C_SOURCES "*.c") add_library(srslte_common SHARED ${C_SOURCES} ${CXX_SOURCES}) +target_link_libraries(srslte_common ${POLAR_LIBRARIES}) INSTALL(TARGETS srslte_common DESTINATION ${LIBRARY_DIR}) SRSLTE_SET_PIC(srslte_common) diff --git a/lib/src/common/security.cc b/lib/src/common/security.cc index 1f3cfc30a..bc65fbe09 100644 --- a/lib/src/common/security.cc +++ b/lib/src/common/security.cc @@ -26,7 +26,7 @@ #include "common/security.h" -#include "liblte_security.h" +#include "common/liblte_security.h" #include "common/snow_3g.h" using namespace srslte; diff --git a/lib/src/upper/CMakeLists.txt b/lib/src/upper/CMakeLists.txt index 2a4e592cb..cc7223f3d 100644 --- a/lib/src/upper/CMakeLists.txt +++ b/lib/src/upper/CMakeLists.txt @@ -19,6 +19,6 @@ file(GLOB SOURCES "*.cc") add_library(srslte_upper SHARED ${SOURCES}) -target_link_libraries(srslte_upper srslte_common) +target_link_libraries(srslte_upper srslte_common srslte_asn1) INSTALL(TARGETS srslte_upper DESTINATION ${LIBRARY_DIR}) SRSLTE_SET_PIC(srslte_upper) diff --git a/lib/test/common/CMakeLists.txt b/lib/test/common/CMakeLists.txt index 5eb73db56..fe7d8c387 100644 --- a/lib/test/common/CMakeLists.txt +++ b/lib/test/common/CMakeLists.txt @@ -21,7 +21,7 @@ # LOGGER TEST ####################################################################### add_executable(logger_test logger_test.cc) -target_link_libraries(logger_test srslte_phy srslte_common srslte_phy lte ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) +target_link_libraries(logger_test srslte_phy srslte_common srslte_phy ${POLAR_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) add_test(logger_test logger_test) add_executable(msg_queue_test msg_queue_test.cc) @@ -29,7 +29,7 @@ target_link_libraries(msg_queue_test srslte_phy srslte_common ${CMAKE_THREAD_LIB add_test(msg_queue_test msg_queue_test) add_executable(log_filter_test log_filter_test.cc) -target_link_libraries(log_filter_test srslte_phy srslte_common srslte_phy lte ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) +target_link_libraries(log_filter_test srslte_phy srslte_common srslte_phy ${POLAR_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) add_executable(timeout_test timeout_test.cc) target_link_libraries(timeout_test srslte_phy ${CMAKE_THREAD_LIBS_INIT}) diff --git a/lib/test/upper/CMakeLists.txt b/lib/test/upper/CMakeLists.txt index 12243c259..b1b4ec5fb 100644 --- a/lib/test/upper/CMakeLists.txt +++ b/lib/test/upper/CMakeLists.txt @@ -18,31 +18,31 @@ # add_executable(rlc_am_data_test rlc_am_data_test.cc) -target_link_libraries(rlc_am_data_test srslte_upper srslte_phy lte) +target_link_libraries(rlc_am_data_test srslte_upper srslte_phy srslte_common) add_test(rlc_am_data_test rlc_am_data_test) add_executable(rlc_am_control_test rlc_am_control_test.cc) -target_link_libraries(rlc_am_control_test srslte_upper srslte_phy lte) +target_link_libraries(rlc_am_control_test srslte_upper srslte_phy) add_test(rlc_am_control_test rlc_am_control_test) add_executable(rlc_am_test rlc_am_test.cc) -target_link_libraries(rlc_am_test srslte_upper srslte_phy lte) +target_link_libraries(rlc_am_test srslte_upper srslte_phy srslte_common) add_test(rlc_am_test rlc_am_test) add_executable(rlc_um_data_test rlc_um_data_test.cc) -target_link_libraries(rlc_um_data_test srslte_upper srslte_phy lte) +target_link_libraries(rlc_um_data_test srslte_upper srslte_phy srslte_common) add_test(rlc_um_data_test rlc_um_data_test) add_executable(rlc_um_test rlc_um_test.cc) -target_link_libraries(rlc_um_test srslte_upper srslte_phy lte) +target_link_libraries(rlc_um_test srslte_upper srslte_phy) add_test(rlc_um_test rlc_um_test) add_executable(usim_test usim_test.cc) -target_link_libraries(usim_test srslte_upper srslte_phy lte) +target_link_libraries(usim_test srslte_upper srslte_phy) add_test(usim_test usim_test) add_executable(rrc_reconfig_test rrc_reconfig_test.cc) -target_link_libraries(rrc_reconfig_test srslte_upper srslte_phy lte) +target_link_libraries(rrc_reconfig_test srslte_upper srslte_phy) add_test(rrc_reconfig_test rrc_reconfig_test) ######################################################################## diff --git a/lib/test/upper/rrc_reconfig_test.cc b/lib/test/upper/rrc_reconfig_test.cc index 99844176a..e1fa52794 100644 --- a/lib/test/upper/rrc_reconfig_test.cc +++ b/lib/test/upper/rrc_reconfig_test.cc @@ -27,8 +27,8 @@ #include #include #include "common/log_stdout.h" -#include "liblte_rrc.h" -#include "liblte_mme.h" +#include "asn1/liblte_rrc.h" +#include "asn1/liblte_mme.h" void nas_test() { srslte::log_stdout log1("NAS");