Added OSX Darwin v13+ cmake files.

This commit is contained in:
Juha Laukkanen 2015-11-17 19:25:12 +02:00
parent 7a69812b17
commit be720b96c1
2 changed files with 38 additions and 7 deletions

View File

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

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