Skip to content

Commit c036b08

Browse files
committed
WIP
1 parent bbe066f commit c036b08

1 file changed

Lines changed: 9 additions & 63 deletions

File tree

cmake_windows.cmd

Lines changed: 9 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -9,82 +9,28 @@ setlocal & pushd .
99
@echo Yadoms build for Windows
1010
@echo ========================
1111
@echo.
12-
@echo To enable Windows XP compatiblity, please enter the platform toolset
13-
@echo.
14-
@echo v120_xp : platform toolset "Visual Studio 2013 - WindowsXP"
15-
@echo v140_xp : platform toolset "Visual Studio 2015 - WindowsXP"
16-
@echo v141_xp : platform toolset "Visual Studio 2017 - WindowsXP"
1712
@echo v142 : platform toolset "Visual Studio 2019"
1813
@echo v143 : platform toolset "Visual Studio 2022"
19-
@echo Leave empty to disable Windows XP compatibility
14+
@echo Leave empty to use default toolset
2015
@echo.
2116
@echo.
2217

23-
set xp_compatibility=%1%
24-
25-
call:getCMakeExecutable cmake_executable
26-
"%cmake_executable%" --version
27-
28-
::Move to destination folder
29-
cd /D %~dp0/projects
18+
cmake --version
3019

31-
if "%xp_compatibility%" == "" (
32-
@echo Using default generator WITHOUT WindowsXP support
33-
"%cmake_executable%" %~dp0/sources -A Win32
34-
goto:eof
35-
)
36-
if "%xp_compatibility%" == "v120_xp" (
37-
@echo Generating using "Visual Studio 2013" with WindowsXP support
38-
"%cmake_executable%" %~dp0/sources -T %xp_compatibility% -A Win32
39-
goto:eof
40-
)
41-
if "%xp_compatibility%" == "v140_xp" (
42-
@echo Generating using "Visual Studio 2015" with WindowsXP support
43-
"%cmake_executable%" %~dp0/sources -T %xp_compatibility% -A Win32
44-
goto:eof
45-
)
46-
if "%xp_compatibility%" == "v141_xp" (
47-
@echo Generating using "Visual Studio 2017" with WindowsXP support
48-
"%cmake_executable%" %~dp0/sources -T %xp_compatibility% -A Win32
20+
if "%1%" == "" (
21+
@echo Generating using default generator
22+
cmake -S sources -B projects -DYADOMS_BINARY_DIR=bin -A Win32
4923
goto:eof
5024
)
51-
if "%xp_compatibility%" == "v142" (
25+
if "%1%" == "v142" (
5226
@echo Generating using "Visual Studio 2019"
53-
"%cmake_executable%" %~dp0/sources -A Win32
27+
cmake -S sources -B projects -G "Visual Studio 17 2019" -DYADOMS_BINARY_DIR=bin -A Win32
5428
goto:eof
5529
)
56-
if "%xp_compatibility%" == "v143" (
30+
if "%1%" == "v143" (
5731
@echo Generating using "Visual Studio 2022"
58-
"%cmake_executable%" %~dp0/sources -A Win32
32+
cmake -S sources -B projects -G "Visual Studio 17 2022" -DYADOMS_BINARY_DIR=bin -A Win32
5933
goto:eof
6034
)
6135
echo Error: invalid toolset selected
6236
goto:eof
63-
64-
:: Function to find cmake executable
65-
:getCMakeExecutable
66-
@setlocal enableextensions enabledelayedexpansion
67-
set file=sources/CMakeListsUserConfig.txt
68-
set key=ALTERNATIVE_CMAKE_ROOT
69-
set value=
70-
for /f "usebackq delims=" %%a in ("!file!") do (
71-
set ln=%%a
72-
if not "x!ln:~0,1!"=="x#" (
73-
for /f tokens^=2^ delims^=^(^)^ %%b in ("!ln!") do (
74-
set current_key=%%b
75-
if "x!key!"=="x!current_key!" (
76-
for /f tokens^=2^ delims^=^" %%c in ("!ln!") do (
77-
set value=%%c
78-
)
79-
)
80-
)
81-
)
82-
)
83-
if [!value!] == [] (
84-
echo Use cmake from PATH
85-
endlocal&set "%~1=cmake"
86-
) else (
87-
echo Use cmake from "%value%"
88-
endlocal&set "%~1=%value%/bin/cmake"
89-
)
90-
goto:eof

0 commit comments

Comments
 (0)