Include some rather simple CMAKE_TOOLCHAIN_FILE.

- Update the build.sh and fix some typos.
  + Don't add the OSX ones because I have not tested them and it won't
    even build anyway due to the libaio dependency. Needs to use POSIX AIO
    or something else.
- They are rather simple and all the magic happens in two lines.
  + First line tells cmake to get ready to compile FOR linux or darwin.
    It also sets CMAKE_CROSSCOMPILING to true which is the only way to
    let cmake known that we are using stuff not from the host.
  + CMAKE_C_COMPILER/CMAKE_CXX_COMPILER are basically used to detect
    the architecture of the target. Since I used generic cc/c++ the
    hardcoded -m32 is needed to ensure we get TARGET=i386. Also
    since I hardcode -m32 and use c++/cc it's to be noted that
    we can only do i386->i386 (trivial), amd64 -> i386, and x32->i386.
    .
    Using something like i586-linux-gnu-{gcc,g++} would also work and
    enable arm -> i386, etc but it's infeasible and impractical to do all
    the combinations. File is simple enough that a distro or user can
    create their own and cross compiling is rather tedious compared
    to using a chroot to compile it.
- I tested it in Debian with "dpkg-buildpackage -ai386" but installing the
  build dependencies was rather tedious.
This commit is contained in:
Miguel A. Colón Vélez 2014-12-24 18:15:55 -05:00 committed by Gregory Hainaut
parent d6d06d243c
commit b03ca5fcf4
4 changed files with 56 additions and 3 deletions

View File

@ -42,6 +42,7 @@ for ARG in "$@"; do
--wx28 ) flags+=(-DWX28_API=TRUE) ;; --wx28 ) flags+=(-DWX28_API=TRUE) ;;
--gtk3 ) flags+=(-DGTK3_API=TRUE) ;; --gtk3 ) flags+=(-DGTK3_API=TRUE) ;;
--no-simd ) flags+=(-DDISABLE_ADVANCE_SIMD=TRUE) ;; --no-simd ) flags+=(-DDISABLE_ADVANCE_SIMD=TRUE) ;;
--cross-multilib ) flags+=(-DCMAKE_TOOLCHAIN_FILE=cmake/linux-compiler-i386-multilib.cmake) ;;
-D* ) flags+=($ARG) ;; -D* ) flags+=($ARG) ;;
*) *)
@ -54,17 +55,18 @@ for ARG in "$@"; do
echo "--clean : Do a clean build." echo "--clean : Do a clean build."
echo "--extra : Build all plugins" echo "--extra : Build all plugins"
echo echo
echo "** Developper option **" echo "** Developer option **"
echo "--clang : Build with Clang/llvm" echo "--clang : Build with Clang/llvm"
echo "--asan : Enable Address sanitizer" echo "--asan : Enable Address sanitizer"
echo echo
echo "--wx28 : Force wxWidget 2.8" echo "--wx28 : Force wxWidget 2.8"
echo "--glsl : Replace CG backend of ZZogl by GLSL" echo "--glsl : Replace CG backend of ZZogl by GLSL"
echo "--egl : Replace GLX by EGL (ZZogl plugins only)" 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 "--gles : Replace openGL backend of GSdx by openGLES3.1"
echo "--cross-multilib: Build a 32bit PCSX2 on a 64bit machine using multilib."
echo echo
echo "** Hardcode Developper option **" echo "** Hardcode Developer option **"
echo "--no-simd : Only allow sse2" echo "--no-simd : Only allow sse2"
echo "--gtk3 : replace GTK2 by GTK3" echo "--gtk3 : replace GTK2 by GTK3"
exit 1 exit 1

View File

@ -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)

View File

@ -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)

View File

@ -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)