forked from DougHamil/DragonbornSpeaksNaturally
-
Notifications
You must be signed in to change notification settings - Fork 7
/
configure.bat
92 lines (76 loc) · 2.38 KB
/
configure.bat
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
@echo off & setlocal ENABLEDELAYEDEXPANSION
:: jump to script's parent dir
cd /d %~dp0
:: load/create option files
SET InstallPathConfig=install-path.ini
:: read or generate config files
if exist %InstallPathConfig% (
call :load_ini %InstallPathConfig%
call :get_ini SkyrimAE InstallPath SkyrimAEInstallPath
call :get_ini SkyrimSE InstallPath SkyrimSEInstallPath
call :get_ini SkyrimVR InstallPath SkyrimVRInstallPath
) else (
echo Set plugin install directories after building:
set /p SkyrimAEInstallPath="SkyrimAE game root path (empty to disable installation): "
set /p SkyrimSEInstallPath="SkyrimSE game root path (empty to disable installation): "
set /p SkyrimVRInstallPath="SkyrimVR game root path (empty to disable installation): "
call :set_ini SkyrimAE InstallPath "!SkyrimAEInstallPath!"
call :set_ini SkyrimSE InstallPath "!SkyrimSEInstallPath!"
call :set_ini SkyrimVR InstallPath "!SkyrimVRInstallPath!"
call :save_ini >%InstallPathConfig%
)
:: create and enter build dir
md build
cd build
:: run CMake
set CMakeFlags=
if defined SkyrimAEInstallPath (
set CMakeFlags=!CMakeFlags! -DSAE_DIR="!SkyrimAEInstallPath!"
)
if defined SkyrimSEInstallPath (
set CMakeFlags=!CMakeFlags! -DSSE_DIR="!SkyrimSEInstallPath!"
)
if defined SkyrimVRInstallPath (
set CMakeFlags=!CMakeFlags! -DSVR_DIR="!SkyrimVRInstallPath!"
)
echo CMakeFlags:!CMakeFlags!
cmake -A x64 !CMakeFlags! ..
:: disable Prefer32Bit for C# project
cd dsn_service
type ..\..\dsn_service\disable_prefer_32bit.ps1 | powershell.exe -Command -
cd ..
:: load project
start DSN.sln
:: pause for user's lookup
pause
goto :eof
:: ----------------- ini parse & edit functions -----------------
:: From <https://zhidao.baidu.com/question/982407720655882739.html>
:load_ini [param#1=ini file path]
set "op="
for /f " usebackq tokens=1* delims==" %%a in ("%~1") do (
if "%%b"=="" (
set "op=%%a"
) else (
set "##!op!#%%a=%%b"
)
)
goto :eof
:get_ini [param#1=Option] [param#2=Key] [param#3=StoredVar]
set %~3=!##[%~1]#%~2!
goto :eof
:set_ini [param#1=Option] [param#2=Key] [param#3=Value, without it the key will be deleted]
set "##[%~1]#%~2=%~3"
goto :eof
:save_ini [>ini path]
set "op="
set "##=##"
for /f "tokens=1-3 delims=#=" %%a in ('set ##') do (
if "%%a"=="!op!" (
echo,%%b=%%c
) else (
echo,%%a
set "op=%%a"
echo,%%b=%%c
)
)