-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathvc6buildlauncher.bat
64 lines (48 loc) · 1.6 KB
/
vc6buildlauncher.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
@echo off
setlocal
set BUILD_DIR=%~dp0build.~
set SOURCE_DIR=%~dp0src\win32\launcher
set TARGET_EXE_PREFIX=%~dp0dist\bin
set RES_TARGET=%BUILD_DIR%\launcher.res
set OBJ_TARGET=%BUILD_DIR%\launcher.obj
if "%JAVA_HOME%"=="" echo Please set JAVA_HOME to point at your JDK before running this script. & goto end
if "%1"=="console" goto console
if "%1"=="windows" goto windows
:printusage
echo usage: %0 [console^|windows] ^<x86^>
goto end
:console
set SUBSYSTEM=CONSOLE
goto arch
:windows
set SUBSYSTEM=WINDOWS
goto arch
:arch
if "%2"=="" set TARGET_EXE=%TARGET_EXE_PREFIX%\hfsexplorer.exe & goto build
if "%2"=="x86" set TARGET_EXE=%TARGET_EXE_PREFIX%\hfsexplorer_x86.exe & goto build
echo Unknown architecture "%2"!
goto printusage
:build
echo Cleaning build dir...
if exist "%BUILD_DIR%" rmdir /s /q "%BUILD_DIR%"
if exist "%BUILD_DIR%" echo Could not clean build dir! & goto error
mkdir "%BUILD_DIR%"
echo Compiling resources...
rc /fo "%RES_TARGET%" "%SOURCE_DIR%\launcher.rc"
if not "%ERRORLEVEL%"=="0" goto error
echo Compiling source code...
cl /c "/Fo%OBJ_TARGET%" "/I%JAVA_HOME%\include" "/I%JAVA_HOME%\include\win32" "%SOURCE_DIR%\launcher.cpp"
if not "%ERRORLEVEL%"=="0" goto error
echo Linking...
link /defaultlib:user32 /defaultlib:shell32 /defaultlib:advapi32 /defaultlib:ole32 /subsystem:%SUBSYSTEM% /entry:mainCRTStartup "/out:%TARGET_EXE%" "%OBJ_TARGET%" "%RES_TARGET%"
if not "%ERRORLEVEL%"=="0" goto error
goto completed
:completed
echo Target generated at %TARGET_EXE%
echo Done!
goto end
:error
echo There were errors...
goto end
:end
endlocal