-
Notifications
You must be signed in to change notification settings - Fork 28
/
make.cmd
118 lines (91 loc) · 3.3 KB
/
make.cmd
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
@echo off
setlocal
if "%JAVA_HOME%" == "" goto javahomeerror
if "%ARCH%" == "" (
"%JAVA_HOME%\bin\java" -d32 -version 2>NUL
if %ERRORLEVEL% EQU 0 set ARCH=x86
"%JAVA_HOME%\bin\java" -d64 -version 2>NUL
if %ERRORLEVEL% EQU 0 set ARCH=x86_64
)
if "%VS_VERSION%" == "" set VS_VERSION=14
if "%TARGET_PLATFORM%" == "" (
if "%ARCH%" == "x86" set "TARGET_PLATFORM=Visual Studio %VS_VERSION%"
if "%ARCH%" == "x86_64" set "TARGET_PLATFORM=Visual Studio %VS_VERSION% Win64"
)
if "%CMAKE_CONFIG%" == "" set CMAKE_CONFIG=RelWithDebInfo
set NATIVE_INSTALL=%~dp0\native\win32\%ARCH%
set NATIVE_TARGET=%~dp0\target\native
set LIBGIT2_TARGET=%NATIVE_TARGET%\libgit2\%ARCH%
set LIBJAGGED_TARGET=%NATIVE_TARGET%\libjagged\%ARCH%
set LIBJAGGED_TEST_TARGET=%NATIVE_TARGET%\libjagged_test\%ARCH%
set LIBGIT2_SRC=%~dp0\src\main\native\libgit2
set LIBJAGGED_SRC=%~dp0\src\main\native\libjagged
set LIBJAGGED_TEST_SRC=%~dp0\src\test\native\libjagged_test
if "%1" == "" goto build
if "%1" == "build" goto build
if "%1" == "clean" goto clean
if "%1" == "install" goto install
echo Unknown target: %1
goto end
:build
:install
rem build libgit2
echo Building libgit2...
if not exist %LIBGIT2_TARGET% ( mkdir %LIBGIT2_TARGET% )
cd %LIBGIT2_TARGET%
cmake %LIBGIT2_SRC% "-G%TARGET_PLATFORM%" ^
-DTHREADSAFE=ON -DBUILD_CLAR=OFF -DSTDCALL=OFF ^
%LIBGIT2_CMAKE_FLAGS%
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
cd %~dp0
cmake --build %LIBGIT2_TARGET% --config %CMAKE_CONFIG%
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
rem build libjagged
echo Building libjagged...
if not exist %LIBJAGGED_TARGET% ( mkdir %LIBJAGGED_TARGET% )
cd %LIBJAGGED_TARGET%
cmake %LIBJAGGED_SRC% "-G%TARGET_PLATFORM%" ^
-DINCLUDE_LIBGIT2=%LIBGIT2_SRC%\include ^
-DLINK_LIBGIT2="%LIBGIT2_TARGET%\%CMAKE_CONFIG%" ^
%LIBJAGGED_CMAKE_FLAGS%
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
cd %~dp0
cmake --build %LIBJAGGED_TARGET% --config %CMAKE_CONFIG%
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
rem build libjagged_test
echo Building libjagged_test...
if not exist %LIBJAGGED_TEST_TARGET% ( mkdir %LIBJAGGED_TEST_TARGET% )
cd %LIBJAGGED_TEST_TARGET%
cmake %LIBJAGGED_TEST_SRC% "-G%TARGET_PLATFORM%" ^
-DINCLUDE_LIBGIT2=%LIBGIT2_SRC%\include ^
-DLINK_LIBGIT2=%LIBGIT2_TARGET%\%CMAKE_CONFIG% ^
-DINCLUDE_LIBJAGGED=%LIBJAGGED_SRC% ^
-DLINK_LIBJAGGED=%LIBJAGGED_TARGET%\%CMAKE_CONFIG% ^
%LIBJAGGED_TEST_CMAKE_FLAGS%
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
cd %~dp0
cmake --build %LIBJAGGED_TEST_TARGET% --config %CMAKE_CONFIG%
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
if not "%1" == "install" ( goto end )
if not exist %NATIVE_INSTALL%\%ARCH_PATH% ( mkdir %NATIVE_INSTALL%\%ARCH_PATH% )
@echo on
copy %LIBGIT2_TARGET%\%CMAKE_CONFIG%\git2.dll %NATIVE_INSTALL%\%ARCH_PATH%
copy %LIBJAGGED_TARGET%\%CMAKE_CONFIG%\jagged.dll %NATIVE_INSTALL%\%ARCH_PATH%
copy %LIBJAGGED_TEST_TARGET%\%CMAKE_CONFIG%\jagged_test.dll %NATIVE_INSTALL%\%ARCH_PATH%
@echo off
goto end
:clean
if exist %LIBGIT2_TARGET% ( cmake --build %LIBGIT2_TARGET% --target clean )
if exist %LIBJAGGED_TARGET% ( cmake --build %LIBJAGGED_TARGET% --target clean )
if exist %LIBJAGGED_TEST_TARGET% ( cmake --build %LIBJAGGED_TEST_TARGET% --target clean )
goto end
:archerror
echo+
echo Unknown build architecture
goto end
:javahomeerror
echo+
echo JAVA_HOME must be set to an installed JDK (matching the current architecture)
goto end
:end
endlocal