mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 11:19:10 +00:00
Don't use CPUID call on targets that don't support it
This commit is contained in:
@ -21,6 +21,16 @@ if(NOT WCHAR_BYTES)
|
|||||||
endif(NOT WCHAR_BYTES)
|
endif(NOT WCHAR_BYTES)
|
||||||
add_definitions(-DWCHAR_BYTES=${WCHAR_BYTES})
|
add_definitions(-DWCHAR_BYTES=${WCHAR_BYTES})
|
||||||
|
|
||||||
|
try_compile(HAVE_CPUID ${PROJECT_BINARY_DIR}
|
||||||
|
${PROJECT_SOURCE_DIR}/cmake/check_cpuid.cpp
|
||||||
|
OUTPUT_VARIABLE OUTPUT)
|
||||||
|
if(HAVE_CPUID)
|
||||||
|
add_definitions(-DHAVE_CPUID)
|
||||||
|
message("CPUID header found -- using hardware math acceleration when available")
|
||||||
|
else()
|
||||||
|
message("CPUID header not found -- using software math")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(CoreLib_SOURCES
|
set(CoreLib_SOURCES
|
||||||
HeadSpin.cpp
|
HeadSpin.cpp
|
||||||
hsBitVector.cpp
|
hsBitVector.cpp
|
||||||
|
@ -40,12 +40,18 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
|
|
||||||
*==LICENSE==*/
|
*==LICENSE==*/
|
||||||
|
|
||||||
#if defined(_MSC_VER) || ((defined(_WIN32) || defined(_WIN64)) && defined(__INTEL_COMPILER))
|
#if defined(HAVE_CPUID)
|
||||||
# include <intrin.h>
|
# if defined(_MSC_VER) || ((defined(_WIN32) || defined(_WIN64)) && defined(__INTEL_COMPILER))
|
||||||
# define MSC_COMPATIBLE
|
# include <intrin.h>
|
||||||
#elif defined(__GNUC__)
|
# define MSC_COMPATIBLE
|
||||||
# include <cpuid.h>
|
# elif defined(__GNUC__)
|
||||||
# define GCC_COMPATIBLE
|
# include <cpuid.h>
|
||||||
|
# define GCC_COMPATIBLE
|
||||||
|
# else
|
||||||
|
# define SOFTWARE_ONLY
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# define SOFTWARE_ONLY
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "hsCpuID.h"
|
#include "hsCpuID.h"
|
||||||
@ -57,7 +63,7 @@ hsCpuId::hsCpuId() {
|
|||||||
const unsigned int ssse3_flag = 1<<9;
|
const unsigned int ssse3_flag = 1<<9;
|
||||||
const unsigned int sse41_flag = 1<<19;
|
const unsigned int sse41_flag = 1<<19;
|
||||||
const unsigned int sse42_flag = 1<<20;
|
const unsigned int sse42_flag = 1<<20;
|
||||||
const unsigned int avx_flag = 1 << 28;
|
const unsigned int avx_flag = 1<<28;
|
||||||
|
|
||||||
unsigned int ax = 0, bx = 0, cx = 0, dx = 0;
|
unsigned int ax = 0, bx = 0, cx = 0, dx = 0;
|
||||||
|
|
||||||
|
11
cmake/check_cpuid.cpp
Normal file
11
cmake/check_cpuid.cpp
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#if defined(_MSC_VER) || ((defined(_WIN32) || defined(_WIN64)) && defined(__INTEL_COMPILER))
|
||||||
|
# include <intrin.h>
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
# include <cpuid.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Just needed to look for the headers -- this just makes the compiler happy. */
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
Reference in New Issue
Block a user