Skip to content

Commit ee87a0c

Browse files
committed
feat: build config
1 parent 2d5e572 commit ee87a0c

2 files changed

Lines changed: 67 additions & 15 deletions

File tree

.github/workflows/RefactoringMSBuild.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ name: RefactoringMSBuild
22

33
on:
44
workflow_dispatch:
5-
push:
6-
branches: [ "refactoring" ]
75
pull_request:
86
branches: [ "refactoring" ]
97

@@ -66,7 +64,7 @@ jobs:
6664

6765
- name: Build Dependency
6866
if: steps.cache-dependency.outputs.cache-hit != 'true'
69-
run: ./init.bat
67+
run: ./init.bat Release
7068
shell: cmd
7169

7270
- name: Build

init.bat

Lines changed: 66 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
@echo off
2+
setlocal enabledelayedexpansion
3+
4+
:: Parse command line arguments
5+
set "BUILD_CONFIG=%1"
6+
if "%BUILD_CONFIG%"=="" (
7+
echo No build configuration specified, will build both Debug and Release versions
8+
set "BUILD_DEBUG=1"
9+
set "BUILD_RELEASE=1"
10+
) else if /i "%BUILD_CONFIG%"=="Debug" (
11+
echo Build configuration: Debug
12+
set "BUILD_DEBUG=1"
13+
set "BUILD_RELEASE=0"
14+
) else if /i "%BUILD_CONFIG%"=="Release" (
15+
echo Build configuration: Release
16+
set "BUILD_DEBUG=0"
17+
set "BUILD_RELEASE=1"
18+
) else (
19+
echo Error: Invalid build configuration "%BUILD_CONFIG%"
20+
echo Usage: init.bat [Debug^|Release]
21+
echo No arguments: Build both Debug and Release versions
22+
echo Debug: Build Debug version only
23+
echo Release: Build Release version only
24+
pause
25+
exit /b 1
26+
)
27+
128
git submodule update --init --recursive
229
for /f "delims=" %%i in ('"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -products * -requires Microsoft.Component.MSBuild -property installationPath -latest') do set VSPath=%%i
330
call "%VSPath%\VC\Auxiliary\Build\vcvars64.bat" x64
@@ -20,10 +47,19 @@ cmake .. -G "Ninja Multi-Config" ^
2047
-D BUILD_PYBULLET=Off ^
2148
-D BULLET2_MULTITHREADING=ON ^
2249
-D BULLET2_USE_PPL_MULTITHREADING=ON
23-
cmake --build . --config Debug -j
24-
cmake --install . --config Debug --prefix ../../install
25-
cmake --build . --config Release -j
26-
cmake --install . --config Release --prefix ../../install
50+
51+
if "%BUILD_DEBUG%"=="1" (
52+
echo Building bullet3 Debug version...
53+
cmake --build . --config Debug -j
54+
cmake --install . --config Debug --prefix ../../install
55+
)
56+
57+
if "%BUILD_RELEASE%"=="1" (
58+
echo Building bullet3 Release version...
59+
cmake --build . --config Release -j
60+
cmake --install . --config Release --prefix ../../install
61+
)
62+
2763
cd ../..
2864
cd ./yaml-cpp
2965
mkdir build
@@ -33,18 +69,36 @@ cmake .. -G "Ninja Multi-Config" ^
3369
-D CMAKE_INSTALL_PREFIX="../../install" ^
3470
-D YAML_CPP_BUILD_TESTS=Off ^
3571
-D YAML_CPP_BUILD_TOOLS=Off
36-
cmake --build . --config Debug -j
37-
cmake --install . --config Debug --prefix ../../install
38-
cmake --build . --config Release -j
39-
cmake --install . --config Release --prefix ../../install
72+
73+
if "%BUILD_DEBUG%"=="1" (
74+
echo Building yaml-cpp Debug version...
75+
cmake --build . --config Debug -j
76+
cmake --install . --config Debug --prefix ../../install
77+
)
78+
79+
if "%BUILD_RELEASE%"=="1" (
80+
echo Building yaml-cpp Release version...
81+
cmake --build . --config Release -j
82+
cmake --install . --config Release --prefix ../../install
83+
)
84+
4085
cd ../..
4186
cd ./libMMD
4287
mkdir build
4388
cd build
4489
cmake .. -G "Ninja Multi-Config" -D CMAKE_DEBUG_POSTFIX="_Debug" -D CMAKE_INSTALL_PREFIX="../../install" -D LIBMMD_BULLET_ROOT="../../install" -D LIBMMD_ENABLE_TEST=off -D LIBMMD_INSTALL=on
45-
cmake --build . --config Debug -j
46-
cmake --install . --config Debug --prefix ../../install
47-
cmake --build . --config Release -j
48-
cmake --install . --config Release --prefix ../../install
90+
91+
if "%BUILD_DEBUG%"=="1" (
92+
echo Building libMMD Debug version...
93+
cmake --build . --config Debug -j
94+
cmake --install . --config Debug --prefix ../../install
95+
)
96+
97+
if "%BUILD_RELEASE%"=="1" (
98+
echo Building libMMD Release version...
99+
cmake --build . --config Release -j
100+
cmake --install . --config Release --prefix ../../install
101+
)
102+
49103
cd ../..
50104
pause

0 commit comments

Comments
 (0)