|
| 1 | +@echo OFF |
| 2 | + |
| 3 | +echo Check for nodejs build location variable: %NODE_ROOT% |
| 4 | +if not defined NODE_ROOT goto nodebuild-not-found |
| 5 | +if not exist "%NODE_ROOT%\src\node.h" goto nodebuild-not-found |
| 6 | +if not exist "%NODE_ROOT%\deps\v8\include\v8.h" goto nodebuild-not-found |
| 7 | +if not exist "%NODE_ROOT%\deps\uv\include\uv.h" goto nodebuild-not-found |
| 8 | + |
| 9 | +echo detect the location of the node.lib file |
| 10 | +set nodelibpath= |
| 11 | +if exist "%NODE_ROOT%\Release\node.lib" set nodelibpath=%NODE_ROOT%\Release |
| 12 | +if not defined nodelibpath if exist "%NODE_ROOT%\Debug\node.lib" set nodelibpath=%NODE_ROOT%\Debug |
| 13 | +if not defined nodelibpath goto nodebuild-not-found |
| 14 | + |
| 15 | +echo detect java |
| 16 | +if not defined NODE_ROOT goto java-not-found |
| 17 | +if not exist "%JAVA_HOME%\include\jni.h" goto java-not-found |
| 18 | +if not exist "%JAVA_HOME%\lib\jvm.lib" goto java-not-found |
| 19 | + |
| 20 | +echo Check for visual studio tools if not already loaded |
| 21 | +if defined VCINSTALLDIR goto start-compilation |
| 22 | +if not defined VS100COMNTOOLS goto msbuild-not-found |
| 23 | +if not exist "%VS100COMNTOOLS%..\..\vc\vcvarsall.bat" goto msbuild-not-found |
| 24 | +call "%VS100COMNTOOLS%..\..\vc\vcvarsall.bat" |
| 25 | +if not defined VCINSTALLDIR goto msbuild-not-found |
| 26 | + |
| 27 | +:start-compilation |
| 28 | +echo Compiling... |
| 29 | +@rem "support throws" "don't strip comments" "no banner" "disable intrinsic functions" "no optimization" "calling conversion __cdecl" "no analysis" "the /I adds some folders in the include path" |
| 30 | +rem /ZI /nologo /W3 /WX- /Od /Oy- /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "NODEJAVA_EXPORTS" /D "_WINDLL" /D "_UNICODE" /D "UNICODE" /Gm /EHsc /RTC1 /GS /fp:precise /Zc:wchar_t /Zc:forScope /Yu"StdAfx.h" /Fp"Debug\node-java.pch" /Fa"Debug\" /Fo"Debug\" /Fd"Debug\vc100.pdb" /Gd /analyze- /errorReport:queue |
| 31 | +cl.exe src\*.cpp /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /EHsc /c /nologo /Oi- /Od /Gd /analyze- /I "%NODE_ROOT%\deps\v8\include" /I "%NODE_ROOT%\src" /I "%NODE_ROOT%\deps\uv\include" /I "%JAVA_HOME%\include" /I "%JAVA_HOME%\include\win32" |
| 32 | +if errorlevel 1 goto exit-error |
| 33 | +echo Done compiling. Linking... |
| 34 | +echo Using %nodelibpath%\node.lib file to link to |
| 35 | +link *.obj node.lib jvm.lib uv.lib /OUT:"nodejavabridge_bindings.dll" /NOLOGO /DLL /MANIFEST:NO /SUBSYSTEM:WINDOWS /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /LIBPATH:%nodelibpath% /LIBPATH:%nodelibpath%/lib /LIBPATH:"%JAVA_HOME%\lib" |
| 36 | +if errorlevel 1 goto exit-error |
| 37 | +echo Done linking |
| 38 | +echo Cleaning up |
| 39 | +if not exist build mkdir build |
| 40 | +if not exist build\Release mkdir build\Release |
| 41 | +move nodejavabridge_bindings.dll build\Release\nodejavabridge_bindings.node |
| 42 | +echo Finished |
| 43 | +goto exit |
| 44 | + |
| 45 | +:msbuild-not-found |
| 46 | +echo Visual studio tools were not found! Please check the VS100COMNTOOLS path variable |
| 47 | +goto exit |
| 48 | + |
| 49 | +:nodebuild-not-found |
| 50 | +echo Node build path not found! Please check the NODE_ROOT path variable exists and that it points to the root of the git repo where you have build |
| 51 | +goto exit |
| 52 | + |
| 53 | +:java-not-found |
| 54 | +echo Java not found! Please check JAVA_HOME variable. |
| 55 | +goto exit |
| 56 | + |
| 57 | +:exit-error |
| 58 | +echo An error occured. Please check the above output |
| 59 | +:exit |
0 commit comments