Tidy up of CMake options

master
Paul Sutton 8 years ago
parent 04ec09bd71
commit a9f0a5d868

@ -47,13 +47,22 @@ configure_file(
"${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.cmake" "${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.cmake"
IMMEDIATE @ONLY) IMMEDIATE @ONLY)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
message(STATUS "Build type not specified: defaulting to Release.")
endif(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
######################################################################## ########################################################################
# Options # Options
######################################################################## ########################################################################
option(STATIC_MKL "Statically link MKL libraries" OFF) option(STATIC_BUILD "Attempt to build with static linking" OFF)
option(DISABLE_BLADERF "Disable BladeRF" OFF) option(RPATH "Enable RPATH" OFF)
option(RPATH "Enable RPATH" OFF) option(ENABLE_VOLK "Enable VOLK SIMD library" ON)
option(ENABLE_GUI "Enable GUI" 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)
set(GCC_ARCH native CACHE STRING "GCC compile for specific architecture.") set(GCC_ARCH native CACHE STRING "GCC compile for specific architecture.")
@ -64,7 +73,6 @@ set(GCC_ARCH native CACHE STRING "GCC compile for specific architecture.")
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
find_package(Polarssl) find_package(Polarssl)
if (POLARSSL_FOUND) if (POLARSSL_FOUND)
set(POLAR_INCLUDE_DIRS "${POLARSSL_INCLUDE_DIRS}") set(POLAR_INCLUDE_DIRS "${POLARSSL_INCLUDE_DIRS}")
set(POLAR_LIBRARIES "${POLARSSL_LIBRARIES}") set(POLAR_LIBRARIES "${POLARSSL_LIBRARIES}")
@ -98,13 +106,13 @@ if(UHD_FOUND)
link_directories(${UHD_LIBRARY_DIRS}) link_directories(${UHD_LIBRARY_DIRS})
endif(UHD_FOUND) endif(UHD_FOUND)
if(NOT DISABLE_BLADERF) if(ENABLE_BLADERF)
find_package(bladeRF) find_package(bladeRF)
if(BLADERF_FOUND) if(BLADERF_FOUND)
include_directories(${BLADERF_INCLUDE_DIRS}) include_directories(${BLADERF_INCLUDE_DIRS})
link_directories(${BLADERF_LIBRARY_DIRS}) link_directories(${BLADERF_LIBRARY_DIRS})
endif(BLADERF_FOUND) endif(BLADERF_FOUND)
endif(NOT DISABLE_BLADERF) endif(ENABLE_BLADERF)
find_package(SoapySDR) find_package(SoapySDR)
if(SOAPYSDR_FOUND) if(SOAPYSDR_FOUND)
@ -125,16 +133,25 @@ else(BLADERF_FOUND OR UHD_FOUND OR SOAPYSDR_FOUND OR LIMESDR_FOUND)
add_definitions(-DDISABLE_RF) add_definitions(-DDISABLE_RF)
endif(BLADERF_FOUND OR UHD_FOUND OR SOAPYSDR_FOUND OR LIMESDR_FOUND) endif(BLADERF_FOUND OR UHD_FOUND OR SOAPYSDR_FOUND OR LIMESDR_FOUND)
include(CheckFunctionExistsMath) if(ENABLE_SRSUE OR ENABLE_SRSENB)
if(${DISABLE_VOLK}) set(BOOST_REQUIRED_COMPONENTS
if(${DISABLE_VOLK} EQUAL 0) program_options
find_package(Volk) system
else(${DISABLE_VOLK} EQUAL 0) )
message(STATUS "VOLK library disabled (DISABLE_VOLK=1)") if(UNIX AND EXISTS "/usr/lib64")
endif(${DISABLE_VOLK} EQUAL 0) list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix
else(${DISABLE_VOLK}) endif(UNIX AND EXISTS "/usr/lib64")
find_package(Volk) set(Boost_ADDITIONAL_VERSIONS
endif(${DISABLE_VOLK}) "1.35.0" "1.35" "1.36.0" "1.36" "1.37.0" "1.37" "1.38.0" "1.38" "1.39.0" "1.39"
"1.40.0" "1.40" "1.41.0" "1.41" "1.42.0" "1.42" "1.43.0" "1.43" "1.44.0" "1.44"
"1.45.0" "1.45" "1.46.0" "1.46" "1.47.0" "1.47" "1.48.0" "1.48" "1.49.0" "1.49"
"1.50.0" "1.50" "1.51.0" "1.51" "1.52.0" "1.52" "1.53.0" "1.53" "1.54.0" "1.54"
"1.55.0" "1.55" "1.56.0" "1.56" "1.57.0" "1.57" "1.58.0" "1.58" "1.59.0" "1.59"
"1.60.0" "1.60" "1.61.0" "1.61" "1.62.0" "1.62" "1.63.0" "1.63" "1.64.0" "1.64"
"1.65.0" "1.65" "1.66.0" "1.66" "1.67.0" "1.67" "1.68.0" "1.68" "1.69.0" "1.69"
)
find_package(Boost "1.35" COMPONENTS ${BOOST_REQUIRED_COMPONENTS})
endif(ENABLE_SRSUE OR ENABLE_SRSENB)
if(ENABLE_GUI) if(ENABLE_GUI)
@ -146,35 +163,19 @@ if(ENABLE_GUI)
endif(SRSGUI_FOUND) endif(SRSGUI_FOUND)
endif(ENABLE_GUI) endif(ENABLE_GUI)
######################################################################## include(CheckFunctionExistsMath)
# Find boost if(ENABLE_VOLK)
######################################################################## find_package(Volk)
set(BOOST_REQUIRED_COMPONENTS if(VOLK_FOUND)
program_options include_directories(${VOLK_INCLUDE_DIRS})
system link_directories(${VOLK_LIBRARY_DIRS})
) message(STATUS "Compiling with VOLK SIMD library.")
if(UNIX AND EXISTS "/usr/lib64") else(VOLK_FOUND)
list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix message(STATUS "VOLK SIMD library NOT found. Using generic implementation.")
endif(UNIX AND EXISTS "/usr/lib64") endif(VOLK_FOUND)
set(Boost_ADDITIONAL_VERSIONS else(ENABLE_VOLK)
"1.35.0" "1.35" "1.36.0" "1.36" "1.37.0" "1.37" "1.38.0" "1.38" "1.39.0" "1.39" message(STATUS "VOLK library disabled")
"1.40.0" "1.40" "1.41.0" "1.41" "1.42.0" "1.42" "1.43.0" "1.43" "1.44.0" "1.44" endif(ENABLE_VOLK)
"1.45.0" "1.45" "1.46.0" "1.46" "1.47.0" "1.47" "1.48.0" "1.48" "1.49.0" "1.49"
"1.50.0" "1.50" "1.51.0" "1.51" "1.52.0" "1.52" "1.53.0" "1.53" "1.54.0" "1.54"
"1.55.0" "1.55" "1.56.0" "1.56" "1.57.0" "1.57" "1.58.0" "1.58" "1.59.0" "1.59"
"1.60.0" "1.60" "1.61.0" "1.61" "1.62.0" "1.62" "1.63.0" "1.63" "1.64.0" "1.64"
"1.65.0" "1.65" "1.66.0" "1.66" "1.67.0" "1.67" "1.68.0" "1.68" "1.69.0" "1.69"
)
find_package(Boost "1.35" COMPONENTS ${BOOST_REQUIRED_COMPONENTS})
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)
######################################################################## ########################################################################
@ -197,12 +198,6 @@ set(DOC_DIR "share/doc/${CPACK_PACKAGE_NAME}")
set(DATA_DIR share/${CPACK_PACKAGE_NAME}) set(DATA_DIR share/${CPACK_PACKAGE_NAME})
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
message(STATUS "Build type not specified: defaulting to Release.")
endif(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
######################################################################## ########################################################################
# Install headers # Install headers
######################################################################## ########################################################################
@ -335,24 +330,21 @@ add_custom_target(add_srslte_headers SOURCES ${HEADERS_ALL})
# Add the subdirectories # Add the subdirectories
######################################################################## ########################################################################
add_subdirectory(lib) add_subdirectory(lib)
if(NOT DISABLE_SRSUE)
if(RF_FOUND) if(RF_FOUND)
if(ENABLE_SRSUE)
message(STATUS "Building with srsUE") message(STATUS "Building with srsUE")
add_subdirectory(srsue) add_subdirectory(srsue)
else(RF_FOUND) else(ENABLE_SRSUE)
message(STATUS "Building without srsUE due to missing RF driver") message(STATUS "srsUE build disabled")
endif(RF_FOUND) endif(ENABLE_SRSUE)
else(NOT DISABLE_SRSUE)
message(STATUS "Building without srsUE") if(ENABLE_SRSENB)
endif(NOT DISABLE_SRSUE)
if(NOT DISABLE_SRSENB)
if(RF_FOUND)
message(STATUS "Building with srsENB") message(STATUS "Building with srsENB")
add_subdirectory(srsenb) add_subdirectory(srsenb)
else(RF_FOUND) else(ENABLE_SRSENB)
message(STATUS "Building without srsENB due to missing RF driver") message(STATUS "srsUE build disabled")
endif(RF_FOUND) endif(ENABLE_SRSENB)
else(NOT DISABLE_SRSENB) else(RF_FOUND)
message(STATUS "Building without srsENB") message(STATUS "srsUE and srsENB builds disabled due to missing RF driver")
endif(NOT DISABLE_SRSENB) endif(RF_FOUND)

@ -18,85 +18,6 @@
# and at http://www.gnu.org/licenses/. # and at http://www.gnu.org/licenses/.
# #
########################################################################
# Install headers
########################################################################
INSTALL(DIRECTORY include/
DESTINATION "${INCLUDE_DIR}"
FILES_MATCHING PATTERN "*.h"
)
########################################################################
# Find Dependencies
########################################################################
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 DISABLE_BLADERF)
find_package(bladeRF)
if(BLADERF_FOUND)
include_directories(${BLADERF_INCLUDE_DIRS})
link_directories(${BLADERF_LIBRARY_DIRS})
endif(BLADERF_FOUND)
endif(NOT DISABLE_BLADERF)
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)
######################################################################## ########################################################################
# Add subdirectories # Add subdirectories
######################################################################## ########################################################################

Loading…
Cancel
Save