Skip to content

Commit

Permalink
Debug Improvments on Windows (SoftFever#3275)
Browse files Browse the repository at this point in the history
* fix assert statements

* Add ORCA_INCLUDE_DEBUG_INFO to deps cmake

adds option ORCA_INCLUDE_DEBUG_INFO to deps build script to allow an alternative for RelWithDebInfo that works on windows

* add build type option to windows script

* update .gitignore to include build*
  • Loading branch information
Ocraftyone authored Jan 24, 2024
1 parent 73481da commit c4a66f3
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Build
Build.bat
/build*/
deps/build
deps/build*
MYMETA.json
MYMETA.yml
_build
Expand Down
44 changes: 34 additions & 10 deletions build_release.bat
Original file line number Diff line number Diff line change
@@ -1,26 +1,50 @@
set WP=%CD%

set debug=OFF
set debuginfo=OFF
if "%1"=="debug" set debug=ON
if "%2"=="debug" set debug=ON
if "%1"=="debuginfo" set debuginfo=ON
if "%2"=="debuginfo" set debuginfo=ON
if "%debug%"=="ON" (
set build_type=Debug
set build_dir=build-dbg
) else (
if "%debuginfo%"=="ON" (
set build_type=RelWithDebInfo
set build_dir=build-dbginfo
) else (
set build_type=Release
set build_dir=build
)
)
echo build type set to %build_type%

cd deps
mkdir build
cd build
mkdir %build_dir%
cd %build_dir%
set DEPS=%CD%/OrcaSlicer_dep
if "%1"=="slicer" (
GOTO :slicer
)
echo "building deps.."
cmake ../ -G "Visual Studio 16 2019" -DDESTDIR="%CD%/OrcaSlicer_dep" -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release --target deps -- -m

echo cmake ../ -G "Visual Studio 16 2019 -A x64 -DDESTDIR="%CD%/OrcaSlicer_dep" -DCMAKE_BUILD_TYPE=%build_type% -DDEP_DEBUG=%debug% -DORCA_INCLUDE_DEBUG_INFO=%debuginfo%
cmake ../ -G "Visual Studio 16 2019 -A x64 -DDESTDIR="%CD%/OrcaSlicer_dep" -DCMAKE_BUILD_TYPE=%build_type% -DDEP_DEBUG=%debug% -DORCA_INCLUDE_DEBUG_INFO=%debuginfo%
cmake --build . --config %build_type% --target deps -- -m

if "%1"=="deps" exit /b 0

:slicer
echo "building Orca Slicer..."
cd %WP%
mkdir build
cd build
mkdir %build_dir%
cd %build_dir%

cmake .. -G "Visual Studio 16 2019" -DBBL_RELEASE_TO_PUBLIC=1 -DCMAKE_PREFIX_PATH="%DEPS%/usr/local" -DCMAKE_INSTALL_PREFIX="./OrcaSlicer" -DCMAKE_BUILD_TYPE=Release -DWIN10SDK_PATH="C:/Program Files (x86)/Windows Kits/10/Include/10.0.19041.0"
cmake --build . --config Release --target ALL_BUILD -- -m
echo cmake .. -G "Visual Studio 16 2019 -A x64 -DBBL_RELEASE_TO_PUBLIC=1 -DCMAKE_PREFIX_PATH="%DEPS%/usr/local" -DCMAKE_INSTALL_PREFIX="./OrcaSlicer" -DCMAKE_BUILD_TYPE=%build_type%
cmake .. -G "Visual Studio 16 2019 -A x64 -DBBL_RELEASE_TO_PUBLIC=1 -DCMAKE_PREFIX_PATH="%DEPS%/usr/local" -DCMAKE_INSTALL_PREFIX="./OrcaSlicer" -DCMAKE_BUILD_TYPE=%build_type% -DWIN10SDK_PATH="C:/Program Files (x86)/Windows Kits/10/Include/10.0.19041.0"
cmake --build . --config %build_type% --target ALL_BUILD -- -m
cd ..
call run_gettext.bat
cd build
cmake --build . --target install --config Release
cd %build_dir%
cmake --build . --target install --config %build_type%
44 changes: 32 additions & 12 deletions build_release_vs2022.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,53 @@ if "%1"=="pack" (
exit /b 0
)

set debug=OFF
set debuginfo=OFF
if "%1"=="debug" set debug=ON
if "%2"=="debug" set debug=ON
if "%1"=="debuginfo" set debuginfo=ON
if "%2"=="debuginfo" set debuginfo=ON
if "%debug%"=="ON" (
set build_type=Debug
set build_dir=build-dbg
) else (
if "%debuginfo%"=="ON" (
set build_type=RelWithDebInfo
set build_dir=build-dbginfo
) else (
set build_type=Release
set build_dir=build
)
)
echo build type set to %build_type%

setlocal DISABLEDELAYEDEXPANSION
cd deps
mkdir build
cd build
mkdir %build_dir%
cd %build_dir%
set DEPS=%CD%/OrcaSlicer_dep

if "%1"=="slicer" (
GOTO :slicer
)
echo "building deps.."


cmake ../ -G "Visual Studio 17 2022" -A x64 -DDESTDIR="%CD%/OrcaSlicer_dep" -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release --target deps -- -m
echo cmake ../ -G "Visual Studio 17 2022" -A x64 -DDESTDIR="%CD%/OrcaSlicer_dep" -DCMAKE_BUILD_TYPE=%build_type% -DDEP_DEBUG=%debug% -DORCA_INCLUDE_DEBUG_INFO=%debuginfo%
cmake ../ -G "Visual Studio 17 2022" -A x64 -DDESTDIR="%CD%/OrcaSlicer_dep" -DCMAKE_BUILD_TYPE=%build_type% -DDEP_DEBUG=%debug% -DORCA_INCLUDE_DEBUG_INFO=%debuginfo%
cmake --build . --config %build_type% --target deps -- -m

if "%1"=="deps" exit /b 0

:slicer
echo "building Orca Slicer..."
cd %WP%
mkdir build
cd build
mkdir %build_dir%
cd %build_dir%

echo cmake .. -G "Visual Studio 17 2022" -A x64 -DBBL_RELEASE_TO_PUBLIC=1 -DCMAKE_PREFIX_PATH="%DEPS%/usr/local" -DCMAKE_INSTALL_PREFIX="./OrcaSlicer" -DCMAKE_BUILD_TYPE=Release
cmake .. -G "Visual Studio 17 2022" -A x64 -DBBL_RELEASE_TO_PUBLIC=1 -DCMAKE_PREFIX_PATH="%DEPS%/usr/local" -DCMAKE_INSTALL_PREFIX="./OrcaSlicer" -DCMAKE_BUILD_TYPE=Release -DWIN10SDK_PATH="C:/Program Files (x86)/Windows Kits/10/Include/10.0.22000.0"
cmake --build . --config Release --target ALL_BUILD -- -m
echo cmake .. -G "Visual Studio 17 2022" -A x64 -DBBL_RELEASE_TO_PUBLIC=1 -DCMAKE_PREFIX_PATH="%DEPS%/usr/local" -DCMAKE_INSTALL_PREFIX="./OrcaSlicer" -DCMAKE_BUILD_TYPE=%build_type%
cmake .. -G "Visual Studio 17 2022" -A x64 -DBBL_RELEASE_TO_PUBLIC=1 -DCMAKE_PREFIX_PATH="%DEPS%/usr/local" -DCMAKE_INSTALL_PREFIX="./OrcaSlicer" -DCMAKE_BUILD_TYPE=%build_type% -DWIN10SDK_PATH="C:/Program Files (x86)/Windows Kits/10/Include/10.0.22000.0"
cmake --build . --config %build_type% --target ALL_BUILD -- -m
cd ..
call run_gettext.bat
cd build
cmake --build . --target install --config Release
cd %build_dir%
cmake --build . --target install --config %build_type%
15 changes: 11 additions & 4 deletions deps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ endif ()
set(DESTDIR "${CMAKE_CURRENT_BINARY_DIR}/destdir" CACHE PATH "Destination directory")
set(DEP_DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR}/../DL_CACHE CACHE PATH "Path for downloaded source packages.")

option(DEP_DEBUG "Build debug variants (only applicable on Windows)" OFF)
get_property(_is_multi GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)

if (_is_multi)
option(DEP_DEBUG "Build debug variants (only applicable on Windows)" OFF)
option(ORCA_INCLUDE_DEBUG_INFO "Includes debug information in a release build (like RelWithDebInfo) in a way that works with multi-configuration generators and incompatible dependencies. DEP_DEBUG option takes priority over this." OFF)
endif ()

if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
option(DEP_WX_GTK3 "Build wxWidgets against GTK3" OFF)
Expand Down Expand Up @@ -87,8 +92,6 @@ find_package(Git REQUIRED)
# The default command line for patching. Only works for newer
set(PATCH_CMD ${GIT_EXECUTABLE} apply --verbose --ignore-space-change --whitespace=fix)

get_property(_is_multi GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)

if (NOT _is_multi AND NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
message(STATUS "Forcing CMAKE_BUILD_TYPE to Release as it was not specified.")
Expand All @@ -99,7 +102,11 @@ function(orcaslicer_add_cmake_project projectname)

set(_configs_line -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE})
if (_is_multi OR MSVC)
set(_configs_line "")
if (ORCA_INCLUDE_DEBUG_INFO AND NOT DEP_DEBUG)
set(_configs_line "-DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELWITHDEBINFO} -DCMAKE_CXX_FLAGS_RELEASE:STRING=${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
else ()
set(_configs_line "")
endif ()
endif ()

set(_gen "")
Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/GCode/PressureEqualizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ void PressureEqualizer::process_layer(const std::string &gcode)
long PressureEqualizer::advance_segment_beyond_small_gap(const long idx_orig)
{
// this should only be run on the last extruding line before a gap
assert(m_gcode_lines[idx_cur_pos].extruding());
assert(m_gcode_lines[idx_orig].extruding());
double distance_traveled = 0.0;
// start at beginning of gap, advance till extrusion found or gap too big
for (auto idx_cur_pos = idx_orig + 1; idx_cur_pos < m_gcode_lines.size(); idx_cur_pos++) {
Expand Down
6 changes: 3 additions & 3 deletions src/libslic3r/Support/TreeSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ static std::vector<std::pair<TreeSupportSettings, std::vector<size_t>>> group_me
const PrintObjectConfig &object_config = print_object.config();
#endif // NDEBUG
// Support must be enabled and set to Tree style.
assert(object_config.support_material || object_config.support_material_enforce_layers > 0);
assert(object_config.support_material_style == smsTree || object_config.support_material_style == smsOrganic);
assert(object_config.enable_support || object_config.enforce_support_layers > 0);
assert(object_config.support_type == stTree || object_config.support_style == smsOrganic);

bool found_existing_group = false;
TreeSupportSettings next_settings{ TreeSupportMeshGroupSettings{ print_object }, print_object.slicing_parameters() };
Expand Down Expand Up @@ -3541,7 +3541,7 @@ static void generate_support_areas(Print &print, const BuildVolume &build_volume
draw_areas(*print.get_object(processing.second.front()), volumes, config, overhangs, move_bounds,
bottom_contacts, top_contacts, intermediate_layers, layer_storage, throw_on_cancel);
else {
assert(print_object.config().support_material_style == smsOrganic);
assert(print_object.config().support_style == smsOrganic);
organic_draw_branches(
*print.get_object(processing.second.front()), volumes, config, move_bounds,
bottom_contacts, top_contacts, interface_placer, intermediate_layers, layer_storage,
Expand Down
4 changes: 2 additions & 2 deletions src/libslic3r/Support/TreeSupportCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ TreeSupportMeshGroupSettings::TreeSupportMeshGroupSettings(const PrintObject &pr
// const std::vector<unsigned int> printing_extruders = print_object.object_extruders();

// Support must be enabled and set to Tree style.
assert(config.support_material || config.support_material_enforce_layers > 0);
assert(config.support_material_style == smsTree || config.support_material_style == smsOrganic);
assert(config.enable_support || config.enforce_support_layers > 0);
assert(config.support_type == stTree || config.support_style == smsOrganic);

// Calculate maximum external perimeter width over all printing regions, taking into account the default layer height.
coordf_t external_perimeter_width = 0.;
Expand Down
2 changes: 0 additions & 2 deletions src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,6 @@ void GLMmSegmentationGizmo3DScene::render(size_t triangle_indices_idx) const
{
assert(triangle_indices_idx < this->triangle_indices_VBO_ids.size());
assert(this->triangle_patches.size() == this->triangle_indices_VBO_ids.size());
assert(this->vertices_VAO_id != 0);
assert(this->vertices_VBO_id != 0);
assert(this->triangle_indices_VBO_ids[triangle_indices_idx] != 0);

Expand Down Expand Up @@ -954,7 +953,6 @@ void GLMmSegmentationGizmo3DScene::render(size_t triangle_indices_idx) const

void GLMmSegmentationGizmo3DScene::finalize_vertices()
{
assert(this->vertices_VAO_id == 0);
assert(this->vertices_VBO_id == 0);
if (!this->vertices.empty()) {
glsafe(::glGenBuffers(1, &this->vertices_VBO_id));
Expand Down

0 comments on commit c4a66f3

Please sign in to comment.