diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-12-24 18:55:17 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-12-24 19:32:10 +0100 |
commit | 01096167ccd013893f36b9b4317500d27210f13e (patch) | |
tree | 673aa3d93debadb84a7833149960f713c47fb2d0 | |
parent | a88e34b21b07f70123926fcb5c505d6afdf99807 (diff) |
cmake/toolchain: make mingw-w64 def usable for clang
-rw-r--r-- | cmake/mingw-w64.cmake | 83 |
1 files changed, 38 insertions, 45 deletions
diff --git a/cmake/mingw-w64.cmake b/cmake/mingw-w64.cmake index e762a989..ec552103 100644 --- a/cmake/mingw-w64.cmake +++ b/cmake/mingw-w64.cmake @@ -14,29 +14,29 @@ endif() SET(CMAKE_SYSTEM_NAME Windows) SET(CMAKE_SYSTEM_VERSION 5) -# specify the cross compiler -if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") - #set(p D:/cygwin64/opt/bin/) - #set(p "/mingw32/bin/") - set(p "") - set(e .exe) - set(c "${p}") -else() - set(p "") - set(c "${p}i686-w64-mingw32-") - set(e "") -endif() - -SET(CMAKE_C_COMPILER ${c}gcc${e}) -SET(CMAKE_CXX_COMPILER ${c}g++${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) +## specify the cross compiler +#if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") +# #set(p D:/cygwin64/opt/bin/) +# #set(p "/mingw32/bin/") +# set(p "") +# set(e .exe) +# set(c "${p}") +#else() +# set(p "") +# set(c "${p}i686-w64-mingw32-") +# set(e "") +#endif() +# +#SET(CMAKE_C_COMPILER ${c}gcc${e}) +#SET(CMAKE_CXX_COMPILER ${c}g++${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) # search for programs in the host directories @@ -46,30 +46,25 @@ 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 -mfpmath=both -mstackrealign -falign-functions=16 -falign-loops=16") -set(cpu "-O3 -march=native -frename-registers") +set(fpu "-ffast-math -mfpmath=sse -mstackrealign") +set(cpu "-O3 -msse3 -mtune=skylake") #set(lto "-fno-lto -fno-use-linker-plugin -flto-compression-level=9 -flto-partition=balanced -fno-ipa-pta -fno-lto-odr-type-merging") set(lto "") -set(sections "-ffunction-sections -fdata-sections -s") +set(sections "-ffunction-sections -fdata-sections") set(cc "") #set(cc "-fdump-statistics-details -fdump-ipa-cgraph") -set(clang-warns "") -if(CMAKE_COMPILER_IS_CLANGXX) - set(clang-warns "-Wweak-vtables") -endif() - set(noisy-warns "") set(suggest-final "") set(numerics "") set(missing-override "") if(WARNINGS_ENABLE) if(WARNINGS_FINAL_SUGGESTIONS) - set(suggest-final "-Wsuggest-final-types -Wsuggest-final-methods") + set(suggest-final "-Wsuggest-final-types") endif() if(WARNINGS_NUMERIC) - set(numerics "-Wdouble-promotion -Wsign-compare") + set(numerics "-Wdouble-promotion") endif() if(WARNINGS_MISSING_OVERRIDE) set(missing-override "-Wsuggest-override") @@ -81,9 +76,9 @@ set(_CXX_WARNS "") set(_C_WARNS "") if(WARNINGS_ENABLE) - set(usual-warns "-Wdelete-non-virtual-dtor -Wno-suggest-override -Wno-odr -Wno-attributes -Wcast-align") + set(usual-warns "-Wstrict-aliasing=3 -Wstrict-overflow=4 -Wdelete-non-virtual-dtor -Wno-odr -Wattributes") set(_C_WARNS "-Wall -Wextra -Wpedantic -Wcast-align") - set(_CXX_WARNS "${_C_WARNS} ${usual-warns} ${clang-warns} ${noisy-warns} ${missing-override}") + set(_CXX_WARNS "${_C_WARNS} ${usual-warns} ${noisy-warns} ${missing-override}") endif() set(ccflags-common "-fvisibility=hidden -pipe -g3") @@ -96,9 +91,9 @@ set(_CXXFLAGS_DEBUG "${_CFLAGS_DEBUG}") add_definitions(-DSTRSAFE_NO_DEPRECATE) -set(_LDFLAGS "-Wl,--dynamicbase,--nxcompat,--as-needed") -set(_LDFLAGS_RELEASE "-Wl,--gc-sections,--exclude-libs,ALL") -set(_LDFLAGS_DEBUG "") +#set(_LDFLAGS "-Wl,--dynamicbase,--nxcompat,--as-needed") +#set(_LDFLAGS_RELEASE "-Wl,--gc-sections,--exclude-libs,ALL") +#set(_LDFLAGS_DEBUG "") set(enable-val FALSE) if(CMAKE_PROJECT_NAME STREQUAL "opentrack") @@ -117,10 +112,8 @@ foreach(j C CXX) endforeach() endforeach() -foreach(j "" _DEBUG _RELEASE) - foreach(i MODULE EXE SHARED) - set(CMAKE_${i}_LINKER_FLAGS${j} "${_LDFLAGS${j}} ${CMAKE_${i}_LINKER_FLAGS${j}}") - endforeach() -endforeach() - - +#foreach(j "" _DEBUG _RELEASE) +# foreach(i MODULE EXE SHARED) +# set(CMAKE_${i}_LINKER_FLAGS${j} "${_LDFLAGS${j}} ${CMAKE_${i}_LINKER_FLAGS${j}}") +# endforeach() +#endforeach() |