summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt8
-rw-r--r--cmake/mingw-w64.cmake20
-rw-r--r--cmake/opentrack-platform.cmake9
3 files changed, 27 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7fcebc97..320b732c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -78,16 +78,18 @@ otr_merge_translations()
include(opentrack-install)
+
+string(TOUPPER __build_type "${CMAKE_BUILD_TYPE}")
message(STATUS "-- Compile flags:")
#foreach(j C CXX)
foreach(j CXX)
- foreach(i "" "_${CMAKE_BUILD_TYPE}")
+ foreach(i "" "_${__build_type}")
message(STATUS " ${j}${i}: ${CMAKE_${j}_FLAGS${i}}")
endforeach()
endforeach()
message(STATUS "-- Link flags:")
-foreach(j "" "_${CMAKE_BUILD_TYPE}")
+foreach(j "" "_${__build_type}")
#foreach(i EXE SHARED)
foreach(i SHARED)
message(STATUS " LINK_${i}${j}: ${CMAKE_${i}_LINKER_FLAGS${j}}")
@@ -95,7 +97,7 @@ foreach(j "" "_${CMAKE_BUILD_TYPE}")
endforeach()
message(STATUS "-- Static archive flags:")
-foreach(k "" "_${CMAKE_BUILD_TYPE}")
+foreach(k "" "_${__build_type}")
message(STATUS " STATIC${k}: ${CMAKE_STATIC_LINKER_FLAGS${k}}")
endforeach()
message(STATUS "--")
diff --git a/cmake/mingw-w64.cmake b/cmake/mingw-w64.cmake
index d32f4a1c..1879ab3a 100644
--- a/cmake/mingw-w64.cmake
+++ b/cmake/mingw-w64.cmake
@@ -3,6 +3,19 @@
# mkdir build && cd build && cmake -DCMAKE_TOOLCHAIN_FILE=$(pwd)/../cmake/mingw-w64.cmake
# -sh 20140922
+if((NOT CMAKE_BUILD_TYPE STREQUAL "DEBUG") AND (NOT CMAKE_BUILD_TYPE STREQUAL "RELEASE"))
+ set(CMAKE_BUILD_TYPE "DEBUG" CACHE STRING "" FORCE)
+endif()
+
+string(TOUPPER "${CMAKE_BUILD_TYPE}" __build_type)
+if(NOT __build_type STREQUAL CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE "${__build_type}" CACHE STRING "" FORCE)
+endif()
+
+if(NOT CMAKE_INSTALL_PREFIX)
+ set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE STRING "" FORCE)
+endif()
+
SET(CMAKE_SYSTEM_NAME Windows)
SET(CMAKE_SYSTEM_VERSION 5)
@@ -39,7 +52,7 @@ 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=i686 -msse3 -mtune=skylake -frename-registers")
+set(cpu "-O3 -march=native -frename-registers")
#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")
@@ -115,7 +128,4 @@ foreach(j "" _DEBUG _RELEASE)
endforeach()
endforeach()
-if(NOT CMAKE_BUILD_TYPE)
- set(CMAKE_BUILD_TYPE "RELEASE" CACHE STRING "" FORCE)
- set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "" FORCE)
-endif()
+
diff --git a/cmake/opentrack-platform.cmake b/cmake/opentrack-platform.cmake
index c9bc2fca..1e34a5ef 100644
--- a/cmake/opentrack-platform.cmake
+++ b/cmake/opentrack-platform.cmake
@@ -22,13 +22,18 @@
# OTHER DEALINGS IN THE SOFTWARE.
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
- set(CMAKE_BUILD_TYPE "RELEASE" CACHE STRING "" FORCE)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "" FORCE)
+ if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE "RELEASE" CACHE STRING "" FORCE)
+ endif()
endif()
+string(TOUPPER "${CMAKE_BUILD_TYPE}" __build_type)
+set(CMAKE_BUILD_TYPE "${__build_type}" CACHE STRING "" FORCE)
+
if(APPLE)
if(NOT CMAKE_OSX_ARCHITECTURES)
- set(CMAKE_OSX_ARCHITECTURES "x86_64")
+ set(CMAKE_OSX_ARCHITECTURES "x86_64")
endif()
endif()