mirror of https://github.com/PCSX2/pcsx2.git
Add a CMake compile time option for building a 64bit binary.
By default the cmake build will still cross compile a 32bit binary and spout a message about it if not enabled. This doesn't fix the 64bit build issues, just makes it easier for someone to test 64bit builds in the future. Look towards a bright future instead of a dark and gloomy past
This commit is contained in:
parent
c5d2343f51
commit
35979bb5a6
|
@ -1,3 +1,6 @@
|
|||
# CMake options
|
||||
option(64BIT_BUILD "Enable a x86_64 build instead of cross compiling (developer option)" OFF)
|
||||
|
||||
# Project Name
|
||||
project(Pcsx2)
|
||||
|
||||
|
@ -40,6 +43,16 @@ if(POLICY CMP0022)
|
|||
cmake_policy(SET CMP0022 OLD)
|
||||
endif()
|
||||
|
||||
# Architecture bitness detection
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(_ARCH_64 1)
|
||||
add_definitions(-D_ARCH_64=1)
|
||||
else()
|
||||
set(_ARCH_32 1)
|
||||
add_definitions(-D_ARCH_32=1)
|
||||
endif()
|
||||
|
||||
|
||||
# Variable to check that people use the good file
|
||||
set(TOP_CMAKE_WAS_SOURCED TRUE)
|
||||
|
||||
|
@ -47,17 +60,18 @@ set(TOP_CMAKE_WAS_SOURCED TRUE)
|
|||
# It would avoid compilation failure later.
|
||||
# Note: disable the failure in package mode
|
||||
if(NOT PACKAGE_MODE)
|
||||
if(CMAKE_SIZEOF_VOID_P MATCHES "8")
|
||||
if(_ARCH_64 AND !64BIT_BUILD)
|
||||
message(WARNING "
|
||||
PCSX2 does not support a 64-bits environment and has no plan to support a 64-bits architecture in the future.
|
||||
It would need a complete rewrite of the core emulator and a lot of time.
|
||||
|
||||
You can still run a 32-bits binary if you install all 32-bits libraries (runtime and dev).")
|
||||
endif(CMAKE_SIZEOF_VOID_P MATCHES "8")
|
||||
endif()
|
||||
endif(NOT PACKAGE_MODE)
|
||||
|
||||
# 64 bits specific configuration
|
||||
if(CMAKE_SIZEOF_VOID_P MATCHES "8")
|
||||
# 64 bits cross-compile specific configuration
|
||||
if(_ARCH_64 AND !64BIT_BUILD)
|
||||
message("Compiling 32bit build on 64bit architecture")
|
||||
# Do not search library in /usr/lib64
|
||||
SET_PROPERTY(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS OFF)
|
||||
# Probably useless but it will not harm
|
||||
|
@ -67,14 +81,12 @@ if(CMAKE_SIZEOF_VOID_P MATCHES "8")
|
|||
if(EXISTS "/usr/lib32")
|
||||
set(CMAKE_LIBRARY_ARCHITECTURE "../lib32")
|
||||
endif()
|
||||
endif(CMAKE_SIZEOF_VOID_P MATCHES "8")
|
||||
|
||||
# Debian/ubuntu drop /usr/lib32 and move /usr/lib to /usr/lib/i386-linux-gnu
|
||||
if(EXISTS "/usr/lib/i386-linux-gnu")
|
||||
set(CMAKE_LIBRARY_ARCHITECTURE "i386-linux-gnu")
|
||||
# Debian/ubuntu drop /usr/lib32 and move /usr/lib to /usr/lib/i386-linux-gnu
|
||||
if(EXISTS "/usr/lib/i386-linux-gnu")
|
||||
set(CMAKE_LIBRARY_ARCHITECTURE "i386-linux-gnu")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# * -fPIC option was removed for multiple reasons.
|
||||
# - Code only supports the x86 architecture.
|
||||
# - code uses the ebx register so it's not compliant with PIC.
|
||||
|
|
|
@ -98,7 +98,11 @@ set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")
|
|||
# -Wno-unused-function: warn for function not used in release build
|
||||
set(DEFAULT_WARNINGS "-Wno-attributes -Wstrict-aliasing -Wno-missing-field-initializers -Wno-unused-function")
|
||||
set(HARDEING_OPT "-D_FORTIFY_SOURCE=2 -Wformat -Wformat-security")
|
||||
set(DEFAULT_GCC_FLAG "-m32 -msse -msse2 -march=i686 -pthread ${DEFAULT_WARNINGS} ${HARDEING_OPT}")
|
||||
if(_ARCH_64 AND !64BIT_BUILD)
|
||||
set(DEFAULT_GCC_FLAG "-m32 -msse -msse2 -march=i686 -pthread ${DEFAULT_WARNINGS} ${HARDEING_OPT}")
|
||||
else()
|
||||
set(DEFAULT_GCC_FLAG "-msse -msse2 -pthread ${DEFAULT_WARNINGS} ${HARDEING_OPT}")
|
||||
endif()
|
||||
if(CMAKE_BUILD_TYPE MATCHES "Debug|Devel")
|
||||
set(DEFAULT_GCC_FLAG "-g ${DEFAULT_GCC_FLAG}")
|
||||
endif()
|
||||
|
|
|
@ -143,7 +143,7 @@ if(wxWidgets_FOUND)
|
|||
if(Linux)
|
||||
# Force the use of 32 bit library configuration on
|
||||
# 64 bits machine with 32 bits library in /usr/lib32
|
||||
if(CMAKE_SIZEOF_VOID_P MATCHES "8")
|
||||
if(_ARCH_64 AND !64BIT_BUILD)
|
||||
## There is no guarantee that wx-config is a link to a 32 bits library. So you need to force the destinity
|
||||
# Library can go into 3 path major paths (+ multiarch but you will see that later when implementation is done)
|
||||
# 1/ /usr/lib32 (32 bits only)
|
||||
|
|
Loading…
Reference in New Issue