This commit is contained in:
PJarczak 2026-04-21 12:24:07 +02:00
parent 4ec06f5bd9
commit e547bd2b20
6 changed files with 566 additions and 518 deletions

View file

@ -708,11 +708,34 @@ endif ()
# l10n
set(L10N_DIR "${SLIC3R_RESOURCES_DIR}/i18n")
set(BBL_L18N_DIR "${CMAKE_CURRENT_SOURCE_DIR}/localization/i18n")
if (WIN32)
set(GETTEXT_XGETTEXT_EXECUTABLE "${PROJECT_SOURCE_DIR}/tools/xgettext.exe")
set(GETTEXT_MSGMERGE_EXECUTABLE "${PROJECT_SOURCE_DIR}/tools/msgmerge.exe")
set(GETTEXT_MSGFMT_EXECUTABLE "${PROJECT_SOURCE_DIR}/tools/msgfmt.exe")
else ()
find_program(GETTEXT_XGETTEXT_EXECUTABLE xgettext)
find_program(GETTEXT_MSGMERGE_EXECUTABLE msgmerge)
find_program(GETTEXT_MSGFMT_EXECUTABLE msgfmt)
if (NOT GETTEXT_XGETTEXT_EXECUTABLE)
set(GETTEXT_XGETTEXT_EXECUTABLE xgettext)
endif ()
if (NOT GETTEXT_MSGMERGE_EXECUTABLE)
set(GETTEXT_MSGMERGE_EXECUTABLE msgmerge)
endif ()
if (NOT GETTEXT_MSGFMT_EXECUTABLE)
set(GETTEXT_MSGFMT_EXECUTABLE msgfmt)
endif ()
endif ()
add_custom_target(gettext_make_pot
COMMAND xgettext --keyword=L --keyword=_L --keyword=_u8L --keyword=L_CONTEXT:1,2c --keyword=_L_PLURAL:1,2 --add-comments=TRN --from-code=UTF-8 --no-location --debug --boost
COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE} --keyword=L --keyword=_L --keyword=_u8L --keyword=L_CONTEXT:1,2c --keyword=_L_PLURAL:1,2 --add-comments=TRN --from-code=UTF-8 --no-location --debug --boost
-f "${BBL_L18N_DIR}/list.txt"
-o "${BBL_L18N_DIR}/OrcaSlicer.pot"
COMMAND hintsToPot ${SLIC3R_RESOURCES_DIR} ${BBL_L18N_DIR}
COMMAND hintsToPot ${SLIC3R_RESOURCES_DIR} ${BBL_L18N_DIR}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT "Generate pot file from strings in the source tree"
)
@ -722,12 +745,10 @@ add_custom_target(gettext_merge_po_with_pot
)
file(GLOB BBL_L10N_PO_FILES "${BBL_L18N_DIR}/*/OrcaSlicer*.po")
foreach(po_file ${BBL_L10N_PO_FILES})
GET_FILENAME_COMPONENT(po_dir "${po_file}" DIRECTORY)
SET(po_new_file "${po_dir}/OrcaSlicer_.po")
add_custom_command(
TARGET gettext_merge_po_with_pot PRE_BUILD
COMMAND msgmerge -N -o ${po_file} ${po_file} "${BBL_L18N_DIR}/OrcaSlicer.pot"
DEPENDS ${po_file}
COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} -N -o "${po_file}" "${po_file}" "${BBL_L18N_DIR}/OrcaSlicer.pot"
DEPENDS "${po_file}"
)
endforeach()
add_custom_target(gettext_po_to_mo
@ -736,16 +757,16 @@ add_custom_target(gettext_po_to_mo
)
file(GLOB L10N_PO_FILES "${BBL_L18N_DIR}/*/OrcaSlicer*.po")
foreach(po_file ${L10N_PO_FILES})
GET_FILENAME_COMPONENT(SECOND_FOLDER_ABSOLUTE ${po_file} DIRECTORY)
string(REGEX REPLACE ".*/(.*)" "\\1" po_dir "${SECOND_FOLDER_ABSOLUTE}" )
SET(mo_dir "${L10N_DIR}/${po_dir}")
SET(mo_file "${mo_dir}/OrcaSlicer.mo")
get_filename_component(po_parent_dir "${po_file}" DIRECTORY)
get_filename_component(po_dir "${po_parent_dir}" NAME)
set(mo_dir "${L10N_DIR}/${po_dir}")
set(mo_file "${mo_dir}/OrcaSlicer.mo")
add_custom_command(
TARGET gettext_po_to_mo PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${mo_dir}
COMMAND msgfmt ARGS --check-format -o ${mo_file} ${po_file}
#COMMAND msgfmt ARGS --check-compatibility -o ${mo_file} ${po_file}
DEPENDS ${po_file}
COMMAND ${CMAKE_COMMAND} -E make_directory "${mo_dir}"
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check-format -o "${mo_file}" "${po_file}"
#COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check-compatibility -o "${mo_file}" "${po_file}"
DEPENDS "${po_file}"
)
endforeach()

View file

@ -1,52 +1,58 @@
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_dir%
cd %build_dir%
set DEPS=%CD%/OrcaSlicer_dep
set "SIG_FLAG="
if defined ORCA_UPDATER_SIG_KEY set "SIG_FLAG=-DORCA_UPDATER_SIG_KEY=%ORCA_UPDATER_SIG_KEY%"
if "%1"=="slicer" (
GOTO :slicer
)
echo "building deps.."
echo cmake ../ -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=%build_type%
cmake ../ -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=%build_type%
cmake --build . --config %build_type% --target deps -- -m
if "%1"=="deps" exit /b 0
:slicer
echo "building Orca Slicer..."
cd %WP%
mkdir %build_dir%
cd %build_dir%
echo cmake .. -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=%build_type%
cmake .. -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=%build_type% %SIG_FLAG%
cmake --build . --config %build_type% --target ALL_BUILD -- -m
cd ..
call scripts/run_gettext.bat
cd %build_dir%
cmake --build . --target install --config %build_type%
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_dir%
cd %build_dir%
set DEPS=%CD%/OrcaSlicer_dep
set "SIG_FLAG="
if defined ORCA_UPDATER_SIG_KEY set "SIG_FLAG=-DORCA_UPDATER_SIG_KEY=%ORCA_UPDATER_SIG_KEY%"
if "%1"=="slicer" (
GOTO :slicer
)
echo "building deps.."
echo cmake ../ -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=%build_type%
cmake ../ -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=%build_type%
if errorlevel 1 exit /b 1
cmake --build . --config %build_type% --target deps -- -m
if errorlevel 1 exit /b 1
if "%1"=="deps" exit /b 0
:slicer
echo "building Orca Slicer..."
cd %WP%
mkdir %build_dir%
cd %build_dir%
echo cmake .. -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=%build_type%
cmake .. -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=%build_type% %SIG_FLAG%
if errorlevel 1 exit /b 1
cmake --build . --config %build_type% --target ALL_BUILD -- -m
if errorlevel 1 exit /b 1
cd ..
call scripts/run_gettext.bat
if errorlevel 1 exit /b 1
cd %build_dir%
cmake --build . --target install --config %build_type%
if errorlevel 1 exit /b 1

View file

@ -1,345 +1,355 @@
@REM OrcaSlicer build script for Windows with VS auto-detect
@echo off
set WP=%CD%
set _START_TIME=%TIME%
@REM Check for Ninja Multi-Config option (-x)
set USE_NINJA=0
for %%a in (%*) do (
if "%%a"=="-x" set USE_NINJA=1
)
if "%USE_NINJA%"=="1" (
echo Using Ninja Multi-Config generator
set CMAKE_GENERATOR="Ninja Multi-Config"
set VS_VERSION=Ninja
goto :generator_ready
)
@REM Detect Visual Studio version using msbuild
echo Detecting Visual Studio version using msbuild...
@REM Try to get MSBuild version - the output format varies by VS version
set VS_MAJOR=
for /f "tokens=*" %%i in ('msbuild -version 2^>^&1 ^| findstr /r "^[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*"') do (
for /f "tokens=1 delims=." %%a in ("%%i") do set VS_MAJOR=%%a
set MSBUILD_OUTPUT=%%i
goto :version_found
)
@REM Alternative method for newer MSBuild versions
if "%VS_MAJOR%"=="" (
for /f "tokens=*" %%i in ('msbuild -version 2^>^&1 ^| findstr /r "[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*"') do (
for /f "tokens=1 delims=." %%a in ("%%i") do set VS_MAJOR=%%a
set MSBUILD_OUTPUT=%%i
goto :version_found
)
)
:version_found
echo MSBuild version detected: %MSBUILD_OUTPUT%
echo Major version: %VS_MAJOR%
if "%VS_MAJOR%"=="" (
echo Error: Could not determine Visual Studio version from msbuild
echo Please ensure Visual Studio and MSBuild are properly installed
exit /b 1
)
if "%VS_MAJOR%"=="16" (
set VS_VERSION=2019
set CMAKE_GENERATOR="Visual Studio 16 2019"
) else if "%VS_MAJOR%"=="17" (
set VS_VERSION=2022
set CMAKE_GENERATOR="Visual Studio 17 2022"
) else if "%VS_MAJOR%"=="18" (
set VS_VERSION=2026
set CMAKE_GENERATOR="Visual Studio 18 2026"
) else (
echo Error: Unsupported Visual Studio version: %VS_MAJOR%
echo Supported versions: VS2019 ^(16.x^), VS2022 ^(17.x^), VS2026 ^(18.x^)
exit /b 1
)
echo Detected Visual Studio %VS_VERSION% (version %VS_MAJOR%)
echo Using CMake generator: %CMAKE_GENERATOR%
:generator_ready
@REM Pack deps
if "%1"=="pack" (
setlocal ENABLEDELAYEDEXPANSION
cd %WP%/deps/build
for /f "tokens=2-4 delims=/ " %%a in ('date /t') do set build_date=%%c%%b%%a
echo packing deps: OrcaSlicer_dep_win64_!build_date!_vs!VS_VERSION!.zip
%WP%/tools/7z.exe a OrcaSlicer_dep_win64_!build_date!_vs!VS_VERSION!.zip OrcaSlicer_dep
goto :done
)
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_dir%
cd %build_dir%
set "SIG_FLAG="
if defined ORCA_UPDATER_SIG_KEY set "SIG_FLAG=-DORCA_UPDATER_SIG_KEY=%ORCA_UPDATER_SIG_KEY%"
if "%1"=="slicer" (
GOTO :slicer
)
echo "building deps.."
echo on
REM Set minimum CMake policy to avoid <3.5 errors
set CMAKE_POLICY_VERSION_MINIMUM=3.5
if "%USE_NINJA%"=="1" (
cmake ../ -G %CMAKE_GENERATOR% -DCMAKE_BUILD_TYPE=%build_type%
cmake --build . --config %build_type% --target deps
) else (
cmake ../ -G %CMAKE_GENERATOR% -A x64 -DCMAKE_BUILD_TYPE=%build_type%
cmake --build . --config %build_type% --target deps -- -m
)
@echo off
if "%1"=="deps" goto :done
:slicer
call :check_linux_bridge_runtime_inputs
if errorlevel 1 exit /b 1
echo "building Orca Slicer..."
cd %WP%
mkdir %build_dir%
cd %build_dir%
echo on
set CMAKE_POLICY_VERSION_MINIMUM=3.5
if "%USE_NINJA%"=="1" (
cmake .. -G %CMAKE_GENERATOR% -DORCA_TOOLS=ON %SIG_FLAG% -DCMAKE_BUILD_TYPE=%build_type%
cmake --build . --config %build_type% --target ALL_BUILD
) else (
cmake .. -G %CMAKE_GENERATOR% -A x64 -DORCA_TOOLS=ON %SIG_FLAG% -DCMAKE_BUILD_TYPE=%build_type%
cmake --build . --config %build_type% --target ALL_BUILD -- -m
)
@echo off
cd ..
call scripts/run_gettext.bat
cd %build_dir%
cmake --build . --target install --config %build_type%
call :copy_linux_bridge_runtime
if errorlevel 1 exit /b 1
:done
@echo off
for /f "tokens=1-3 delims=:.," %%a in ("%_START_TIME: =0%") do set /a "_start_s=(1%%a-100)*3600 + (1%%b-100)*60 + (1%%c-100)"
for /f "tokens=1-3 delims=:.," %%a in ("%TIME: =0%") do set /a "_end_s=(1%%a-100)*3600 + (1%%b-100)*60 + (1%%c-100)"
set /a "_elapsed=_end_s - _start_s"
if %_elapsed% lss 0 set /a "_elapsed+=86400"
set /a "_hours=_elapsed / 3600"
set /a "_remainder=_elapsed - _hours * 3600"
set /a "_mins=_remainder / 60"
set /a "_secs=_remainder - _mins * 60"
echo.
echo Build completed in %_hours%h %_mins%m %_secs%s
exit /b 0
:resolve_rootfs_tar
if defined PJARCZAK_ROOTFS_TAR exit /b 0
if defined PJARCZAK_WSL_ROOTFS_TAR (
if exist "%PJARCZAK_WSL_ROOTFS_TAR%" (
set "PJARCZAK_ROOTFS_TAR=%PJARCZAK_WSL_ROOTFS_TAR%"
exit /b 0
)
echo Missing file from PJARCZAK_WSL_ROOTFS_TAR: %PJARCZAK_WSL_ROOTFS_TAR%
exit /b 1
)
if exist "%WP%\tools\pjarczak_bambu_runtime\rootfs\windows-wsl2-rootfs.tar" (
set "PJARCZAK_ROOTFS_TAR=%WP%\tools\pjarczak_bambu_runtime\rootfs\windows-wsl2-rootfs.tar"
exit /b 0
)
if exist "%WP%\tools\pjarczak_bambu_runtime\windows-wsl2-rootfs.tar" (
set "PJARCZAK_ROOTFS_TAR=%WP%\tools\pjarczak_bambu_runtime\windows-wsl2-rootfs.tar"
exit /b 0
)
echo Missing windows-wsl2-rootfs.tar
echo Expected one of:
echo %WP%\tools\pjarczak_bambu_runtime\rootfs\windows-wsl2-rootfs.tar
echo %WP%\tools\pjarczak_bambu_runtime\windows-wsl2-rootfs.tar
echo Or set PJARCZAK_WSL_ROOTFS_TAR to an absolute path.
exit /b 1
:check_linux_bridge_runtime_inputs
set "HOST_RUNTIME_DIR=%WP%\tools\pjarczak_bambu_linux_host\runtime\linux-x86_64"
call :resolve_rootfs_tar
if errorlevel 1 exit /b 1
if not exist "%HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host" (
echo Missing linux host runtime: %HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host
echo Build it first on Linux with:
echo tools\pjarczak_bambu_linux_host\package_linux_host_runtime.sh
exit /b 1
)
if not exist "%HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host_abi1" (
echo Missing linux host ABI1 runtime: %HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host_abi1
exit /b 1
)
if not exist "%HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host_abi0" (
echo Missing linux host ABI0 runtime: %HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host_abi0
exit /b 1
)
if not exist "%HOST_RUNTIME_DIR%\ca-certificates.crt" (
echo Missing CA bundle for linux bridge runtime: %HOST_RUNTIME_DIR%\ca-certificates.crt
exit /b 1
)
if not exist "%HOST_RUNTIME_DIR%\slicer_base64.cer" (
echo Missing slicer certificate for linux bridge runtime: %HOST_RUNTIME_DIR%\slicer_base64.cer
exit /b 1
)
echo Linux bridge preflight OK
echo host runtime: %HOST_RUNTIME_DIR%
echo rootfs tar: %PJARCZAK_ROOTFS_TAR%
exit /b 0
:copy_linux_bridge_runtime
set "INSTALL_DIR=%WP%\%build_dir%\OrcaSlicer"
set "HOST_RUNTIME_DIR=%WP%\tools\pjarczak_bambu_linux_host\runtime\linux-x86_64"
if not defined PJARCZAK_ROOTFS_TAR (
call :resolve_rootfs_tar
if errorlevel 1 exit /b 1
)
if not exist "%HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host" (
echo Missing linux host runtime: %HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host
echo Build it first on Linux with:
echo tools\pjarczak_bambu_linux_host\package_linux_host_runtime.sh
exit /b 1
)
if not exist "%HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host_abi1" (
echo Missing linux host ABI1 runtime: %HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host_abi1
exit /b 1
)
if not exist "%HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host_abi0" (
echo Missing linux host ABI0 runtime: %HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host_abi0
exit /b 1
)
if not exist "%HOST_RUNTIME_DIR%\ca-certificates.crt" (
echo Missing CA bundle for linux bridge runtime: %HOST_RUNTIME_DIR%\ca-certificates.crt
exit /b 1
)
if not exist "%HOST_RUNTIME_DIR%\slicer_base64.cer" (
echo Missing slicer certificate for linux bridge runtime: %HOST_RUNTIME_DIR%\slicer_base64.cer
exit /b 1
)
if not exist "%INSTALL_DIR%" (
echo Missing install directory: %INSTALL_DIR%
exit /b 1
)
if not exist "%INSTALL_DIR%\pjarczak_bambu_networking_bridge.dll" (
if exist "%WP%\%build_dir%\pjarczak_bambu_networking_bridge.dll" (
copy /Y "%WP%\%build_dir%\pjarczak_bambu_networking_bridge.dll" "%INSTALL_DIR%\pjarczak_bambu_networking_bridge.dll" >nul
)
)
if not exist "%INSTALL_DIR%\pjarczak_bambu_networking_bridge.dll" (
if exist "%WP%\%build_dir%\src\%build_type%\pjarczak_bambu_networking_bridge.dll" (
copy /Y "%WP%\%build_dir%\src\%build_type%\pjarczak_bambu_networking_bridge.dll" "%INSTALL_DIR%\pjarczak_bambu_networking_bridge.dll" >nul
)
)
if not exist "%INSTALL_DIR%\pjarczak_bambu_networking_bridge.dll" (
echo Missing bridge DLL in install output: %INSTALL_DIR%\pjarczak_bambu_networking_bridge.dll
exit /b 1
)
xcopy "%HOST_RUNTIME_DIR%\*" "%INSTALL_DIR%\\" /I /Y >nul
if errorlevel 4 (
echo Failed to copy flat linux host runtime files into %INSTALL_DIR%
exit /b 1
)
copy /Y "%PJARCZAK_ROOTFS_TAR%" "%INSTALL_DIR%\windows-wsl2-rootfs.tar" >nul
if errorlevel 1 (
echo Failed to copy windows-wsl2-rootfs.tar into %INSTALL_DIR%
exit /b 1
)
copy /Y "%WP%\tools\pjarczak_bambu_runtime\wsl\pjarczak_wsl_run_host.sh" "%INSTALL_DIR%\pjarczak_wsl_run_host.sh" >nul
if errorlevel 1 (
echo Failed to copy pjarczak_wsl_run_host.sh into %INSTALL_DIR%
exit /b 1
)
copy /Y "%WP%\tools\pjarczak_bambu_runtime\wsl\install_runtime.ps1" "%INSTALL_DIR%\install_runtime.ps1" >nul
if errorlevel 1 (
echo Failed to copy install_runtime.ps1 into %INSTALL_DIR%
exit /b 1
)
copy /Y "%WP%\tools\pjarczak_bambu_runtime\wsl\install_runtime.cmd" "%INSTALL_DIR%\install_runtime.cmd" >nul
if errorlevel 1 (
echo Failed to copy install_runtime.cmd into %INSTALL_DIR%
exit /b 1
)
copy /Y "%WP%\tools\pjarczak_bambu_runtime\wsl\verify_runtime.ps1" "%INSTALL_DIR%\verify_runtime.ps1" >nul
if errorlevel 1 (
echo Failed to copy verify_runtime.ps1 into %INSTALL_DIR%
exit /b 1
)
copy /Y "%WP%\tools\pjarczak_bambu_runtime\wsl\pjarczak_wsl_distro.txt" "%INSTALL_DIR%\pjarczak_wsl_distro.txt" >nul
if errorlevel 1 (
echo Failed to copy pjarczak_wsl_distro.txt into %INSTALL_DIR%
exit /b 1
)
copy /Y "%WP%\tools\pjarczak_bambu_runtime\wsl\pjarczak_plugin_cache_subdir.txt" "%INSTALL_DIR%\pjarczak_plugin_cache_subdir.txt" >nul
if errorlevel 1 (
echo Failed to copy pjarczak_plugin_cache_subdir.txt into %INSTALL_DIR%
exit /b 1
)
copy /Y "%WP%\tools\pjarczak_bambu_runtime\release\assemble_windows_runtime_bundle.ps1" "%INSTALL_DIR%\assemble_windows_runtime_bundle.ps1" >nul
if errorlevel 1 (
echo Failed to copy assemble_windows_runtime_bundle.ps1 into %INSTALL_DIR%
exit /b 1
)
exit /b 0
@REM OrcaSlicer build script for Windows with VS auto-detect
@echo off
set WP=%CD%
set _START_TIME=%TIME%
@REM Check for Ninja Multi-Config option (-x)
set USE_NINJA=0
for %%a in (%*) do (
if "%%a"=="-x" set USE_NINJA=1
)
if "%USE_NINJA%"=="1" (
echo Using Ninja Multi-Config generator
set CMAKE_GENERATOR="Ninja Multi-Config"
set VS_VERSION=Ninja
goto :generator_ready
)
@REM Detect Visual Studio version using msbuild
echo Detecting Visual Studio version using msbuild...
@REM Try to get MSBuild version - the output format varies by VS version
set VS_MAJOR=
for /f "tokens=*" %%i in ('msbuild -version 2^>^&1 ^| findstr /r "^[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*"') do (
for /f "tokens=1 delims=." %%a in ("%%i") do set VS_MAJOR=%%a
set MSBUILD_OUTPUT=%%i
goto :version_found
)
@REM Alternative method for newer MSBuild versions
if "%VS_MAJOR%"=="" (
for /f "tokens=*" %%i in ('msbuild -version 2^>^&1 ^| findstr /r "[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*"') do (
for /f "tokens=1 delims=." %%a in ("%%i") do set VS_MAJOR=%%a
set MSBUILD_OUTPUT=%%i
goto :version_found
)
)
:version_found
echo MSBuild version detected: %MSBUILD_OUTPUT%
echo Major version: %VS_MAJOR%
if "%VS_MAJOR%"=="" (
echo Error: Could not determine Visual Studio version from msbuild
echo Please ensure Visual Studio and MSBuild are properly installed
exit /b 1
)
if "%VS_MAJOR%"=="16" (
set VS_VERSION=2019
set CMAKE_GENERATOR="Visual Studio 16 2019"
) else if "%VS_MAJOR%"=="17" (
set VS_VERSION=2022
set CMAKE_GENERATOR="Visual Studio 17 2022"
) else if "%VS_MAJOR%"=="18" (
set VS_VERSION=2026
set CMAKE_GENERATOR="Visual Studio 18 2026"
) else (
echo Error: Unsupported Visual Studio version: %VS_MAJOR%
echo Supported versions: VS2019 ^(16.x^), VS2022 ^(17.x^), VS2026 ^(18.x^)
exit /b 1
)
echo Detected Visual Studio %VS_VERSION% (version %VS_MAJOR%)
echo Using CMake generator: %CMAKE_GENERATOR%
:generator_ready
@REM Pack deps
if "%1"=="pack" (
setlocal ENABLEDELAYEDEXPANSION
cd %WP%/deps/build
for /f "tokens=2-4 delims=/ " %%a in ('date /t') do set build_date=%%c%%b%%a
echo packing deps: OrcaSlicer_dep_win64_!build_date!_vs!VS_VERSION!.zip
%WP%/tools/7z.exe a OrcaSlicer_dep_win64_!build_date!_vs!VS_VERSION!.zip OrcaSlicer_dep
goto :done
)
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_dir%
cd %build_dir%
set "SIG_FLAG="
if defined ORCA_UPDATER_SIG_KEY set "SIG_FLAG=-DORCA_UPDATER_SIG_KEY=%ORCA_UPDATER_SIG_KEY%"
if "%1"=="slicer" (
GOTO :slicer
)
echo "building deps.."
echo on
REM Set minimum CMake policy to avoid <3.5 errors
set CMAKE_POLICY_VERSION_MINIMUM=3.5
if "%USE_NINJA%"=="1" (
cmake ../ -G %CMAKE_GENERATOR% -DCMAKE_BUILD_TYPE=%build_type%
if errorlevel 1 exit /b 1
cmake --build . --config %build_type% --target deps
if errorlevel 1 exit /b 1
) else (
cmake ../ -G %CMAKE_GENERATOR% -A x64 -DCMAKE_BUILD_TYPE=%build_type%
if errorlevel 1 exit /b 1
cmake --build . --config %build_type% --target deps -- -m
if errorlevel 1 exit /b 1
)
@echo off
if "%1"=="deps" goto :done
:slicer
call :check_linux_bridge_runtime_inputs
if errorlevel 1 exit /b 1
echo "building Orca Slicer..."
cd %WP%
mkdir %build_dir%
cd %build_dir%
echo on
set CMAKE_POLICY_VERSION_MINIMUM=3.5
if "%USE_NINJA%"=="1" (
cmake .. -G %CMAKE_GENERATOR% -DORCA_TOOLS=ON %SIG_FLAG% -DCMAKE_BUILD_TYPE=%build_type%
if errorlevel 1 exit /b 1
cmake --build . --config %build_type% --target ALL_BUILD
if errorlevel 1 exit /b 1
) else (
cmake .. -G %CMAKE_GENERATOR% -A x64 -DORCA_TOOLS=ON %SIG_FLAG% -DCMAKE_BUILD_TYPE=%build_type%
if errorlevel 1 exit /b 1
cmake --build . --config %build_type% --target ALL_BUILD -- -m
if errorlevel 1 exit /b 1
)
@echo off
cd ..
call scripts/run_gettext.bat
if errorlevel 1 exit /b 1
cd %build_dir%
cmake --build . --target install --config %build_type%
if errorlevel 1 exit /b 1
call :copy_linux_bridge_runtime
if errorlevel 1 exit /b 1
:done
@echo off
for /f "tokens=1-3 delims=:.," %%a in ("%_START_TIME: =0%") do set /a "_start_s=(1%%a-100)*3600 + (1%%b-100)*60 + (1%%c-100)"
for /f "tokens=1-3 delims=:.," %%a in ("%TIME: =0%") do set /a "_end_s=(1%%a-100)*3600 + (1%%b-100)*60 + (1%%c-100)"
set /a "_elapsed=_end_s - _start_s"
if %_elapsed% lss 0 set /a "_elapsed+=86400"
set /a "_hours=_elapsed / 3600"
set /a "_remainder=_elapsed - _hours * 3600"
set /a "_mins=_remainder / 60"
set /a "_secs=_remainder - _mins * 60"
echo.
echo Build completed in %_hours%h %_mins%m %_secs%s
exit /b 0
:resolve_rootfs_tar
if defined PJARCZAK_ROOTFS_TAR exit /b 0
if defined PJARCZAK_WSL_ROOTFS_TAR (
if exist "%PJARCZAK_WSL_ROOTFS_TAR%" (
set "PJARCZAK_ROOTFS_TAR=%PJARCZAK_WSL_ROOTFS_TAR%"
exit /b 0
)
echo Missing file from PJARCZAK_WSL_ROOTFS_TAR: %PJARCZAK_WSL_ROOTFS_TAR%
exit /b 1
)
if exist "%WP%\tools\pjarczak_bambu_runtime\rootfs\windows-wsl2-rootfs.tar" (
set "PJARCZAK_ROOTFS_TAR=%WP%\tools\pjarczak_bambu_runtime\rootfs\windows-wsl2-rootfs.tar"
exit /b 0
)
if exist "%WP%\tools\pjarczak_bambu_runtime\windows-wsl2-rootfs.tar" (
set "PJARCZAK_ROOTFS_TAR=%WP%\tools\pjarczak_bambu_runtime\windows-wsl2-rootfs.tar"
exit /b 0
)
echo Missing windows-wsl2-rootfs.tar
echo Expected one of:
echo %WP%\tools\pjarczak_bambu_runtime\rootfs\windows-wsl2-rootfs.tar
echo %WP%\tools\pjarczak_bambu_runtime\windows-wsl2-rootfs.tar
echo Or set PJARCZAK_WSL_ROOTFS_TAR to an absolute path.
exit /b 1
:check_linux_bridge_runtime_inputs
set "HOST_RUNTIME_DIR=%WP%\tools\pjarczak_bambu_linux_host\runtime\linux-x86_64"
call :resolve_rootfs_tar
if errorlevel 1 exit /b 1
if not exist "%HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host" (
echo Missing linux host runtime: %HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host
echo Build it first on Linux with:
echo tools\pjarczak_bambu_linux_host\package_linux_host_runtime.sh
exit /b 1
)
if not exist "%HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host_abi1" (
echo Missing linux host ABI1 runtime: %HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host_abi1
exit /b 1
)
if not exist "%HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host_abi0" (
echo Missing linux host ABI0 runtime: %HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host_abi0
exit /b 1
)
if not exist "%HOST_RUNTIME_DIR%\ca-certificates.crt" (
echo Missing CA bundle for linux bridge runtime: %HOST_RUNTIME_DIR%\ca-certificates.crt
exit /b 1
)
if not exist "%HOST_RUNTIME_DIR%\slicer_base64.cer" (
echo Missing slicer certificate for linux bridge runtime: %HOST_RUNTIME_DIR%\slicer_base64.cer
exit /b 1
)
echo Linux bridge preflight OK
echo host runtime: %HOST_RUNTIME_DIR%
echo rootfs tar: %PJARCZAK_ROOTFS_TAR%
exit /b 0
:copy_linux_bridge_runtime
set "INSTALL_DIR=%WP%\%build_dir%\OrcaSlicer"
set "HOST_RUNTIME_DIR=%WP%\tools\pjarczak_bambu_linux_host\runtime\linux-x86_64"
if not defined PJARCZAK_ROOTFS_TAR (
call :resolve_rootfs_tar
if errorlevel 1 exit /b 1
)
if not exist "%HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host" (
echo Missing linux host runtime: %HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host
echo Build it first on Linux with:
echo tools\pjarczak_bambu_linux_host\package_linux_host_runtime.sh
exit /b 1
)
if not exist "%HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host_abi1" (
echo Missing linux host ABI1 runtime: %HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host_abi1
exit /b 1
)
if not exist "%HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host_abi0" (
echo Missing linux host ABI0 runtime: %HOST_RUNTIME_DIR%\pjarczak_bambu_linux_host_abi0
exit /b 1
)
if not exist "%HOST_RUNTIME_DIR%\ca-certificates.crt" (
echo Missing CA bundle for linux bridge runtime: %HOST_RUNTIME_DIR%\ca-certificates.crt
exit /b 1
)
if not exist "%HOST_RUNTIME_DIR%\slicer_base64.cer" (
echo Missing slicer certificate for linux bridge runtime: %HOST_RUNTIME_DIR%\slicer_base64.cer
exit /b 1
)
if not exist "%INSTALL_DIR%" (
echo Missing install directory: %INSTALL_DIR%
exit /b 1
)
if not exist "%INSTALL_DIR%\pjarczak_bambu_networking_bridge.dll" (
if exist "%WP%\%build_dir%\pjarczak_bambu_networking_bridge.dll" (
copy /Y "%WP%\%build_dir%\pjarczak_bambu_networking_bridge.dll" "%INSTALL_DIR%\pjarczak_bambu_networking_bridge.dll" >nul
)
)
if not exist "%INSTALL_DIR%\pjarczak_bambu_networking_bridge.dll" (
if exist "%WP%\%build_dir%\src\%build_type%\pjarczak_bambu_networking_bridge.dll" (
copy /Y "%WP%\%build_dir%\src\%build_type%\pjarczak_bambu_networking_bridge.dll" "%INSTALL_DIR%\pjarczak_bambu_networking_bridge.dll" >nul
)
)
if not exist "%INSTALL_DIR%\pjarczak_bambu_networking_bridge.dll" (
echo Missing bridge DLL in install output: %INSTALL_DIR%\pjarczak_bambu_networking_bridge.dll
exit /b 1
)
xcopy "%HOST_RUNTIME_DIR%\*" "%INSTALL_DIR%\\" /I /Y >nul
if errorlevel 4 (
echo Failed to copy flat linux host runtime files into %INSTALL_DIR%
exit /b 1
)
copy /Y "%PJARCZAK_ROOTFS_TAR%" "%INSTALL_DIR%\windows-wsl2-rootfs.tar" >nul
if errorlevel 1 (
echo Failed to copy windows-wsl2-rootfs.tar into %INSTALL_DIR%
exit /b 1
)
copy /Y "%WP%\tools\pjarczak_bambu_runtime\wsl\pjarczak_wsl_run_host.sh" "%INSTALL_DIR%\pjarczak_wsl_run_host.sh" >nul
if errorlevel 1 (
echo Failed to copy pjarczak_wsl_run_host.sh into %INSTALL_DIR%
exit /b 1
)
copy /Y "%WP%\tools\pjarczak_bambu_runtime\wsl\install_runtime.ps1" "%INSTALL_DIR%\install_runtime.ps1" >nul
if errorlevel 1 (
echo Failed to copy install_runtime.ps1 into %INSTALL_DIR%
exit /b 1
)
copy /Y "%WP%\tools\pjarczak_bambu_runtime\wsl\install_runtime.cmd" "%INSTALL_DIR%\install_runtime.cmd" >nul
if errorlevel 1 (
echo Failed to copy install_runtime.cmd into %INSTALL_DIR%
exit /b 1
)
copy /Y "%WP%\tools\pjarczak_bambu_runtime\wsl\verify_runtime.ps1" "%INSTALL_DIR%\verify_runtime.ps1" >nul
if errorlevel 1 (
echo Failed to copy verify_runtime.ps1 into %INSTALL_DIR%
exit /b 1
)
copy /Y "%WP%\tools\pjarczak_bambu_runtime\wsl\pjarczak_wsl_distro.txt" "%INSTALL_DIR%\pjarczak_wsl_distro.txt" >nul
if errorlevel 1 (
echo Failed to copy pjarczak_wsl_distro.txt into %INSTALL_DIR%
exit /b 1
)
copy /Y "%WP%\tools\pjarczak_bambu_runtime\wsl\pjarczak_plugin_cache_subdir.txt" "%INSTALL_DIR%\pjarczak_plugin_cache_subdir.txt" >nul
if errorlevel 1 (
echo Failed to copy pjarczak_plugin_cache_subdir.txt into %INSTALL_DIR%
exit /b 1
)
copy /Y "%WP%\tools\pjarczak_bambu_runtime\release\assemble_windows_runtime_bundle.ps1" "%INSTALL_DIR%\assemble_windows_runtime_bundle.ps1" >nul
if errorlevel 1 (
echo Failed to copy assemble_windows_runtime_bundle.ps1 into %INSTALL_DIR%
exit /b 1
)
exit /b 0

View file

@ -1,71 +1,77 @@
@REM OrcaSlicer build script for Windows
@echo off
set WP=%CD%
@REM Pack deps
if "%1"=="pack" (
setlocal ENABLEDELAYEDEXPANSION
cd %WP%/deps/build
for /f "tokens=2-4 delims=/ " %%a in ('date /t') do set build_date=%%c%%b%%a
echo packing deps: OrcaSlicer_dep_win64_!build_date!_vs2022.zip
%WP%/tools/7z.exe a OrcaSlicer_dep_win64_!build_date!_vs2022.zip OrcaSlicer_dep
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_dir%
cd %build_dir%
set "SIG_FLAG="
if defined ORCA_UPDATER_SIG_KEY set "SIG_FLAG=-DORCA_UPDATER_SIG_KEY=%ORCA_UPDATER_SIG_KEY%"
if "%1"=="slicer" (
GOTO :slicer
)
echo "building deps.."
echo on
REM Set minimum CMake policy to avoid <3.5 errors
set CMAKE_POLICY_VERSION_MINIMUM=3.5
cmake ../ -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=%build_type%
cmake --build . --config %build_type% --target deps -- -m
@echo off
if "%1"=="deps" exit /b 0
:slicer
echo "building Orca Slicer..."
cd %WP%
mkdir %build_dir%
cd %build_dir%
echo on
set CMAKE_POLICY_VERSION_MINIMUM=3.5
cmake .. -G "Visual Studio 17 2022" -A x64 -DORCA_TOOLS=ON %SIG_FLAG% -DCMAKE_BUILD_TYPE=%build_type%
cmake --build . --config %build_type% --target ALL_BUILD -- -m
@echo off
cd ..
call scripts/run_gettext.bat
cd %build_dir%
cmake --build . --target install --config %build_type%
@REM OrcaSlicer build script for Windows
@echo off
set WP=%CD%
@REM Pack deps
if "%1"=="pack" (
setlocal ENABLEDELAYEDEXPANSION
cd %WP%/deps/build
for /f "tokens=2-4 delims=/ " %%a in ('date /t') do set build_date=%%c%%b%%a
echo packing deps: OrcaSlicer_dep_win64_!build_date!_vs2022.zip
%WP%/tools/7z.exe a OrcaSlicer_dep_win64_!build_date!_vs2022.zip OrcaSlicer_dep
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_dir%
cd %build_dir%
set "SIG_FLAG="
if defined ORCA_UPDATER_SIG_KEY set "SIG_FLAG=-DORCA_UPDATER_SIG_KEY=%ORCA_UPDATER_SIG_KEY%"
if "%1"=="slicer" (
GOTO :slicer
)
echo "building deps.."
echo on
REM Set minimum CMake policy to avoid <3.5 errors
set CMAKE_POLICY_VERSION_MINIMUM=3.5
cmake ../ -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=%build_type%
if errorlevel 1 exit /b 1
cmake --build . --config %build_type% --target deps -- -m
if errorlevel 1 exit /b 1
@echo off
if "%1"=="deps" exit /b 0
:slicer
echo "building Orca Slicer..."
cd %WP%
mkdir %build_dir%
cd %build_dir%
echo on
set CMAKE_POLICY_VERSION_MINIMUM=3.5
cmake .. -G "Visual Studio 17 2022" -A x64 -DORCA_TOOLS=ON %SIG_FLAG% -DCMAKE_BUILD_TYPE=%build_type%
if errorlevel 1 exit /b 1
cmake --build . --config %build_type% --target ALL_BUILD -- -m
if errorlevel 1 exit /b 1
@echo off
cd ..
call scripts/run_gettext.bat
if errorlevel 1 exit /b 1
cd %build_dir%
cmake --build . --target install --config %build_type%
if errorlevel 1 exit /b 1

View file

@ -1,35 +1,41 @@
@echo off
REM OrcaSlicer gettext
REM Created by SoftFever on 27/5/23.
REM Check for --full argument
set FULL_MODE=0
for %%a in (%*) do (
if "%%a"=="--full" set FULL_MODE=1
)
if %FULL_MODE%==1 (
.\tools\xgettext.exe --keyword=L --keyword=_L --keyword=_u8L --keyword=L_CONTEXT:1,2c --keyword=_L_PLURAL:1,2 --add-comments=TRN --from-code=UTF-8 --no-location --debug --boost -f ./localization/i18n/list.txt -o ./localization/i18n/OrcaSlicer.pot
python scripts/HintsToPot.py ./resources ./localization/i18n
)
REM Print the current directory
echo %cd%
set pot_file="./localization/i18n/OrcaSlicer.pot"
REM Run the script for each .po file
for /r "./localization/i18n/" %%f in (*.po) do (
call :processFile "%%f"
)
goto :eof
:processFile
set "file=%~1"
set "dir=%~dp1"
set "name=%~n1"
set "lang=%name:OrcaSlicer_=%"
if %FULL_MODE%==1 (
.\tools\msgmerge.exe -N -o "%file%" "%file%" "%pot_file%"
)
if not exist "./resources/i18n/%lang%" mkdir "./resources/i18n/%lang%"
.\tools\msgfmt.exe --check-format -o "./resources/i18n/%lang%/OrcaSlicer.mo" "%file%"
goto :eof
@echo off
setlocal EnableExtensions
REM OrcaSlicer gettext
REM Created by SoftFever on 27/5/23.
REM Check for --full argument
set FULL_MODE=0
for %%a in (%*) do (
if "%%a"=="--full" set FULL_MODE=1
)
if %FULL_MODE%==1 (
.\tools\xgettext.exe --keyword=L --keyword=_L --keyword=_u8L --keyword=L_CONTEXT:1,2c --keyword=_L_PLURAL:1,2 --add-comments=TRN --from-code=UTF-8 --no-location --debug --boost -f ./localization/i18n/list.txt -o ./localization/i18n/OrcaSlicer.pot
if errorlevel 1 exit /b 1
python scripts/HintsToPot.py ./resources ./localization/i18n
if errorlevel 1 exit /b 1
)
REM Print the current directory
echo %cd%
set pot_file="./localization/i18n/OrcaSlicer.pot"
REM Run the script for each .po file
for /r "./localization/i18n/" %%f in (*.po) do (
call :processFile "%%f"
if errorlevel 1 exit /b 1
)
exit /b 0
:processFile
set "file=%~1"
set "dir=%~dp1"
set "name=%~n1"
set "lang=%name:OrcaSlicer_=%"
if %FULL_MODE%==1 (
.\tools\msgmerge.exe -N -o "%file%" "%file%" "%pot_file%"
if errorlevel 1 exit /b 1
)
if not exist "./resources/i18n/%lang%" mkdir "./resources/i18n/%lang%"
.\tools\msgfmt.exe --check-format -o "./resources/i18n/%lang%/OrcaSlicer.mo" "%file%"
if errorlevel 1 exit /b 1
exit /b 0

View file

@ -125,7 +125,6 @@ if (NOT WIN32 AND NOT APPLE)
endif ()
target_link_libraries(OrcaSlicer libslic3r cereal::cereal)
add_dependencies(OrcaSlicer gettext_po_to_mo)
set(PJARCZAK_WINDOWS_RUNTIME_SUPPORT_FILES "")
set(PJARCZAK_OPTIONAL_WINDOWS_RUNTIME_FILES "")