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,30 +133,7 @@ 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})
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(ENABLE_GUI)
find_package(SRSGUI)
if(SRSGUI_FOUND)
add_definitions(-DENABLE_GUI)
include_directories(${SRSGUI_INCLUDE_DIRS})
link_directories(${SRSGUI_LIBRARY_DIRS})
endif(SRSGUI_FOUND)
endif(ENABLE_GUI)
########################################################################
# Find boost
########################################################################
set(BOOST_REQUIRED_COMPONENTS set(BOOST_REQUIRED_COMPONENTS
program_options program_options
system system
@ -166,8 +151,21 @@ set(Boost_ADDITIONAL_VERSIONS
"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" "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}) find_package(Boost "1.35" COMPONENTS ${BOOST_REQUIRED_COMPONENTS})
endif(ENABLE_SRSUE OR ENABLE_SRSENB)
if(ENABLE_GUI)
find_package(SRSGUI)
if(SRSGUI_FOUND)
add_definitions(-DENABLE_GUI)
include_directories(${SRSGUI_INCLUDE_DIRS})
link_directories(${SRSGUI_LIBRARY_DIRS})
endif(SRSGUI_FOUND)
endif(ENABLE_GUI)
include(CheckFunctionExistsMath)
if(ENABLE_VOLK)
find_package(Volk)
if(VOLK_FOUND) if(VOLK_FOUND)
include_directories(${VOLK_INCLUDE_DIRS}) include_directories(${VOLK_INCLUDE_DIRS})
link_directories(${VOLK_LIBRARY_DIRS}) link_directories(${VOLK_LIBRARY_DIRS})
@ -175,6 +173,9 @@ if(VOLK_FOUND)
else(VOLK_FOUND) else(VOLK_FOUND)
message(STATUS "VOLK SIMD library NOT found. Using generic implementation.") message(STATUS "VOLK SIMD library NOT found. Using generic implementation.")
endif(VOLK_FOUND) endif(VOLK_FOUND)
else(ENABLE_VOLK)
message(STATUS "VOLK library disabled")
endif(ENABLE_VOLK)
######################################################################## ########################################################################
@ -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")
endif(NOT DISABLE_SRSUE)
if(NOT DISABLE_SRSENB) if(ENABLE_SRSENB)
if(RF_FOUND)
message(STATUS "Building with srsENB") message(STATUS "Building with srsENB")
add_subdirectory(srsenb) add_subdirectory(srsenb)
else(ENABLE_SRSENB)
message(STATUS "srsUE build disabled")
endif(ENABLE_SRSENB)
else(RF_FOUND) else(RF_FOUND)
message(STATUS "Building without srsENB due to missing RF driver") message(STATUS "srsUE and srsENB builds disabled due to missing RF driver")
endif(RF_FOUND) endif(RF_FOUND)
else(NOT DISABLE_SRSENB)
message(STATUS "Building without srsENB")
endif(NOT DISABLE_SRSENB)

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