diff --git a/build.sh b/build.sh index 160b6cb30e..6a9c64bb82 100755 --- a/build.sh +++ b/build.sh @@ -42,6 +42,7 @@ for ARG in "$@"; do --wx28 ) flags+=(-DWX28_API=TRUE) ;; --gtk3 ) flags+=(-DGTK3_API=TRUE) ;; --no-simd ) flags+=(-DDISABLE_ADVANCE_SIMD=TRUE) ;; + --cross-multilib ) flags+=(-DCMAKE_TOOLCHAIN_FILE=cmake/linux-compiler-i386-multilib.cmake) ;; -D* ) flags+=($ARG) ;; *) @@ -54,17 +55,18 @@ for ARG in "$@"; do echo "--clean : Do a clean build." echo "--extra : Build all plugins" echo - echo "** Developper option **" + echo "** Developer option **" echo "--clang : Build with Clang/llvm" echo "--asan : Enable Address sanitizer" echo echo "--wx28 : Force wxWidget 2.8" echo "--glsl : Replace CG backend of ZZogl by GLSL" echo "--egl : Replace GLX by EGL (ZZogl plugins only)" - echo "--sdl2 : Build with SDL2 (crash if wx is linked to SDL1)" + echo "--sdl2 : Build with SDL2 (crashes if wx is linked to SDL1.2)" echo "--gles : Replace openGL backend of GSdx by openGLES3.1" + echo "--cross-multilib: Build a 32bit PCSX2 on a 64bit machine using multilib." echo - echo "** Hardcode Developper option **" + echo "** Hardcode Developer option **" echo "--no-simd : Only allow sse2" echo "--gtk3 : replace GTK2 by GTK3" exit 1 diff --git a/cmake/darwin-compiler-i386-clang.cmake b/cmake/darwin-compiler-i386-clang.cmake new file mode 100644 index 0000000000..182a6d4a91 --- /dev/null +++ b/cmake/darwin-compiler-i386-clang.cmake @@ -0,0 +1,20 @@ +# Tell cmake we are cross compiling and targeting darwin +set(CMAKE_SYSTEM_NAME Darwin) +set(CMAKE_SYSTEM_PROCESSOR i686) + +# Use clang and target i686-apple-darwin. +set(CMAKE_C_COMPILER clang -m32) +set(CMAKE_C_COMPILER_TARGET i686-apple-darwin) +set(CMAKE_CXX_COMPILER clang++ -m32) +set(CMAKE_CXX_COMPILER_TARGET i686-apple-darwin) + +# Enable clang +set(USE_CLANG TRUE) + +# If given a CMAKE_FIND_ROOT_PATH then +# FIND_PROGRAM ignores CMAKE_FIND_ROOT_PATH (probably can't run) +# FIND_{LIBRARY,INCLUDE,PACKAGE} only uses the files in CMAKE_FIND_ROOT_PATH. +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) diff --git a/cmake/darwin-compiler-i386-generic.cmake b/cmake/darwin-compiler-i386-generic.cmake new file mode 100644 index 0000000000..b2ac14e6a3 --- /dev/null +++ b/cmake/darwin-compiler-i386-generic.cmake @@ -0,0 +1,15 @@ +# Tell cmake we are cross compiling and targeting darwin +set(CMAKE_SYSTEM_NAME Darwin) +set(CMAKE_SYSTEM_PROCESSOR i686) + +# Leave it generic since it could be clang, gnu, etc. +set(CMAKE_C_COMPILER cc -m32) +set(CMAKE_CXX_COMPILER c++ -m32) + +# If given a CMAKE_FIND_ROOT_PATH then +# FIND_PROGRAM ignores CMAKE_FIND_ROOT_PATH (probably can't run) +# FIND_{LIBRARY,INCLUDE,PACKAGE} only uses the files in CMAKE_FIND_ROOT_PATH. +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) diff --git a/cmake/linux-compiler-i386-multilib.cmake b/cmake/linux-compiler-i386-multilib.cmake new file mode 100644 index 0000000000..ddf7ceaf5d --- /dev/null +++ b/cmake/linux-compiler-i386-multilib.cmake @@ -0,0 +1,16 @@ +# Tell cmake we are cross compiling and targeting linux +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR i686) + +# It could be i?86-*linux-gnu, x86_64-*linux-gnu, x86_64-*linux-gnux32, etc. +# Leave it generic to only support amd64 or x32 to i386 with any compiler. +set(CMAKE_C_COMPILER cc -m32) +set(CMAKE_CXX_COMPILER c++ -m32) + +# If given a CMAKE_FIND_ROOT_PATH then +# FIND_PROGRAM ignores CMAKE_FIND_ROOT_PATH (probably can't run) +# FIND_{LIBRARY,INCLUDE,PACKAGE} only uses the files in CMAKE_FIND_ROOT_PATH. +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)