-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_mingw_dummy.bat
More file actions
71 lines (43 loc) · 1.69 KB
/
build_mingw_dummy.bat
File metadata and controls
71 lines (43 loc) · 1.69 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
REM Dependencies
:: whole build is done using MSYS2 mingw
::winget install -e --id MSYS2.MSYS2
REM Run using MSYS2 shell
:: TODO: wouldnt be better to create temporary script? - would solve the issue with mutiline commands and command line arguments -- CURRENTLY BROKEN - kept only as example how mingw bash commands can be run from batch file (arguments, cd, double quotes MAY NOT WORK)
@echo off
setlocal enabledelayedexpansion
for /f "delims=" %%A in ('more +18 %~f0') do (
echo "%%A" | findstr /b "\"cd "
if errorlevel 1 (C:\msys64\msys2_shell.cmd -mingw64 -defterm -no-start -shell bash -where "!cd!" -c "%%A") else (%%A)
)
@echo on
exit /B
# Start of MSYS2 shell script
## Dependencies
if [[ " $@ " =~ " --dependencies " ]]; then
# no dependencies (except build tools)
pacman -S --needed base-devel gcc
fi
## Prepare
# construct version string
BUILD="HUI-mingw-$(uname -m)-dummy"
# create target directory
mkdir -p $BUILD
cd $BUILD
## Build
# build with simple g++
g++ -shared -fPIC -o ./libHUI.dll ../hui_webview__dummy.cc -I..
## Deploy
if [[ " $@ " =~ " --deploy " ]]; then
# copy all non-system libraries (makes the build self-contained)
ldd ./libHUI.dll | grep -vE /c/WINDOWS\|System32\|SYSTEM32 | awk '{print $3}' | xargs -I {} sh -c '[ -f {} ] && cp {} .'
fi
## Tests
if [[ " $@ " =~ " --tests " ]]; then
# build and deploy (the first ldd command can be omitted since it works recursively)
#g++ -o <your_executable> <your_source> -L. -lHUI
#ldd <your_executable> | grep -vE /c/WINDOWS\|System32\|SYSTEM32 | awk '{print $3}' | xargs -I {} sh -c '[ -f {} ] && cp {} .'
# build tests
g++ -o test_webview_js_api.exe ../tests/test_webview_js_api.cc -I.. -L. -lHUI
fi
## Notes
cd ..