Set debug flags on non-Win32 according to CONFIG; add -g as well.

This commit is contained in:
Joseph Lenox 2021-04-05 23:26:03 -05:00
parent d01653f261
commit 8e68a63d7b
3 changed files with 15 additions and 5 deletions

View File

@ -22,6 +22,15 @@ else()
endif()
endif()
if(NOT WIN32)
# Add DEBUG flags to debug builds.
# Also add -g to RELWITHDEBINFO on non-win32
set(_CC_DEBUG_FLAGS $<$<CONFIG:DEBUG>:-DwxDEBUG_LEVEL=1>
$<$<CONFIG:DEBUG>:-g>
$<$<CONFIG:RELWITHDEBINFO>:-g>
)
endif()
option(SLIC3R_STATIC "Compile Slic3r with static libraries (Boost, TBB, glew)" ${SLIC3R_STATIC_INITIAL})
option(SLIC3R_GUI "Compile Slic3r with GUI components (OpenGL, wxWidgets)" 1)
option(SLIC3R_FHS "Assume Slic3r is to be installed in a FHS directory structure" 0)
@ -113,11 +122,6 @@ enable_testing ()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(NOT WIN32)
# Add DEBUG flags to debug builds.
add_compile_options("$<$<CONFIG:DEBUG>:-DDEBUG>")
endif()
# To be able to link libslic3r with the Perl XS module.
# Once we get rid of Perl and libslic3r is linked statically, we can get rid of -fPIC
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

View File

@ -99,6 +99,7 @@ if (WIN32)
add_library(Slic3r SHARED PrusaSlicer.cpp PrusaSlicer.hpp)
else ()
add_executable(Slic3r PrusaSlicer.cpp PrusaSlicer.hpp)
target_compile_options(Slic3r PRIVATE ${_CC_DEBUG_FLAGS})
endif ()
if (MINGW)

View File

@ -1,6 +1,11 @@
project(libslic3r)
cmake_minimum_required(VERSION 3.13)
if(NOT WIN32)
# Add DEBUG flags to debug builds.
add_compile_options(${_CC_DEBUG_FLAGS})
endif()
include(PrecompiledHeader)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libslic3r_version.h.in ${CMAKE_CURRENT_BINARY_DIR}/libslic3r_version.h @ONLY)