mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-28 15:53:55 -04:00
CMake: Fix detection and use of SSE2 compiler flag on MSVC
This is one half of the fix for #1072
This commit is contained in:
parent
fa04d77b57
commit
3786dc2aea
@ -6,6 +6,7 @@
|
||||
# file based on the user's selected configure variables.
|
||||
#
|
||||
|
||||
include(CheckCXXCompilerFlag)
|
||||
include(CheckCXXSourceCompiles)
|
||||
include(CheckCSourceRuns)
|
||||
include(CheckIncludeFileCXX)
|
||||
@ -137,8 +138,18 @@ check_include_file_cxx(stdint.h PHAVE_STDINT_H)
|
||||
#set(HAVE_POSIX_THREADS ${CMAKE_USE_PTHREADS_INIT})
|
||||
|
||||
# Do we have SSE2 support?
|
||||
include(CheckCXXCompilerFlag)
|
||||
check_cxx_compiler_flag(-msse2 HAVE_SSE2)
|
||||
if(MSVC)
|
||||
check_cxx_source_compiles("
|
||||
#if !defined(__SSE2__) && !defined(_M_X64) && !defined(_M_AMD64) && !defined(_M_IX86_FP)
|
||||
#error no
|
||||
#endif
|
||||
int main (int argc, char *argv[]) {
|
||||
return 0;
|
||||
}
|
||||
" HAVE_SSE2)
|
||||
else()
|
||||
check_cxx_compiler_flag(-msse2 HAVE_SSE2)
|
||||
endif()
|
||||
|
||||
# Set LINK_ALL_STATIC if we're building everything as static libraries.
|
||||
# Also set the library type used for "modules" appropriately.
|
||||
|
@ -32,11 +32,17 @@ set(P3PNMIMAGE_IGATEEXT
|
||||
pfmFile_ext.h
|
||||
)
|
||||
|
||||
if(HAVE_SSE2 AND CMAKE_SIZEOF_VOID_P EQUAL 4 AND CMAKE_SYSTEM_PROCESSOR MATCHES "86")
|
||||
if(HAVE_SSE2 AND CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
# It's only necessary to do this on 32-bit x86; 64-bit makes SSE2 builtin.
|
||||
if(MSVC)
|
||||
set_source_files_properties(convert_srgb_sse2.cxx PROPERTIES
|
||||
SKIP_UNITY_BUILD_INCLUSION YES
|
||||
COMPILE_FLAGS /arch:SSE2)
|
||||
else()
|
||||
set_source_files_properties(convert_srgb_sse2.cxx PROPERTIES
|
||||
SKIP_UNITY_BUILD_INCLUSION YES
|
||||
COMPILE_FLAGS -msse2)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
composite_sources(p3pnmimage P3PNMIMAGE_SOURCES)
|
||||
|
Loading…
x
Reference in New Issue
Block a user