1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 17:28:50 -05:00

cmake: windows fixes for MSVC

- disable sdrangelbench on windows with MSVC
- fix cpu flags test code for MSVC
- add ico file
This commit is contained in:
Davide Gerhard 2019-05-24 08:32:40 +02:00
parent 92129089a5
commit 6e80780d17
No known key found for this signature in database
GPG Key ID: 7CBEFA144857DC97
21 changed files with 395 additions and 155 deletions

View File

@ -1,5 +1,11 @@
cmake_minimum_required(VERSION 3.1.0) cmake_minimum_required(VERSION 3.1.0)
# force 64bit on windows because we have only that library
# TODO discuss because, at this days, a dsp software should be 64bit
if(WIN32 AND NOT CMAKE_GENERATOR_PLATFORM AND NOT CMAKE_C_COMPILER AND NOT CMAKE_CXX_COMPILER)
set(CMAKE_GENERATOR_PLATFORM "x64" CACHE INTERNAL "")
endif()
project(sdrangel) project(sdrangel)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
@ -92,10 +98,7 @@ set(CPACK_SOURCE_IGNORE_FILES "${PROJECT_BINARY_DIR};/.git/;.gitignore;menu.yml;
set(CPACK_SOURCE_GENERATOR "ZIP;TGZ") set(CPACK_SOURCE_GENERATOR "ZIP;TGZ")
# if we don't set build_type # if we don't set build_type
if(NOT DEFINED CMAKE_BUILD_TYPE OR if(NOT DEFINED CMAKE_BUILD_TYPE OR "${CMAKE_BUILD_TYPE}" STREQUAL "")
"${CMAKE_BUILD_TYPE}" STREQUAL "" OR
"${CMAKE_BUILD_TYPE}" STREQUAL "MacPorts" OR
"${CMAKE_BUILD_TYPE}" STREQUAL "None")
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE) set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
endif() endif()
message(STATUS "Build type set to: ${CMAKE_BUILD_TYPE}") message(STATUS "Build type set to: ${CMAKE_BUILD_TYPE}")
@ -106,14 +109,26 @@ if(NOT DEBUG_OUTPUT)
endif() endif()
# declare build structures # declare build structures
# !! change sdrbase/plugin/pluginmanager.cpp too !! # !! change sdrbase/plugins/pluginmanager.cpp too !!
set(SDRANGEL_BINARY_BIN_DIR "${CMAKE_BINARY_DIR}/bin")
set(SDRANGEL_BINARY_LIB_DIR "${CMAKE_BINARY_DIR}/lib")
if(WIN32) if(WIN32)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${SDRANGEL_BINARY_BIN_DIR}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
else() else()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
endif() endif()
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${SDRANGEL_BINARY_LIB_DIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${SDRANGEL_BINARY_LIB_DIR}")
if(WIN32)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
set(BUILD_PLUGINS_RUNTIME_DIR "${SDRANGEL_BINARY_BIN_DIR}/plugins")
set(BUILD_PLUGINSSRV_RUNTIME_DIR "${SDRANGEL_BINARY_BIN_DIR}/pluginssrv")
endif()
set(BUILD_PLUGINS_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/plugins") set(BUILD_PLUGINS_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/plugins")
set(BUILD_PLUGINSSRV_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/pluginssrv") set(BUILD_PLUGINSSRV_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/pluginssrv")
# use only lib when create .app/.dmg # use only lib when create .app/.dmg
@ -159,15 +174,53 @@ elseif(APPLE)
configure_file("${CMAKE_SOURCE_DIR}/cmake/cpack/MacOSXBundleInfo.plist.in" configure_file("${CMAKE_SOURCE_DIR}/cmake/cpack/MacOSXBundleInfo.plist.in"
"${CMAKE_BINARY_DIR}/Info.plist" @ONLY) "${CMAKE_BINARY_DIR}/Info.plist" @ONLY)
elseif (WIN32) elseif (WIN32)
# check compiler version
if(MSVC_VERSION GREATER 1919 AND MSVC_VERSION LESS 1910)
message(FATAL_ERROR "You must use Microsoft Visual Studio 2017 as compiler, aka MSVC 14.1")
endif()
# used on code but not defined on VS2017
add_definitions(-D__WINDOWS__)
# compile with full multicore
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} /MP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
# find Qt folder
include(QtLocator)
# in alternative we can use ExternalProject
set(EXTERNAL_LIBRARY_FOLDER "${CMAKE_SOURCE_DIR}/external/windows") set(EXTERNAL_LIBRARY_FOLDER "${CMAKE_SOURCE_DIR}/external/windows")
set(BOOST_ROOT "${EXTERNAL_LIBRARY_FOLDER}/boost" CACHE INTERNAL "") set(BOOST_ROOT "${EXTERNAL_LIBRARY_FOLDER}/boost" CACHE INTERNAL "")
set(FFTW3F_FOUND ON CACHE INTERNAL "") set(FFTW3F_FOUND ON CACHE INTERNAL "")
set(FFTW3F_INCLUDE_DIRS "${EXTERNAL_LIBRARY_FOLDER}/fftw-3/include" CACHE INTERNAL "") set(FFTW3F_INCLUDE_DIRS "${EXTERNAL_LIBRARY_FOLDER}/fftw-3/include" CACHE INTERNAL "")
set(FFTW3F_LIBRARIES "${EXTERNAL_LIBRARY_FOLDER}/fftw-3/libfftw3f-3.dll" CACHE INTERNAL "") set(FFTW3F_LIBRARIES "${EXTERNAL_LIBRARY_FOLDER}/fftw-3/libfftw3f-3.lib" CACHE INTERNAL "")
set(LIBUSB_INCLUDE_DIR "${EXTERNAL_LIBRARY_FOLDER}/libusb/include" CACHE INTERNAL "") set(LIBUSB_INCLUDE_DIR "${EXTERNAL_LIBRARY_FOLDER}/libusb/include" CACHE INTERNAL "")
set(LIBUSB_LIBRARIES "${EXTERNAL_LIBRARY_FOLDER}/libusb/libusb-1.0.x64.dll" CACHE INTERNAL "") set(LIBUSB_LIBRARIES "${EXTERNAL_LIBRARY_FOLDER}/libusb/MS64/dll/libusb-1.0.lib" CACHE INTERNAL "")
set(OpenCV_DIR "${EXTERNAL_LIBRARY_FOLDER}/opencv" CACHE INTERNAL "") set(OpenCV_DIR "${EXTERNAL_LIBRARY_FOLDER}/opencv" CACHE INTERNAL "")
set(PKG_CONFIG_EXECUTABLE "${EXTERNAL_LIBRARY_FOLDER}/pkg-config-lite/bin/pkg-config.exe" CACHE INTERNAL "") set(PKG_CONFIG_EXECUTABLE "${EXTERNAL_LIBRARY_FOLDER}/pkg-config-lite/bin/pkg-config.exe" CACHE INTERNAL "")
# ffmpeg
set(FFMPEG_INCLUDE_DIRS "${EXTERNAL_LIBRARY_FOLDER}/ffmpeg/include" CACHE INTERNAL "")
#set(FFMPEG_LIBRARIES)
set(AVCODEC_INCLUDE_DIRS "${EXTERNAL_LIBRARY_FOLDER}/ffmpeg/include" CACHE INTERNAL "")
set(AVCODEC_LIBRARIES "${EXTERNAL_LIBRARY_FOLDER}/ffmpeg/lib/avcodec.lib" CACHE INTERNAL "")
set(AVFORMAT_INCLUDE_DIRS "${EXTERNAL_LIBRARY_FOLDER}/ffmpeg/include" CACHE INTERNAL "")
set(AVFORMAT_LIBRARIES "${EXTERNAL_LIBRARY_FOLDER}/ffmpeg/lib/avformat.lib" CACHE INTERNAL "")
set(AVUTIL_INCLUDE_DIRS "${EXTERNAL_LIBRARY_FOLDER}/ffmpeg/include" CACHE INTERNAL "")
set(AVUTIL_LIBRARIES "${EXTERNAL_LIBRARY_FOLDER}/ffmpeg/lib/avutil.lib" CACHE INTERNAL "")
set(SWRESAMPLE_INCLUDE_DIRS "${EXTERNAL_LIBRARY_FOLDER}/ffmpeg/include" CACHE INTERNAL "")
set(SWRESAMPLE_LIBRARIES "${EXTERNAL_LIBRARY_FOLDER}/ffmpeg/lib/swresample.lib" CACHE INTERNAL "")
set(SWSCALE_INCLUDE_DIRS "${EXTERNAL_LIBRARY_FOLDER}/ffmpeg/include" CACHE INTERNAL "")
set(SWSCALE_LIBRARIES "${EXTERNAL_LIBRARY_FOLDER}/ffmpeg/lib/swscale.lib" CACHE INTERNAL "")
# used on fixup_bundle phase
set(WINDOWS_FIXUP_BUNDLE_LIB_DIRS
"${Qt5_DIR}/../../../bin"
"${EXTERNAL_LIBRARY_FOLDER}/fftw-3"
"${EXTERNAL_LIBRARY_FOLDER}/libusb/MS64/dll"
"${EXTERNAL_LIBRARY_FOLDER}/ffmpeg/bin"
)
endif() endif()
# TODO: check if(DEFINED) and fix macports -D # TODO: check if(DEFINED) and fix macports -D
@ -246,7 +299,22 @@ find_package(PkgConfig REQUIRED)
find_package(Boost REQUIRED) find_package(Boost REQUIRED)
find_package(FFTW3F REQUIRED) find_package(FFTW3F REQUIRED)
find_package(LibUSB REQUIRED) # used by so many packages find_package(LibUSB REQUIRED) # used by so many packages
find_package(OpenCV) # channeltx/modatv find_package(OpenCV REQUIRED core highgui imgproc) # channeltx/modatv
# unfortunately OpenCV library from windows doesn't set the cache option
if(WIN32)
set(OpenCV_INCLUDE_DIRS "${OpenCV_INCLUDE_DIRS}" CACHE INTERNAL "")
set(OpenCV_LIBS "${OpenCV_LIBS}" CACHE INTERNAL "")
# add libs folder for fixup_bundle()
get_filename_component(GFN_Boost_LIBS_DIR Boost_LIBS DIRECTORY)
get_filename_component(GFN_OpenCV_LIBS_DIR OpenCV_LIBS DIRECTORY)
set(WINDOWS_FIXUP_BUNDLE_LIB_DIRS
"${WINDOWS_FIXUP_BUNDLE_LIB_DIRS}"
"${GFN_Boost_LIBS_DIR}"
"${GFN_OpenCV_LIBS_DIR}"
)
endif()
# macOS compatibility # macOS compatibility
if(APPLE) if(APPLE)
@ -310,13 +378,19 @@ endif()
# base libraries # base libraries
add_subdirectory(sdrbase) add_subdirectory(sdrbase)
add_subdirectory(sdrbench)
add_subdirectory(httpserver) add_subdirectory(httpserver)
add_subdirectory(logging) add_subdirectory(logging)
add_subdirectory(qrtplib) add_subdirectory(qrtplib)
add_subdirectory(swagger) add_subdirectory(swagger)
add_subdirectory(devices) add_subdirectory(devices)
# strange symbol dependency
# mainbench.obj : error LNK2001: unresolved external
# symbol "public: static float const decimation_scale<12>::scaleIn" (?scaleIn@?$decimation_scale@$0M@@@2MB)
if(NOT WIN32)
add_subdirectory(sdrbench)
endif()
if (BUILD_GUI) if (BUILD_GUI)
add_subdirectory(sdrgui) add_subdirectory(sdrgui)
add_subdirectory(plugins plugins) add_subdirectory(plugins plugins)
@ -343,20 +417,21 @@ include_directories(
) )
############ build sdrangel benchmark ################ ############ build sdrangel benchmark ################
set(sdrangelbench_SOURCES if(NOT WIN32)
set(sdrangelbench_SOURCES
appbench/main.cpp appbench/main.cpp
) )
add_executable(sdrangelbench add_executable(sdrangelbench
${sdrangelbench_SOURCES} ${sdrangelbench_SOURCES}
) )
target_link_libraries(sdrangelbench target_link_libraries(sdrangelbench
Qt5::Multimedia Qt5::Multimedia
sdrbench sdrbench
logging logging
) )
endif()
############ build sdrangel gui ################ ############ build sdrangel gui ################
if (BUILD_GUI) if (BUILD_GUI)
set(sdrangel_SOURCES set(sdrangel_SOURCES
@ -397,7 +472,9 @@ if (BUILD_SERVER)
endif() endif()
############ install ################## ############ install ##################
install(TARGETS sdrangelbench DESTINATION ${INSTALL_BIN_DIR}) if(NOT WIN32)
install(TARGETS sdrangelbench DESTINATION ${INSTALL_BIN_DIR})
endif()
if (BUILD_GUI) if (BUILD_GUI)
install(TARGETS ${CMAKE_PROJECT_NAME} DESTINATION ${INSTALL_BIN_DIR}) install(TARGETS ${CMAKE_PROJECT_NAME} DESTINATION ${INSTALL_BIN_DIR})
endif() endif()

View File

@ -74,9 +74,11 @@ if (${ARCHITECTURE} MATCHES "x86_64|x86" AND (FORCE_SSSE3 OR FORCE_SSE41))
add_definitions(-DUSE_SSSE3) add_definitions(-DUSE_SSSE3)
add_definitions(-DUSE_SSE4_1) add_definitions(-DUSE_SSE4_1)
elseif(C_MSVC) elseif(C_MSVC)
# seems that from MSVC 2015 comiler doesn't support those flags
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE4_1" ) 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_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" ) set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
message(STATUS "Use SSE 4.1 SIMD instructions")
add_definitions (/D "_CRT_SECURE_NO_WARNINGS") add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
add_definitions(-DUSE_SSSE3) add_definitions(-DUSE_SSSE3)
add_definitions(-DUSE_SSE4_1) add_definitions(-DUSE_SSE4_1)
@ -84,12 +86,16 @@ if (${ARCHITECTURE} MATCHES "x86_64|x86" AND (FORCE_SSSE3 OR FORCE_SSE41))
endif() endif()
else () else ()
if (${ARCHITECTURE} MATCHES "x86_64|x86") 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(C_MSVC)
try_run(RUN_SSE2 COMPILE_SSE2 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_sse2.cxx" COMPILE_DEFINITIONS /O0)
else()
try_run(RUN_SSE2 COMPILE_SSE2 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_sse2.cxx" COMPILE_DEFINITIONS -msse2 -O0)
endif()
if(COMPILE_SSE2 AND RUN_SSE2 EQUAL 0) if(COMPILE_SSE2 AND RUN_SSE2 EQUAL 0)
set(HAS_SSE2 ON CACHE BOOL "Architecture has SSSE2 SIMD enabled") set(HAS_SSE2 ON CACHE BOOL "Architecture has SSSE2 SIMD enabled")
message(STATUS "Use SSE2 SIMD instructions")
if(C_GCC OR C_CLANG) if(C_GCC OR C_CLANG)
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2" )
message(STATUS "Use SSE2 SIMD instructions")
add_definitions(-DUSE_SSE2) add_definitions(-DUSE_SSE2)
elseif(C_MSVC) elseif(C_MSVC)
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE2" ) set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE2" )
@ -101,35 +107,46 @@ if (${ARCHITECTURE} MATCHES "x86_64|x86")
else() else()
set(HAS_SSE2 OFF CACHE BOOL "Architecture does not have SSSE2 SIMD enabled") set(HAS_SSE2 OFF CACHE BOOL "Architecture does not have SSSE2 SIMD enabled")
endif() endif()
try_run(RUN_SSSE3 COMPILE_SSSE3 ${CMAKE_BINARY_DIR}/tmp ${TEST_DIR}/test_x86_ssse3.cxx COMPILE_DEFINITIONS -mssse3 -O0) if(C_MSVC)
try_run(RUN_SSSE3 COMPILE_SSSE3 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_ssse3.cxx" COMPILE_DEFINITIONS /O0)
else()
try_run(RUN_SSSE3 COMPILE_SSSE3 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_ssse3.cxx" COMPILE_DEFINITIONS -mssse3 -O0)
endif()
if(COMPILE_SSSE3 AND RUN_SSSE3 EQUAL 0) if(COMPILE_SSSE3 AND RUN_SSSE3 EQUAL 0)
set(HAS_SSSE3 ON CACHE BOOL "Architecture has SSSE3 SIMD enabled") set(HAS_SSSE3 ON CACHE BOOL "Architecture has SSSE3 SIMD enabled")
message(STATUS "Use SSSE3 SIMD instructions")
if(C_GCC OR C_CLANG) if(C_GCC OR C_CLANG)
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mssse3" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mssse3" )
message(STATUS "Use SSSE3 SIMD instructions")
add_definitions(-DUSE_SSSE3) add_definitions(-DUSE_SSSE3)
elseif(C_MSVC) elseif(C_MSVC)
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSSE3" ) # seems not present on MSVC 2017
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSSE3" ) #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_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" ) 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 (/D "_CRT_SECURE_NO_WARNINGS")
add_definitions(-DUSE_SSSE3) add_definitions(-DUSE_SSSE3)
endif() endif()
else() else()
set(HAS_SSSE3 OFF CACHE BOOL "Architecture does not have SSSE3 SIMD enabled") set(HAS_SSSE3 OFF CACHE BOOL "Architecture does not have SSSE3 SIMD enabled")
endif() endif()
try_run(RUN_SSE4_1 COMPILE_SSE4_1 ${CMAKE_BINARY_DIR}/tmp ${TEST_DIR}/test_x86_sse41.cxx COMPILE_DEFINITIONS -msse4.1 -O0) if(C_MSVC)
try_run(RUN_SSE4_1 COMPILE_SSE4_1 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_sse41.cxx" COMPILE_DEFINITIONS /O0)
else()
try_run(RUN_SSE4_1 COMPILE_SSE4_1 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_sse41.cxx" COMPILE_DEFINITIONS -msse4.1 -O0)
endif()
if(COMPILE_SSE4_1 AND RUN_SSE4_1 EQUAL 0) if(COMPILE_SSE4_1 AND RUN_SSE4_1 EQUAL 0)
set(HAS_SSE4_1 ON CACHE BOOL "Architecture has SSE 4.1 SIMD enabled") set(HAS_SSE4_1 ON CACHE BOOL "Architecture has SSE 4.1 SIMD enabled")
message(STATUS "Use SSE 4.1 SIMD instructions")
if(C_GCC OR C_CLANG) if(C_GCC OR C_CLANG)
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -msse4.1" ) set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -msse4.1" )
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -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) add_definitions(-DUSE_SSE4_1)
elseif(C_MSVC) elseif(C_MSVC)
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE4_1" ) # seems not present on MSVC 2017
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSE4_1" ) #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_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" ) set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
add_definitions (/D "_CRT_SECURE_NO_WARNINGS") add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
add_definitions(-DUSE_SSE4_1) add_definitions(-DUSE_SSE4_1)
@ -137,17 +154,23 @@ if (${ARCHITECTURE} MATCHES "x86_64|x86")
else() else()
set(HAS_SSE4_1 OFF CACHE BOOL "Architecture does not have SSE 4.1 SIMD enabled") set(HAS_SSE4_1 OFF CACHE BOOL "Architecture does not have SSE 4.1 SIMD enabled")
endif() endif()
try_run(RUN_SSE4_2 COMPILE_SSE4_2 ${CMAKE_BINARY_DIR}/tmp ${TEST_DIR}/test_x86_sse42.cxx COMPILE_DEFINITIONS -msse4.2 -O0) if(C_MSVC)
try_run(RUN_SSE4_2 COMPILE_SSE4_2 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_sse42.cxx" COMPILE_DEFINITIONS /O0)
else()
try_run(RUN_SSE4_2 COMPILE_SSE4_2 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_sse42.cxx" COMPILE_DEFINITIONS -msse4.2 -O0)
endif()
if(COMPILE_SSE4_2 AND RUN_SSE4_2 EQUAL 0) if(COMPILE_SSE4_2 AND RUN_SSE4_2 EQUAL 0)
set(HAS_SSE4_2 ON CACHE BOOL "Architecture has SSE 4.2 SIMD enabled") set(HAS_SSE4_2 ON CACHE BOOL "Architecture has SSE 4.2 SIMD enabled")
message(STATUS "Use SSE 4.2 SIMD instructions")
if(C_GCC OR C_CLANG) if(C_GCC OR C_CLANG)
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -msse4.2" ) set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -msse4.2" )
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -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) add_definitions(-DUSE_SSE4_2)
elseif(C_MSVC) elseif(C_MSVC)
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE4_2" ) # seems not present on MSVC 2017
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSE4_2" ) #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_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" ) set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
add_definitions (/D "_CRT_SECURE_NO_WARNINGS") add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
add_definitions(-DUSE_SSE4_2) add_definitions(-DUSE_SSE4_2)
@ -155,50 +178,84 @@ if (${ARCHITECTURE} MATCHES "x86_64|x86")
else() else()
set(HAS_SSE4_2 OFF CACHE BOOL "Architecture does not have SSE 4.2 SIMD enabled") set(HAS_SSE4_2 OFF CACHE BOOL "Architecture does not have SSE 4.2 SIMD enabled")
endif() endif()
try_run(RUN_AVX COMPILE_AVX ${CMAKE_BINARY_DIR}/tmp ${TEST_DIR}/test_x86_avx.cxx COMPILE_DEFINITIONS -mavx -O0) if(C_MSVC)
try_run(RUN_AVX COMPILE_AVX "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_avx.cxx" COMPILE_DEFINITIONS /O0)
else()
try_run(RUN_AVX COMPILE_AVX "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_avx.cxx" COMPILE_DEFINITIONS -mavx -O0)
endif()
if(COMPILE_AVX AND RUN_AVX EQUAL 0) if(COMPILE_AVX AND RUN_AVX EQUAL 0)
set(HAS_AVX ON CACHE BOOL "Architecture has AVX SIMD enabled") set(HAS_AVX ON CACHE BOOL "Architecture has AVX SIMD enabled")
message(STATUS "Use AVX SIMD instructions")
if(C_GCC OR C_CLANG) if(C_GCC OR C_CLANG)
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mavx" ) set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mavx" )
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -mavx" ) set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -mavx" )
message(STATUS "Use AVX SIMD instructions") add_definitions(-DUSE_AVX)
elseif(C_MSVC)
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:AVX" )
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:AVX" )
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
add_definitions(-DUSE_AVX) add_definitions(-DUSE_AVX)
endif() endif()
else() else()
set(HAS_AVX OFF CACHE BOOL "Architecture does not have AVX SIMD enabled") set(HAS_AVX OFF CACHE BOOL "Architecture does not have AVX SIMD enabled")
endif() endif()
try_run(RUN_AVX2 COMPILE_AVX2 ${CMAKE_BINARY_DIR}/tmp ${TEST_DIR}/test_x86_avx2.cxx COMPILE_DEFINITIONS -mavx2 -O0) if(C_MSVC)
try_run(RUN_AVX2 COMPILE_AVX2 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_avx2.cxx" COMPILE_DEFINITIONS /O0)
else()
try_run(RUN_AVX2 COMPILE_AVX2 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_avx2.cxx" COMPILE_DEFINITIONS -mavx2 -O0)
endif()
if(COMPILE_AVX2 AND RUN_AVX2 EQUAL 0) if(COMPILE_AVX2 AND RUN_AVX2 EQUAL 0)
set(HAS_AVX2 ON CACHE BOOL "Architecture has AVX2 SIMD enabled") set(HAS_AVX2 ON CACHE BOOL "Architecture has AVX2 SIMD enabled")
message(STATUS "Use AVX2 SIMD instructions")
if(C_GCC OR C_CLANG) if(C_GCC OR C_CLANG)
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mavx2" ) set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mavx2" )
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -mavx2" ) set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -mavx2" )
message(STATUS "Use AVX2 SIMD instructions") add_definitions(-DUSE_AVX2)
elseif(C_MSVC)
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:AVX2" )
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:AVX2" )
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
add_definitions(-DUSE_AVX2) add_definitions(-DUSE_AVX2)
endif() endif()
else() else()
set(HAS_AVX2 OFF CACHE BOOL "Architecture does not have AVX2 SIMD enabled") set(HAS_AVX2 OFF CACHE BOOL "Architecture does not have AVX2 SIMD enabled")
endif() endif()
try_run(RUN_AVX512 COMPILE_AVX512 ${CMAKE_BINARY_DIR}/tmp ${TEST_DIR}/test_x86_avx512.cxx COMPILE_DEFINITIONS -mavx512f -O0) if(C_MSVC)
try_run(RUN_AVX512 COMPILE_AVX512 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_avx512.cxx" COMPILE_DEFINITIONS /O0)
else()
try_run(RUN_AVX512 COMPILE_AVX512 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_avx512.cxx" COMPILE_DEFINITIONS -mavx512f -O0)
endif()
if(COMPILE_AVX512 AND RUN_AVX512 EQUAL 0) if(COMPILE_AVX512 AND RUN_AVX512 EQUAL 0)
set(HAS_AVX512 ON CACHE BOOL "Architecture has AVX512 SIMD enabled") set(HAS_AVX512 ON CACHE BOOL "Architecture has AVX512 SIMD enabled")
message(STATUS "Use AVX512 SIMD instructions")
if(C_GCC OR C_CLANG) if(C_GCC OR C_CLANG)
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mavx512f" ) set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mavx512f" )
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -mavx512f" ) set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -mavx512f" )
message(STATUS "Use AVX512 SIMD instructions") add_definitions(-DUSE_AVX512)
elseif(C_MSVC)
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:AVX512" )
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:AVX512" )
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
add_definitions(-DUSE_AVX512) add_definitions(-DUSE_AVX512)
endif() endif()
else() else()
set(HAS_AVX512 OFF CACHE BOOL "Architecture does not have AVX512 SIMD enabled") set(HAS_AVX512 OFF CACHE BOOL "Architecture does not have AVX512 SIMD enabled")
endif() endif()
elseif(ARCHITECTURE_ARM) 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(C_MSVC)
try_run(RUN_NEON COMPILE_NEON "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_arm_neon.cxx" COMPILE_DEFINITIONS /O0)
else()
try_run(RUN_NEON COMPILE_NEON "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_arm_neon.cxx" COMPILE_DEFINITIONS -mfpu=neon -O0)
endif()
if(COMPILE_NEON AND RUN_NEON EQUAL 0) if(COMPILE_NEON AND RUN_NEON EQUAL 0)
set(HAS_NEON ON CACHE BOOL "Architecture has NEON SIMD enabled") set(HAS_NEON ON CACHE BOOL "Architecture has NEON SIMD enabled")
message(STATUS "Use NEON SIMD instructions")
if(C_GCC OR C_CLANG) if(C_GCC OR C_CLANG)
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mfpu=neon" ) set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mfpu=neon" )
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -mfpu=neon" ) set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -mfpu=neon" )
message(STATUS "Use NEON SIMD instructions")
add_definitions(-DUSE_NEON) add_definitions(-DUSE_NEON)
endif() endif()
else() else()

View File

@ -0,0 +1,41 @@
SET(QT_MISSING True)
# msvc only; mingw will need different logic
IF(MSVC)
# look for user-registry pointing to qtcreator
GET_FILENAME_COMPONENT(QT_BIN [HKEY_CURRENT_USER\\Software\\Classes\\Applications\\QtProject.QtCreator.cpp\\shell\\Open\\Command] PATH)
# get root path so we can search for 5.3, 5.4, 5.5, etc
STRING(REPLACE "/Tools" ";" QT_BIN "${QT_BIN}")
LIST(GET QT_BIN 0 QT_BIN)
FILE(GLOB QT_VERSIONS "${QT_BIN}/5.*")
LIST(SORT QT_VERSIONS)
# assume the latest version will be last alphabetically
LIST(REVERSE QT_VERSIONS)
LIST(GET QT_VERSIONS 0 QT_VERSION)
# fix any double slashes which seem to be common
STRING(REPLACE "//" "/" QT_VERSION "${QT_VERSION}")
# do some math trickery to guess folder
# - qt uses (e.g.) "msvc2012"
# - cmake uses (e.g.) "1800"
# - see also https://cmake.org/cmake/help/v3.0/variable/MSVC_VERSION.html
MATH(EXPR QT_MSVC "2000 + (${MSVC_VERSION} - 200) / 100")
# check for 64-bit os
# may need to be removed for older compilers as it wasn't always offered
IF(CMAKE_SYSTEM_PROCESSOR MATCHES 64)
SET(QT_MSVC "${QT_MSVC}_64")
ENDIF()
SET(QT_PATH "${QT_VERSION}/msvc${QT_MSVC}")
SET(QT_MISSING False)
ENDIF()
# use Qt_DIR approach so you can find Qt after cmake has been invoked
IF(NOT QT_MISSING)
MESSAGE("-- Qt found: ${QT_PATH}")
SET(Qt5_DIR "${QT_PATH}/lib/cmake/Qt5/")
SET(Qt5Test_DIR "${QT_PATH}/lib/cmake/Qt5Test")
ENDIF()

View File

@ -171,15 +171,44 @@ elseif(LINUX AND BUNDLE)
set (CPACK_RPM_PACKAGE_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR}) set (CPACK_RPM_PACKAGE_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
endif (RPMBUILDER) endif (RPMBUILDER)
elseif((WIN32 OR MINGW) AND BUNDLE) elseif(WIN32 OR MINGW)
#set(CMAKE_INSTALL_UCRT_LIBRARIES TRUE) # Copy Qt Plugins; fixup_bundle doesn't do that
install (
DIRECTORY
"${QT_PLUGINS_DIR}/platforms"
"${QT_PLUGINS_DIR}/audio"
"${QT_PLUGINS_DIR}/accessible"
"${QT_PLUGINS_DIR}/imageformats"
"${QT_PLUGINS_DIR}/mediaservice"
"${QT_PLUGINS_DIR}/playlistformats"
"${QT_PLUGINS_DIR}/styles"
"${QT_PLUGINS_DIR}/iconengines"
DESTINATION "${SDRANGEL_BINARY_BIN_DIR}"
CONFIGURATIONS Release MinSizeRel
COMPONENT runtime
FILES_MATCHING PATTERN "*${CMAKE_SHARED_LIBRARY_SUFFIX}"
PATTERN "*minimal*${CMAKE_SHARED_LIBRARY_SUFFIX}" EXCLUDE
PATTERN "*offscreen*${CMAKE_SHARED_LIBRARY_SUFFIX}" EXCLUDE
PATTERN "*quick*${CMAKE_SHARED_LIBRARY_SUFFIX}" EXCLUDE
PATTERN "*_debug${CMAKE_SHARED_LIBRARY_SUFFIX}" EXCLUDE
)
list(APPEND CPACK_GENERATOR "NSIS") install(CODE "
include(BundleUtilities)
fixup_bundle("${SDRANGEL_BINARY_BIN_DIR}" "" "${WINDOWS_FIXUP_BUNDLE_LIB_DIRS}")
" COMPONENT Runtime)
if(BUNDLE)
set(CMAKE_INSTALL_UCRT_LIBRARIES TRUE)
list(APPEND CPACK_GENERATOR "ZIP;NSIS")
set(CPACK_NSIS_PACKAGE_NAME "${APPLICATION_NAME}") set(CPACK_NSIS_PACKAGE_NAME "${APPLICATION_NAME}")
set(CPACK_NSIS_CONTACT "${APPLICATION_MAINTAINER}") set(CPACK_NSIS_CONTACT "${APPLICATION_MAINTAINER}")
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON) set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
set(CPACK_NSIS_MODIFY_PATH ON) set(CPACK_NSIS_MODIFY_PATH ON)
endif()
endif(APPLE AND BUNDLE AND BUILD_GUI) endif(APPLE AND BUNDLE AND BUILD_GUI)

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

View File

@ -1,5 +1,5 @@
#include <arm_neon.h>
#include <stdint.h> #include <stdint.h>
#include <arm_neon.h>
#include <stdlib.h> #include <stdlib.h>
#include <signal.h> #include <signal.h>

View File

@ -1,4 +1,5 @@
#include <signal.h> #include <signal.h>
#include <stdlib.h>
#include <immintrin.h> #include <immintrin.h>
void signalHandler(int signum) { void signalHandler(int signum) {

View File

@ -1,4 +1,5 @@
#include <signal.h> #include <signal.h>
#include <stdlib.h>
#include <immintrin.h> #include <immintrin.h>
void signalHandler(int signum) { void signalHandler(int signum) {

View File

@ -1,4 +1,5 @@
#include <stdint.h> #include <stdint.h>
#include <stdlib.h>
#include <signal.h> #include <signal.h>
#include <immintrin.h> #include <immintrin.h>

View File

@ -1,4 +1,5 @@
#include <signal.h> #include <signal.h>
#include <stdlib.h>
#include <emmintrin.h> #include <emmintrin.h>
void signalHandler(int signum) { void signalHandler(int signum) {

View File

@ -1,4 +1,5 @@
#include <signal.h> #include <signal.h>
#include <stdlib.h>
#include <emmintrin.h> #include <emmintrin.h>
#include <pmmintrin.h> #include <pmmintrin.h>

View File

@ -1,4 +1,5 @@
#include <signal.h> #include <signal.h>
#include <stdlib.h>
#include <emmintrin.h> #include <emmintrin.h>
#include <smmintrin.h> #include <smmintrin.h>

View File

@ -1,4 +1,5 @@
#include <signal.h> #include <signal.h>
#include <stdlib.h>
#include <nmmintrin.h> #include <nmmintrin.h>
void signalHandler(int signum) { void signalHandler(int signum) {

View File

@ -1,4 +1,5 @@
#include <signal.h> #include <signal.h>
#include <stdlib.h>
#include <emmintrin.h> #include <emmintrin.h>
#include <tmmintrin.h> #include <tmmintrin.h>

View File

@ -7,91 +7,158 @@
# other viable solution is to use execute_process() during config # other viable solution is to use execute_process() during config
# but make the configuration dirty # but make the configuration dirty
# which version/tag/checkout to use
set(CODEC2_TAG 7a0187da3ffb06fd90c081216b50bab94d02d046)
set(CM256CC_TAG 19f023d9d6c6f1a2e7dc5bcf466a1424c7918de4)
set(MBELIB_TAG "debian/1.3.0")
set(SERIALDV_TAG abd65a0fc2d5339808194862d14119b0cba70424)
set(DSDCC_TAG 2d60d60f16c1ac778ba518310180f81043befdd0)
# For some external project macros # For some external project macros
include(ExternalProject) include(ExternalProject)
# add the build path to cmake # default build destination in windows to avoid Release/Debug folder
#list(APPEND CMAKE_PREFIX_PATH "${EXTERNAL_BUILD_LIBRARIES}") if(WIN32)
# the build will be output on the same folder of sdrangel
set(DEFAULT_OUTPUT_DIRECTORY
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${SDRANGEL_BINARY_BIN_DIR}
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG=${SDRANGEL_BINARY_BIN_DIR}
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=${SDRANGEL_BINARY_BIN_DIR}
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=${SDRANGEL_BINARY_LIB_DIR}
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG=${SDRANGEL_BINARY_LIB_DIR}
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE=${SDRANGEL_BINARY_LIB_DIR}
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${SDRANGEL_BINARY_LIB_DIR}
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG=${SDRANGEL_BINARY_LIB_DIR}
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=${SDRANGEL_BINARY_LIB_DIR})
endif()
# macro that create symbolic links # macro that create symbolic links
macro(makeLink src dest target) macro(makeLink src dest target)
if(NOT EXISTS ${dest})
add_custom_command(TARGET ${target} PRE_BUILD add_custom_command(TARGET ${target} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E create_symlink ${src} ${dest} DEPENDS ${dest} COMMENT "mklink ${src} -> ${dest}") COMMAND ${CMAKE_COMMAND} -E create_symlink ${src} ${dest} DEPENDS ${dest} COMMENT "mklink ${src} -> ${dest}")
endif()
endmacro()
# macro that copy folder
macro(makeCopy src dest target)
if(NOT EXISTS ${dest})
add_custom_command(TARGET ${target} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${src} ${dest} DEPENDS ${dest} COMMENT "copy ${src} -> ${dest}")
endif()
endmacro() endmacro()
# needs boost # probably build with mingw64 on windows
ExternalProject_Add(codec2 if(NOT WIN32)
# needs boost
ExternalProject_Add(codec2
GIT_REPOSITORY https://github.com/drowe67/codec2.git GIT_REPOSITORY https://github.com/drowe67/codec2.git
GIT_TAG 7a0187da3ffb06fd90c081216b50bab94d02d046 GIT_TAG ${CODEC2_TAG}
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/codec2" PREFIX "${EXTERNAL_BUILD_LIBRARIES}/codec2"
CMAKE_ARGS ${DEFAULT_OUTPUT_DIRECTORY}
INSTALL_COMMAND "" INSTALL_COMMAND ""
TEST_COMMAND "" TEST_COMMAND ""
) )
set(CODEC2_FOUND ON CACHE INTERNAL "") ExternalProject_Get_Property(codec2 source_dir binary_dir)
set(CODEC2_INCLUDE_DIR "${EXTERNAL_BUILD_LIBRARIES}/codec2/src/codec2/src" CACHE INTERNAL "") set(CODEC2_FOUND ON CACHE INTERNAL "")
set(CODEC2_LIBRARIES "${EXTERNAL_BUILD_LIBRARIES}/codec2/src/codec2-build/libcodec2${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "") set(CODEC2_INCLUDE_DIR "${source_dir}/src" CACHE INTERNAL "")
# some source include "codec2/comp.h" and some without codec2 if(WIN32)
makeLink("${EXTERNAL_BUILD_LIBRARIES}/codec2/src/codec2/src" "${EXTERNAL_BUILD_LIBRARIES}/codec2/src/codec2/src/codec2" codec2) set(CODEC2_LIBRARIES "${SDRANGEL_BINARY_LIB_DIR}/codec2.lib" CACHE INTERNAL "")
makeCopy("${source_dir}/src" "${source_dir}/src/codec2" codec2)
else()
set(CODEC2_LIBRARIES "${binary_dir}/libcodec2${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
# some source include "codec2/comp.h" and some without codec2
makeLink("${source_dir}/src" "${source_dir}/src/codec2" codec2)
endif()
endif()
# needs boost # needs boost
ExternalProject_Add(cm256cc ExternalProject_Add(cm256cc
GIT_REPOSITORY https://github.com/f4exb/cm256cc.git GIT_REPOSITORY https://github.com/f4exb/cm256cc.git
GIT_TAG v1.0.5 GIT_TAG ${CM256CC_TAG}
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/cm256cc" PREFIX "${EXTERNAL_BUILD_LIBRARIES}/cm256cc"
CMAKE_ARGS -DBUILD_TOOLS=OFF -DBOOST_ROOT="${BOOST_ROOT}" ${DEFAULT_OUTPUT_DIRECTORY}
INSTALL_COMMAND "" INSTALL_COMMAND ""
TEST_COMMAND "" TEST_COMMAND ""
) )
ExternalProject_Get_Property(cm256cc source_dir binary_dir)
set(CM256CC_FOUND ON CACHE INTERNAL "") set(CM256CC_FOUND ON CACHE INTERNAL "")
# we need cm256cc/library.h
set(CM256CC_INCLUDE_DIR "${EXTERNAL_BUILD_LIBRARIES}/cm256cc/src" CACHE INTERNAL "") set(CM256CC_INCLUDE_DIR "${EXTERNAL_BUILD_LIBRARIES}/cm256cc/src" CACHE INTERNAL "")
set(CM256CC_LIBRARIES "${EXTERNAL_BUILD_LIBRARIES}/cm256cc/src/cm256cc-build/libcm256cc${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "") if(WIN32)
set(CM256CC_LIBRARIES "${SDRANGEL_BINARY_LIB_DIR}/cm256cc.lib" CACHE INTERNAL "")
else()
set(CM256CC_LIBRARIES "${binary_dir}/libcm256cc${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
endif()
set(USE_MBELIB OFF)
if(NOT WIN32)
ExternalProject_Add(mbelib ExternalProject_Add(mbelib
GIT_REPOSITORY https://github.com/szechyjs/mbelib.git GIT_REPOSITORY https://github.com/szechyjs/mbelib.git
GIT_TAG "debian/1.3.0" GIT_TAG ${MBELIB_TAG}
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/mbelib" PREFIX "${EXTERNAL_BUILD_LIBRARIES}/mbelib"
CMAKE_ARGS -DDISABLE_TEST=ON ${DEFAULT_OUTPUT_DIRECTORY}
INSTALL_COMMAND "" INSTALL_COMMAND ""
TEST_COMMAND "" TEST_COMMAND ""
) )
ExternalProject_Get_Property(mbelib source_dir binary_dir)
set(USE_MBELIB ON)
set(DSDCC_DEPENDS mbelib) set(DSDCC_DEPENDS mbelib)
set(LIBMBE_FOUND) set(LIBMBE_FOUND)
set(LIBMBE_INCLUDE_DIR "${EXTERNAL_BUILD_LIBRARIES}/mbelib/src/mbelib") set(LIBMBE_INCLUDE_DIR "${source_dir}")
set(LIBMBE_LIBRARIES "${EXTERNAL_BUILD_LIBRARIES}/mbelib/src/mbelib-build/libmbe${CMAKE_SHARED_LIBRARY_SUFFIX}") if(WIN32)
set(LIBMBE_LIBRARIES "${SDRANGEL_BINARY_LIB_DIR}/mbe.lib")
else()
set(LIBMBE_LIBRARIES "${binary_dir}/libmbe${CMAKE_SHARED_LIBRARY_SUFFIX}")
endif()
endif(NOT WIN32)
if(WIN32 OR LINUX) if(WIN32 OR LINUX)
ExternalProject_Add(serialdv ExternalProject_Add(serialdv
GIT_REPOSITORY https://github.com/f4exb/serialDV.git GIT_REPOSITORY https://github.com/f4exb/serialDV.git
GIT_TAG 89c841ce5b24b8b75c329d6330ec216773f002d2 GIT_TAG ${SERIALDV_TAG}
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/serialdv" PREFIX "${EXTERNAL_BUILD_LIBRARIES}/serialdv"
CMAKE_ARGS -DBUILD_TOOL=OFF ${DEFAULT_OUTPUT_DIRECTORY}
INSTALL_COMMAND "" INSTALL_COMMAND ""
TEST_COMMAND "" TEST_COMMAND ""
) )
ExternalProject_Get_Property(serialdv source_dir binary_dir)
set(DSDCC_DEPENDS ${DSDCC_DEPENDS} serialdv) set(DSDCC_DEPENDS ${DSDCC_DEPENDS} serialdv)
set(LIBSERIALDV_FOUND ON CACHE INTERNAL "") set(LIBSERIALDV_FOUND ON CACHE INTERNAL "")
set(LIBSERIALDV_INCLUDE_DIR "${EXTERNAL_BUILD_LIBRARIES}/serialdv/src/serialdv" CACHE INTERNAL "") set(LIBSERIALDV_INCLUDE_DIR "${source_dir}" CACHE INTERNAL "")
set(LIBSERIALDV_LIBRARY "${EXTERNAL_BUILD_LIBRARIES}/serialdv/src/serialdv-build/libserialdv${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "") if(WIN32)
set(LIBSERIALDV_LIBRARY "${SDRANGEL_BINARY_LIB_DIR}/serialdv.lib" CACHE INTERNAL "")
makeCopy("${source_dir}" "${source_dir}/dsp" serialdv)
else()
set(LIBSERIALDV_LIBRARY "${binary_dir}/libserialdv${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
# because sdrbase/dsp/dvserialworker.h use dsp/dvcontroller.h # because sdrbase/dsp/dvserialworker.h use dsp/dvcontroller.h
# so we need a link # so we need a link
makeLink("${EXTERNAL_BUILD_LIBRARIES}/serialdv/src/serialdv" "${EXTERNAL_BUILD_LIBRARIES}/serialdv/src/serialdv/dsp" serialdv) makeLink("${source_dir}" "${source_dir}/dsp" serialdv)
endif()
endif() endif()
ExternalProject_Add(dsdcc ExternalProject_Add(dsdcc
GIT_REPOSITORY https://github.com/f4exb/dsdcc.git GIT_REPOSITORY https://github.com/f4exb/dsdcc.git
GIT_TAG cee82816bc8982ecb218abbd2baeb5bb5186711b GIT_TAG ${DSDCC_TAG}
DEPENDS ${DSDCC_DEPENDS} DEPENDS ${DSDCC_DEPENDS}
PREFIX "${EXTERNAL_BUILD_LIBRARIES}/dsdcc" PREFIX "${EXTERNAL_BUILD_LIBRARIES}/dsdcc"
CMAKE_ARGS "-DUSE_MBELIB=ON -DLIBMBE_INCLUDE_DIR=${LIBMBE_INCLUDE_DIR} -DLIBMBE_LIBRARY=${LIBMBE_LIBRARIES} -DLIBSERIALDV_INCLUDE_DIR=${LIBSERIALDV_INCLUDE_DIR} -DLIBSERIALDV_LIBRARY=${LIBSERIALDV_LIBRARY}" CMAKE_ARGS ${DEFAULT_OUTPUT_DIRECTORY} -DBUILD_TOOL=OFF -DUSE_MBELIB=${USE_MBELIB} -DLIBMBE_INCLUDE_DIR="${LIBMBE_INCLUDE_DIR}" -DLIBMBE_LIBRARY="${LIBMBE_LIBRARIES}" -DLIBSERIALDV_INCLUDE_DIR="${LIBSERIALDV_INCLUDE_DIR}" -DLIBSERIALDV_LIBRARY="${LIBSERIALDV_LIBRARY}"
INSTALL_COMMAND "" INSTALL_COMMAND ""
TEST_COMMAND "" TEST_COMMAND ""
) )
ExternalProject_Get_Property(dsdcc source_dir binary_dir)
set(LIBDSDCC_FOUND ON CACHE INTERNAL "") set(LIBDSDCC_FOUND ON CACHE INTERNAL "")
set(LIBDSDCC_INCLUDE_DIR "${EXTERNAL_BUILD_LIBRARIES}/dsdcc/src" CACHE INTERNAL "") set(LIBDSDCC_INCLUDE_DIR "${EXTERNAL_BUILD_LIBRARIES}/dsdcc/src" CACHE INTERNAL "")
set(LIBDSDCC_LIBRARIES "${EXTERNAL_BUILD_LIBRARIES}/dsdcc/src/dsdcc-build/libdsdcc${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "") if(WIN32)
set(LIBDSDCC_LIBRARIES "${SDRANGEL_BINARY_LIB_DIR}/dsdcc.lib" CACHE INTERNAL "")
else()
set(LIBDSDCC_LIBRARIES "${binary_dir}/libdsdcc${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "")
endif()
# already on the respository # already on the respository
# TODO decide what to do # TODO decide what to do
if(OFF) if(OFF)
# needs pkgconfig, libusb, autoconf, automake and autolib # needs pkgconfig, libusb, autoconf, automake and libtool
ExternalProject_Add(perseus ExternalProject_Add(perseus
GIT_REPOSITORY https://github.com/f4exb/libperseus-sdr.git GIT_REPOSITORY https://github.com/f4exb/libperseus-sdr.git
GIT_TAG afefa23e3140ac79d845acb68cf0beeb86d09028 GIT_TAG afefa23e3140ac79d845acb68cf0beeb86d09028

2
external/windows vendored

@ -1 +1 @@
Subproject commit e09fc96d9998207336dfcb42122c046bafd0bdee Subproject commit efa84ff291820aa476e9f67286e0162ecab9f806

View File

@ -7,11 +7,29 @@ include_directories(
) )
if (NOT SERVER_MODE) if (NOT SERVER_MODE)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${BUILD_PLUGINS_DIR}) if(WIN32)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${BUILD_PLUGINS_DIR}) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${BUILD_PLUGINS_RUNTIME_DIR}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${BUILD_PLUGINS_RUNTIME_DIR}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${BUILD_PLUGINS_RUNTIME_DIR}")
endif()
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${BUILD_PLUGINS_DIR}")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${BUILD_PLUGINS_DIR}")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${BUILD_PLUGINS_DIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${BUILD_PLUGINS_DIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${BUILD_PLUGINS_DIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${BUILD_PLUGINS_DIR}")
else() else()
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${BUILD_PLUGINSSRV_DIR}) if(WIN32)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${BUILD_PLUGINSSRV_DIR}) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${BUILD_PLUGINSSRV_RUNTIME_DIR}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${BUILD_PLUGINSSRV_RUNTIME_DIR}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${BUILD_PLUGINSSRV_RUNTIME_DIR}")
endif()
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${BUILD_PLUGINSSRV_DIR}")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${BUILD_PLUGINSSRV_DIR}")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${BUILD_PLUGINSSRV_DIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${BUILD_PLUGINSSRV_DIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${BUILD_PLUGINSSRV_DIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${BUILD_PLUGINSSRV_DIR}")
endif() endif()
add_subdirectory(channelrx) add_subdirectory(channelrx)

View File

@ -33,6 +33,9 @@ if(NOT SERVER_MODE)
# TODO use libavcodec/version.h # TODO use libavcodec/version.h
find_package(FFmpeg) find_package(FFmpeg)
if (FFMPEG_FOUND) if (FFMPEG_FOUND)
if(WIN32)
add_subdirectory(demoddatv)
else()
# You can only get FFmpeg version from the command line # You can only get FFmpeg version from the command line
EXECUTE_PROCESS(COMMAND ffmpeg -version COMMAND grep ffmpeg COMMAND cut -d\ -f3 COMMAND tr -d '\n' OUTPUT_VARIABLE FFMPEG_VERSION) EXECUTE_PROCESS(COMMAND ffmpeg -version COMMAND grep ffmpeg COMMAND cut -d\ -f3 COMMAND tr -d '\n' OUTPUT_VARIABLE FFMPEG_VERSION)
message(STATUS "FFmpeg version ${FFMPEG_VERSION} found") message(STATUS "FFmpeg version ${FFMPEG_VERSION} found")
@ -43,4 +46,5 @@ if(NOT SERVER_MODE)
message(STATUS "FFmpeg too old to compile demoddatv; needs at least ffmpeg 3.1") message(STATUS "FFmpeg too old to compile demoddatv; needs at least ffmpeg 3.1")
endif() endif()
endif() endif()
endif()
endif() endif()

View File

@ -1,50 +0,0 @@
project(localoutput)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(localoutput_SOURCES
localoutputgui.cpp
localoutput.cpp
localoutputplugin.cpp
localoutputsettings.cpp
)
set(localoutput_HEADERS
localoutputgui.h
localoutput.h
localoutputplugin.h
localoutputsettings.h
)
set(localoutput_FORMS
localoutputgui.ui
)
include_directories(
.
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client
)
add_definitions(${QT_DEFINITIONS})
add_definitions(-DQT_PLUGIN)
add_definitions(-DQT_SHARED)
qt5_wrap_ui(localoutput_FORMS_HEADERS ${localoutput_FORMS})
add_library(outputlocal SHARED
${localoutput_SOURCES}
${localoutput_HEADERS_MOC}
${localoutput_FORMS_HEADERS}
)
target_link_libraries(outputlocal
${QT_LIBRARIES}
sdrbase
sdrgui
swagger
)
target_link_libraries(outputlocal Qt5::Core Qt5::Widgets)
install(TARGETS outputlocal DESTINATION lib/plugins/samplesink)

View File

@ -75,6 +75,8 @@ void PluginManager::loadPluginsPart(const QString& pluginsSubDir)
#ifdef __APPLE__ #ifdef __APPLE__
// on SDRAngel.app // on SDRAngel.app
PluginsPath << applicationDirPath + "/../Resources/lib/" + pluginsSubDir; PluginsPath << applicationDirPath + "/../Resources/lib/" + pluginsSubDir;
#elif defined(_WIN32) || defined(WIN32)
PluginsPath << applicationDirPath + "/" + pluginsSubDir;
#endif #endif
// NOTE: exit on the first folder found // NOTE: exit on the first folder found

View File

@ -12,21 +12,7 @@ set(sdrsrv_HEADERS
webapi/webapiadaptersrv.h webapi/webapiadaptersrv.h
) )
set(sdrsrv_SOURCES
${sdrsrv_SOURCES}
${sdrsrv_HEADERS}
)
add_definitions(${QT_DEFINITIONS})
add_definitions(-DQT_SHARED)
add_library(sdrsrv SHARED
${sdrsrv_SOURCES}
${sdrsrv_HEADERS_MOC}
)
include_directories( include_directories(
.
${CMAKE_SOURCE_DIR}/exports ${CMAKE_SOURCE_DIR}/exports
${CMAKE_SOURCE_DIR}/sdrbase ${CMAKE_SOURCE_DIR}/sdrbase
${CMAKE_SOURCE_DIR}/logging ${CMAKE_SOURCE_DIR}/logging
@ -35,15 +21,16 @@ include_directories(
${OPENGL_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR}
) )
add_library(sdrsrv SHARED
${sdrsrv_SOURCES}
)
target_link_libraries(sdrsrv target_link_libraries(sdrsrv
${QT_LIBRARIES} Qt5::Core
Qt5::Multimedia
sdrbase sdrbase
logging logging
) )
target_compile_features(sdrsrv PRIVATE cxx_generalized_initializers) # cmake >= 3.1.0
target_link_libraries(sdrsrv Qt5::Core Qt5::Multimedia)
install(TARGETS sdrsrv DESTINATION ${INSTALL_LIB_DIR}) install(TARGETS sdrsrv DESTINATION ${INSTALL_LIB_DIR})