diff --git a/CMakeLists.txt b/CMakeLists.txt index 995fcb1..697e6fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,11 @@ function(adjust_bin_paths lib) ) endfunction() +# windows prefers win8.1 sdk instead of win 10 sdk for some god forsaken reason +if(WIN32) + set(CMAKE_SYSTEM_VERSION 10.0 CACHE STRING "Forcing Win10 SDK" FORCE) +endif() + project("SpaceCalibrator") # 3rd party stuff @@ -57,5 +62,12 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_C_COMPILER_ID}" S /GF) # eliminate duplicate strings endif() +# Match SteamVR build flags on MSVC +if(MSVC) + add_compile_options(/guard:cf /GS) + add_link_options("/GUARD:CF") + add_compile_options($<$:/Ot> $<$:/Oi> $<$:/Gy>) +endif() + # Include project add_subdirectory ("src") \ No newline at end of file diff --git a/GenWin64.bat b/GenWin64.bat index 295e48c..35650f7 100644 --- a/GenWin64.bat +++ b/GenWin64.bat @@ -1,2 +1,2 @@ @ECHO OFF -cmake -G "Visual Studio 17 2022" -T ClangCL -A x64 -B bin -S . \ No newline at end of file +cmake -G "Visual Studio 17 2022" -A x64 -B bin -S . \ No newline at end of file diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 80cdbc6..6caca84 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -76,7 +76,7 @@ target_compile_definitions(SpaceCalibratorCommon $<$>:QUILL_COMPILE_ACTIVE_LOG_LEVEL=QUILL_COMPILE_ACTIVE_LOG_LEVEL_INFO> ) -if (MSVC) +if(NOT MSVC) target_compile_options(SpaceCalibratorCommon PRIVATE -fno-exceptions) endif() @@ -96,7 +96,7 @@ target_compile_definitions(SpaceCalibratorCommon if (MSVC) target_compile_options(SpaceCalibratorCommon PRIVATE - /EHs- + /EHsc $<$:/Ob2 /Zc:inline> $<$:/Ob2 /Zc:inline> $<$:/Ob2 /Zc:inline>