mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2026-01-07 07:17:43 -07:00
Merge branch 'main' into main
This commit is contained in:
commit
074a3bd8ab
11 changed files with 207 additions and 60 deletions
4
.github/workflows/build_deps.yml
vendored
4
.github/workflows/build_deps.yml
vendored
|
|
@ -69,8 +69,8 @@ jobs:
|
|||
working-directory: ${{ github.workspace }}
|
||||
run: |
|
||||
choco install strawberryperl
|
||||
.\build_release_vs2022.bat deps
|
||||
.\build_release_vs2022.bat pack
|
||||
.\build_release_vs.bat deps
|
||||
.\build_release_vs.bat pack
|
||||
cd ${{ github.workspace }}/deps/build
|
||||
|
||||
- name: Build on Mac ${{ inputs.arch }}
|
||||
|
|
|
|||
2
.github/workflows/build_orca.yml
vendored
2
.github/workflows/build_orca.yml
vendored
|
|
@ -233,7 +233,7 @@ jobs:
|
|||
env:
|
||||
WindowsSdkDir: 'C:\Program Files (x86)\Windows Kits\10\'
|
||||
WindowsSDKVersion: '10.0.26100.0\'
|
||||
run: .\build_release_vs2022.bat slicer
|
||||
run: .\build_release_vs.bat slicer
|
||||
|
||||
- name: Create installer Win
|
||||
if: inputs.os == 'windows-latest'
|
||||
|
|
|
|||
119
build_release_vs.bat
Normal file
119
build_release_vs.bat
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
@REM OrcaSlicer build script for Windows with VS auto-detect
|
||||
@echo off
|
||||
set WP=%CD%
|
||||
|
||||
@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%
|
||||
|
||||
@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
|
||||
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 %CMAKE_GENERATOR% -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 %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%
|
||||
|
|
@ -61,6 +61,7 @@ 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
|
||||
|
|
|
|||
|
|
@ -1,15 +1,21 @@
|
|||
From 6fb3f6333150a777e835fc7c48e49750591bf7fe Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Buch <bebuch@users.noreply.github.com>
|
||||
Date: Thu, 23 May 2024 16:05:19 +0200
|
||||
Subject: [PATCH] Support VS 2022 17.1x.y
|
||||
|
||||
With 17.10.0 the MSVC toolset was set to 19.40.x which breaks the compatibility test in the OpenCV's CMake Config files.
|
||||
---
|
||||
cmake/templates/OpenCVConfig.root-WIN32.cmake.in | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/cmake/OpenCVDetectCXXCompiler.cmake b/cmake/OpenCVDetectCXXCompiler.cmake
|
||||
index 7f229cde96..d8e20f8fe9 100644
|
||||
--- a/cmake/OpenCVDetectCXXCompiler.cmake
|
||||
+++ b/cmake/OpenCVDetectCXXCompiler.cmake
|
||||
@@ -171,8 +171,10 @@ elseif(MSVC)
|
||||
set(OpenCV_RUNTIME vc15)
|
||||
elseif(MSVC_VERSION MATCHES "^192[0-9]$")
|
||||
set(OpenCV_RUNTIME vc16)
|
||||
- elseif(MSVC_VERSION MATCHES "^193[0-9]$")
|
||||
+ elseif(MSVC_VERSION MATCHES "^19[34][0-9]$")
|
||||
set(OpenCV_RUNTIME vc17)
|
||||
+ elseif(MSVC_VERSION MATCHES "^195[0-9]$")
|
||||
+ set(OpenCV_RUNTIME vc18)
|
||||
else()
|
||||
message(WARNING "OpenCV does not recognize MSVC_VERSION \"${MSVC_VERSION}\". Cannot set OpenCV_RUNTIME")
|
||||
endif()
|
||||
diff --git a/cmake/templates/OpenCVConfig.root-WIN32.cmake.in b/cmake/templates/OpenCVConfig.root-WIN32.cmake.in
|
||||
index b0f254ebe8..62e36272f3 100644
|
||||
index b0f254ebe8..8f0178b0ae 100644
|
||||
--- a/cmake/templates/OpenCVConfig.root-WIN32.cmake.in
|
||||
+++ b/cmake/templates/OpenCVConfig.root-WIN32.cmake.in
|
||||
@@ -137,7 +137,7 @@ elseif(MSVC)
|
||||
|
|
@ -21,32 +27,28 @@ index b0f254ebe8..62e36272f3 100644
|
|||
set(OpenCV_RUNTIME vc17)
|
||||
check_one_config(has_VS2022)
|
||||
if(NOT has_VS2022)
|
||||
--
|
||||
2.45.2.windows.1
|
||||
|
||||
From f85818ba6f9031c450475a7453dee0acce31a881 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Buch <bebuch@users.noreply.github.com>
|
||||
Date: Fri, 24 May 2024 11:10:09 +0200
|
||||
Subject: [PATCH] Support VS 2022 17.1x.y in OpenCVDetectCXXCompiler.cmake
|
||||
|
||||
With 17.10.0 the MSVC toolset was set to 19.40.x which breaks the compatibility test in the OpenCV's CMake Config files.
|
||||
---
|
||||
cmake/OpenCVDetectCXXCompiler.cmake | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/cmake/OpenCVDetectCXXCompiler.cmake b/cmake/OpenCVDetectCXXCompiler.cmake
|
||||
index 1743aca11f..448afd46ea 100644
|
||||
--- a/cmake/OpenCVDetectCXXCompiler.cmake
|
||||
+++ b/cmake/OpenCVDetectCXXCompiler.cmake
|
||||
@@ -176,7 +176,7 @@ elseif(MSVC)
|
||||
set(OpenCV_RUNTIME vc15)
|
||||
elseif(MSVC_VERSION MATCHES "^192[0-9]$")
|
||||
set(OpenCV_RUNTIME vc16)
|
||||
- elseif(MSVC_VERSION MATCHES "^193[0-9]$")
|
||||
+ elseif(MSVC_VERSION MATCHES "^19[34][0-9]$")
|
||||
set(OpenCV_RUNTIME vc17)
|
||||
else()
|
||||
message(WARNING "OpenCV does not recognize MSVC_VERSION \"${MSVC_VERSION}\". Cannot set OpenCV_RUNTIME")
|
||||
--
|
||||
2.45.2.windows.1
|
||||
|
||||
@@ -151,6 +151,24 @@ elseif(MSVC)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
+ elseif(MSVC_VERSION MATCHES "^195[0-9]$")
|
||||
+ set(OpenCV_RUNTIME vc18)
|
||||
+ check_one_config(has_VS2026)
|
||||
+ if(NOT has_VS2026)
|
||||
+ set(OpenCV_RUNTIME vc17)
|
||||
+ check_one_config(has_VS2022)
|
||||
+ if(NOT has_VS2022)
|
||||
+ set(OpenCV_RUNTIME vc16)
|
||||
+ check_one_config(has_VS2019)
|
||||
+ if(NOT has_VS2019)
|
||||
+ set(OpenCV_RUNTIME vc15) # selecting previous compatible runtime version
|
||||
+ check_one_config(has_VS2017)
|
||||
+ if(NOT has_VS2017)
|
||||
+ set(OpenCV_RUNTIME vc14) # selecting previous compatible runtime version
|
||||
+ endif()
|
||||
+ endif()
|
||||
+ endif()
|
||||
+ endif()
|
||||
endif()
|
||||
elseif(MINGW)
|
||||
set(OpenCV_RUNTIME mingw)
|
||||
2
deps/OpenCV/OpenCV.cmake
vendored
2
deps/OpenCV/OpenCV.cmake
vendored
|
|
@ -11,7 +11,7 @@ endif ()
|
|||
orcaslicer_add_cmake_project(OpenCV
|
||||
URL https://github.com/opencv/opencv/archive/refs/tags/4.6.0.tar.gz
|
||||
URL_HASH SHA256=1ec1cba65f9f20fe5a41fda1586e01c70ea0c9a6d7b67c9e13edf0cfe2239277
|
||||
PATCH_COMMAND git apply ${OpenCV_DIRECTORY_FLAG} --verbose --ignore-space-change --whitespace=fix ${CMAKE_CURRENT_LIST_DIR}/0001-vs2022.patch ${CMAKE_CURRENT_LIST_DIR}/0002-clang19-macos.patch
|
||||
PATCH_COMMAND git apply ${OpenCV_DIRECTORY_FLAG} --verbose --ignore-space-change --whitespace=fix ${CMAKE_CURRENT_LIST_DIR}/0001-vs.patch ${CMAKE_CURRENT_LIST_DIR}/0002-clang19-macos.patch
|
||||
CMAKE_ARGS
|
||||
-DBUILD_SHARED_LIBS=0
|
||||
-DBUILD_PERE_TESTS=OFF
|
||||
|
|
|
|||
4
deps/deps-windows.cmake
vendored
4
deps/deps-windows.cmake
vendored
|
|
@ -19,6 +19,10 @@ elseif (MSVC_VERSION LESS 1950)
|
|||
# 1930-1949 = VS 17.0 (v143 toolset)
|
||||
set(DEP_VS_VER "17")
|
||||
set(DEP_BOOST_TOOLSET "msvc-14.3")
|
||||
elseif (MSVC_VERSION LESS 1960)
|
||||
# 1950-1959 = VS 18.0 (v145 toolset)
|
||||
set(DEP_VS_VER "18")
|
||||
set(DEP_BOOST_TOOLSET "msvc-14.5")
|
||||
else ()
|
||||
message(FATAL_ERROR "Unsupported MSVC version")
|
||||
endif ()
|
||||
|
|
|
|||
|
|
@ -22,12 +22,13 @@ Whether you're a contributor or just want a custom build, this guide will help y
|
|||
- [Common dependencies across distributions](#common-dependencies-across-distributions)
|
||||
- [Additional dependencies for specific distributions](#additional-dependencies-for-specific-distributions)
|
||||
- [Linux Instructions](#linux-instructions)
|
||||
- [Unit Testing](#unit-testing)
|
||||
- [Portable User Configuration](#portable-user-configuration)
|
||||
- [Example folder structure](#example-folder-structure)
|
||||
|
||||
## Windows 64-bit
|
||||
|
||||
How to building with Visual Studio 2022 on Windows 64-bit.
|
||||
How to building with Visual Studio on Windows 64-bit.
|
||||
|
||||
### Windows Tools Required
|
||||
|
||||
|
|
@ -35,9 +36,9 @@ How to building with Visual Studio 2022 on Windows 64-bit.
|
|||
```shell
|
||||
winget install --id=Microsoft.VisualStudio.2022.Professional -e
|
||||
```
|
||||
- [CMake (version 3.31)](https://cmake.org/) — **⚠️ version 3.31.x is mandatory**
|
||||
- [CMake](https://cmake.org/)
|
||||
```shell
|
||||
winget install --id=Kitware.CMake -v "3.31.6" -e
|
||||
winget install --id=Kitware.CMake -e
|
||||
```
|
||||
- [Strawberry Perl](https://strawberryperl.com/)
|
||||
```shell
|
||||
|
|
@ -58,6 +59,14 @@ How to building with Visual Studio 2022 on Windows 64-bit.
|
|||
> winget install --id=GitHub.GitHubDesktop -e
|
||||
> ```
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Check your CMake version. Run `cmake --version` in your terminal and verify it returns a **4.x** version.
|
||||
> If you see an older version (e.g. 3.29), it's likely due to another copy in your system's PATH (e.g. from Strawberry Perl).
|
||||
> You can run where cmake to check the active paths and rearrange your **System Environment Variables** > PATH, ensuring the correct CMake (e.g. C:\Program Files\CMake\bin) appears before others like C:\Strawberry\c\bin.
|
||||
|
||||

|
||||

|
||||
|
||||
### Windows Instructions
|
||||
|
||||
1. Clone the repository:
|
||||
|
|
@ -72,16 +81,33 @@ How to building with Visual Studio 2022 on Windows 64-bit.
|
|||
git lfs pull
|
||||
```
|
||||
2. Open the appropriate command prompt:
|
||||
- For Visual Studio 2019:
|
||||
Open **x64 Native Tools Command Prompt for VS 2019** and run:
|
||||
```shell
|
||||
build_release.bat
|
||||
- Visual Studio 2022:
|
||||
```MD
|
||||
x64 Native Tools Command Prompt for VS 2022
|
||||
```
|
||||
- For Visual Studio 2022:
|
||||
Open **x64 Native Tools Command Prompt for VS 2022** and run:
|
||||
```shell
|
||||
build_release_vs2022.bat
|
||||
- Visual Studio 2019:
|
||||
```MD
|
||||
x64 Native Tools Command Prompt for VS 2019
|
||||
```
|
||||
1. Navigate to correct drive (if needed), e.g.:
|
||||
```shell
|
||||
N:
|
||||
```
|
||||
2. Change directory to the cloned repository, e.g.:
|
||||
```shell
|
||||
cd N:\Repos\OrcaSlicer
|
||||
```
|
||||
3. Run the build script:
|
||||
- Visual Studio 2022:
|
||||
```shell
|
||||
build_release_vs2022.bat
|
||||
```
|
||||
- Visual Studio 2019:
|
||||
```shell
|
||||
build_release.bat
|
||||
```
|
||||
|
||||

|
||||
|
||||
> [!NOTE]
|
||||
> The build process will take a long time depending on your system but even with high-end hardware it can take up to 40 minutes.
|
||||
|
|
@ -106,11 +132,6 @@ How to building with Visual Studio 2022 on Windows 64-bit.
|
|||
> Changes to .hpp files take longer, depending on what you change.
|
||||
> If you switch back and forth between branches, it also takes a long time to rebuild, even if you haven't made any changes.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Make sure that CMake version 3.31.x is actually being used. Run `cmake --version` and verify it returns a **3.31.x** version.
|
||||
> If you see an older version (e.g. 3.29), it's likely due to another copy in your system's PATH (e.g. from Strawberry Perl).
|
||||
> You can run where cmake to check the active paths and rearrange your **System Environment Variables** > PATH, ensuring the correct CMake (e.g. C:\Program Files\CMake\bin) appears before others like C:\Strawberry\c\bin.
|
||||
|
||||
> [!TIP]
|
||||
> If the build fails, try deleting the `build/` and `deps/build/` directories to clear any cached build data. Rebuilding after a clean-up is usually sufficient to resolve most issues.
|
||||
|
||||
|
|
|
|||
BIN
doc/images/develop/vs2022cmd.png
Normal file
BIN
doc/images/develop/vs2022cmd.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.8 KiB |
BIN
doc/images/develop/windows_variables_order.png
Normal file
BIN
doc/images/develop/windows_variables_order.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.4 KiB |
BIN
doc/images/develop/windows_variables_path.png
Normal file
BIN
doc/images/develop/windows_variables_path.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.1 KiB |
Loading…
Add table
Add a link
Reference in a new issue