From df22522126916595cab9cef1ccb4cb7c04450d4e Mon Sep 17 00:00:00 2001 From: Davide Gerhard Date: Tue, 27 Aug 2019 17:43:27 +0200 Subject: [PATCH] cmake: fix cpu flags autodiscovery and terminal for raspberry - we set cpu flags for CXX and C - raspberry "only" has lxterminal not xterm --- CMakeLists.txt | 10 +- cmake/modules/FindCPUflags.cmake | 223 +++++++++++++++++-------------- conf/CMakeLists.txt | 2 +- 3 files changed, 130 insertions(+), 105 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2fd7ede..8551897 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,7 +34,15 @@ set(COPYRIGHT "Copyright (c) 2019 John Langner, WB2OSZ. All rights reserved.") add_definitions("-DCOPYRIGHT=\"${COPYRIGHT}\"") set(IDENTIFIER "com.${COMPANY}.${APPLICATION_NAME}") add_definitions("-DIDENTIFIER=\"${IDENTIFIER}\"") -set(APPLICATION_DESKTOP_EXEC "xterm -e ${CMAKE_PROJECT_NAME}") +# raspberry as only lxterminal not xterm +if(NOT WIN32) + find_program(BINARY_TERMINAL_BIN lxterminal) + if(BINARY_TERMINAL_BIN) + set(APPLICATION_DESKTOP_EXEC "${BINARY_TERMINAL_BIN} -e ${CMAKE_PROJECT_NAME}") + else() + set(APPLICATION_DESKTOP_EXEC "xterm -e ${CMAKE_PROJECT_NAME}") + endif() +endif() find_package(Git) if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git/") diff --git a/cmake/modules/FindCPUflags.cmake b/cmake/modules/FindCPUflags.cmake index 69710e8..461fe74 100644 --- a/cmake/modules/FindCPUflags.cmake +++ b/cmake/modules/FindCPUflags.cmake @@ -53,12 +53,14 @@ if (${ARCHITECTURE} MATCHES "x86_64|x86" AND (FORCE_SSE OR FORCE_SSSE3 OR FORCE_ if (FORCE_SSE) set(HAS_SSE ON CACHE BOOL "SSE SIMD enabled") if(C_GCC OR C_CLANG) + set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse" ) message(STATUS "Use SSE SIMD instructions") add_definitions(-DUSE_SSE) elseif(C_MSVC) - #set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE" ) - #set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSE" ) + set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:SSE" ) + set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE" ) + set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox" ) 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" ) message(STATUS "Use MSVC SSSE3 SIMD instructions") @@ -68,101 +70,109 @@ if (${ARCHITECTURE} MATCHES "x86_64|x86" AND (FORCE_SSE OR FORCE_SSSE3 OR FORCE_ elseif (FORCE_SSSE3) set(HAS_SSSE3 ON CACHE BOOL "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(C_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_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox" ) - 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() - elseif (FORCE_SSE41) - set(HAS_SSSE3 ON CACHE BOOL "SSSE3 SIMD enabled") - 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_SSSE3) - add_definitions(-DUSE_SSE4_1) - 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_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" ) - message(STATUS "Use SSE 4.1 SIMD instructions") - add_definitions (/D "_CRT_SECURE_NO_WARNINGS") - add_definitions(-DUSE_SSSE3) - add_definitions(-DUSE_SSE4_1) - endif() + set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mssse3" ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mssse3" ) + message(STATUS "Use SSSE3 SIMD instructions") + add_definitions(-DUSE_SSSE3) + elseif(C_MSVC) + set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:SSSE3" ) + set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSSE3" ) + set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox" ) + 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" ) + message(STATUS "Use MSVC SSSE3 SIMD instructions") + add_definitions (/D "_CRT_SECURE_NO_WARNINGS") + add_definitions(-DUSE_SSSE3) endif() + elseif (FORCE_SSE41) + set(HAS_SSSE3 ON CACHE BOOL "SSSE3 SIMD enabled") + set(HAS_SSE4_1 ON CACHE BOOL "Architecture has SSE 4.1 SIMD enabled") + if(C_GCC OR C_CLANG) + set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.1" ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1" ) + message(STATUS "Use SSE 4.1 SIMD instructions") + add_definitions(-DUSE_SSSE3) + add_definitions(-DUSE_SSE4_1) + elseif(C_MSVC) + # seems that from MSVC 2015 comiler doesn't support those flags + set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:SSE4_1" ) + set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE4_1" ) + set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox" ) + 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" ) + message(STATUS "Use SSE 4.1 SIMD instructions") + add_definitions (/D "_CRT_SECURE_NO_WARNINGS") + add_definitions(-DUSE_SSSE3) + add_definitions(-DUSE_SSE4_1) + endif() + endif() else () -if (${ARCHITECTURE} MATCHES "x86_64|x86") + if (${ARCHITECTURE} MATCHES "x86_64|x86") if(C_MSVC) - try_run(RUN_SSE2 COMPILE_SSE2 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_sse2.cxx" COMPILE_DEFINITIONS /O0) + 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) + 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) - set(HAS_SSE2 ON CACHE BOOL "Architecture has SSSE2 SIMD enabled") - message(STATUS "Use SSE2 SIMD instructions") - if(C_GCC OR C_CLANG) - set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2" ) - add_definitions(-DUSE_SSE2) - elseif(C_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() + set(HAS_SSE2 ON CACHE BOOL "Architecture has SSSE2 SIMD enabled") + message(STATUS "Use SSE2 SIMD instructions") + if(C_GCC OR C_CLANG) + set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2" ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2" ) + add_definitions(-DUSE_SSE2) + elseif(C_MSVC) + set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:SSE2" ) + set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE2" ) + set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox /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() 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() if(C_MSVC) - try_run(RUN_SSSE3 COMPILE_SSSE3 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_ssse3.cxx" COMPILE_DEFINITIONS /O0) + 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) + 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) - set(HAS_SSSE3 ON CACHE BOOL "Architecture has SSSE3 SIMD enabled") - message(STATUS "Use SSSE3 SIMD instructions") - if(C_GCC OR C_CLANG) - set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mssse3" ) - add_definitions(-DUSE_SSSE3) + set(HAS_SSSE3 ON CACHE BOOL "Architecture has SSSE3 SIMD enabled") + message(STATUS "Use SSSE3 SIMD instructions") + if(C_GCC OR C_CLANG) + set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mssse3" ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mssse3" ) + add_definitions(-DUSE_SSSE3) elseif(C_MSVC) - # seems not present on MSVC 2017 - #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" ) - add_definitions (/D "_CRT_SECURE_NO_WARNINGS") - add_definitions(-DUSE_SSSE3) + # seems not present on MSVC 2017 + #set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSSE3" ) + set( CMAKE_C_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox" ) + 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" ) + add_definitions (/D "_CRT_SECURE_NO_WARNINGS") + add_definitions(-DUSE_SSSE3) + endif() + else() + set(HAS_SSSE3 OFF CACHE BOOL "Architecture does not have SSSE3 SIMD enabled") endif() - else() - set(HAS_SSSE3 OFF CACHE BOOL "Architecture does not have SSSE3 SIMD enabled") - endif() - 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() + 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) - 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) - set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -msse4.1" ) - set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -msse4.1" ) - add_definitions(-DUSE_SSE4_1) + 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) + set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.1" ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1" ) + add_definitions(-DUSE_SSE4_1) elseif(C_MSVC) # seems not present on MSVC 2017 #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_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox" ) 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" ) add_definitions (/D "_CRT_SECURE_NO_WARNINGS") @@ -180,14 +190,15 @@ if (${ARCHITECTURE} MATCHES "x86_64|x86") 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) - set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -msse4.2" ) - set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -msse4.2" ) + set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.2" ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.2" ) add_definitions(-DUSE_SSE4_2) elseif(C_MSVC) # seems not present on MSVC 2017 #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_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox" ) + set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox" ) set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" ) add_definitions (/D "_CRT_SECURE_NO_WARNINGS") add_definitions(-DUSE_SSE4_2) @@ -204,15 +215,17 @@ if (${ARCHITECTURE} MATCHES "x86_64|x86") set(HAS_AVX ON CACHE BOOL "Architecture has AVX SIMD enabled") message(STATUS "Use AVX SIMD instructions") 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" ) + set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx" ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx" ) 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) + set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:AVX" ) + set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:AVX" ) + set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox /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) endif() else() set(HAS_AVX OFF CACHE BOOL "Architecture does not have AVX SIMD enabled") @@ -226,15 +239,17 @@ if (${ARCHITECTURE} MATCHES "x86_64|x86") set(HAS_AVX2 ON CACHE BOOL "Architecture has AVX2 SIMD enabled") message(STATUS "Use AVX2 SIMD instructions") 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" ) - 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") + set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx2" ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2" ) add_definitions(-DUSE_AVX2) + elseif(C_MSVC) + set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:AVX2" ) + set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:AVX2" ) + set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox /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) endif() else() set(HAS_AVX2 OFF CACHE BOOL "Architecture does not have AVX2 SIMD enabled") @@ -248,15 +263,17 @@ if (${ARCHITECTURE} MATCHES "x86_64|x86") set(HAS_AVX512 ON CACHE BOOL "Architecture has AVX512 SIMD enabled") message(STATUS "Use AVX512 SIMD instructions") 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" ) + set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx512f" ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx512f" ) 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) + set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:AVX512" ) + set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:AVX512" ) + set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox /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) endif() else() set(HAS_AVX512 OFF CACHE BOOL "Architecture does not have AVX512 SIMD enabled") @@ -271,8 +288,8 @@ elseif(ARCHITECTURE_ARM) set(HAS_NEON ON CACHE BOOL "Architecture has NEON SIMD enabled") message(STATUS "Use NEON SIMD instructions") 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" ) + set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=neon" ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon" ) add_definitions(-DUSE_NEON) endif() else() diff --git a/conf/CMakeLists.txt b/conf/CMakeLists.txt index df31598..61d668e 100644 --- a/conf/CMakeLists.txt +++ b/conf/CMakeLists.txt @@ -42,7 +42,7 @@ add_custom_target(install-conf-conf COMMAND ${CMAKE_COMMAND} -E copy "${CUSTOM_CONF_DIR}/sdr.conf" ~ ) -if(LINUX) +if(NOT WIN32) add_custom_target(install-conf) add_dependencies(install-conf install-conf-conf install-conf-scripts install-conf-telemetry) endif()