From 7be24414f3ad83f7c45c40f244699fd41d487f72 Mon Sep 17 00:00:00 2001 From: Vojtech Kral Date: Fri, 17 Aug 2018 12:38:33 +0200 Subject: [PATCH] Build: Option to force generation of PDB file on MSVC Release build --- CMakeLists.txt | 1 + xs/CMakeLists.txt | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d9194d06..8e3d8ad4d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,7 @@ option(SLIC3R_GUI "Compile Slic3r with GUI components (OpenGL, wxWidgets)" option(SLIC3R_PRUSACONTROL "Compile Slic3r with the PrusaControl prject file format (requires wxWidgets base library)" 1) option(SLIC3R_PROFILE "Compile Slic3r with an invasive Shiny profiler" 0) option(SLIC3R_MSVC_COMPILE_PARALLEL "Compile on Visual Studio in parallel" 1) +option(SLIC3R_MSVC_PDB "Generate PDB files on MSVC in Release mode" 1) if (MSVC AND SLIC3R_MSVC_COMPILE_PARALLEL) add_compile_options(/MP) diff --git a/xs/CMakeLists.txt b/xs/CMakeLists.txt index 6c2a61685..d4306c525 100644 --- a/xs/CMakeLists.txt +++ b/xs/CMakeLists.txt @@ -497,6 +497,14 @@ if (WIN32) target_compile_definitions(XS PRIVATE -DNOGDI -DNOMINMAX -DHAS_BOOL) endif () +# SLIC3R_MSVC_PDB +if (MSVC AND SLIC3R_MSVC_PDB AND ${CMAKE_BUILD_TYPE} STREQUAL "Release") + set_target_properties(XS PROPERTIES + COMPILE_FLAGS "/Zi" + LINK_FLAGS "/DEBUG /OPT:REF /OPT:ICF" + ) +endif() + ## Configuration flags if (SLIC3R_GUI) message("Slic3r will be built with GUI support")