aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--layers/CMakeLists.txt17
1 files changed, 15 insertions, 2 deletions
diff --git a/layers/CMakeLists.txt b/layers/CMakeLists.txt
index b5933578..44345d62 100644
--- a/layers/CMakeLists.txt
+++ b/layers/CMakeLists.txt
@@ -88,8 +88,21 @@ include_directories(
)
if (WIN32)
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS")
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS")
+ set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -D_CRT_SECURE_NO_WARNINGS")
+ set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -D_CRT_SECURE_NO_WARNINGS")
+
+ # For VS 2015, which uses compiler version 1900, draw_state.cpp fails with too many objects
+ # without either optimizations enabled, or setting the /bigobj compilation option. Since
+ # optimizations are enabled in a release build, this only affects the debug build. For now,
+ # enable /bigobj mode for all debug layer files. An alternative for the future is to split
+ # draw_state.cpp into multiple files, which will also alleviate the compilation error.
+ if (NOT (MSVC_VERSION LESS 1900))
+ set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_CRT_SECURE_NO_WARNINGS /bigobj")
+ set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_CRT_SECURE_NO_WARNINGS /bigobj")
+ else()
+ set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_CRT_SECURE_NO_WARNINGS")
+ set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_CRT_SECURE_NO_WARNINGS")
+ endif()
endif()
if (NOT WIN32)
set (CMAKE_CXX_FLAGS "-std=c++11")