From be720b96c191e83c5eab4d6febe3b68b2aa1fae5 Mon Sep 17 00:00:00 2001 From: Juha Laukkanen Date: Tue, 17 Nov 2015 19:25:12 +0200 Subject: [PATCH] Added OSX Darwin v13+ cmake files. --- build.sh | 25 +++++++++++++++++------- cmake/darwin13-compiler-i386-clang.cmake | 20 +++++++++++++++++++ 2 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 cmake/darwin13-compiler-i386-clang.cmake diff --git a/build.sh b/build.sh index be3f2c60fe..2500837a0d 100755 --- a/build.sh +++ b/build.sh @@ -26,6 +26,21 @@ CoverityBuild=0 cppcheck=0 clangTidy=0 +if [[ $(uname -s) == 'Darwin' ]]; then + ncpu=$(sysctl -n hw.ncpu) + release=$(uname -r) + if [[ ${release:0:2} -lt 13 ]]; then + echo "This old OSX version is not supported! Build will fail." + toolfile=cmake/darwin-compiler-i386-clang.cmake + else + echo "Using Mavericks build with C++11 support." + toolfile=cmake/darwin13-compiler-i386-clang.cmake + fi +else + ncpu=$(grep -w -c processor /proc/cpuinfo) + toolfile=cmake/linux-compiler-i386-multilib.cmake +fi + for ARG in "$@"; do case "$ARG" in --clean ) cleanBuild=1 ;; @@ -44,7 +59,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); useCross=1; ;; + --cross-multilib ) flags+=(-DCMAKE_TOOLCHAIN_FILE=$toolfile); useCross=1; ;; --no-cross-multilib ) useCross=0; ;; --coverity ) CoverityBuild=1; cleanBuild=1; ;; -D* ) flags+=($ARG) ;; @@ -98,7 +113,7 @@ fi if [[ "$useCross" -eq 2 ]] && [[ "$(getconf LONG_BIT 2> /dev/null)" != 32 ]]; then echo "Forcing cross compilation." - flags+=(-DCMAKE_TOOLCHAIN_FILE=cmake/linux-compiler-i386-multilib.cmake) + flags+=(-DCMAKE_TOOLCHAIN_FILE=$toolfile) elif [[ "$useCross" -ne 1 ]]; then useCross=0 fi @@ -125,11 +140,7 @@ else cmake "${flags[@]}" $root 2>&1 | tee -a $log fi -if [[ $(uname -s) == 'Darwin' ]]; then - ncpu=$(sysctl -n hw.ncpu) -else - ncpu=$(grep -w -c processor /proc/cpuinfo) -fi + ############################################################ # CPP check build diff --git a/cmake/darwin13-compiler-i386-clang.cmake b/cmake/darwin13-compiler-i386-clang.cmake new file mode 100644 index 0000000000..40785dbd7f --- /dev/null +++ b/cmake/darwin13-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-darwin13.0.0 (Mavericks) +set(CMAKE_C_COMPILER clang -m32) +#set(CMAKE_C_COMPILER_TARGET i686-apple-darwin13.0.0) +set(CMAKE_CXX_COMPILER clang++ -m32) +#set(CMAKE_CXX_COMPILER_TARGET i686-apple-darwin13.0.0) + +#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpmath=sse -msse2") +#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpmath=sse -msse2") + +# 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)