Switch to static internal libs, set -fPIC by default

This commit is contained in:
Paul Sutton 2017-06-08 11:22:02 +01:00
parent 0e87bc7b80
commit 4b68272964
33 changed files with 94 additions and 54 deletions

View File

@ -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)
set(GCC_ARCH native CACHE STRING "GCC compile for specific architecture.")
@ -281,11 +284,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

View File

@ -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

View File

@ -20,7 +20,7 @@
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_link_libraries(srslte_common ${SEC_LIBRARIES})
install(TARGETS srslte_common DESTINATION ${LIBRARY_DIR})
SRSLTE_SET_PIC(srslte_common)

View File

@ -113,5 +113,4 @@ if(VOLK_FOUND)
endif(VOLK_FOUND)
install(TARGETS srslte_phy DESTINATION ${LIBRARY_DIR})
SRSLTE_SET_PIC(srslte_phy)

View File

@ -20,4 +20,3 @@
file(GLOB SOURCES "*.c")
add_library(srslte_agc OBJECT ${SOURCES})
SRSLTE_SET_PIC(srslte_agc)

View File

@ -20,5 +20,4 @@
file(GLOB SOURCES "*.c")
add_library(srslte_ch_estimation OBJECT ${SOURCES})
SRSLTE_SET_PIC(srslte_ch_estimation)
add_subdirectory(test)

View File

@ -20,4 +20,3 @@
file(GLOB SOURCES "*.c")
add_library(srslte_channel OBJECT ${SOURCES})
SRSLTE_SET_PIC(srslte_channel)

View File

@ -20,4 +20,3 @@
file(GLOB SOURCES "*.c")
add_library(srslte_phy_common OBJECT ${SOURCES})
SRSLTE_SET_PIC(srslte_phy_common)

View File

@ -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)

View File

@ -20,4 +20,3 @@
file(GLOB SOURCES "*.c")
add_library(srslte_enb OBJECT ${SOURCES})
SRSLTE_SET_PIC(srslte_enb)

View File

@ -20,5 +20,4 @@
file(GLOB SOURCES "*.c")
add_library(srslte_fec OBJECT ${SOURCES})
SRSLTE_SET_PIC(srslte_fec)
add_subdirectory(test)

View File

@ -20,4 +20,3 @@
file(GLOB SOURCES "*.c")
add_library(srslte_io OBJECT ${SOURCES})
SRSLTE_SET_PIC(srslte_io)

View File

@ -20,5 +20,4 @@
file(GLOB SOURCES "*.c")
add_library(srslte_mimo OBJECT ${SOURCES})
SRSLTE_SET_PIC(srslte_mimo)
add_subdirectory(test)

View File

@ -20,5 +20,4 @@
file(GLOB SOURCES "*.c")
add_library(srslte_modem OBJECT ${SOURCES})
SRSLTE_SET_PIC(srslte_modem)
add_subdirectory(test)

View File

@ -20,5 +20,4 @@
file(GLOB SOURCES "*.c")
add_library(srslte_phch OBJECT ${SOURCES})
SRSLTE_SET_PIC(srslte_phch)
add_subdirectory(test)

View File

@ -20,5 +20,4 @@
file(GLOB SOURCES "*.c")
add_library(srslte_resampling OBJECT ${SOURCES})
SRSLTE_SET_PIC(srslte_resampling)
add_subdirectory(test)

View File

@ -56,5 +56,4 @@ if(RF_FOUND)
INSTALL(TARGETS srslte_rf DESTINATION ${LIBRARY_DIR})
SRSLTE_SET_PIC(srslte_rf)
endif(RF_FOUND)

View File

@ -20,5 +20,4 @@
file(GLOB SOURCES "*.c")
add_library(srslte_scrambling OBJECT ${SOURCES})
SRSLTE_SET_PIC(srslte_scrambling)
add_subdirectory(test)

View File

@ -20,5 +20,4 @@
file(GLOB SOURCES "*.c")
add_library(srslte_sync OBJECT ${SOURCES})
SRSLTE_SET_PIC(srslte_sync)
add_subdirectory(test)

View File

@ -20,4 +20,3 @@
file(GLOB SOURCES "*.c")
add_library(srslte_ue OBJECT ${SOURCES})
SRSLTE_SET_PIC(srslte_ue)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -1,5 +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_mac SHARED ${SOURCES})
target_link_libraries(srsenb_mac)
add_library(srsenb_mac STATIC ${SOURCES})
install(TARGETS srsenb_mac DESTINATION ${LIBRARY_DIR})

View File

@ -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 ${SRSLTE_LIBRARIES} )
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})

View File

@ -1,3 +1,23 @@
#
# 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 ${SRSLTE_LIBRARIES})
add_library(srsenb_upper STATIC ${SOURCES})
install(TARGETS srsenb_upper DESTINATION ${LIBRARY_DIR})

View File

@ -34,7 +34,6 @@ target_link_libraries(srsue srsue_mac
srslte_phy
srslte_upper
srslte_radio
${SRSLTE_LIBRARIES}
${LIBLTE_LIBRARY}
${CMAKE_THREAD_LIBS_INIT}
${Boost_LIBRARIES})

View File

@ -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})

View File

@ -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})

View File

@ -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})

View File

@ -19,5 +19,5 @@
#
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-switch")
add_executable(mac_test mac_test.cc)
target_link_libraries(mac_test srsue_mac srsue_phy srslte_common srslte_phy srslte_radio srslte_asn1 ${SRSLTE_LIBRARIES} ${LIBLTE_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
target_link_libraries(mac_test srsue_mac srsue_phy srslte_common srslte_phy srslte_radio srslte_asn1 ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})

View File

@ -19,7 +19,7 @@
#
add_executable(ue_itf_test_sib1 ue_itf_test_sib1.cc)
target_link_libraries(ue_itf_test_sib1 srsue_phy srslte_common srslte_phy srslte_radio ${SRSLTE_LIBRARIES} ${LIBLTE_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
target_link_libraries(ue_itf_test_sib1 srsue_phy srslte_common srslte_phy srslte_radio ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
add_executable(ue_itf_test_prach ue_itf_test_prach.cc)
target_link_libraries(ue_itf_test_prach srsue_phy srslte_common srslte_phy srslte_radio ${SRSLTE_LIBRARIES} ${LIBLTE_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
target_link_libraries(ue_itf_test_prach srsue_phy srslte_common srslte_phy srslte_radio ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})

View File

@ -26,8 +26,6 @@ target_link_libraries(ip_test srsue_mac
srslte_phy
srslte_radio
srslte_upper
${SRSLTE_LIBRARIES}
${LIBLTE_LIBRARY}
${CMAKE_THREAD_LIBS_INIT}
${Boost_LIBRARIES})