2016-02-28 16:03:37 -05:00
|
|
|
cmake_minimum_required(VERSION 3.1.0)
|
2015-06-12 02:13:53 -04:00
|
|
|
cmake_policy(SET CMP0043 OLD)
|
2014-11-05 07:34:33 -05:00
|
|
|
|
2017-12-16 04:03:38 -05:00
|
|
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9")
|
|
|
|
message(FATAL_ERROR "SDRangel requires GCC version 4.9 or higher!")
|
|
|
|
endif()
|
|
|
|
|
2016-06-28 04:20:47 -04:00
|
|
|
# QT Framework
|
|
|
|
set(CMAKE_PREFIX_PATH "/Applications/Qt/5.7/clang_64/lib/cmake")
|
|
|
|
|
2016-02-24 05:51:36 -05:00
|
|
|
# use, i.e. don't skip the full RPATH for the build tree
|
|
|
|
set(CMAKE_SKIP_BUILD_RPATH FALSE)
|
|
|
|
|
|
|
|
# when building, don't use the install RPATH already
|
|
|
|
# (but later on when installing)
|
2018-09-11 07:41:09 -04:00
|
|
|
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
|
2016-02-24 05:51:36 -05:00
|
|
|
|
2016-02-24 09:27:05 -05:00
|
|
|
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
|
2016-02-24 05:51:36 -05:00
|
|
|
|
|
|
|
# add the automatically determined parts of the RPATH
|
|
|
|
# which point to directories outside the build tree to the install RPATH
|
|
|
|
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
|
|
|
|
2016-03-06 09:10:22 -05:00
|
|
|
add_definitions(-DLINUX) # for compatibility with Android and Windows builds with QtCretino
|
|
|
|
|
2015-03-31 13:46:29 -04:00
|
|
|
option(V4L-RTL "Use Linux Kernel RTL-SDR Source." OFF)
|
|
|
|
option(V4L-MSI "Use Linux Kernel MSI2500 Source." OFF)
|
2015-10-21 20:19:07 -04:00
|
|
|
option(BUILD_TYPE "Build type (RELEASE, RELEASEWITHDBGINFO, DEBUG" RELEASE)
|
|
|
|
option(DEBUG_OUTPUT "Print debug messages" OFF)
|
2018-02-15 04:53:42 -05:00
|
|
|
option(SANITIZE_ADDRESS "Activate memory address sanitization" OFF)
|
2017-06-19 02:38:00 -04:00
|
|
|
option(HOST_RPI "Compiling on RPi" OFF)
|
2018-01-22 02:46:05 -05:00
|
|
|
option(RX_SAMPLE_24BIT "Internal 24 bit Rx DSP" OFF)
|
2018-04-27 23:08:01 -04:00
|
|
|
option(NO_DSP_SIMD "Do not use SIMD instructions for DSP even if available" OFF)
|
2018-12-03 19:39:41 -05:00
|
|
|
option(BUILD_SERVER "Build Server" ON)
|
|
|
|
option(BUILD_GUI "Build GUI" ON)
|
2014-11-05 07:34:33 -05:00
|
|
|
|
2014-05-18 11:52:39 -04:00
|
|
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
|
|
|
|
|
2015-08-29 19:30:43 -04:00
|
|
|
project(sdrangel)
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2015-10-21 20:19:07 -04:00
|
|
|
if (BUILD_TYPE MATCHES RELEASE)
|
2016-10-25 18:57:46 -04:00
|
|
|
set(CMAKE_BUILD_TYPE "Release")
|
2015-10-21 20:19:07 -04:00
|
|
|
elseif (BUILD_TYPE MATCHES RELEASEWITHDBGINFO)
|
2016-10-25 18:57:46 -04:00
|
|
|
set(CMAKE_BUILD_TYPE "ReleaseWithDebugInfo")
|
2015-10-21 20:19:07 -04:00
|
|
|
elseif (BUILD_TYPE MATCHES DEBUG)
|
2016-10-25 18:57:46 -04:00
|
|
|
set(CMAKE_BUILD_TYPE "Debug")
|
|
|
|
elseif (BUILD_TYPE MATCHES DEBIAN)
|
|
|
|
set(CMAKE_BUILD_TYPE "Release")
|
|
|
|
set(BUILD_DEBIAN TRUE)
|
2015-10-21 20:19:07 -04:00
|
|
|
else()
|
2016-10-25 18:57:46 -04:00
|
|
|
set(CMAKE_BUILD_TYPE "Release")
|
2015-10-21 20:19:07 -04:00
|
|
|
endif()
|
2014-05-18 11:52:39 -04:00
|
|
|
|
|
|
|
set(QT_USE_QTOPENGL TRUE)
|
|
|
|
set(CMAKE_AUTOMOC ON)
|
|
|
|
|
2019-04-15 04:54:27 -04:00
|
|
|
if(APPLE AND EXISTS /usr/local/opt/qt5)
|
|
|
|
# Homebrew installs Qt5 (up to at least 5.9.1) in
|
|
|
|
# /usr/local/qt5, ensure it can be found by CMake since
|
|
|
|
# it is not in the default /usr/local prefix.
|
|
|
|
list(APPEND CMAKE_PREFIX_PATH "/usr/local/opt/qt5")
|
|
|
|
endif()
|
|
|
|
|
2014-05-18 11:52:39 -04:00
|
|
|
#find_package(Qt4 REQUIRED)
|
|
|
|
find_package(Qt5Core 5.0 REQUIRED)
|
|
|
|
find_package(Qt5Widgets 5.0 REQUIRED)
|
|
|
|
find_package(Qt5Multimedia 5.0 REQUIRED)
|
2018-06-12 18:20:51 -04:00
|
|
|
find_package(Qt5OpenGL 5.0 REQUIRED)
|
2014-05-18 11:52:39 -04:00
|
|
|
find_package(OpenGL REQUIRED)
|
|
|
|
find_package(PkgConfig)
|
2017-08-12 06:07:51 -04:00
|
|
|
find_package(Boost REQUIRED)
|
2014-05-18 11:52:39 -04:00
|
|
|
find_package(FFTW3F)
|
2016-10-25 18:57:46 -04:00
|
|
|
|
|
|
|
if (NOT BUILD_DEBIAN)
|
|
|
|
find_package(LibDSDcc)
|
|
|
|
find_package(LibMbe)
|
|
|
|
find_package(SerialDV)
|
|
|
|
endif()
|
2016-05-04 11:07:26 -04:00
|
|
|
|
2016-06-28 04:20:47 -04:00
|
|
|
# MacOS Compatibility
|
|
|
|
if(APPLE)
|
2016-06-29 04:00:38 -04:00
|
|
|
find_package(ICONV)
|
2016-06-28 04:20:47 -04:00
|
|
|
endif(APPLE)
|
2014-05-18 11:52:39 -04:00
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
#include(${QT_USE_FILE})
|
2015-10-21 20:19:07 -04:00
|
|
|
|
|
|
|
if (DEBUG_OUTPUT)
|
2016-10-25 18:57:46 -04:00
|
|
|
set( QT_DEFINITIONS "${QT_DEFINITIONS}" )
|
2015-10-21 20:19:07 -04:00
|
|
|
else()
|
2016-10-25 18:57:46 -04:00
|
|
|
set( QT_DEFINITIONS "${QT_DEFINITIONS} -DQT_NO_DEBUG_OUTPUT" )
|
2015-10-21 20:19:07 -04:00
|
|
|
endif()
|
|
|
|
|
2014-05-18 11:52:39 -04:00
|
|
|
add_definitions(${QT_DEFINITIONS})
|
|
|
|
|
|
|
|
if(MSVC)
|
2016-10-25 18:57:46 -04:00
|
|
|
foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
|
|
|
|
string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG)
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/bin_${OUTPUTCONFIG})
|
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/bin_${OUTPUTCONFIG})
|
|
|
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/bin_${OUTPUTCONFIG})
|
|
|
|
endforeach(OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES)
|
2014-05-18 11:52:39 -04:00
|
|
|
endif()
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
|
2017-09-05 02:27:15 -04:00
|
|
|
if (HOST_RPI)
|
|
|
|
message( STATUS "Compiling on RPi" )
|
|
|
|
endif()
|
|
|
|
|
2019-04-15 15:43:48 -04:00
|
|
|
|
|
|
|
set(TEST_DIR ${PROJECT_SOURCE_DIR}/cmake/test)
|
|
|
|
|
|
|
|
# Clang or AppleClang (see CMP0025)
|
|
|
|
if(NOT DEFINED C_CLANG AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|
|
|
set(C_CLANG 1)
|
|
|
|
endif()
|
|
|
|
if(NOT DEFINED C_GCC AND CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
|
|
|
set(C_GCC 1)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Detect current compilation architecture and create standard definitions
|
|
|
|
# =======================================================================
|
|
|
|
include(CheckSymbolExists)
|
|
|
|
function(detect_architecture symbol arch)
|
|
|
|
if (NOT DEFINED ARCHITECTURE)
|
|
|
|
set(CMAKE_REQUIRED_QUIET 1)
|
|
|
|
check_symbol_exists("${symbol}" "" ARCHITECTURE_${arch})
|
|
|
|
unset(CMAKE_REQUIRED_QUIET)
|
|
|
|
|
|
|
|
# The output variable needs to be unique across invocations otherwise
|
|
|
|
# CMake's crazy scope rules will keep it defined
|
|
|
|
if (ARCHITECTURE_${arch})
|
|
|
|
set(ARCHITECTURE "${arch}" PARENT_SCOPE)
|
|
|
|
set(ARCHITECTURE_${arch} 1 PARENT_SCOPE)
|
|
|
|
add_definitions(-DARCHITECTURE_${arch}=1)
|
2017-09-05 02:27:15 -04:00
|
|
|
endif()
|
2019-04-15 15:43:48 -04:00
|
|
|
endif()
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
if (NOT ENABLE_GENERIC)
|
|
|
|
if (MSVC)
|
|
|
|
detect_architecture("_M_AMD64" x86_64)
|
|
|
|
detect_architecture("_M_IX86" x86)
|
|
|
|
detect_architecture("_M_ARM" ARM)
|
|
|
|
detect_architecture("_M_ARM64" ARM64)
|
2017-09-05 02:27:15 -04:00
|
|
|
else()
|
2019-04-15 15:43:48 -04:00
|
|
|
detect_architecture("__x86_64__" x86_64)
|
|
|
|
detect_architecture("__i386__" x86)
|
|
|
|
detect_architecture("__arm__" ARM)
|
|
|
|
detect_architecture("__aarch64__" ARM64)
|
2017-09-05 02:27:15 -04:00
|
|
|
endif()
|
2019-04-15 15:43:48 -04:00
|
|
|
endif()
|
|
|
|
if (NOT DEFINED ARCHITECTURE)
|
|
|
|
set(ARCHITECTURE "GENERIC")
|
|
|
|
set(ARCHITECTURE_GENERIC 1)
|
|
|
|
add_definitions(-DARCHITECTURE_GENERIC=1)
|
|
|
|
endif()
|
|
|
|
message(STATUS "Target architecture: ${ARCHITECTURE}")
|
|
|
|
|
|
|
|
# flag that set the minimum cpu flag requirements
|
|
|
|
# used to create re-distribuitable binary
|
|
|
|
if (ENABLE_DISTRIBUTION)
|
|
|
|
if (${ARCHITECTURE} MATCHES "x86_64|x86")
|
|
|
|
set(HAS_SSSE3 ON CACHE BOOL "SSSE3 SIMD enabled")
|
|
|
|
if(C_GCC OR C_CLANG)
|
|
|
|
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mssse3" )
|
2017-09-05 02:27:15 -04:00
|
|
|
message(STATUS "Use SSSE3 SIMD instructions")
|
|
|
|
add_definitions(-DUSE_SSSE3)
|
|
|
|
elseif(MSVC)
|
|
|
|
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSSE3" )
|
|
|
|
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSSE3" )
|
|
|
|
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
|
2019-04-15 15:43:48 -04:00
|
|
|
message(STATUS "Use MSVC SSSE3 SIMD instructions")
|
2017-09-05 02:27:15 -04:00
|
|
|
add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
|
|
|
|
add_definitions(-DUSE_SSSE3)
|
|
|
|
endif()
|
2019-04-15 15:43:48 -04:00
|
|
|
elseif (${ARCHITECTURE} MATCHES "ARM|ARM64")
|
|
|
|
set(HAS_NEON ON CACHE BOOL "NEON SIMD enabled")
|
|
|
|
message(STATUS "Use NEON SIMD instructions")
|
|
|
|
add_definitions(-DUSE_NEON)
|
|
|
|
endif()
|
|
|
|
else ()
|
|
|
|
if (${ARCHITECTURE} MATCHES "x86_64|x86")
|
|
|
|
try_run(RUN_SSE2 COMPILE_SSE2 ${CMAKE_BINARY_DIR}/tmp ${TEST_DIR}/test_x86_sse2.cxx COMPILE_DEFINITIONS -msse2 -O0)
|
|
|
|
if(COMPILE_SSE2 AND RUN_SSE2 EQUAL 0)
|
|
|
|
set(HAS_SSE2 ON CACHE BOOL "Architecture has SSSE2 SIMD enabled")
|
|
|
|
if(C_GCC OR C_CLANG)
|
|
|
|
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2" )
|
|
|
|
message(STATUS "Use SSE2 SIMD instructions")
|
|
|
|
add_definitions(-DUSE_SSE2)
|
|
|
|
elseif(MSVC)
|
|
|
|
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE2" )
|
|
|
|
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSE2" )
|
|
|
|
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
|
|
|
|
add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
|
|
|
|
add_definitions(-DUSE_SSE2)
|
|
|
|
endif()
|
2017-09-05 02:27:15 -04:00
|
|
|
else()
|
2019-04-15 15:43:48 -04:00
|
|
|
set(HAS_SSE2 OFF CACHE BOOL "Architecture does not have SSSE2 SIMD enabled")
|
2017-09-05 02:27:15 -04:00
|
|
|
endif()
|
2019-04-15 15:43:48 -04:00
|
|
|
try_run(RUN_SSSE3 COMPILE_SSSE3 ${CMAKE_BINARY_DIR}/tmp ${TEST_DIR}/test_x86_ssse3.cxx COMPILE_DEFINITIONS -mssse3 -O0)
|
|
|
|
if(COMPILE_SSSE3 AND RUN_SSSE3 EQUAL 0)
|
|
|
|
set(HAS_SSSE3 ON CACHE BOOL "Architecture has SSSE3 SIMD enabled")
|
|
|
|
if(C_GCC OR C_CLANG)
|
|
|
|
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mssse3" )
|
|
|
|
message(STATUS "Use SSSE3 SIMD instructions")
|
|
|
|
add_definitions(-DUSE_SSSE3)
|
|
|
|
elseif(MSVC)
|
|
|
|
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSSE3" )
|
|
|
|
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSSE3" )
|
|
|
|
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
|
|
|
|
message(STATUS "Use MSVC SSSE3 SIMD instructions")
|
|
|
|
add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
|
|
|
|
add_definitions(-DUSE_SSSE3)
|
|
|
|
endif()
|
2017-09-05 02:27:15 -04:00
|
|
|
else()
|
2019-04-15 15:43:48 -04:00
|
|
|
set(HAS_SSSE3 OFF CACHE BOOL "Architecture does not have SSSE3 SIMD enabled")
|
2017-09-05 02:27:15 -04:00
|
|
|
endif()
|
2019-04-15 15:43:48 -04:00
|
|
|
try_run(RUN_SSE4_1 COMPILE_SSE4_1 ${CMAKE_BINARY_DIR}/tmp ${TEST_DIR}/test_x86_sse41.cxx COMPILE_DEFINITIONS -msse4.1 -O0)
|
|
|
|
if(COMPILE_SSE4_1 AND RUN_SSE4_1 EQUAL 0)
|
|
|
|
set(HAS_SSE4_1 ON CACHE BOOL "Architecture has SSE 4.1 SIMD enabled")
|
|
|
|
if(C_GCC OR C_CLANG)
|
|
|
|
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -msse4.1" )
|
|
|
|
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -msse4.1" )
|
|
|
|
message(STATUS "Use SSE 4.1 SIMD instructions")
|
|
|
|
add_definitions(-DUSE_SSE4_1)
|
|
|
|
elseif(MSVC)
|
|
|
|
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE4_1" )
|
|
|
|
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSE4_1" )
|
|
|
|
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
|
|
|
|
add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
|
|
|
|
add_definitions(-DUSE_SSE4_1)
|
|
|
|
endif()
|
2017-09-05 02:27:15 -04:00
|
|
|
else()
|
2019-04-15 15:43:48 -04:00
|
|
|
set(HAS_SSE4_1 OFF CACHE BOOL "Architecture does not have SSE 4.1 SIMD enabled")
|
2017-09-05 02:27:15 -04:00
|
|
|
endif()
|
2019-04-15 15:43:48 -04:00
|
|
|
try_run(RUN_SSE4_2 COMPILE_SSE4_2 ${CMAKE_BINARY_DIR}/tmp ${TEST_DIR}/test_x86_sse42.cxx COMPILE_DEFINITIONS -msse4.2 -O0)
|
|
|
|
if(COMPILE_SSE4_2 AND RUN_SSE4_2 EQUAL 0)
|
|
|
|
set(HAS_SSE4_2 ON CACHE BOOL "Architecture has SSE 4.2 SIMD enabled")
|
|
|
|
if(C_GCC OR C_CLANG)
|
|
|
|
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -msse4.2" )
|
|
|
|
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -msse4.2" )
|
|
|
|
message(STATUS "Use SSE 4.2 SIMD instructions")
|
|
|
|
add_definitions(-DUSE_SSE4_2)
|
|
|
|
elseif(MSVC)
|
|
|
|
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE4_2" )
|
|
|
|
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSE4_2" )
|
|
|
|
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
|
|
|
|
add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
|
|
|
|
add_definitions(-DUSE_SSE4_2)
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
set(HAS_SSE4_2 OFF CACHE BOOL "Architecture does not have SSE 4.2 SIMD enabled")
|
|
|
|
endif()
|
|
|
|
try_run(RUN_AVX COMPILE_AVX ${CMAKE_BINARY_DIR}/tmp ${TEST_DIR}/test_x86_avx.cxx COMPILE_DEFINITIONS -mavx -O0)
|
|
|
|
if(COMPILE_AVX AND RUN_AVX EQUAL 0)
|
|
|
|
set(HAS_AVX ON CACHE BOOL "Architecture has AVX SIMD enabled")
|
|
|
|
if(C_GCC OR C_CLANG)
|
|
|
|
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mavx" )
|
|
|
|
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -mavx" )
|
|
|
|
message(STATUS "Use AVX SIMD instructions")
|
|
|
|
add_definitions(-DUSE_AVX)
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
set(HAS_AVX OFF CACHE BOOL "Architecture does not have AVX SIMD enabled")
|
2017-09-05 02:27:15 -04:00
|
|
|
endif()
|
2019-04-15 15:43:48 -04:00
|
|
|
try_run(RUN_AVX2 COMPILE_AVX2 ${CMAKE_BINARY_DIR}/tmp ${TEST_DIR}/test_x86_avx2.cxx COMPILE_DEFINITIONS -mavx2 -O0)
|
|
|
|
if(COMPILE_AVX2 AND RUN_AVX2 EQUAL 0)
|
|
|
|
set(HAS_AVX2 ON CACHE BOOL "Architecture has AVX2 SIMD enabled")
|
|
|
|
if(C_GCC OR C_CLANG)
|
|
|
|
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mavx2" )
|
|
|
|
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -mavx2" )
|
|
|
|
message(STATUS "Use AVX2 SIMD instructions")
|
|
|
|
add_definitions(-DUSE_AVX2)
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
set(HAS_AVX2 OFF CACHE BOOL "Architecture does not have AVX2 SIMD enabled")
|
|
|
|
endif()
|
|
|
|
try_run(RUN_AVX512 COMPILE_AVX512 ${CMAKE_BINARY_DIR}/tmp ${TEST_DIR}/test_x86_avx512.cxx COMPILE_DEFINITIONS -mavx512f -O0)
|
|
|
|
if(COMPILE_AVX512 AND RUN_AVX512 EQUAL 0)
|
|
|
|
set(HAS_AVX512 ON CACHE BOOL "Architecture has AVX512 SIMD enabled")
|
|
|
|
if(C_GCC OR C_CLANG)
|
|
|
|
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mavx512f" )
|
|
|
|
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -mavx512f" )
|
|
|
|
message(STATUS "Use AVX512 SIMD instructions")
|
|
|
|
add_definitions(-DUSE_AVX512)
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
set(HAS_AVX512 OFF CACHE BOOL "Architecture does not have AVX512 SIMD enabled")
|
|
|
|
endif()
|
|
|
|
elseif(ARCHITECTURE_ARM)
|
|
|
|
try_run(RUN_NEON COMPILE_NEON ${CMAKE_BINARY_DIR}/tmp ${TEST_DIR}/test_arm_neon.cxx COMPILE_DEFINITIONS -mfpu=neon -O0)
|
|
|
|
if(COMPILE_NEON AND RUN_NEON EQUAL 0)
|
|
|
|
set(HAS_NEON ON CACHE BOOL "Architecture has NEON SIMD enabled")
|
|
|
|
if(C_GCC OR C_CLANG)
|
|
|
|
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mfpu=neon" )
|
|
|
|
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -mfpu=neon" )
|
|
|
|
message(STATUS "Use NEON SIMD instructions")
|
|
|
|
add_definitions(-DUSE_NEON)
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
set(HAS_NEON OFF CACHE BOOL "Architecture does not have NEON SIMD enabled")
|
|
|
|
endif()
|
|
|
|
elseif(ARCHITECTURE_ARM64)
|
|
|
|
# Advanced SIMD (aka NEON) is mandatory for AArch64
|
|
|
|
set(HAS_NEON ON CACHE BOOL "Architecture has NEON SIMD enabled")
|
|
|
|
message(STATUS "Use NEON SIMD instructions")
|
|
|
|
add_definitions(-DUSE_NEON)
|
|
|
|
endif()
|
2017-09-05 02:27:15 -04:00
|
|
|
endif()
|
|
|
|
|
2019-04-15 15:43:48 -04:00
|
|
|
# clear binary test folder
|
|
|
|
FILE(REMOVE_RECURSE ${CMAKE_BINARY_DIR}/tmp)
|
|
|
|
##############################################################################
|
|
|
|
|
2017-09-05 02:27:15 -04:00
|
|
|
# Compiler flags.
|
2018-01-22 02:46:05 -05:00
|
|
|
if (RX_SAMPLE_24BIT)
|
2018-02-08 10:45:00 -05:00
|
|
|
message(STATUS "Compiling for 24 bit Rx DSP chain")
|
2018-01-22 02:46:05 -05:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSDR_RX_SAMPLE_24BIT")
|
2018-02-08 10:45:00 -05:00
|
|
|
else()
|
|
|
|
message(STATUS "Compiling for 16 bit Rx DSP chain")
|
2018-01-21 15:48:36 -05:00
|
|
|
endif()
|
2018-02-08 10:45:00 -05:00
|
|
|
|
2018-02-15 04:53:42 -05:00
|
|
|
if (SANITIZE_ADDRESS)
|
|
|
|
message(STATUS "Activate address sanitization")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
|
|
|
|
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fsanitize=address")
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address")
|
|
|
|
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} -fsanitize=address")
|
|
|
|
endif()
|
|
|
|
|
2018-04-26 16:45:47 -04:00
|
|
|
if (NO_DSP_SIMD)
|
|
|
|
message(STATUS "Not compiling with SIMD instructions for DSP even if available")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNO_DSP_SIMD")
|
|
|
|
else()
|
|
|
|
message(STATUS "Compiling with SIMD instructions for DSP if available")
|
|
|
|
endif()
|
|
|
|
|
2018-12-01 21:06:04 -05:00
|
|
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wvla -Woverloaded-virtual -ffast-math -ftree-vectorize ${EXTRA_FLAGS}")
|
|
|
|
elseif (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W3 -MP ${EXTRA_FLAGS}")
|
|
|
|
endif()
|
2018-03-03 19:47:32 -05:00
|
|
|
|
|
|
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
2018-09-19 19:19:34 -04:00
|
|
|
if (BUILD_DEBIAN)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmax-errors=1")
|
|
|
|
else()
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmax-errors=10")
|
|
|
|
endif()
|
2018-03-03 19:47:32 -05:00
|
|
|
endif()
|
2017-09-05 02:27:15 -04:00
|
|
|
|
2019-04-13 04:30:16 -04:00
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
execute_process(
|
|
|
|
COMMAND git describe --abbrev=8 --always --tags
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
OUTPUT_VARIABLE GIT_COMMIT_HASH
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
)
|
|
|
|
add_definitions("-DGIT_COMMIT_HASH=${GIT_COMMIT_HASH}")
|
|
|
|
|
|
|
|
configure_file(
|
|
|
|
${CMAKE_SOURCE_DIR}/version.h.in
|
|
|
|
${CMAKE_BINARY_DIR}/generated/sdrangel_version.h
|
|
|
|
)
|
|
|
|
|
2017-09-05 02:27:15 -04:00
|
|
|
##############################################################################
|
2017-10-22 13:12:43 -04:00
|
|
|
# base libraries
|
2017-10-22 06:01:04 -04:00
|
|
|
add_subdirectory(sdrbase)
|
2018-12-03 19:39:41 -05:00
|
|
|
if (BUILD_GUI)
|
2017-10-22 13:12:43 -04:00
|
|
|
add_subdirectory(sdrgui)
|
2018-12-03 19:39:41 -05:00
|
|
|
endif()
|
|
|
|
if (BUILD_SERVER)
|
2017-12-17 05:09:51 -05:00
|
|
|
add_subdirectory(sdrsrv)
|
2018-12-03 19:39:41 -05:00
|
|
|
endif()
|
2018-04-23 10:43:18 -04:00
|
|
|
add_subdirectory(sdrbench)
|
2017-11-11 05:11:44 -05:00
|
|
|
add_subdirectory(httpserver)
|
|
|
|
add_subdirectory(logging)
|
2018-02-22 12:43:28 -05:00
|
|
|
add_subdirectory(qrtplib)
|
2017-11-16 21:17:15 -05:00
|
|
|
add_subdirectory(swagger)
|
2014-05-18 11:52:39 -04:00
|
|
|
|
|
|
|
include_directories(
|
2016-10-25 18:57:46 -04:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
2019-04-13 04:30:16 -04:00
|
|
|
${CMAKE_BINARY_DIR}/generated
|
2018-03-09 07:48:14 -05:00
|
|
|
${CMAKE_SOURCE_DIR}/exports
|
2016-10-25 18:57:46 -04:00
|
|
|
${CMAKE_SOURCE_DIR}/sdrbase
|
2017-10-22 13:12:43 -04:00
|
|
|
${CMAKE_SOURCE_DIR}/sdrgui
|
2017-11-11 05:11:44 -05:00
|
|
|
${CMAKE_SOURCE_DIR}/logging
|
2016-10-25 18:57:46 -04:00
|
|
|
${OPENGL_INCLUDE_DIR}
|
2014-05-18 11:52:39 -04:00
|
|
|
)
|
|
|
|
|
2018-02-18 17:01:02 -05:00
|
|
|
##############################################################################
|
|
|
|
# External binary resources
|
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/include/Qt5ExternalResources.cmake)
|
|
|
|
|
|
|
|
qt5_add_external_resources(sdrbase.rcc sdrbase/resources/res.qrc)
|
|
|
|
|
|
|
|
|
2017-12-17 06:08:18 -05:00
|
|
|
##############################################################################
|
|
|
|
# main GUI application
|
2018-12-03 19:39:41 -05:00
|
|
|
if (BUILD_GUI)
|
2017-12-17 06:08:18 -05:00
|
|
|
|
2015-08-29 19:30:43 -04:00
|
|
|
set(sdrangel_SOURCES
|
2016-10-25 18:57:46 -04:00
|
|
|
app/main.cpp
|
2014-05-18 11:52:39 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
if(WIN32)
|
2018-06-09 18:02:51 -04:00
|
|
|
SET(sdrangel_SOURCES ${sdrangel_SOURCES} sdrgui/resources/sdrangel.rc)
|
2014-05-18 11:52:39 -04:00
|
|
|
endif(WIN32)
|
|
|
|
|
2015-08-29 19:30:43 -04:00
|
|
|
add_executable(sdrangel
|
2016-10-25 18:57:46 -04:00
|
|
|
${sdrangel_SOURCES}
|
2014-05-18 11:52:39 -04:00
|
|
|
)
|
|
|
|
|
2015-08-29 19:30:43 -04:00
|
|
|
target_link_libraries(sdrangel
|
2016-10-25 18:57:46 -04:00
|
|
|
sdrbase
|
2017-10-22 13:12:43 -04:00
|
|
|
sdrgui
|
2017-11-11 05:11:44 -05:00
|
|
|
logging
|
2016-10-25 18:57:46 -04:00
|
|
|
${QT_LIBRARIES}
|
|
|
|
${OPENGL_LIBRARIES}
|
2014-05-18 11:52:39 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
if(WIN32)
|
2016-10-25 18:57:46 -04:00
|
|
|
set_target_properties(sdrangel PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:CONSOLE")
|
|
|
|
set_target_properties(sdrangel PROPERTIES COMPILE_DEFINITIONS_DEBUG "_CONSOLE")
|
|
|
|
set_target_properties(sdrangel PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/SUBSYSTEM:CONSOLE")
|
|
|
|
set_target_properties(sdrangel PROPERTIES COMPILE_DEFINITIONS_RELWITHDEBINFO "_CONSOLE")
|
|
|
|
set_target_properties(sdrangel PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")
|
|
|
|
set_target_properties(sdrangel PROPERTIES LINK_FLAGS_MINSIZEREL "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")
|
2014-05-18 11:52:39 -04:00
|
|
|
endif(WIN32)
|
|
|
|
|
2018-06-12 18:20:51 -04:00
|
|
|
target_link_libraries(sdrangel Qt5::Widgets Qt5::Multimedia)
|
2018-12-03 19:39:41 -05:00
|
|
|
endif()
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2017-12-17 06:08:18 -05:00
|
|
|
##############################################################################
|
|
|
|
# main server application
|
2018-12-03 19:39:41 -05:00
|
|
|
if (BUILD_SERVER)
|
2017-12-17 06:08:18 -05:00
|
|
|
|
|
|
|
set(sdrangelsrv_SOURCES
|
|
|
|
appsrv/main.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
add_executable(sdrangelsrv
|
|
|
|
${sdrangelsrv_SOURCES}
|
|
|
|
)
|
|
|
|
|
|
|
|
target_include_directories(sdrangelsrv
|
|
|
|
PUBLIC ${CMAKE_SOURCE_DIR}/sdrsrv
|
|
|
|
)
|
|
|
|
|
|
|
|
target_link_libraries(sdrangelsrv
|
|
|
|
sdrbase
|
|
|
|
sdrsrv
|
|
|
|
logging
|
|
|
|
${QT_LIBRARIES}
|
|
|
|
)
|
|
|
|
|
2018-06-12 18:20:51 -04:00
|
|
|
target_link_libraries(sdrangelsrv Qt5::Multimedia)
|
2018-12-03 19:39:41 -05:00
|
|
|
endif()
|
2017-12-17 06:08:18 -05:00
|
|
|
|
2018-04-23 10:43:18 -04:00
|
|
|
##############################################################################
|
|
|
|
# main benchmark application
|
|
|
|
|
|
|
|
set(sdrangelbench_SOURCES
|
|
|
|
appbench/main.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
add_executable(sdrangelbench
|
|
|
|
${sdrangelbench_SOURCES}
|
|
|
|
)
|
|
|
|
|
|
|
|
target_include_directories(sdrangelbench
|
|
|
|
PUBLIC ${CMAKE_SOURCE_DIR}/sdrbench
|
|
|
|
)
|
|
|
|
|
|
|
|
target_link_libraries(sdrangelbench
|
|
|
|
sdrbench
|
|
|
|
logging
|
|
|
|
${QT_LIBRARIES}
|
|
|
|
)
|
|
|
|
|
2018-04-25 12:01:01 -04:00
|
|
|
target_compile_features(sdrangelbench PRIVATE cxx_generalized_initializers) # cmake >= 3.1.0
|
2018-06-12 18:20:51 -04:00
|
|
|
target_link_libraries(sdrangelbench Qt5::Multimedia)
|
2018-04-23 10:43:18 -04:00
|
|
|
|
2014-05-18 11:52:39 -04:00
|
|
|
##############################################################################
|
|
|
|
|
2016-10-25 18:57:46 -04:00
|
|
|
if (BUILD_DEBIAN)
|
|
|
|
add_subdirectory(cm256cc)
|
|
|
|
add_subdirectory(mbelib)
|
|
|
|
add_subdirectory(serialdv)
|
|
|
|
add_subdirectory(dsdcc)
|
|
|
|
add_subdirectory(libairspy)
|
2018-01-10 20:21:29 -05:00
|
|
|
add_subdirectory(libairspyhf)
|
2016-10-25 18:57:46 -04:00
|
|
|
add_subdirectory(libhackrf)
|
|
|
|
add_subdirectory(librtlsdr)
|
2016-11-02 10:51:45 -04:00
|
|
|
add_subdirectory(libbladerf)
|
2017-05-08 20:47:45 -04:00
|
|
|
add_subdirectory(liblimesuite)
|
2018-02-10 15:50:57 -05:00
|
|
|
add_subdirectory(libmirisdr)
|
|
|
|
add_subdirectory(libperseus)
|
2017-09-11 02:34:33 -04:00
|
|
|
add_subdirectory(libiio)
|
2018-11-30 02:38:22 -05:00
|
|
|
add_subdirectory(libsoapysdr)
|
2016-10-25 18:57:46 -04:00
|
|
|
endif (BUILD_DEBIAN)
|
|
|
|
|
2019-03-04 17:04:27 -05:00
|
|
|
find_package(Codec2)
|
|
|
|
if (CODEC2_FOUND)
|
|
|
|
add_subdirectory(libfreedv)
|
|
|
|
endif(CODEC2_FOUND)
|
|
|
|
|
2016-12-30 10:13:28 -05:00
|
|
|
add_subdirectory(devices)
|
2018-12-03 19:39:41 -05:00
|
|
|
if (BUILD_GUI)
|
2014-05-18 11:52:39 -04:00
|
|
|
add_subdirectory(plugins)
|
2018-12-03 19:39:41 -05:00
|
|
|
endif()
|
|
|
|
if (BUILD_SERVER)
|
2017-12-17 04:25:08 -05:00
|
|
|
add_subdirectory(pluginssrv)
|
2018-12-03 19:39:41 -05:00
|
|
|
endif()
|
2016-02-17 13:42:26 -05:00
|
|
|
|
|
|
|
if(LIBUSB_FOUND AND UNIX)
|
2016-10-25 18:57:46 -04:00
|
|
|
add_subdirectory(fcdhid)
|
|
|
|
add_subdirectory(fcdlib)
|
2016-02-17 13:42:26 -05:00
|
|
|
endif(LIBUSB_FOUND AND UNIX)
|
2016-02-24 05:51:36 -05:00
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
#install targets
|
2018-12-03 19:39:41 -05:00
|
|
|
if (BUILD_GUI)
|
2016-02-24 05:51:36 -05:00
|
|
|
install(TARGETS sdrangel DESTINATION bin)
|
2018-12-03 19:39:41 -05:00
|
|
|
endif()
|
|
|
|
if (BUILD_SERVER)
|
2017-12-17 06:08:18 -05:00
|
|
|
install(TARGETS sdrangelsrv DESTINATION bin)
|
2018-12-03 19:39:41 -05:00
|
|
|
endif()
|
2018-04-23 10:43:18 -04:00
|
|
|
install(TARGETS sdrangelbench DESTINATION bin)
|
2017-10-22 06:01:04 -04:00
|
|
|
#install(TARGETS sdrbase DESTINATION lib)
|
2016-02-24 05:51:36 -05:00
|
|
|
|
2017-11-29 13:26:09 -05:00
|
|
|
#install files and directories
|
2019-04-16 08:52:08 -04:00
|
|
|
if (CMAKE_SYSTEM_NAME EQUAL "Linux")
|
2017-11-29 13:26:09 -05:00
|
|
|
install(DIRECTORY udev-rules DESTINATION share/sdrangel)
|
2018-12-03 20:06:21 -05:00
|
|
|
install(FILES udev-rules/install.sh DESTINATION share/sdrangel/udev-rules PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
2018-02-18 17:01:02 -05:00
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/sdrbase.rcc DESTINATION bin)
|
2018-12-03 20:06:21 -05:00
|
|
|
install(FILES desktop/sdrangel.desktop DESTINATION share/applications)
|
|
|
|
install(FILES desktop/sdrangel_icon.png DESTINATION share/pixmaps)
|
2019-04-16 08:52:08 -04:00
|
|
|
endif()
|
2017-11-29 13:26:09 -05:00
|
|
|
|
2016-02-24 05:51:36 -05:00
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
# uninstall target
|
|
|
|
configure_file(
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
|
|
|
IMMEDIATE @ONLY)
|
|
|
|
|
|
|
|
add_custom_target(uninstall
|
|
|
|
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
|