forked from CrealityOfficial/CrealityPrint
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_vs2022_unified.bat
More file actions
198 lines (170 loc) · 5.58 KB
/
Copy pathbuild_vs2022_unified.bat
File metadata and controls
198 lines (170 loc) · 5.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
@REM Unified OrcaSlicer build script for Windows with single build directory
@echo off
set WP=%CD%
@REM Check for help
if "%1"=="help" (
echo Usage: build_vs2022_unified.bat [target] [options]
echo.
echo Targets:
echo deps - Build dependencies ^(Release + Debug^)
echo deps-debug - Build Debug dependencies only ^(assumes Release deps exist^)
echo slicer - Build slicer only ^(assumes deps are built^)
echo all - Build both deps and slicer ^(default^)
echo clean - Clean build directory
echo open - Open Visual Studio solution
echo.
echo Build type is controlled in Visual Studio ^(Debug/Release/RelWithDebInfo^)
echo.
exit /b 0
)
set build_dir=build_unified
set target=%1
if "%target%"=="" set target=all
@REM Clean
if "%target%"=="clean" (
echo Cleaning build directory...
if exist %build_dir% rmdir /s /q %build_dir%
if exist deps\%build_dir% rmdir /s /q deps\%build_dir%
echo Done.
exit /b 0
)
setlocal DISABLEDELAYEDEXPANSION
@REM Build dependencies
if "%target%"=="deps" GOTO :deps
if "%target%"=="deps-debug" GOTO :deps_debug
if "%target%"=="all" GOTO :deps
if "%target%"=="slicer" GOTO :slicer
if "%target%"=="open" GOTO :open
echo Invalid target: %target%
echo Run with "help" for usage
exit /b 1
:deps
echo ========================================
echo Building dependencies...
echo ========================================
cd deps
mkdir %build_dir% 2>nul
cd %build_dir%
set DEPS=%CD%/OrcaSlicer_dep
echo Configuring dependencies with CMake...
echo cmake ../ -G "Visual Studio 17 2022" -A x64 -DDESTDIR="%CD%/OrcaSlicer_dep" -DDEP_DEBUG=ON -DORCA_INCLUDE_DEBUG_INFO=OFF
cmake ../ -G "Visual Studio 17 2022" -A x64 -DDESTDIR="%CD%/OrcaSlicer_dep" -DDEP_DEBUG=ON -DORCA_INCLUDE_DEBUG_INFO=OFF
if %ERRORLEVEL% NEQ 0 (
echo CMake configuration failed!
exit /b %ERRORLEVEL%
)
echo.
echo Building dependencies for Release configuration...
echo This may take 30-60 minutes depending on your system...
cmake --build . --config Release --target deps -- -m
if %ERRORLEVEL% NEQ 0 (
echo Dependencies Release build failed!
exit /b %ERRORLEVEL%
)
echo.
echo Building dependencies for Debug configuration...
echo This may take another 30-60 minutes...
cmake --build . --config Debug --target deps -- -m
if %ERRORLEVEL% NEQ 0 (
echo Dependencies Debug build failed!
exit /b %ERRORLEVEL%
)
echo.
echo ========================================
echo Dependencies built successfully!
echo ========================================
echo Location: deps\%build_dir%
echo Both Release and Debug configurations are built.
echo.
if "%target%"=="deps" exit /b 0
cd %WP%
GOTO :slicer
:deps_debug
echo ========================================
echo Building Debug dependencies only...
echo ========================================
cd deps
cd %build_dir%
if not exist "OrcaSlicer_dep\usr\local" (
echo ERROR: Release dependencies not found!
echo Please build all dependencies first: build_vs2022_unified.bat deps
exit /b 1
)
echo Building dependencies for Debug configuration...
cmake --build . --config Debug --target deps -- -m
if %ERRORLEVEL% NEQ 0 (
echo Dependencies Debug build failed!
exit /b %ERRORLEVEL%
)
echo.
echo ========================================
echo Debug dependencies built successfully!
echo ========================================
exit /b 0
:slicer
echo ========================================
echo Building Orca Slicer...
echo ========================================
cd %WP%
@REM Ensure deps are built
if not exist "deps\%build_dir%\OrcaSlicer_dep\usr\local" (
echo ERROR: Dependencies not found!
echo Please build dependencies first: build_vs2022_unified.bat deps
exit /b 1
)
set DEPS=%WP%\deps\%build_dir%\OrcaSlicer_dep
mkdir %build_dir% 2>nul
cd %build_dir%
echo Configuring Orca Slicer with CMake...
echo cmake .. -G "Visual Studio 17 2022" -A x64 -DBBL_RELEASE_TO_PUBLIC=1 -DCMAKE_PREFIX_PATH="%DEPS%/usr/local" -DCMAKE_INSTALL_PREFIX="./OrcaSlicer" -DWIN10SDK_PATH="C:/Program Files (x86)/Windows Kits/10/Include/10.0.22000.0"
cmake .. -G "Visual Studio 17 2022" -A x64 ^
-DBBL_RELEASE_TO_PUBLIC=1 ^
-DCMAKE_PREFIX_PATH="%DEPS%/usr/local" ^
-DCMAKE_INSTALL_PREFIX="./OrcaSlicer" ^
-DWIN10SDK_PATH="C:/Program Files (x86)/Windows Kits/10/Include/10.0.22000.0"
if %ERRORLEVEL% NEQ 0 (
echo CMake configuration failed!
exit /b %ERRORLEVEL%
)
echo.
echo Building Orca Slicer for Release configuration...
cmake --build . --config Release --target ALL_BUILD -- -m
if %ERRORLEVEL% NEQ 0 (
echo Build failed!
exit /b %ERRORLEVEL%
)
echo.
echo Running gettext localization processing...
cd %WP%
call run_gettext.bat
echo.
echo Installing Release build...
cd %build_dir%
cmake --build . --target install --config Release
echo.
echo ========================================
echo Build completed successfully!
echo ========================================
echo.
echo Build directory: %build_dir%
echo Solution file: %build_dir%\CrealityPrint.sln
echo.
echo To build Debug configuration:
echo 1. Open Visual Studio: build_vs2022_unified.bat open
echo 2. Select Debug configuration in toolbar
echo 3. Build Solution ^(Ctrl+Shift+B^)
echo.
echo Or from command line:
echo cmake --build %build_dir% --config Debug --target ALL_BUILD -- -m
echo cmake --build %build_dir% --config Debug --target install
echo.
exit /b 0
:open
if not exist "%build_dir%\CrealityPrint.sln" (
echo ERROR: Solution file not found!
echo Please build the project first: build_vs2022_unified.bat all
exit /b 1
)
echo Opening Visual Studio...
start "" "%build_dir%\CrealityPrint.sln"
exit /b 0