forked from radareorg/radare2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
meson.bat
97 lines (85 loc) · 2.45 KB
/
meson.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
93
94
95
96
97
@ECHO OFF
SET BACKEND=ninja
SET BUILDDIR=build
SET DEFAULT_LIBRARY=--default-library static
SET RELEASE=
SET BUILD=
SET XP=
rem ######## Meson msvc script ########
rem ## Usage examples:
rem meson.bat -p ; Creates vs2015 solution
rem meson.bat -p2 ; Creates vs2017 solution
rem meson.bat ; Compiles the project using ninja build system
rem meson.bat --release ; Compiles the project with release flags and ninja build system
rem meson.bat --release --msbuild --xp ; Compiles the project with msbuild and windows xp support
:PARSEARGS
IF NOT "%1"=="" (
IF "%1"=="-p" (
SET BACKEND=vs2015
SET BUILD=project
)
IF "%1"=="-p2" (
SET BACKEND=vs2017
SET BUILD=project
)
IF "%1"=="-r" (
SET BUILD=regen
)
IF "%1"=="--release" (
SET RELEASE=--buildtype=release
)
IF "%1"=="--msbuild" (
SET BUILD=msbuild
)
IF "%1"=="--xp" (
rem TODO Not portable check also -p and -p2 options
SET BACKEND=vs2015
SET XP=1
)
SHIFT
GOTO PARSEARGS
)
IF EXIST shlr\capstone GOTO START
ECHO [ R2 MESON CLONING CAPSTONE ]
git clone -b next --depth 10 https://github.com/aquynh/capstone.git shlr\capstone
rem Applying capstone patches
rem cd shlr\capstone
rem FOR /r %%p IN (..\capstone-patches\*) DO git apply %%p
rem git apply ..\capstone-patches\add-mips2.patch
rem cd ..\..
:START
IF NOT "%RELEASE%"=="" ECHO [ R2 MESON BUILD: RELEASE ]
IF "%BUILD%"=="regen" GOTO REBUILD
IF "%BUILD%"=="project" GOTO BUILDPROJECT
rem Creating build directory with correct parameters
IF EXIST %BUILDDIR% GOTO BUILD
python meson.py --prefix=%CD% %BUILDDIR% %RELEASE% %DEFAULT_LIBRARY% --backend %BACKEND%
:BUILD
CALL :SDB_BUILD
IF "%BUILD%"=="msbuild" GOTO MSBUILD
ECHO [ R2 MESON NINJA BUILD ]
ninja -C %BUILDDIR%
EXIT /b %errorlevel%
:MSBUILD
ECHO [ R2 MESON MSBUILD ]
IF "%XP%"=="1" (
python sys\meson_extra.py
)
msbuild %BUILDDIR%\radare2.sln
EXIT /b %errorlevel%
:BUILDPROJECT
ECHO [ R2 MESON BUILDING %BACKEND% SLN]
IF EXIST %BUILDDIR% rd /s /q %BUILDDIR%
python meson.py --prefix=%CD% %BUILDDIR% --backend=%BACKEND% %RELEASE% %DEFAULT_LIBRARY%
IF "%XP%"=="1" (
python sys\meson_extra.py
)
GOTO EXIT
:REBUILD
python meson.py --internal regenerate %CD% "%CD%\%BUILDDIR%" --backend %BACKEND% %RELEASE% %DEFAULT_LIBRARY%
:EXIT
EXIT /B 0
:SDB_BUILD
ECHO [ SDB BUILD AND GENERATION ]
python sys\meson_sdb.py
EXIT /B 0