Adding support for static builds

master
Paul Sutton 7 years ago
parent faa33139cd
commit b71f7b7080

@ -79,13 +79,21 @@ find_package(Threads REQUIRED)
find_package(Polarssl) find_package(Polarssl)
if (POLARSSL_FOUND) if (POLARSSL_FOUND)
set(SEC_INCLUDE_DIRS "${POLARSSL_INCLUDE_DIRS}") set(SEC_INCLUDE_DIRS "${POLARSSL_INCLUDE_DIRS}")
if(BUILD_STATIC)
set(SEC_LIBRARIES "${POLARSSL_STATIC_LIBRARIES}")
else(BUILD_STATIC)
set(SEC_LIBRARIES "${POLARSSL_LIBRARIES}") set(SEC_LIBRARIES "${POLARSSL_LIBRARIES}")
endif(BUILD_STATIC)
add_definitions(-DHAVE_POLARSSL) add_definitions(-DHAVE_POLARSSL)
else(POLARSSL_FOUND) else(POLARSSL_FOUND)
find_package(MbedTLS REQUIRED) find_package(MbedTLS REQUIRED)
if (MBEDTLS_FOUND) if (MBEDTLS_FOUND)
set(SEC_INCLUDE_DIRS "${MBEDTLS_INCLUDE_DIRS}") set(SEC_INCLUDE_DIRS "${MBEDTLS_INCLUDE_DIRS}")
if(BUILD_STATIC)
set(SEC_LIBRARIES "${MBEDTLS_STATIC_LIBRARIES}")
else(BUILD_STATIC)
set(SEC_LIBRARIES "${MBEDTLS_LIBRARIES}") set(SEC_LIBRARIES "${MBEDTLS_LIBRARIES}")
endif(BUILD_STATIC)
add_definitions(-DHAVE_MBEDTLS) add_definitions(-DHAVE_MBEDTLS)
endif (MBEDTLS_FOUND) endif (MBEDTLS_FOUND)
endif(POLARSSL_FOUND) endif(POLARSSL_FOUND)
@ -119,6 +127,10 @@ endif(BLADERF_FOUND OR UHD_FOUND OR SOAPYSDR_FOUND)
if(ENABLE_SRSUE OR ENABLE_SRSENB) if(ENABLE_SRSUE OR ENABLE_SRSENB)
# Find Boost # Find Boost
if(BUILD_STATIC)
set(Boost_USE_STATIC_LIBS ON)
endif(BUILD_STATIC)
set(BOOST_REQUIRED_COMPONENTS set(BOOST_REQUIRED_COMPONENTS
program_options program_options
system system

@ -32,9 +32,23 @@ FIND_LIBRARY(
/usr/lib64 /usr/lib64
) )
FIND_LIBRARY(
MBEDTLS_STATIC_LIBRARIES
NAMES libmbedcrypto.a
HINTS $ENV{MBEDTLS_DIR}/lib
${PC_MBEDTLS_LIBDIR}
${CMAKE_INSTALL_PREFIX}/lib
${CMAKE_INSTALL_PREFIX}/lib64
PATHS /usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
)
message(STATUS "MBEDTLS LIBRARIES: " ${MBEDTLS_LIBRARIES}) message(STATUS "MBEDTLS LIBRARIES: " ${MBEDTLS_LIBRARIES})
message(STATUS "MBEDTLS STATIC LIBRARIES: " ${MBEDTLS_STATIC_LIBRARIES})
message(STATUS "MBEDTLS INCLUDE DIRS: " ${MBEDTLS_INCLUDE_DIRS}) message(STATUS "MBEDTLS INCLUDE DIRS: " ${MBEDTLS_INCLUDE_DIRS})
INCLUDE(FindPackageHandleStandardArgs) INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MBEDTLS DEFAULT_MSG MBEDTLS_LIBRARIES MBEDTLS_INCLUDE_DIRS) FIND_PACKAGE_HANDLE_STANDARD_ARGS(MBEDTLS DEFAULT_MSG MBEDTLS_LIBRARIES MBEDTLS_STATIC_LIBRARIES MBEDTLS_INCLUDE_DIRS)
MARK_AS_ADVANCED(MBEDTLS_LIBRARIES MBEDTLS_INCLUDE_DIRS) MARK_AS_ADVANCED(MBEDTLS_LIBRARIES MBEDTLS_STATIC_LIBRARIES MBEDTLS_INCLUDE_DIRS)

@ -31,9 +31,23 @@ FIND_LIBRARY(
/usr/lib64 /usr/lib64
) )
FIND_LIBRARY(
POLARSSL_STATIC_LIBRARIES
NAMES libpolarssl.a
HINTS $ENV{POLARSSL_DIR}/lib
${PC_POLARSSL_LIBDIR}
${CMAKE_INSTALL_PREFIX}/lib
${CMAKE_INSTALL_PREFIX}/lib64
PATHS /usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
)
message(STATUS "POLARSSL LIBRARIES: " ${POLARSSL_LIBRARIES}) message(STATUS "POLARSSL LIBRARIES: " ${POLARSSL_LIBRARIES})
message(STATUS "POLARSSL STATIC LIBRARIES: " ${POLARSSL_STATIC_LIBRARIES})
message(STATUS "POLARSSL INCLUDE DIRS: " ${POLARSSL_INCLUDE_DIRS}) message(STATUS "POLARSSL INCLUDE DIRS: " ${POLARSSL_INCLUDE_DIRS})
INCLUDE(FindPackageHandleStandardArgs) INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(POLARSSL DEFAULT_MSG POLARSSL_LIBRARIES POLARSSL_INCLUDE_DIRS) FIND_PACKAGE_HANDLE_STANDARD_ARGS(POLARSSL DEFAULT_MSG POLARSSL_LIBRARIES POLARSSL_STATIC_LIBRARIES POLARSSL_INCLUDE_DIRS)
MARK_AS_ADVANCED(POLARSSL_LIBRARIES POLARSSL_INCLUDE_DIRS) MARK_AS_ADVANCED(POLARSSL_STATIC_LIBRARIES POLARSSL_LIBRARIES POLARSSL_INCLUDE_DIRS)

@ -66,13 +66,12 @@ public:
void write_pdu_pcch(byte_buffer_t *sdu); void write_pdu_pcch(byte_buffer_t *sdu);
private: private:
log *pdcp_log;
pdcp_entity pdcp_array[SRSLTE_N_RADIO_BEARERS];
srsue::rlc_interface_pdcp *rlc; srsue::rlc_interface_pdcp *rlc;
srsue::rrc_interface_pdcp *rrc; srsue::rrc_interface_pdcp *rrc;
srsue::gw_interface_pdcp *gw; srsue::gw_interface_pdcp *gw;
log *pdcp_log;
pdcp_entity pdcp_array[SRSLTE_N_RADIO_BEARERS];
uint8_t direction; uint8_t direction;
bool valid_lcid(uint32_t lcid); bool valid_lcid(uint32_t lcid);

@ -72,11 +72,11 @@ endif(MKL_FOUND)
if(MKL_FOUND) if(MKL_FOUND)
if(STATIC_MKL) if(BUILD_STATIC)
target_link_libraries(srslte_phy ${MKL_STATIC_LIBRARIES}) target_link_libraries(srslte_phy ${MKL_STATIC_LIBRARIES})
else(STATIC_MKL) else(BUILD_STATIC)
target_link_libraries(srslte_phy ${MKL_LIBRARIES}) target_link_libraries(srslte_phy ${MKL_LIBRARIES})
endif(STATIC_MKL) endif(BUILD_STATIC)
else(MKL_FOUND) else(MKL_FOUND)
target_link_libraries(srslte_phy ${FFTW3F_LIBRARIES}) target_link_libraries(srslte_phy ${FFTW3F_LIBRARIES})
endif(MKL_FOUND) endif(MKL_FOUND)

@ -21,9 +21,9 @@
find_package(LibConfig REQUIRED) find_package(LibConfig REQUIRED)
find_package(SCTP REQUIRED) find_package(SCTP REQUIRED)
if(STATIC_LIBCONFIGPP) if(BUILD_STATIC)
set(LIBCONFIGPP_LIBRARIES "${LIBCONFIGPP_STATIC_LIBRARY_PATH}") set(LIBCONFIGPP_LIBRARIES "${LIBCONFIGPP_STATIC_LIBRARY_PATH}")
endif(STATIC_LIBCONFIGPP) endif(BUILD_STATIC)
if(NOT Boost_FOUND) if(NOT Boost_FOUND)
message(FATAL_ERROR "Boost required to compile srsENB") message(FATAL_ERROR "Boost required to compile srsENB")

@ -5,9 +5,9 @@ add_subdirectory(upper)
# Link libstdc++ and libgcc # Link libstdc++ and libgcc
if(STATIC_LIB) if(BUILD_STATIC)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc")
endif(STATIC_LIB) endif(BUILD_STATIC)
if (RPATH) if (RPATH)

@ -22,6 +22,11 @@ add_subdirectory(phy)
add_subdirectory(mac) add_subdirectory(mac)
add_subdirectory(upper) add_subdirectory(upper)
# Link libstdc++ and libgcc
if(BUILD_STATIC)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc")
endif(BUILD_STATIC)
if (RPATH) if (RPATH)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
endif (RPATH) endif (RPATH)

Loading…
Cancel
Save