forked from unsound/hfsexplorer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildlauncher.bat
55 lines (44 loc) · 1.44 KB
/
buildlauncher.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
@echo off
setlocal
set LAUNCHER_SRC=%~dp0src\win32\launcher
set OUTDIR=%~dp0dist\bin
set OUTFILE=hfsexplorer.exe
set BUILD_DIR=%~dp0build.~
if "%JAVA_HOME%"=="" echo Please set the JAVA_HOME environment variable before executing this script. & goto error
if not "%CPATH%"=="" set "CPATH=%CPATH%;"
set CPATH=%CPATH%%JAVA_HOME%\include;%JAVA_HOME%\include\win32
echo "CPATH: %CPATH%"
if "%1"=="console" goto console
if "%1"=="windows" goto win
echo You must specify console or windows application...
goto error
:win
set BUILDTYPE=windows
goto build
:console
set BUILDTYPE=console
goto build
:build
echo Cleaning build dir...
if exist "%BUILD_DIR%" rmdir /s /q "%BUILD_DIR%"
if exist "%BUILD_DIR%" echo Could not clean build dir!
mkdir "%BUILD_DIR%"
echo Compiling resources...
pushd "%LAUNCHER_SRC%"
windres .\launcher.rc "%BUILD_DIR%"\launcher_res.o
set WINDRES_RES=%ERRORLEVEL%
popd
if not "%WINDRES_RES%"=="0" goto error
echo Compiling launcher.cpp...
g++ -g -Wall -D_JNI_IMPLEMENTATION_ -c "%LAUNCHER_SRC%\launcher.cpp" -o "%BUILD_DIR%\launcher.o"
if not "%ERRORLEVEL%"=="0" goto error
echo Building %BUILDTYPE% app...
g++ -static-libgcc -static-libstdc++ -g -m%BUILDTYPE% -Wall -D_JNI_IMPLEMENTATION_ -Wl,--kill-at "%BUILD_DIR%\launcher_res.o" "%BUILD_DIR%\launcher.o" -o "%OUTDIR%\%OUTFILE%"
if not "%ERRORLEVEL%"=="0" goto error
echo Done!
goto end
:error
echo There were errors...
goto end
:end
endlocal