mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-12-25 00:58:35 -07:00
* Add script with VS version auto detection * Add msvc145 toolset support * Fix issue when build slicer only * Fix vs2026 OpenCV build * Set github action to use new build script * Get vs version from `msbuild --version` so it works for github action
71 lines
1.8 KiB
Batchfile
71 lines
1.8 KiB
Batchfile
@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%
|