mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-25 09:18:54 -05:00
CMake: Remove limited compiler detection and properly support compilers simulating MSVC
This commit is contained in:
parent
33ab785085
commit
c57b11cdab
@ -1,13 +1,12 @@
|
||||
include_guard(GLOBAL)
|
||||
|
||||
include(DetectCompiler)
|
||||
include(DetectArchitecture)
|
||||
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
|
||||
if (C_CLANG OR C_GCC)
|
||||
add_compile_options(-Wall -Wextra -Wvla -Woverloaded-virtual -ffast-math -ftree-vectorize)
|
||||
elseif (C_MSVC)
|
||||
if(MSVC)
|
||||
add_compile_options(/MP)
|
||||
else()
|
||||
add_compile_options(-Wall -Wextra -Wvla -Woverloaded-virtual -ffast-math -ftree-vectorize)
|
||||
endif()
|
||||
|
||||
if (SANITIZE_ADDRESS)
|
||||
|
@ -93,7 +93,7 @@ function(detect_msvc_native_opt)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
if (C_MSVC)
|
||||
if (MSVC)
|
||||
detect_architecture("_M_AMD64" x86_64)
|
||||
detect_architecture("_M_IX86" x86)
|
||||
detect_architecture("_M_ARM" ARM)
|
||||
@ -114,7 +114,7 @@ endif()
|
||||
if (FORCE_SSSE3)
|
||||
message(WARNING "FORCE_SSSE3 flag is deprecated, please use ARCH_OPT option.")
|
||||
set(ARCH_OPT "")
|
||||
if (C_MSVC)
|
||||
if (MSVC)
|
||||
if (ARCHITECTURE_x86)
|
||||
set(ARCH_OPT "SSE2")
|
||||
endif()
|
||||
@ -127,7 +127,7 @@ endif()
|
||||
if (FORCE_SSE41)
|
||||
message(WARNING "FORCE_SSE41 flag is deprecated, please use ARCH_OPT option.")
|
||||
set(ARCH_OPT "")
|
||||
if (C_MSVC)
|
||||
if (MSVC)
|
||||
if (ARCHITECTURE_x86)
|
||||
set(ARCH_OPT "SSE2")
|
||||
else()
|
||||
@ -138,7 +138,7 @@ if (FORCE_SSE41)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (C_MSVC)
|
||||
if (MSVC)
|
||||
# Glue to make ARCH_OPT more flexible for MSVC
|
||||
if (ARCH_OPT STREQUAL "native")
|
||||
detect_msvc_native_opt()
|
||||
@ -165,7 +165,7 @@ message(STATUS "Target architecture: ${ARCHITECTURE}-${ARCH_OPT}")
|
||||
|
||||
cmake_push_check_state(RESET)
|
||||
if (ARCH_OPT)
|
||||
if(C_MSVC)
|
||||
if(MSVC)
|
||||
set(CMAKE_REQUIRED_FLAGS "/arch:${ARCH_OPT}")
|
||||
add_compile_options(${CMAKE_REQUIRED_FLAGS})
|
||||
else()
|
||||
@ -173,7 +173,7 @@ if (ARCH_OPT)
|
||||
add_compile_options(-march=${ARCH_OPT})
|
||||
endif()
|
||||
elseif(FORCE_SSSE3 OR FORCE_SSE41)
|
||||
if (NOT C_MSVC)
|
||||
if (NOT MSVC)
|
||||
set(CMAKE_REQUIRED_FLAGS ${FORCE_OPT})
|
||||
add_compile_options(${FORCE_OPT})
|
||||
endif()
|
||||
@ -185,7 +185,7 @@ if (NOT FLAG_SUPPORTED)
|
||||
endif()
|
||||
|
||||
if (ARCHITECTURE_ARM)
|
||||
if (C_MSVC)
|
||||
if (MSVC)
|
||||
force_ext_available(ARM_NEON)
|
||||
else()
|
||||
list(APPEND CMAKE_REQUIRED_FLAGS -mfpu=neon)
|
||||
|
@ -1,9 +0,0 @@
|
||||
include_guard(GLOBAL)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(C_CLANG 1)
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
set(C_GCC 1)
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
set(C_MSVC 1)
|
||||
endif()
|
@ -17,7 +17,7 @@ include_directories(
|
||||
${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client
|
||||
)
|
||||
|
||||
if (C_GCC OR C_CLANG)
|
||||
if (NOT MSVC)
|
||||
set_target_properties(swagger PROPERTIES COMPILE_FLAGS "-Wno-conversion-null -Wno-unused-variable -Wno-unused-parameter")
|
||||
endif()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user