cmake: fix cpu flags autodiscovery and terminal for raspberry

- we set cpu flags for CXX and C
- raspberry "only" has lxterminal not xterm
This commit is contained in:
Davide Gerhard 2019-08-27 17:43:27 +02:00
parent a1c16a67ef
commit df22522126
No known key found for this signature in database
GPG Key ID: 7CBEFA144857DC97
3 changed files with 130 additions and 105 deletions

View File

@ -34,7 +34,15 @@ set(COPYRIGHT "Copyright (c) 2019 John Langner, WB2OSZ. All rights reserved.")
add_definitions("-DCOPYRIGHT=\"${COPYRIGHT}\"") add_definitions("-DCOPYRIGHT=\"${COPYRIGHT}\"")
set(IDENTIFIER "com.${COMPANY}.${APPLICATION_NAME}") set(IDENTIFIER "com.${COMPANY}.${APPLICATION_NAME}")
add_definitions("-DIDENTIFIER=\"${IDENTIFIER}\"") 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) find_package(Git)
if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git/") if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git/")

View File

@ -53,12 +53,14 @@ if (${ARCHITECTURE} MATCHES "x86_64|x86" AND (FORCE_SSE OR FORCE_SSSE3 OR FORCE_
if (FORCE_SSE) if (FORCE_SSE)
set(HAS_SSE ON CACHE BOOL "SSE SIMD enabled") set(HAS_SSE ON CACHE BOOL "SSE SIMD enabled")
if(C_GCC OR C_CLANG) if(C_GCC OR C_CLANG)
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse" )
message(STATUS "Use SSE SIMD instructions") message(STATUS "Use SSE SIMD instructions")
add_definitions(-DUSE_SSE) add_definitions(-DUSE_SSE)
elseif(C_MSVC) elseif(C_MSVC)
#set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE" ) set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:SSE" )
#set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /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_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") 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) elseif (FORCE_SSSE3)
set(HAS_SSSE3 ON CACHE BOOL "SSSE3 SIMD enabled") set(HAS_SSSE3 ON CACHE BOOL "SSSE3 SIMD enabled")
if(C_GCC OR C_CLANG) if(C_GCC OR C_CLANG)
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mssse3" ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mssse3" )
message(STATUS "Use SSSE3 SIMD instructions") set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mssse3" )
add_definitions(-DUSE_SSSE3) message(STATUS "Use SSSE3 SIMD instructions")
elseif(C_MSVC) add_definitions(-DUSE_SSSE3)
#set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSSE3" ) elseif(C_MSVC)
#set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSSE3" ) set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:SSSE3" )
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox" ) set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSSE3" )
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" ) set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
message(STATUS "Use MSVC SSSE3 SIMD instructions") set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
add_definitions (/D "_CRT_SECURE_NO_WARNINGS") set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
add_definitions(-DUSE_SSSE3) message(STATUS "Use MSVC SSSE3 SIMD instructions")
endif() add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
elseif (FORCE_SSE41) add_definitions(-DUSE_SSSE3)
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()
endif() 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 () else ()
if (${ARCHITECTURE} MATCHES "x86_64|x86") if (${ARCHITECTURE} MATCHES "x86_64|x86")
if(C_MSVC) 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() 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() 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") 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_C_FLAGS "${CMAKE_C_FLAGS} -msse2" )
add_definitions(-DUSE_SSE2) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2" )
elseif(C_MSVC) add_definitions(-DUSE_SSE2)
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE2" ) elseif(C_MSVC)
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSE2" ) set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:SSE2" )
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" ) set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE2" )
add_definitions (/D "_CRT_SECURE_NO_WARNINGS") set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSE2" )
add_definitions(-DUSE_SSE2) set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSE2" )
endif() 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() 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()
if(C_MSVC) 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() 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() 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") 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_C_FLAGS "${CMAKE_C_FLAGS} -mssse3" )
add_definitions(-DUSE_SSSE3) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mssse3" )
add_definitions(-DUSE_SSSE3)
elseif(C_MSVC) elseif(C_MSVC)
# seems not present on MSVC 2017 # 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 /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_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_SSSE3) add_definitions(-DUSE_SSSE3)
endif()
else()
set(HAS_SSSE3 OFF CACHE BOOL "Architecture does not have SSSE3 SIMD enabled")
endif() endif()
else() if(C_MSVC)
set(HAS_SSSE3 OFF CACHE BOOL "Architecture does not have SSSE3 SIMD enabled") try_run(RUN_SSE4_1 COMPILE_SSE4_1 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_sse41.cxx" COMPILE_DEFINITIONS /O0)
endif() 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) try_run(RUN_SSE4_1 COMPILE_SSE4_1 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_sse41.cxx" COMPILE_DEFINITIONS -msse4.1 -O0)
endif() 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") 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_C_FLAGS "${CMAKE_C_FLAGS} -msse4.1" )
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -msse4.1" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1" )
add_definitions(-DUSE_SSE4_1) add_definitions(-DUSE_SSE4_1)
elseif(C_MSVC) elseif(C_MSVC)
# seems not present on MSVC 2017 # seems not present on MSVC 2017
#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_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_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")
@ -180,14 +190,15 @@ if (${ARCHITECTURE} MATCHES "x86_64|x86")
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") 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_C_FLAGS "${CMAKE_C_FLAGS} -msse4.2" )
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -msse4.2" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.2" )
add_definitions(-DUSE_SSE4_2) add_definitions(-DUSE_SSE4_2)
elseif(C_MSVC) elseif(C_MSVC)
# seems not present on MSVC 2017 # seems not present on MSVC 2017
#set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /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 /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" ) 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)
@ -204,15 +215,17 @@ if (${ARCHITECTURE} MATCHES "x86_64|x86")
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") 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_C_FLAGS "${CMAKE_C_FLAGS} -mavx" )
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -mavx" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx" )
add_definitions(-DUSE_AVX) add_definitions(-DUSE_AVX)
elseif(C_MSVC) elseif(C_MSVC)
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:AVX" ) set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:AVX" )
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:AVX" ) set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:AVX" )
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" ) set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:AVX" )
add_definitions (/D "_CRT_SECURE_NO_WARNINGS") set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:AVX" )
add_definitions(-DUSE_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() 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")
@ -226,15 +239,17 @@ if (${ARCHITECTURE} MATCHES "x86_64|x86")
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") 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_C_FLAGS "${CMAKE_C_FLAGS} -mavx2" )
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -mavx2" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -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")
add_definitions(-DUSE_AVX2) 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() 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")
@ -248,15 +263,17 @@ if (${ARCHITECTURE} MATCHES "x86_64|x86")
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") 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_C_FLAGS "${CMAKE_C_FLAGS} -mavx512f" )
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -mavx512f" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx512f" )
add_definitions(-DUSE_AVX512) add_definitions(-DUSE_AVX512)
elseif(C_MSVC) elseif(C_MSVC)
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:AVX512" ) set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:AVX512" )
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:AVX512" ) set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:AVX512" )
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" ) set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:AVX512" )
add_definitions (/D "_CRT_SECURE_NO_WARNINGS") set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:AVX512" )
add_definitions(-DUSE_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() 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")
@ -271,8 +288,8 @@ elseif(ARCHITECTURE_ARM)
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") 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_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=neon" )
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -mfpu=neon" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon" )
add_definitions(-DUSE_NEON) add_definitions(-DUSE_NEON)
endif() endif()
else() else()

View File

@ -42,7 +42,7 @@ add_custom_target(install-conf-conf
COMMAND ${CMAKE_COMMAND} -E copy "${CUSTOM_CONF_DIR}/sdr.conf" ~ COMMAND ${CMAKE_COMMAND} -E copy "${CUSTOM_CONF_DIR}/sdr.conf" ~
) )
if(LINUX) if(NOT WIN32)
add_custom_target(install-conf) add_custom_target(install-conf)
add_dependencies(install-conf install-conf-conf install-conf-scripts install-conf-telemetry) add_dependencies(install-conf install-conf-conf install-conf-scripts install-conf-telemetry)
endif() endif()