Adding support for static builds

master
Paul Sutton 8 years ago
parent faa33139cd
commit b71f7b7080

@ -66,7 +66,7 @@ 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)
option(USE_LTE_RATES "Use standard LTE sampling rates" OFF)
set(GCC_ARCH native CACHE STRING "GCC compile for specific architecture.")
@ -79,13 +79,21 @@ find_package(Threads REQUIRED)
find_package(Polarssl)
if (POLARSSL_FOUND)
set(SEC_INCLUDE_DIRS "${POLARSSL_INCLUDE_DIRS}")
set(SEC_LIBRARIES "${POLARSSL_LIBRARIES}")
if(BUILD_STATIC)
set(SEC_LIBRARIES "${POLARSSL_STATIC_LIBRARIES}")
else(BUILD_STATIC)
set(SEC_LIBRARIES "${POLARSSL_LIBRARIES}")
endif(BUILD_STATIC)
add_definitions(-DHAVE_POLARSSL)
else(POLARSSL_FOUND)
find_package(MbedTLS REQUIRED)
if (MBEDTLS_FOUND)
set(SEC_INCLUDE_DIRS "${MBEDTLS_INCLUDE_DIRS}")
set(SEC_LIBRARIES "${MBEDTLS_LIBRARIES}")
if(BUILD_STATIC)
set(SEC_LIBRARIES "${MBEDTLS_STATIC_LIBRARIES}")
else(BUILD_STATIC)
set(SEC_LIBRARIES "${MBEDTLS_LIBRARIES}")
endif(BUILD_STATIC)
add_definitions(-DHAVE_MBEDTLS)
endif (MBEDTLS_FOUND)
endif(POLARSSL_FOUND)
@ -119,6 +127,10 @@ endif(BLADERF_FOUND OR UHD_FOUND OR SOAPYSDR_FOUND)
if(ENABLE_SRSUE OR ENABLE_SRSENB)
# Find Boost
if(BUILD_STATIC)
set(Boost_USE_STATIC_LIBS ON)
endif(BUILD_STATIC)
set(BOOST_REQUIRED_COMPONENTS
program_options
system

@ -32,9 +32,23 @@ FIND_LIBRARY(
/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 STATIC LIBRARIES: " ${MBEDTLS_STATIC_LIBRARIES})
message(STATUS "MBEDTLS INCLUDE DIRS: " ${MBEDTLS_INCLUDE_DIRS})
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MBEDTLS DEFAULT_MSG MBEDTLS_LIBRARIES MBEDTLS_INCLUDE_DIRS)
MARK_AS_ADVANCED(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_STATIC_LIBRARIES MBEDTLS_INCLUDE_DIRS)

@ -31,9 +31,23 @@ FIND_LIBRARY(
/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 STATIC LIBRARIES: " ${POLARSSL_STATIC_LIBRARIES})
message(STATUS "POLARSSL INCLUDE DIRS: " ${POLARSSL_INCLUDE_DIRS})
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(POLARSSL DEFAULT_MSG POLARSSL_LIBRARIES POLARSSL_INCLUDE_DIRS)
MARK_AS_ADVANCED(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_STATIC_LIBRARIES POLARSSL_LIBRARIES POLARSSL_INCLUDE_DIRS)

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

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

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

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

@ -22,6 +22,11 @@ add_subdirectory(phy)
add_subdirectory(mac)
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)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
endif (RPATH)

Loading…
Cancel
Save