-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompile.bat
More file actions
80 lines (67 loc) · 1.94 KB
/
compile.bat
File metadata and controls
80 lines (67 loc) · 1.94 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
72
73
74
75
76
77
78
79
80
@echo off
setlocal enabledelayedexpansion
echo =====================================================
echo FastTouch Native Compiler
echo =====================================================
echo.
REM Auto-detect JAVA_HOME
if not defined JAVA_HOME (
for /f "tokens=*" %%a in ('where javac 2^>nul') do (
set "JAVA_HOME=%%~dpa.."
)
)
if not defined JAVA_HOME (
echo ERROR: JAVA_HOME not found. Please install JDK 17+.
pause
exit /b 1
)
echo Using JAVA_HOME: %JAVA_HOME%
REM Auto-detect Visual Studio
set "VS_PATH="
for %%p in (
"C:\Program Files\Microsoft Visual Studio\2022\Community"
"C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
"C:\Program Files\Microsoft Visual Studio\2022\Professional"
"C:\Program Files\Microsoft Visual Studio\2022\BuildTools"
"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools"
) do (
if exist "%%~p\VC\Auxiliary\Build\vcvars64.bat" (
set "VS_PATH=%%~p"
goto :found_vs
)
)
:found_vs
if not defined VS_PATH (
echo ERROR: Visual Studio 2022 not found.
pause
exit /b 1
)
echo Using Visual Studio: %VS_PATH%
REM Setup environment
call "%VS_PATH%\VC\Auxiliary\Build\vcvars64.bat"
REM Create build directory
if not exist build mkdir build
echo.
echo Compiling FastTouch Native DLL...
echo =====================================================
cl /LD /Fe:build\fasttouch.dll ^
native\FastTouch.cpp ^
user32.lib ^
/I"%JAVA_HOME%\include" ^
/I"%JAVA_HOME%\include\win32" ^
/EHsc /std:c++17 /O2 /W3 ^
/link /DEF:native\FastTouch.def
if %ERRORLEVEL% neq 0 (
echo.
echo =====================================================
echo COMPILATION FAILED
echo =====================================================
pause
exit /b 1
)
echo.
echo =====================================================
echo BUILD SUCCESSFUL: build\fasttouch.dll
echo =====================================================
echo.
pause