mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
CMake Build: Tidy up when -msse2 is passed to gcc (#622)
* Define CMAKE_ARM_COMPILER automatically (#469) Makes use of CMAKE_SYSTEM_PROCESSOR to detect whether compilation is happening for an ARM architecture. * Use the correct guard for specifying msse2 compiler flags. Bruteforce and conversions were only checking against ANDROID which was not sufficient for ARM Linux builds. * Remove redundant uses of the msse2 compiler flag. * Globally set -msse2 for x86/amd64 gcc, Apple and Clang builds. This is a change in behaviour. Prior to this commit, msse2 was only set for bruteforce and conversions. msse and mfpmath=sse were already set globally prior to this change.
This commit is contained in:
@@ -122,17 +122,16 @@ include(CheckFunctionExists)
|
||||
include(CheckIncludeFiles)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?Clang")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-narrowing")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-narrowing")
|
||||
# -msse -mfpmath=sse to force gcc to use sse for float math,
|
||||
# avoiding excess precision problems that cause tests like int2float
|
||||
# to falsely fail. -ffloat-store also works, but WG suggested
|
||||
# that sse would be better.
|
||||
if(CMAKE_ARM_COMPILER OR ANDROID)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-narrowing")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-narrowing")
|
||||
else(CMAKE_ARM_COMPILER OR ANDROID)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse -mfpmath=sse -Wno-narrowing")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse -mfpmath=sse -Wno-narrowing")
|
||||
endif(CMAKE_ARM_COMPILER OR ANDROID)
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*" OR CMAKE_SYSTEM_PROCESSOR MATCHES "i686.*|i386.*|x86.*")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse -msse2 -mfpmath=sse")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse -msse2 -mfpmath=sse")
|
||||
endif()
|
||||
else()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D__SSE__")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D__SSE__")
|
||||
|
||||
Reference in New Issue
Block a user