Common: Ported over Dolphin's code for x86 CPU capability detection.

This commit is contained in:
bunnei 2015-07-21 19:49:33 -04:00
parent 3f69c2039d
commit 4d51792285
5 changed files with 286 additions and 19 deletions

View file

@ -11,8 +11,8 @@ if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git/hooks/pre-commit)
endif()
if (NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-attributes -pthread")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-attributes -pthread -msse4.2")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread -msse4.2")
else()
# Silence "deprecation" warnings
add_definitions(/D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE)
@ -51,6 +51,17 @@ else()
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/DEBUG /INCREMENTAL:NO /OPT:REF,ICF" CACHE STRING "" FORCE)
endif()
# Platform-agnostic definition to check if we are on x86_64
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^x86" OR
${CMAKE_SYSTEM_PROCESSOR} MATCHES "i.86" OR
${CMAKE_SYSTEM_PROCESSOR} MATCHES "[aA][mM][dD]64" OR
APPLE)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(ARCHITECTURE_X64 1)
add_definitions(-DARCHITECTURE_X64=1)
endif()
endif()
add_definitions(-DSINGLETHREADED)
# CMake seems to only define _DEBUG on Windows
set_property(DIRECTORY APPEND PROPERTY