summaryrefslogtreecommitdiffhomepage
path: root/cmake/msvc.cmake
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2019-02-22 15:30:07 +0100
committerStanislaw Halik <sthalik@misaki.pl>2019-02-22 15:30:07 +0100
commita974e34c11aa1dcda3c8c72c6d2a366d6efba052 (patch)
tree9b86bccb2fe1814f7ffaa64f4d07f8b847bde37f /cmake/msvc.cmake
parent187624cf9ac365759bdfd82b11ae6f77099e04d1 (diff)
cmake/msvc: simplify
Diffstat (limited to 'cmake/msvc.cmake')
-rw-r--r--cmake/msvc.cmake69
1 files changed, 29 insertions, 40 deletions
diff --git a/cmake/msvc.cmake b/cmake/msvc.cmake
index 7275badf..e3616bb8 100644
--- a/cmake/msvc.cmake
+++ b/cmake/msvc.cmake
@@ -11,14 +11,6 @@ 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(cc "")
-# oldest CPU supported here is Northwood-based Pentium 4. -sh 20150811
-set(cc "${cc} -O2 -O2it -Oy- -Ob2 -fp:fast -GS- -GF -GL -Gw -Gy -Gs9999999")
-set(cc "${cc} -FS -arch:SSE2 -D_HAS_EXCEPTIONS=0")
-#set(cc "${cc} -Qvec-report:1")
-
-set(warns_ "")
-
#C4457: declaration of 'id' hides function parameter
#C4456: declaration of 'i' hides previous local declaration
#C4263 - member function does not override any base class virtual member function
@@ -28,6 +20,19 @@ set(warns_ "")
#C4928 - illegal copy-initialization, more than one user-defined conversion has been implicitly applied
set(warns-disable 4530 4577 4789 4244 4702 4530 4244 4127 4458 4456 4251 4100 4702 4457)
+add_definitions(-D_ENABLE_EXTENDED_ALIGNED_STORAGE)
+add_definitions(-D_ENABLE_ATOMIC_ALIGNMENT_FIX)
+add_definitions(-D_SILENCE_CXX17_NEGATORS_DEPRECATION_WARNING)
+add_definitions(-D_SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING)
+add_definitions(-D_SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING)
+add_definitions(-diagnostics:caret)
+#add_compile_options(-Qvec-report:2)
+#add_compile_options(-d2cgsummary)
+
+if(NOT CMAKE_RC_FLAGS)
+ set(CMAKE_RC_FLAGS "/nologo /DWIN32")
+endif()
+
if(CMAKE_PROJECT_NAME STREQUAL "opentrack")
include("${CMAKE_CURRENT_LIST_DIR}/opentrack-policy.cmake" NO_POLICY_SCOPE)
@@ -37,60 +42,44 @@ if(CMAKE_PROJECT_NAME STREQUAL "opentrack")
set(warns-noerr 4005)
foreach(i ${warns-disable})
- set(warns_ "${warns_} -wd${i}")
+ add_compile_options(-wd${i})
endforeach()
foreach(i ${warns})
- set(warns_ "${warns_} -w1${i} -we${i}")
+ add_compile_options(-w1${i} -we${i})
endforeach()
foreach(i ${warns-noerr})
- set(warns_ "${warns_} -w1${i}")
+ add_compile_options(-w1${i})
endforeach()
- set(cc "${cc} -GR-")
-
- set(CMAKE_RC_FLAGS "/nologo /DWIN32")
+ add_compile_options(-W4)
endif()
-set(base-cflags "-MT -Zi -Zf -Zo -W4 -bigobj -cgthreads1 -diagnostics:caret ${warns_}")
-#set(base-cflags "${base-cflags} -d2cgsummary")
+add_compile_options(-MT -Zi -Zf -Zo -bigobj -cgthreads1 -vd0)
+add_link_options(-cgthreads:1)
-set(_CFLAGS "${base-cflags}")
-set(_CXXFLAGS "${base-cflags}")
-set(_CFLAGS_RELEASE "${cc}")
+set(_CFLAGS "")
+set(_CXXFLAGS "")
+set(_CFLAGS_RELEASE "-O2 -O2it -Oy- -Ob3 -fp:fast -GS- -GF -GL -Gw -Gy -arch:SSE2 -GR-")
set(_CFLAGS_DEBUG "-GS -sdl -Gs -guard:cf")
-set(_CXXFLAGS_RELEASE "${cc}")
+set(_CXXFLAGS_RELEASE "${_CFLAGS_RELEASE}")
set(_CXXFLAGS_DEBUG "${_CFLAGS_DEBUG}")
-set(_LDFLAGS "-cgthreads:1 -DEBUG")
-
-#set(_ltcg "-LTCG")
-set(_ltcg "-LTCG:INCREMENTAL")
-
-set(_LDFLAGS_RELEASE "-OPT:REF,ICF=4 ${_ltcg}")
-set(_LDFLAGS_DEBUG "")
+set(_LDFLAGS_RELEASE "-OPT:REF -OPT:ICF=10 -LTCG:INCREMENTAL -DEBUG:FULL")
+set(_LDFLAGS_DEBUG "-DEBUG:FULL")
+add_link_options(-DEBUGTYPE:CV,PDATA,FIXUP)
set(_LDFLAGS_STATIC "")
-set(_LDFLAGS_STATIC_RELEASE "${_ltcg}")
+set(_LDFLAGS_STATIC_RELEASE "-LTCG:INCREMENTAL")
set(_LDFLAGS_STATIC_DEBUG "")
-# debugging build times
-#set(_CXXFLAGS "${_CXXFLAGS} -Bt+")
-#set(_LDFLAGS "${_LDFLAGS} -time")
-
if(NOT CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" 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_BUILD_TYPE STREQUAL "DEBUG") AND (NOT CMAKE_BUILD_TYPE STREQUAL "RELEASE"))
- set(CMAKE_BUILD_TYPE "RELEASE" CACHE STRING "" FORCE)
-endif()
+string(TOUPPER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE)
+set(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING "" FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS RELEASE DEBUG)
foreach(k "" "_${CMAKE_BUILD_TYPE}")