Browse Source

CMake: Test that the compiler has SSE2 support.

Sam Edwards 10 years ago
parent
commit
cdf3e21025
2 changed files with 7 additions and 1 deletions
  1. 4 0
      dtool/LocalSetup.cmake
  2. 3 1
      panda/src/pnmimage/CMakeLists.txt

+ 4 - 0
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]
 

+ 3 - 1
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)