Add a Cmake generic build option and remove x86_32 build capabilities.

Adds the ability to build our generic build option without manually enabling it in the cmake file.
If trying to build on a x86_32 host, throw a fatal error but say that a binary can be built as a generic build if one wants.
This commit is contained in:
Ryan Houdek 2014-05-25 20:52:52 -05:00
parent a2d73ed525
commit 28e643c384
1 changed files with 32 additions and 29 deletions

View File

@ -11,6 +11,7 @@ option(USE_UPNP "Enables UPnP port mapping support" ON)
option(DISABLE_WX "Disable wxWidgets (use CLI interface)" OFF) option(DISABLE_WX "Disable wxWidgets (use CLI interface)" OFF)
option(ENABLE_PCH "Use PCH to speed up compilation" ON) option(ENABLE_PCH "Use PCH to speed up compilation" ON)
option(ENABLE_LTO "Enables Link Time Optimization" OFF) option(ENABLE_LTO "Enables Link Time Optimization" OFF)
option(ENABLE_GENERIC "Enables generic build that should run on any little-endian host" OFF)
option(OPENMP "Enable OpenMP parallelization" ON) option(OPENMP "Enable OpenMP parallelization" ON)
option(ENCODE_FRAMEDUMPS "Encode framedumps in AVI format" ON) option(ENCODE_FRAMEDUMPS "Encode framedumps in AVI format" ON)
@ -134,37 +135,39 @@ else()
add_definitions(-D_ARCH_32=1) add_definitions(-D_ARCH_32=1)
endif() endif()
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^x86" OR if(NOT ENABLE_GENERIC)
${CMAKE_SYSTEM_PROCESSOR} MATCHES "i.86" OR if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^x86" OR
${CMAKE_SYSTEM_NAME} MATCHES "Darwin") ${CMAKE_SYSTEM_PROCESSOR} MATCHES "i.86" OR
add_definitions(-msse2) ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(_M_X86 1) if(_ARCH_64)
add_definitions(-D_M_X86=1) set(_M_X86 1)
if(_ARCH_64) set(_M_X86_64 1)
set(_M_X86_64 1) add_definitions(-D_M_X86=1 -D_M_X86_64=1 -msse2)
add_definitions(-D_M_X86_64=1) else()
message(FATAL_ERROR "x86_32 is an unsupported platform. Enable generic build if you really want a JIT-less binary.")
endif()
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^arm")
# This option only applies to 32bit ARM
set(_M_ARM 1)
set(_M_ARM_32 1)
add_definitions(-D_M_ARM=1 -D_M_ARM_32=1)
# ARMv7 isn't a generic build anymore, this shouldn't need to be defined
set(ENABLE_GENERIC 1)
if(${ANDROID_NDK_ABI_NAME} MATCHES "armeabi-v7a")
add_definitions(-marm -march=armv7-a)
endif()
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
# This option only applies to 64bit ARM
set(_M_ARM 1)
set(_M_ARM_64 1)
add_definitions(-D_M_ARM=1 -D_M_ARM_64=1)
set(ENABLE_GENERIC 1)
else() else()
set(_M_X86_32 1) set(ENABLE_GENERIC 1)
add_definitions(-D_M_X86_32=1)
endif() endif()
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^arm") endif()
# This option only applies to 32bit ARM
set(_M_ARM 1) if(ENABLE_GENERIC)
set(_M_ARM_32 1)
add_definitions(-D_M_ARM=1 -D_M_ARM_32=1)
set(_M_GENERIC 1)
add_definitions(-D_M_GENERIC=1)
if(${ANDROID_NDK_ABI_NAME} MATCHES "armeabi-v7a")
add_definitions(-marm -march=armv7-a)
endif()
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
# This option only applies to 64bit ARM
set(_M_ARM 1)
set(_M_ARM_64 1)
add_definitions(-D_M_ARM=1 -D_M_ARM_64=1)
set(_M_GENERIC 1)
add_definitions(-D_M_GENERIC=1)
else()
message("Warning! Building generic build!") message("Warning! Building generic build!")
set(_M_GENERIC 1) set(_M_GENERIC 1)
add_definitions(-D_M_GENERIC=1) add_definitions(-D_M_GENERIC=1)