diff --git a/build.sh b/build.sh index 919dc222db..7a5747bd80 100755 --- a/build.sh +++ b/build.sh @@ -20,18 +20,11 @@ set -u # Function declarations set_ncpu_toolfile() { - ncpu=$(getconf _NPROCESSORS_ONLN) + ncpu=$(getconf NPROCESSORS_ONLN 2>/dev/null || getconf _NPROCESSORS_ONLN) if [ "$(uname -s)" = 'Darwin' ]; then - # Get the major Darwin/OSX version. - if [ "$(sysctl -n kern.osrelease | cut -d . -f 1)" -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 + i386_flag="-DCMAKE_OSX_ARCHITECTURES=i386" elif [ "$(uname -s)" != 'FreeBSD' ]; then - toolfile=cmake/linux-compiler-i386-multilib.cmake + i386_flag="-DCMAKE_TOOLCHAIN_FILE=cmake/linux-compiler-i386-multilib.cmake" fi } @@ -205,13 +198,13 @@ for ARG in "$@"; do --use-system-yaml ) flags="$flags -DUSE_SYSTEM_YAML=TRUE" ;; --asan ) flags="$flags -DUSE_ASAN=TRUE" ;; --gtk2 ) flags="$flags -DGTK2_API=TRUE" ;; - --lto ) flags="$flags -DUSE_LTO=TRUE" ;; + --lto ) flags="$flags -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=TRUE" ;; --pgo-optimize ) flags="$flags -DUSE_PGO_OPTIMIZE=TRUE" ;; --pgo-generate ) flags="$flags -DUSE_PGO_GENERATE=TRUE" ;; --no-portaudio ) flags="$flags -DPORTAUDIO_API=FALSE" ;; --no-simd ) flags="$flags -DDISABLE_ADVANCE_SIMD=TRUE" ;; --no-trans ) flags="$flags -DNO_TRANSLATION=TRUE" ;; - --cross-multilib ) flags="$flags -DCMAKE_TOOLCHAIN_FILE=$toolfile"; useCross=1; ;; + --cross-multilib ) flags="$flags $i386_flag"; useCross=1; ;; --no-cross-multilib ) useCross=0; ;; --coverity ) CoverityBuild=1; cleanBuild=1; ;; --vtune ) flags="$flags -DUSE_VTUNE=TRUE" ;; @@ -271,7 +264,7 @@ fi if [ "$useCross" -eq 2 ] && [ "$(getconf LONG_BIT 2> /dev/null)" != 32 ]; then echo "Forcing cross compilation." - flags="$flags -DCMAKE_TOOLCHAIN_FILE=$toolfile" + flags="$flags $i386_flag" elif [ "$useCross" -ne 1 ]; then useCross=0 fi diff --git a/cmake/BuildParameters.cmake b/cmake/BuildParameters.cmake index 55f0ed3e45..55346a0dbb 100644 --- a/cmake/BuildParameters.cmake +++ b/cmake/BuildParameters.cmake @@ -26,7 +26,6 @@ option(USE_VTUNE "Plug VTUNE to profile GS JIT.") #------------------------------------------------------------------------------- # Graphical option #------------------------------------------------------------------------------- -option(REBUILD_SHADER "Rebuild GLSL/CG shader (developer option)") option(BUILD_REPLAY_LOADERS "Build GS replayer to ease testing (developer option)") #------------------------------------------------------------------------------- @@ -73,24 +72,6 @@ else() message(FATAL_ERROR "Unknown compiler: ${CMAKE_CXX_COMPILER_ID}") endif() -#------------------------------------------------------------------------------- -# Select the support of plugin -#------------------------------------------------------------------------------- -option(BUILTIN_GS "Disable support of GS plugin (developer option)") -option(BUILTIN_PAD "Disable support of PAD plugin (developer option)") -option(BUILTIN_USB "Disable support of USB plugin (developer option)") - -set(PLUGIN_SUPPORT "") -if(BUILTIN_GS) - set(PLUGIN_SUPPORT "${PLUGIN_SUPPORT} -DBUILTIN_GS_PLUGIN") -endif() -if(BUILTIN_PAD) - set(PLUGIN_SUPPORT "${PLUGIN_SUPPORT} -DBUILTIN_PAD_PLUGIN") -endif() -if(BUILTIN_USB) - set(PLUGIN_SUPPORT "${PLUGIN_SUPPORT} -DBUILTIN_USB_PLUGIN") -endif() - #------------------------------------------------------------------------------- # if no build type is set, use Devel as default # Note without the CMAKE_BUILD_TYPE options the value is still defined to "" @@ -235,7 +216,6 @@ endif() #------------------------------------------------------------------------------- # Set some default compiler flags #------------------------------------------------------------------------------- -option(USE_LTO "Enable LTO optimization") option(USE_PGO_GENERATE "Enable PGO optimization (generate profile)") option(USE_PGO_OPTIMIZE "Enable PGO optimization (use profile)") @@ -297,18 +277,6 @@ elseif (USE_GCC) set(DBG "-ggdb3 -fno-omit-frame-pointer") endif() -if (USE_LTO) - include(ProcessorCount) - ProcessorCount(ncpu) - set(LTO_FLAGS "-fuse-linker-plugin -flto=${ncpu}") - set(DBG "") # not supported with LTO - set(CMAKE_AR /usr/bin/gcc-ar CACHE STRING "Archiver" FORCE) - set(CMAKE_RANLIB /usr/bin/gcc-ranlib CACHE STRING "ranlib" FORCE) - set(CMAKE_NM /usr/bin/gcc-nm CACHE STRING "nm" FORCE) -else() - set(LTO_FLAGS "") -endif() - if (USE_PGO_GENERATE OR USE_PGO_OPTIMIZE) set(PGO_FLAGS "-fprofile-dir=${CMAKE_SOURCE_DIR}/profile") endif() @@ -365,7 +333,7 @@ endif() # Note: -DGTK_DISABLE_DEPRECATED can be used to test a build without gtk deprecated feature. It could be useful to port to a newer API # Disabling the hardening flags for the moment, as they spam quite a bit. ${HARDENING_FLAG} -set(DEFAULT_GCC_FLAG "${ARCH_FLAG} ${COMMON_FLAG} ${DEFAULT_WARNINGS} ${AGGRESSIVE_WARNING} ${DEBUG_FLAG} ${ASAN_FLAG} ${OPTIMIZATION_FLAG} ${LTO_FLAGS} ${PGO_FLAGS} ${PLUGIN_SUPPORT}") +set(DEFAULT_GCC_FLAG "${ARCH_FLAG} ${COMMON_FLAG} ${DEFAULT_WARNINGS} ${AGGRESSIVE_WARNING} ${DEBUG_FLAG} ${ASAN_FLAG} ${OPTIMIZATION_FLAG} ${LTO_FLAGS} ${PGO_FLAGS}") # c++ only flags set(DEFAULT_CPP_FLAG "${DEFAULT_GCC_FLAG} -Wno-invalid-offsetof") diff --git a/cmake/darwin-compiler-i386-clang.cmake b/cmake/darwin-compiler-i386-clang.cmake deleted file mode 100644 index b968afeca8..0000000000 --- a/cmake/darwin-compiler-i386-clang.cmake +++ /dev/null @@ -1,17 +0,0 @@ -# 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) - -# 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 deleted file mode 100644 index 6b33fdf8d2..0000000000 --- a/cmake/darwin-compiler-i386-generic.cmake +++ /dev/null @@ -1,17 +0,0 @@ -# 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. -if("$ENV{CC}" STREQUAL "" OR "$ENV{CXX}" STREQUAL "") - set(CMAKE_C_COMPILER cc -m32) - set(CMAKE_CXX_COMPILER c++ -m32) -endif() - -# 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/darwin13-compiler-i386-clang.cmake b/cmake/darwin13-compiler-i386-clang.cmake deleted file mode 100644 index 40785dbd7f..0000000000 --- a/cmake/darwin13-compiler-i386-clang.cmake +++ /dev/null @@ -1,20 +0,0 @@ -# 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)