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__")
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
set_source_files_properties(COMPILE_FLAGS -msse2)
|
||||
|
||||
string(TOLOWER ${MODULE_NAME} MODULE_NAME_LOWER)
|
||||
|
||||
set(${MODULE_NAME}_OUT ${CONFORMANCE_PREFIX}${MODULE_NAME_LOWER}${CONFORMANCE_SUFFIX})
|
||||
|
||||
@@ -25,10 +25,4 @@ set_source_files_properties(
|
||||
COMPILE_FLAGS -march=i686)
|
||||
endif(NOT CMAKE_CL_64 AND NOT MSVC AND NOT ANDROID)
|
||||
|
||||
if(NOT ANDROID)
|
||||
set_source_files_properties(
|
||||
Sleep.cpp test_conversions.cpp basic_test_conversions.cpp
|
||||
COMPILE_FLAGS -msse2)
|
||||
endif(NOT ANDROID)
|
||||
|
||||
include(../CMakeCommon.txt)
|
||||
|
||||
@@ -21,26 +21,6 @@ set(${MODULE_NAME}_SOURCES
|
||||
unary_u.cpp
|
||||
)
|
||||
|
||||
|
||||
if (NOT ANDROID)
|
||||
set_source_files_properties(
|
||||
FunctionList.cpp
|
||||
Sleep.cpp
|
||||
binary.cpp
|
||||
binaryOperator.cpp
|
||||
Utility.cpp
|
||||
binary_i.cpp
|
||||
binary_two_results_i.cpp
|
||||
i_unary.cpp
|
||||
macro_binary.cpp
|
||||
macro_unary.cpp
|
||||
mad.cpp
|
||||
main.cpp reference_math.cpp
|
||||
ternary.cpp unary.cpp unary_two_results.cpp
|
||||
unary_two_results_i.cpp unary_u.cpp
|
||||
COMPILE_FLAGS -msse2 )
|
||||
endif(NOT ANDROID)
|
||||
|
||||
if (NOT CMAKE_CL_64 AND NOT MSVC AND NOT ANDROID)
|
||||
set_source_files_properties(
|
||||
${MODULE_NAME}_SOURCES
|
||||
|
||||
@@ -6,8 +6,4 @@ set(${MODULE_NAME}_SOURCES
|
||||
test_multiple_devices.cpp
|
||||
)
|
||||
|
||||
|
||||
set_source_files_properties(
|
||||
COMPILE_FLAGS -msse2)
|
||||
|
||||
include(../CMakeCommon.txt)
|
||||
|
||||
@@ -15,11 +15,6 @@ set (SPIR_SOURCES
|
||||
add_executable(${SPIR_OUT}
|
||||
${SPIR_SOURCES})
|
||||
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)" AND NOT MSVC)
|
||||
set_source_files_properties(
|
||||
COMPILE_FLAGS -msse2)
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
set_target_properties(${SPIR_OUT} PROPERTIES
|
||||
COMPILE_FLAGS "-fexceptions -frtti")
|
||||
@@ -69,4 +64,3 @@ foreach(input_file ${SPIR_FILES})
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/${input_file}" "$<TARGET_FILE_DIR:${SPIR_OUT}>/"
|
||||
)
|
||||
endforeach(input_file)
|
||||
|
||||
|
||||
@@ -5,7 +5,4 @@ set(${MODULE_NAME}_SOURCES
|
||||
test_thread_dimensions.cpp
|
||||
)
|
||||
|
||||
set_source_files_properties(
|
||||
COMPILE_FLAGS -msse2)
|
||||
|
||||
include(../CMakeCommon.txt)
|
||||
|
||||
@@ -8,8 +8,4 @@ set(${MODULE_NAME}_SOURCES
|
||||
type_replacer.cpp
|
||||
)
|
||||
|
||||
set_source_files_properties(
|
||||
COMPILE_FLAGS -msse2)
|
||||
|
||||
include(../CMakeCommon.txt)
|
||||
|
||||
|
||||
@@ -8,7 +8,4 @@ set(${MODULE_NAME}_SOURCES
|
||||
type_replacer.cpp
|
||||
)
|
||||
|
||||
set_source_files_properties(
|
||||
COMPILE_FLAGS -msse2)
|
||||
|
||||
include(../CMakeCommon.txt)
|
||||
|
||||
Reference in New Issue
Block a user