@@ -5,6 +5,8 @@ set "PROJECT_ROOT=%~dp0"
55set " PROJECT_ROOT = %PROJECT_ROOT:~0 ,-1 % "
66set " BUILD_TYPE = Release"
77set " PRESET = windows-release"
8+ set " LIVEKIT_VERSION = "
9+ set " CMAKE_EXTRA_ARGS = "
810
911REM ============================================================
1012REM Auto-detect LIBCLANG_PATH if not already set
@@ -55,42 +57,71 @@ if not defined LIBCLANG_PATH (
5557)
5658
5759if " %1 " == " " goto usage
58- if " %1 " == " help" goto usage
60+ if /I " %1 " == " help" goto usage
5961if " %1 " == " -h" goto usage
6062if " %1 " == " --help" goto usage
6163
62- if " %1 " == " debug" (
64+ set " CMD = %1 "
65+ shift
66+ goto parse_args
67+
68+ :parse_args
69+ if " %1 " == " " goto after_parse
70+
71+ if " %1 " == " --version" (
72+ shift
73+ if " %1 " == " " (
74+ echo ERROR: --version requires a value
75+ exit /b 1
76+ )
77+ set " LIVEKIT_VERSION = %1 "
78+ shift
79+ goto parse_args
80+ )
81+
82+ echo ERROR: Unknown option: %1
83+ exit /b 1
84+
85+ :after_parse
86+ if defined LIVEKIT_VERSION (
87+ set " CMAKE_EXTRA_ARGS = -DLIVEKIT_VERSION=%LIVEKIT_VERSION% "
88+ echo ==^ > Injecting LIVEKIT_VERSION=%LIVEKIT_VERSION%
89+ )
90+ goto dispatch
91+
92+ :dispatch
93+ if " %CMD% " == " debug" (
6394 set " BUILD_TYPE = Debug"
6495 set " PRESET = windows-debug"
6596 set " BUILD_DIR = %PROJECT_ROOT% \build-debug"
6697 goto configure_build
6798)
6899
69- if " %1 " == " debug-examples" (
100+ if " %CMD% " == " debug-examples" (
70101 set " BUILD_TYPE = Debug"
71102 set " PRESET = windows-debug-examples"
72103 set " BUILD_DIR = %PROJECT_ROOT% \build-debug"
73104 goto configure_build
74105)
75106
76- if " %1 " == " release" (
107+ if " %CMD% " == " release" (
77108 set " BUILD_TYPE = Release"
78109 set " PRESET = windows-release"
79110 set " BUILD_DIR = %PROJECT_ROOT% \build-release"
80111 goto configure_build
81112)
82113
83- if " %1 " == " release-examples" (
114+ if " %CMD% " == " release-examples" (
84115 set " BUILD_TYPE = Release"
85116 set " PRESET = windows-release-examples"
86117 set " BUILD_DIR = %PROJECT_ROOT% \build-release"
87118 goto configure_build
88119)
89120
90- if " %1 " == " clean" goto clean
91- if " %1 " == " clean-all" goto clean_all
121+ if " %CMD% " == " clean" goto clean
122+ if " %CMD% " == " clean-all" goto clean_all
92123
93- echo Unknown command: %1
124+ echo Unknown command: %CMD%
94125goto usage
95126
96127:usage
@@ -117,9 +148,9 @@ goto :eof
117148echo ==^ > Configuring CMake (%BUILD_TYPE% )...
118149if not defined VCPKG_ROOT (
119150 echo Warning: VCPKG_ROOT is not set. Attempting to configure without vcpkg...
120- cmake -S . -B " %BUILD_DIR% " -G " Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=%BUILD_TYPE%
151+ cmake -S . -B " %BUILD_DIR% " -G " Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=%BUILD_TYPE% %CMAKE_EXTRA_ARGS%
121152) else (
122- cmake --preset %PRESET%
153+ cmake --preset " %PRESET% " %CMAKE_EXTRA_ARGS %
123154)
124155if errorlevel 1 (
125156 echo Configuration failed!
0 commit comments