Configure CI/CD build to properly build OrcaSlicer with Protobuf and codegen

This commit is contained in:
ExPikaPaka
2026-06-04 08:37:32 +02:00
parent a78ef9ce1c
commit 6e84139d60
8 changed files with 62 additions and 1 deletions

View File

@@ -50,6 +50,20 @@ jobs:
useLocalCache: true # <--= Use the local cache (default is 'false').
useCloudCache: true
- name: Install codegen tools and generate config sources
run: |
pip install grpcio-tools
python tools/run_codegen.py
if: runner.os == 'Windows'
shell: pwsh
- name: Install codegen tools and generate config sources
run: |
pip3 install grpcio-tools
python3 tools/run_codegen.py
if: runner.os != 'Windows'
shell: bash
- name: Get the version and date on Ubuntu and macOS
if: runner.os != 'Windows'
run: |

View File

@@ -872,6 +872,11 @@ function(orcaslicer_copy_dlls target config postfix output_dlls)
endfunction()
# Config codegen — generates src/slic3r/GUI/generated/*.cpp from src/PrintConfigs/*.proto.
# Must run before compiling libslic3r (PrintConfig.cpp #includes the generated files).
# Requires: pip install grpcio-tools OR standalone protoc in PATH.
include(cmake/modules/ConfigCodegen.cmake)
# libslic3r, OrcaSlicer GUI and the OrcaSlicer executable.
add_subdirectory(deps_src)
add_subdirectory(src)

View File

@@ -545,6 +545,10 @@ if [[ -n "${BUILD_ORCA}" ]] || [[ -n "${BUILD_TESTS}" ]] ; then
BUILD_ARGS+=(-DORCA_UPDATER_SIG_KEY="${ORCA_UPDATER_SIG_KEY}")
fi
echo "Generating config sources from proto..."
pip install grpcio-tools -q
python3 tools/run_codegen.py || { echo "ERROR: config codegen failed"; exit 1; }
print_and_run cmake -S . -B $BUILD_DIR "${CMAKE_C_CXX_COMPILER_CLANG[@]}" "${CMAKE_LLD_LINKER_ARGS[@]}" "${CMAKE_CCACHE_ARGS[@]}" -G "Ninja Multi-Config" \
-DSLIC3R_PCH=${SLIC3R_PRECOMPILED_HEADERS} \
-DORCA_TOOLS=ON \

View File

@@ -180,6 +180,10 @@ function pack_deps() {
}
function build_slicer() {
echo "Generating config sources from proto..."
pip3 install grpcio-tools -q
python3 tools/run_codegen.py || { echo "ERROR: config codegen failed"; exit 1; }
# iterate over two architectures: x86_64 and arm64
for _ARCH in x86_64 arm64; do
# if ARCH is universal or equal to _ARCH

View File

@@ -126,6 +126,15 @@ if "%1"=="deps" goto :done
:slicer
echo "building Orca Slicer..."
cd %WP%
echo "generating config sources from proto..."
pip install grpcio-tools -q
python tools/run_codegen.py
if errorlevel 1 (
echo "ERROR: config codegen failed"
exit /b 1
)
mkdir %build_dir%
cd %build_dir%

View File

@@ -57,6 +57,15 @@ if "%1"=="deps" exit /b 0
:slicer
echo "building Orca Slicer..."
cd %WP%
echo "generating config sources from proto..."
pip install grpcio-tools -q
python tools/run_codegen.py
if errorlevel 1 (
echo "ERROR: config codegen failed"
exit /b 1
)
mkdir %build_dir%
cd %build_dir%

View File

@@ -489,6 +489,21 @@ add_library(libslic3r STATIC ${lisbslic3r_sources}
${OpenVDBUtils_SOURCES})
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${lisbslic3r_sources})
# Ensure codegen runs before compiling libslic3r (PrintConfig.cpp, Preset.cpp, Print.cpp
# all #include generated files — MSVC tracks the #include deps automatically after first build,
# but this dependency ensures the generated files exist and are up-to-date before compilation).
if(TARGET codegen_config)
add_dependencies(libslic3r codegen_config)
# Tell cmake that the three source files that #include generated code depend on them,
# so an incremental build recompiles them when protos change.
set_source_files_properties(
"${CMAKE_CURRENT_SOURCE_DIR}/PrintConfig.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Preset.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Print.cpp"
PROPERTIES OBJECT_DEPENDS "${CONFIG_GENERATED_SOURCES}"
)
endif()
if (SLIC3R_STATIC)
set(CGAL_Boost_USE_STATIC_LIBS ON CACHE BOOL "" FORCE)
endif ()

View File

@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.13)
cmake_minimum_required(VERSION 3.13)
project(libslic3r_gui)
include(PrecompiledHeader)
@@ -460,6 +460,7 @@ set(SLIC3R_GUI_SOURCES
GUI/TabButton.hpp
GUI/Tab.cpp
GUI/Tab.hpp
GUI/TabLayoutExtra.cpp
GUI/TaskManager.cpp
GUI/TaskManager.hpp
GUI/TextLines.cpp