diff --git a/CMakeLists.txt b/CMakeLists.txt index 2c0b7f5bb..83ebeb618 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,13 +56,16 @@ set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "") ######################################################################## # Options ######################################################################## -option(STATIC_BUILD "Attempt to build with static linking" OFF) -option(RPATH "Enable RPATH" OFF) -option(ENABLE_VOLK "Enable VOLK SIMD library" ON) -option(ENABLE_GUI "Enable GUI" ON) -option(ENABLE_SRSUE "Build srsUE application" ON) -option(ENABLE_SRSENB "Build srsENB application" ON) -option(ENABLE_BLADERF "Enable BladeRF" ON) +option(ENABLE_SRSUE "Build srsUE application" ON) +option(ENABLE_SRSENB "Build srsENB application" ON) + +option(ENABLE_VOLK "Enable use of VOLK SIMD library" ON) +option(ENABLE_GUI "Enable GUI (using srsGUI)" ON) +option(ENABLE_BLADERF "Enable BladeRF" ON) + +option(BUILD_STATIC "Attempt to statically link external deps" OFF) +option(RPATH "Enable RPATH" OFF) + option(USE_LTE_RATES "Use standard LTE sampling rates" OFF) set(GCC_ARCH native CACHE STRING "GCC compile for specific architecture.") @@ -275,11 +278,9 @@ add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) ######################################################################## -# Macro to add -fPIC property to static libs +# Add -fPIC property to all targets ######################################################################## -macro(SRSLTE_SET_PIC) - set_target_properties(${ARGV} PROPERTIES COMPILE_FLAGS -fPIC) -endmacro(SRSLTE_SET_PIC) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) ######################################################################## # Print summary diff --git a/lib/src/asn1/CMakeLists.txt b/lib/src/asn1/CMakeLists.txt index aeed84602..d3c52b807 100644 --- a/lib/src/asn1/CMakeLists.txt +++ b/lib/src/asn1/CMakeLists.txt @@ -19,7 +19,7 @@ # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-switch -Wno-unused-but-set-variable -Wno-unused-variable -Wno-return-type -Wno-sign-compare -Wno-reorder -Wno-parantheses") -add_library(srslte_asn1 SHARED +add_library(srslte_asn1 STATIC liblte_common.cc liblte_rrc.cc liblte_mme.cc diff --git a/lib/src/common/CMakeLists.txt b/lib/src/common/CMakeLists.txt index 6f022b417..723085e24 100644 --- a/lib/src/common/CMakeLists.txt +++ b/lib/src/common/CMakeLists.txt @@ -20,8 +20,9 @@ file(GLOB CXX_SOURCES "*.cc") file(GLOB C_SOURCES "*.c") -add_library(srslte_common SHARED ${C_SOURCES} ${CXX_SOURCES}) + +add_library(srslte_common STATIC ${C_SOURCES} ${CXX_SOURCES}) target_include_directories(srslte_common PUBLIC ${SEC_INCLUDE_DIRS}) target_link_libraries(srslte_common ${SEC_LIBRARIES}) install(TARGETS srslte_common DESTINATION ${LIBRARY_DIR}) -SRSLTE_SET_PIC(srslte_common) + diff --git a/lib/src/phy/CMakeLists.txt b/lib/src/phy/CMakeLists.txt index 47f72d2dc..a0b5cd516 100644 --- a/lib/src/phy/CMakeLists.txt +++ b/lib/src/phy/CMakeLists.txt @@ -126,5 +126,4 @@ if(VOLK_FOUND) endif(VOLK_FOUND) install(TARGETS srslte_phy DESTINATION ${LIBRARY_DIR}) -SRSLTE_SET_PIC(srslte_phy) diff --git a/lib/src/phy/agc/CMakeLists.txt b/lib/src/phy/agc/CMakeLists.txt index 79a7a1dcb..fed3467d4 100644 --- a/lib/src/phy/agc/CMakeLists.txt +++ b/lib/src/phy/agc/CMakeLists.txt @@ -20,4 +20,3 @@ file(GLOB SOURCES "*.c") add_library(srslte_agc OBJECT ${SOURCES}) -SRSLTE_SET_PIC(srslte_agc) diff --git a/lib/src/phy/ch_estimation/CMakeLists.txt b/lib/src/phy/ch_estimation/CMakeLists.txt index 067a41d69..ac069bd04 100644 --- a/lib/src/phy/ch_estimation/CMakeLists.txt +++ b/lib/src/phy/ch_estimation/CMakeLists.txt @@ -20,5 +20,4 @@ file(GLOB SOURCES "*.c") add_library(srslte_ch_estimation OBJECT ${SOURCES}) -SRSLTE_SET_PIC(srslte_ch_estimation) add_subdirectory(test) diff --git a/lib/src/phy/channel/CMakeLists.txt b/lib/src/phy/channel/CMakeLists.txt index 19f8fe93e..0ea8799c5 100644 --- a/lib/src/phy/channel/CMakeLists.txt +++ b/lib/src/phy/channel/CMakeLists.txt @@ -20,4 +20,3 @@ file(GLOB SOURCES "*.c") add_library(srslte_channel OBJECT ${SOURCES}) -SRSLTE_SET_PIC(srslte_channel) diff --git a/lib/src/phy/common/CMakeLists.txt b/lib/src/phy/common/CMakeLists.txt index 6b282e7d6..ba2fc1351 100644 --- a/lib/src/phy/common/CMakeLists.txt +++ b/lib/src/phy/common/CMakeLists.txt @@ -20,4 +20,3 @@ file(GLOB SOURCES "*.c") add_library(srslte_phy_common OBJECT ${SOURCES}) -SRSLTE_SET_PIC(srslte_phy_common) diff --git a/lib/src/phy/dft/CMakeLists.txt b/lib/src/phy/dft/CMakeLists.txt index 516ff817f..3af59bf34 100644 --- a/lib/src/phy/dft/CMakeLists.txt +++ b/lib/src/phy/dft/CMakeLists.txt @@ -20,5 +20,4 @@ set(SRCS dft_fftw.c dft_precoding.c ofdm.c) add_library(srslte_dft OBJECT ${SRCS}) -SRSLTE_SET_PIC(srslte_dft) add_subdirectory(test) diff --git a/lib/src/phy/enb/CMakeLists.txt b/lib/src/phy/enb/CMakeLists.txt index 0ac7e5a90..e15fae905 100644 --- a/lib/src/phy/enb/CMakeLists.txt +++ b/lib/src/phy/enb/CMakeLists.txt @@ -20,4 +20,3 @@ file(GLOB SOURCES "*.c") add_library(srslte_enb OBJECT ${SOURCES}) -SRSLTE_SET_PIC(srslte_enb) diff --git a/lib/src/phy/fec/CMakeLists.txt b/lib/src/phy/fec/CMakeLists.txt index d304e2c37..86ed0819d 100644 --- a/lib/src/phy/fec/CMakeLists.txt +++ b/lib/src/phy/fec/CMakeLists.txt @@ -20,5 +20,4 @@ file(GLOB SOURCES "*.c") add_library(srslte_fec OBJECT ${SOURCES}) -SRSLTE_SET_PIC(srslte_fec) add_subdirectory(test) diff --git a/lib/src/phy/io/CMakeLists.txt b/lib/src/phy/io/CMakeLists.txt index 01e3a3dea..a56658e34 100644 --- a/lib/src/phy/io/CMakeLists.txt +++ b/lib/src/phy/io/CMakeLists.txt @@ -20,4 +20,3 @@ file(GLOB SOURCES "*.c") add_library(srslte_io OBJECT ${SOURCES}) -SRSLTE_SET_PIC(srslte_io) diff --git a/lib/src/phy/mimo/CMakeLists.txt b/lib/src/phy/mimo/CMakeLists.txt index 826baae09..f909a60a9 100644 --- a/lib/src/phy/mimo/CMakeLists.txt +++ b/lib/src/phy/mimo/CMakeLists.txt @@ -20,5 +20,4 @@ file(GLOB SOURCES "*.c") add_library(srslte_mimo OBJECT ${SOURCES}) -SRSLTE_SET_PIC(srslte_mimo) add_subdirectory(test) diff --git a/lib/src/phy/modem/CMakeLists.txt b/lib/src/phy/modem/CMakeLists.txt index 654446610..f7576161a 100644 --- a/lib/src/phy/modem/CMakeLists.txt +++ b/lib/src/phy/modem/CMakeLists.txt @@ -20,5 +20,4 @@ file(GLOB SOURCES "*.c") add_library(srslte_modem OBJECT ${SOURCES}) -SRSLTE_SET_PIC(srslte_modem) add_subdirectory(test) diff --git a/lib/src/phy/phch/CMakeLists.txt b/lib/src/phy/phch/CMakeLists.txt index b6c511bd5..a0a7169cd 100644 --- a/lib/src/phy/phch/CMakeLists.txt +++ b/lib/src/phy/phch/CMakeLists.txt @@ -20,5 +20,4 @@ file(GLOB SOURCES "*.c") add_library(srslte_phch OBJECT ${SOURCES}) -SRSLTE_SET_PIC(srslte_phch) add_subdirectory(test) diff --git a/lib/src/phy/resampling/CMakeLists.txt b/lib/src/phy/resampling/CMakeLists.txt index f12d301f7..ef6513cbf 100644 --- a/lib/src/phy/resampling/CMakeLists.txt +++ b/lib/src/phy/resampling/CMakeLists.txt @@ -20,5 +20,4 @@ file(GLOB SOURCES "*.c") add_library(srslte_resampling OBJECT ${SOURCES}) -SRSLTE_SET_PIC(srslte_resampling) add_subdirectory(test) diff --git a/lib/src/phy/rf/CMakeLists.txt b/lib/src/phy/rf/CMakeLists.txt index 651ac331a..16b0404ce 100644 --- a/lib/src/phy/rf/CMakeLists.txt +++ b/lib/src/phy/rf/CMakeLists.txt @@ -56,5 +56,4 @@ if(RF_FOUND) INSTALL(TARGETS srslte_rf DESTINATION ${LIBRARY_DIR}) - SRSLTE_SET_PIC(srslte_rf) endif(RF_FOUND) diff --git a/lib/src/phy/scrambling/CMakeLists.txt b/lib/src/phy/scrambling/CMakeLists.txt index 1f9e10353..b8c4941ad 100644 --- a/lib/src/phy/scrambling/CMakeLists.txt +++ b/lib/src/phy/scrambling/CMakeLists.txt @@ -20,5 +20,4 @@ file(GLOB SOURCES "*.c") add_library(srslte_scrambling OBJECT ${SOURCES}) -SRSLTE_SET_PIC(srslte_scrambling) add_subdirectory(test) diff --git a/lib/src/phy/sync/CMakeLists.txt b/lib/src/phy/sync/CMakeLists.txt index 709b6a45b..706efde38 100644 --- a/lib/src/phy/sync/CMakeLists.txt +++ b/lib/src/phy/sync/CMakeLists.txt @@ -20,5 +20,4 @@ file(GLOB SOURCES "*.c") add_library(srslte_sync OBJECT ${SOURCES}) -SRSLTE_SET_PIC(srslte_sync) add_subdirectory(test) diff --git a/lib/src/phy/ue/CMakeLists.txt b/lib/src/phy/ue/CMakeLists.txt index f366f4f4f..3072b3a43 100644 --- a/lib/src/phy/ue/CMakeLists.txt +++ b/lib/src/phy/ue/CMakeLists.txt @@ -20,4 +20,3 @@ file(GLOB SOURCES "*.c") add_library(srslte_ue OBJECT ${SOURCES}) -SRSLTE_SET_PIC(srslte_ue) diff --git a/lib/src/phy/utils/CMakeLists.txt b/lib/src/phy/utils/CMakeLists.txt index 5e82da2ef..f8a886ed8 100644 --- a/lib/src/phy/utils/CMakeLists.txt +++ b/lib/src/phy/utils/CMakeLists.txt @@ -25,5 +25,4 @@ if(VOLK_FOUND) set_target_properties(srslte_utils PROPERTIES COMPILE_DEFINITIONS "${VOLK_DEFINITIONS}") endif(VOLK_FOUND) -SRSLTE_SET_PIC(srslte_utils) add_subdirectory(test) diff --git a/lib/src/radio/CMakeLists.txt b/lib/src/radio/CMakeLists.txt index 42931ea62..dc972bb79 100644 --- a/lib/src/radio/CMakeLists.txt +++ b/lib/src/radio/CMakeLists.txt @@ -20,7 +20,6 @@ if(RF_FOUND) add_library(srslte_radio SHARED radio.cc radio_multi.cc) - install(TARGETS srslte_radio DESTINATION ${LIBRARY_DIR}) target_link_libraries(srslte_radio srslte_rf) - SRSLTE_SET_PIC(srslte_radio) + install(TARGETS srslte_radio DESTINATION ${LIBRARY_DIR}) endif(RF_FOUND) diff --git a/lib/src/upper/CMakeLists.txt b/lib/src/upper/CMakeLists.txt index e1a0507e3..725d6de60 100644 --- a/lib/src/upper/CMakeLists.txt +++ b/lib/src/upper/CMakeLists.txt @@ -19,7 +19,6 @@ # file(GLOB SOURCES "*.cc") -add_library(srslte_upper SHARED ${SOURCES}) +add_library(srslte_upper STATIC ${SOURCES}) target_link_libraries(srslte_upper srslte_common srslte_asn1) install(TARGETS srslte_upper DESTINATION ${LIBRARY_DIR}) -SRSLTE_SET_PIC(srslte_upper) diff --git a/srsenb/src/mac/CMakeLists.txt b/srsenb/src/mac/CMakeLists.txt index 4369d11a4..8819c0bcb 100644 --- a/srsenb/src/mac/CMakeLists.txt +++ b/srsenb/src/mac/CMakeLists.txt @@ -1,5 +1,24 @@ -file(GLOB SOURCES "*.cc") -add_library(srsenb_mac SHARED ${SOURCES}) -target_link_libraries(srsenb_mac) +# +# Copyright 2013-2017 Software Radio Systems Limited +# +# This file is part of srsLTE +# +# srsLTE is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of +# the License, or (at your option) any later version. +# +# srsLTE is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# A copy of the GNU Affero General Public License can be found in +# the LICENSE file in the top-level directory of this distribution +# and at http://www.gnu.org/licenses/. +# +file(GLOB SOURCES "*.cc") +add_library(srsenb_mac STATIC ${SOURCES}) +install(TARGETS srsenb_mac DESTINATION ${LIBRARY_DIR}) diff --git a/srsenb/src/phy/CMakeLists.txt b/srsenb/src/phy/CMakeLists.txt index beae7143a..5d46d3201 100644 --- a/srsenb/src/phy/CMakeLists.txt +++ b/srsenb/src/phy/CMakeLists.txt @@ -1,8 +1,29 @@ +# +# Copyright 2013-2017 Software Radio Systems Limited +# +# This file is part of srsLTE +# +# srsLTE is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of +# the License, or (at your option) any later version. +# +# srsLTE is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# A copy of the GNU Affero General Public License can be found in +# the LICENSE file in the top-level directory of this distribution +# and at http://www.gnu.org/licenses/. +# + file(GLOB SOURCES "*.cc") -add_library(srsenb_phy SHARED ${SOURCES}) -target_link_libraries(srsenb_phy) +add_library(srsenb_phy STATIC ${SOURCES}) if(ENABLE_GUI AND SRSGUI_FOUND) target_link_libraries(srsenb_phy ${SRSGUI_LIBRARIES}) endif(ENABLE_GUI AND SRSGUI_FOUND) +install(TARGETS srsenb_phy DESTINATION ${LIBRARY_DIR}) + diff --git a/srsenb/src/upper/CMakeLists.txt b/srsenb/src/upper/CMakeLists.txt index aed9b0283..59116bab7 100644 --- a/srsenb/src/upper/CMakeLists.txt +++ b/srsenb/src/upper/CMakeLists.txt @@ -1,3 +1,24 @@ +# +# Copyright 2013-2017 Software Radio Systems Limited +# +# This file is part of srsLTE +# +# srsLTE is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of +# the License, or (at your option) any later version. +# +# srsLTE is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# A copy of the GNU Affero General Public License can be found in +# the LICENSE file in the top-level directory of this distribution +# and at http://www.gnu.org/licenses/. +# + file(GLOB SOURCES "*.cc") -add_library(srsenb_upper SHARED ${SOURCES}) -target_link_libraries(srsenb_upper) +add_library(srsenb_upper STATIC ${SOURCES}) +install(TARGETS srsenb_upper DESTINATION ${LIBRARY_DIR}) + diff --git a/srsue/src/mac/CMakeLists.txt b/srsue/src/mac/CMakeLists.txt index 1aae8ffd6..fb5783b4d 100644 --- a/srsue/src/mac/CMakeLists.txt +++ b/srsue/src/mac/CMakeLists.txt @@ -19,5 +19,5 @@ # file(GLOB SOURCES "*.cc") -add_library(srsue_mac ${SOURCES}) -target_link_libraries(srsue_mac) +add_library(srsue_mac STATIC ${SOURCES}) +install(TARGETS srsue_mac DESTINATION ${LIBRARY_DIR}) diff --git a/srsue/src/phy/CMakeLists.txt b/srsue/src/phy/CMakeLists.txt index 590b51411..d3e4dee7d 100644 --- a/srsue/src/phy/CMakeLists.txt +++ b/srsue/src/phy/CMakeLists.txt @@ -19,9 +19,10 @@ # file(GLOB SOURCES "*.cc") -add_library(srsue_phy ${SOURCES}) -target_link_libraries(srsue_phy ${SRSLTE_PHY_LIBRARY}) +add_library(srsue_phy STATIC ${SOURCES}) if(ENABLE_GUI AND SRSGUI_FOUND) target_link_libraries(srsue_phy ${SRSGUI_LIBRARIES}) endif(ENABLE_GUI AND SRSGUI_FOUND) + +install(TARGETS srsue_phy DESTINATION ${LIBRARY_DIR}) diff --git a/srsue/src/upper/CMakeLists.txt b/srsue/src/upper/CMakeLists.txt index fec89c8e3..43e6acf4c 100644 --- a/srsue/src/upper/CMakeLists.txt +++ b/srsue/src/upper/CMakeLists.txt @@ -19,4 +19,5 @@ # file(GLOB SOURCES "*.cc") -add_library(srsue_upper SHARED ${SOURCES}) +add_library(srsue_upper STATIC ${SOURCES}) +install(TARGETS srsue_upper DESTINATION ${LIBRARY_DIR})