diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-06-14 11:33:43 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-06-14 18:14:46 +0200 |
commit | 2b02600171a88afa0c7ffdfa06ba61395df99341 (patch) | |
tree | 6de4bff7627090176edaa295d15d51c165df7473 | |
parent | 98385c129b6bf5da7ed9f37051444c70c55e0372 (diff) |
cmake: update mingw-w64 toolchain file
- set path for 6.1.0 from sourceforce mingw-w64 "personal builds".
- set objcopy, objdump, strip
- enable -fipa-pta now that it works, change some lto params
- always strip for RELEASE build type
- set install prefix to relative BINARY_DIR/install at first run
- change some warns
-rw-r--r-- | cmake/mingw-w64.cmake | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/cmake/mingw-w64.cmake b/cmake/mingw-w64.cmake index 790d4f46..b17591c4 100644 --- a/cmake/mingw-w64.cmake +++ b/cmake/mingw-w64.cmake @@ -7,19 +7,22 @@ SET(CMAKE_SYSTEM_NAME Windows) SET(CMAKE_SYSTEM_VERSION 1) # specify the cross compiler -set(p c:/mingw-w64/i686-5.3.0-posix-dwarf-rt_v4-rev0/mingw32/bin) +set(p C:/mingw-w64/i686-6.1.0-posix/bin) set(c ${p}/i686-w64-mingw32-) #set(CMAKE_MAKE_PROGRAM ${p}/mingw32-make.exe CACHE FILEPATH "" FORCE) set(e .exe) -SET(CMAKE_C_COMPILER ${c}gcc${e}) -SET(CMAKE_CXX_COMPILER ${c}g++${e}) +SET(CMAKE_C_COMPILER ${c}cc${e}) +SET(CMAKE_CXX_COMPILER ${c}c++${e}) set(CMAKE_RC_COMPILER ${c}windres${e}) set(CMAKE_LINKER ${c}ld${e}) set(CMAKE_AR ${c}gcc-ar${e} CACHE STRING "" FORCE) set(CMAKE_NM ${c}gcc-nm${e} CACHE STRING "" FORCE) set(CMAKE_RANLIB ${c}gcc-ranlib${e} CACHE STRING "" FORCE) +set(CMAKE_OBJCOPY ${c}objcopy${e} CACHE STRING "" FORCE) +set(CMAKE_OBJDUMP ${c}objdump${e} CACHE STRING "" FORCE) +set(CMAKE_STRIP ${c}strip${e} CACHE STRING "" FORCE) SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32) @@ -30,9 +33,9 @@ SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) # oldest CPU supported here is Northwood-based Pentium 4. -sh 20150811 -set(fpu "-ffast-math -fno-finite-math-only -mfpmath=both -mstackrealign -ftree-vectorize") +set(fpu "-ffast-math -ffinite-math-only -mfpmath=both -mstackrealign -ftree-vectorize") set(cpu "-O3 -march=pentium4 -mtune=corei7-avx -msse -msse2 -mno-sse3 -mno-avx -frename-registers -fno-PIC") -set(lto "-flto -fuse-linker-plugin") +set(lto "-flto -fuse-linker-plugin -flto-compression-level=3 -fno-fat-lto-objects -flto-partition=balanced -fipa-pta") set(_CFLAGS " -fvisibility=hidden ") set(_CXXFLAGS " ${_CFLAGS} ") @@ -68,7 +71,6 @@ if(CMAKE_PROJECT_NAME STREQUAL "opentrack" AND WARNINGS_ENABLE) set(noisy-warns "${suggest-final} ${numerics}") endif() -# -Wodr and -Wattributes are disabled due to LTO false positives in dependencies. set(clang-warns "") if(CMAKE_COMPILER_IS_CLANG) set(clang-warns "-Wweak-vtables") @@ -78,18 +80,15 @@ set(_C_WARNS "") if(WARNINGS_ENABLE) set(usual-warns "-Wall -Wextra -pedantic -Wdelete-non-virtual-dtor -Wno-suggest-override -Wno-odr -Wno-attributes -Wcast-align -Wc++14-compat") set(_CXX_WARNS "${usual-warns} ${clang-warns} ${noisy-warns} ${missing-override}") - set(_C_WARNS "-Wall -Wextra -pedantic -Wcast-align -Wno-attributes") + set(_C_WARNS "-Wall -Wextra -pedantic -Wcast-align") endif() foreach(j C CXX) - foreach(i "" _DEBUG _RELEASE) + foreach(i _DEBUG _RELEASE) set(OVERRIDE_${j}_FLAGS${i} "" CACHE STRING "") - set(CMAKE_${j}_FLAGS${i} " ${_${j}FLAGS${i}} ${_${j}_WARNS} ${OVERRIDE_${j}_FLAGS${i}} " CACHE STRING "" FORCE) + set(CMAKE_${j}_FLAGS${i} " ${_${j}FLAGS${i}} ${OVERRIDE_${j}_FLAGS${i}} " CACHE STRING "" FORCE) endforeach() -endforeach() - -foreach (i "" _DEBUG _RELEASE) - set(CMAKE_CXX_FLAGS${i} " ${CMAKE_CXX_FLAGS${i}} " CACHE STRING "" FORCE) + set(CMAKE_${j}_FLAGS " ${_${j}FLAGS} ${_${j}_WARNS} ${OVERRIDE_${j}_FLAGS} " CACHE STRING "" FORCE) endforeach() foreach(j "" _DEBUG _RELEASE) @@ -99,4 +98,11 @@ foreach(j "" _DEBUG _RELEASE) endforeach() endforeach() +set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s" CACHE STRING "" FORCE) +set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s" CACHE STRING "" FORCE) + set(CMAKE_BUILD_TYPE_INIT "RELEASE") + +if(NOT CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "" FORCE) +endif() |