Browse Source

CMake: When building on MSVC, add /bigobj to compiler where necessary

Sam Edwards 6 years ago
parent
commit
8588ddc3dc
3 changed files with 15 additions and 0 deletions
  1. 5 0
      dtool/CompilerFlags.cmake
  2. 5 0
      panda/src/display/CMakeLists.txt
  3. 5 0
      panda/src/grutil/CMakeLists.txt

+ 5 - 0
dtool/CompilerFlags.cmake

@@ -146,6 +146,11 @@ add_compile_options(
   "$<${cxx_exceptions_property}:${cxx_exceptions_on}>"
   "$<$<NOT:${cxx_exceptions_property}>:${cxx_exceptions_off}>")
 
+if(MSVC)
+  set(msvc_bigobj_property "$<BOOL:$<TARGET_PROPERTY:MSVC_BIGOBJ>>")
+  add_compile_options("$<${msvc_bigobj_property}:/bigobj>")
+endif()
+
 # We should use -fvisibility=hidden everywhere, as it makes sure we think
 # about what symbols really should be exposed externally.  For more info, see:
 # https://gcc.gnu.org/wiki/Visibility

+ 5 - 0
panda/src/display/CMakeLists.txt

@@ -100,6 +100,11 @@ target_link_libraries(p3display p3cull p3device p3pgraphnodes
   PKG::X11)
 target_interrogate(p3display ALL EXTENSIONS ${P3DISPLAY_IGATEEXT})
 
+if(HAVE_EIGEN)
+  # Eigen puts this over the threshold where bigobj is needed on MSVC
+  set_target_properties(p3display PROPERTIES MSVC_BIGOBJ ON)
+endif()
+
 if(NOT BUILD_METALIBS)
   install(TARGETS p3display
     EXPORT Core COMPONENT Core

+ 5 - 0
panda/src/grutil/CMakeLists.txt

@@ -50,6 +50,11 @@ if(HAVE_AUDIO)
 endif()
 target_interrogate(p3grutil ALL)
 
+if(HAVE_EIGEN)
+  # Eigen puts this over the threshold where bigobj is needed on MSVC
+  set_target_properties(p3grutil PROPERTIES MSVC_BIGOBJ ON)
+endif()
+
 if(NOT BUILD_METALIBS)
   install(TARGETS p3grutil
     EXPORT Core COMPONENT Core