From cdf3e21025352cf5dacd741ccfd7cc8476844d4e Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Wed, 11 Nov 2015 14:35:24 -0800 Subject: [PATCH] CMake: Test that the compiler has SSE2 support. --- dtool/LocalSetup.cmake | 4 ++++ panda/src/pnmimage/CMakeLists.txt | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/dtool/LocalSetup.cmake b/dtool/LocalSetup.cmake index 9f5fe2ed1e..b5ebc89576 100644 --- a/dtool/LocalSetup.cmake +++ b/dtool/LocalSetup.cmake @@ -159,6 +159,10 @@ check_include_file_cxx(typeinfo HAVE_RTTI) # Do we have Posix threads? #set(HAVE_POSIX_THREADS ${CMAKE_USE_PTHREADS_INIT}) +# Do we have SSE2 support? +include(CheckCXXCompilerFlag) +check_cxx_compiler_flag(-msse2 HAVE_SSE2) + #/* Define if needed to have 64-bit file i/o */ #$[cdefine __USE_LARGEFILE64] diff --git a/panda/src/pnmimage/CMakeLists.txt b/panda/src/pnmimage/CMakeLists.txt index 3372d009f1..a813a6fd1e 100644 --- a/panda/src/pnmimage/CMakeLists.txt +++ b/panda/src/pnmimage/CMakeLists.txt @@ -30,7 +30,9 @@ set(P3PNMIMAGE_IGATEEXT pfmFile_ext.h ) -set_source_files_properties(convert_srgb_sse2.cxx PROPERTIES COMPILE_FLAGS -msse2) +if(HAVE_SSE2) + set_source_files_properties(convert_srgb_sse2.cxx PROPERTIES COMPILE_FLAGS -msse2) +endif() composite_sources(p3pnmimage P3PNMIMAGE_SOURCES) add_library(p3pnmimage ${P3PNMIMAGE_HEADERS} ${P3PNMIMAGE_SOURCES} convert_srgb_sse2.cxx)