mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-15 12:51:49 -05:00
Make main CMakeLists.txt detect Clang compiler correctly
This commit is contained in:
parent
980192548d
commit
98fc93a26b
@ -106,7 +106,7 @@ if (${ARCHITECTURE} MATCHES "x86_64|AMD64|x86")
|
|||||||
EXECUTE_PROCESS( COMMAND grep flags /proc/cpuinfo OUTPUT_VARIABLE CPU_FLAGS )
|
EXECUTE_PROCESS( COMMAND grep flags /proc/cpuinfo OUTPUT_VARIABLE CPU_FLAGS )
|
||||||
# if (${CPU_FLAGS} MATCHES "avx2")
|
# if (${CPU_FLAGS} MATCHES "avx2")
|
||||||
# set(HAS_AVX2 ON CACHE BOOL "Architecture has AVX2 SIMD enabled")
|
# set(HAS_AVX2 ON CACHE BOOL "Architecture has AVX2 SIMD enabled")
|
||||||
# if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
|
# if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR (CMAKE_CXX_COMPILER_ID STREQUAL "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")
|
# message(STATUS "Use AVX2 SIMD instructions")
|
||||||
@ -117,7 +117,7 @@ if (${ARCHITECTURE} MATCHES "x86_64|AMD64|x86")
|
|||||||
# endif()
|
# endif()
|
||||||
if (${CPU_FLAGS} MATCHES "sse4_1")
|
if (${CPU_FLAGS} MATCHES "sse4_1")
|
||||||
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")
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
|
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR (CMAKE_CXX_COMPILER_ID STREQUAL "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")
|
message(STATUS "Use SSE 4.1 SIMD instructions")
|
||||||
@ -134,7 +134,7 @@ if (${ARCHITECTURE} MATCHES "x86_64|AMD64|x86")
|
|||||||
endif()
|
endif()
|
||||||
if (${CPU_FLAGS} MATCHES "ssse3")
|
if (${CPU_FLAGS} MATCHES "ssse3")
|
||||||
set(HAS_SSSE3 ON CACHE BOOL "Architecture has SSSE3 SIMD enabled")
|
set(HAS_SSSE3 ON CACHE BOOL "Architecture has SSSE3 SIMD enabled")
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
|
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))
|
||||||
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mssse3" )
|
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mssse3" )
|
||||||
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -mssse3" )
|
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -mssse3" )
|
||||||
message(STATUS "Use SSSE3 SIMD instructions")
|
message(STATUS "Use SSSE3 SIMD instructions")
|
||||||
@ -151,7 +151,7 @@ if (${ARCHITECTURE} MATCHES "x86_64|AMD64|x86")
|
|||||||
endif()
|
endif()
|
||||||
if (${CPU_FLAGS} MATCHES "sse2")
|
if (${CPU_FLAGS} MATCHES "sse2")
|
||||||
set(HAS_SSE2 ON CACHE BOOL "Architecture has SSE2 SIMD enabled")
|
set(HAS_SSE2 ON CACHE BOOL "Architecture has SSE2 SIMD enabled")
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
|
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))
|
||||||
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -msse2" )
|
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -msse2" )
|
||||||
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -msse2" )
|
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -msse2" )
|
||||||
message(STATUS "Use SSE2 SIMD instructions")
|
message(STATUS "Use SSE2 SIMD instructions")
|
||||||
@ -170,7 +170,7 @@ elseif (${ARCHITECTURE} MATCHES "armv7l")
|
|||||||
EXECUTE_PROCESS( COMMAND grep Features /proc/cpuinfo OUTPUT_VARIABLE CPU_FLAGS )
|
EXECUTE_PROCESS( COMMAND grep Features /proc/cpuinfo OUTPUT_VARIABLE CPU_FLAGS )
|
||||||
if (${CPU_FLAGS} MATCHES "neon")
|
if (${CPU_FLAGS} MATCHES "neon")
|
||||||
set(HAS_NEON ON CACHE BOOL "Architecture has NEON SIMD enabled")
|
set(HAS_NEON ON CACHE BOOL "Architecture has NEON SIMD enabled")
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
|
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR (CMAKE_CXX_COMPILER_ID STREQUAL "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")
|
message(STATUS "Use NEON SIMD instructions")
|
||||||
@ -181,7 +181,7 @@ elseif (${ARCHITECTURE} MATCHES "armv7l")
|
|||||||
endif()
|
endif()
|
||||||
elseif (${ARCHITECTURE} MATCHES "aarch64")
|
elseif (${ARCHITECTURE} MATCHES "aarch64")
|
||||||
set(HAS_NEON ON CACHE BOOL FORCE "Architecture has NEON SIMD enabled")
|
set(HAS_NEON ON CACHE BOOL FORCE "Architecture has NEON SIMD enabled")
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
|
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))
|
||||||
message(STATUS "Aarch64 always has NEON SIMD instructions")
|
message(STATUS "Aarch64 always has NEON SIMD instructions")
|
||||||
add_definitions(-DUSE_NEON)
|
add_definitions(-DUSE_NEON)
|
||||||
endif()
|
endif()
|
||||||
@ -204,7 +204,11 @@ if (SANITIZE_ADDRESS)
|
|||||||
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} -fsanitize=address")
|
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} -fsanitize=address")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wvla -Woverloaded-virtual -fmax-errors=10 -ffast-math -ftree-vectorize ${EXTRA_FLAGS}")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wvla -Woverloaded-virtual -ffast-math -ftree-vectorize ${EXTRA_FLAGS}")
|
||||||
|
|
||||||
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmax-errors=10")
|
||||||
|
endif()
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# base libraries
|
# base libraries
|
||||||
|
Loading…
Reference in New Issue
Block a user