LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: elias on May 10, 2004, 13:21:35

Title: Building LWJGL win32 with the MS free cmd line compiler
Post by: elias on May 10, 2004, 13:21:35
Hi,

I managed to compile the LWJGL win32 part with the free MS command line compiler/linker. Here's what I did:

1. Fetched the tools from

http://msdn.microsoft.com/visualc/vctoolkit2003/

2. Fetched the Platform SDK update from

http://www.microsoft.com/msdownload/platformsdk/sdkupdate/

3. Fetched the DirectX SDK from

http://www.microsoft.com/downloads/details.aspx?FamilyID=1d97f320-9dfd-4e7a-b947-3a037ccf84af&displaylang=en

4. Installed everything
5. Put this batch file into src/native/win32:


@echo off

set JAVAHOME=f:\j2sdk1.4.2_02
set ALHOME="F:\Program Files\OpenAL 1.0 Software Development Kit"
set EAXHOME="F:\Program Files\Creative Labs\EAX 2.0 Extensions SDK"
set DXHOME=f:\DXSDK
set COPTIONS=/I%DXHOME%\Include /I%JAVAHOME%\include /I%JAVAHOME%\include\win32 /I%ALHOME%\Include /I%EAXHOME%\Include /I..\common /O2 /nologo /c
set LINKEROPTS=/link /LIBPATH:%ALHOME%\libs /LIBPATH:%EAXHOME%\Libs /LIBPATH:%DXHOME%\Lib
set LIBS=dinput.lib dxguid.lib OpenAL32.lib alut.lib eaxguid.lib OpenGL32.Lib Version.lib user32.lib Gdi32.lib Advapi32.lib

for %%x in (*.cpp) do cl %COPTIONS% %%x
for %%x in (..\common\*.cpp) do cl %COPTIONS% %%x
for %%x in (..\common\arb\*.cpp) do cl %COPTIONS% %%x
for %%x in (..\common\nv\*.cpp) do cl %COPTIONS% %%x
for %%x in (..\common\ext\*.cpp) do cl %COPTIONS% %%x
for %%x in (..\common\ati\*.cpp) do cl %COPTIONS% %%x

cl /LD /Felwjgl.dll *.obj %LINKEROPTS% %LIBS%


6. Run it

- elias
Title: Building LWJGL win32 with the MS free cmd line compiler
Post by: princec on May 10, 2004, 14:59:19
Nice one. Perhaps you can commit it into platform_build and add a comment to the Wiki?

Cas :)
Title: Building LWJGL win32 with the MS free cmd line compiler
Post by: Matzon on May 10, 2004, 16:02:22
speaking of platform build - is there anyway we could get the makefile stuff out of src/native and into platform_build? Sure I know I am being anal about it, I just have this weird obsession about a clean directory structure  :twisted:
Title: Building LWJGL win32 with the MS free cmd line compiler
Post by: Matzon on May 11, 2004, 20:36:31
I'd just like to add, that one needs OpenAL:
http://developer.creative.com/articles/article.asp?cat=1&sbcat=31&top=38&aid=45

and EAX too:
http://developer.creative.com/articles/article.asp?cat=1&sbcat=31&top=37&aid=61
Title: Building LWJGL win32 with the MS free cmd line compiler
Post by: Morgrog on May 12, 2004, 12:18:30
Sticky?

or maybe link it in the wiki?

so, uh sticky/wiki  :oops:


(cuz this is fun information for those CVS, latest release guys) :D
Title: Building LWJGL win32 with the MS free cmd line compiler
Post by: CaptainJester on October 07, 2004, 01:42:47
Been trying to get this to work.  I am sure I have it set up right, but I am still getting errors.

Here is a sample from the commands that are being performed:
F:\Apps\Java\eclipse\workspace\LWJGL\platform_build\win32_ms_cmdline>cl "/IF:\Apps\DXSDK\include /IF:\Apps\Microsoft Visual C++ Toolkit 2003\include /IF:\Apps\Microsoft SDK\include /IF:\Apps\Java\j2sdk1.4.2_04\include /IF:\Apps\Java\j2sdk1.4.2_04\include\win32 /IF:\Apps\Creative Labs\OpenAL 1.0 SDK\include /IF:\Apps\Creative Labs\EAX 2.0 Extensions SDK\include /I..\..\src\native\common /O2 /nologo /c" ..\..\src\native\win32\org_lwjgl_Sys.cpp

and here is the error:


org_lwjgl_Sys.cpp
f:\Apps\Java\eclipse\workspace\LWJGL\src\native\win32\Window.h(51) : fatal error
C1083: Cannot open include file: 'windows.h': No such file or directory


I don't know why it can't find it, because /IF:\Apps\Microsoft SDK\include points to it.

Any suggestions?
Title: Building LWJGL win32 with the MS free cmd line compiler
Post by: Matzon on October 07, 2004, 05:11:06
that should probably be:
/I"F:\Apps\Microsoft SDK\include"
you have spaces in the path.
Title: Building LWJGL win32 with the MS free cmd line compiler
Post by: CaptainJester on October 07, 2004, 10:47:38
I had put quotes around the whole thing.  I will try putting quotes around the individual entries to see if that works.

Thanks.
Title: Building LWJGL win32 with the MS free cmd line compiler
Post by: Matzon on October 07, 2004, 10:53:00
you should only put it on the items so that it becomes:F:\Apps\Java\eclipse\workspace\LWJGL\platform_build\win32_ms_cmdline>cl /I"F:\Apps\DXSDK\include" /I"F:\Apps\Microsoft Visual C++ Toolkit 2003\include" /I"F:\Apps\Microsoft SDK\include" /I"F:\Apps\Java\j2sdk1.4.2_04\include" /I"F:\Apps\Java\j2sdk1.4.2_04\include\win32" /I"F:\Apps\Creative Labs\OpenAL 1.0 SDK\include" /I"F:\Apps\Creative Labs\EAX 2.0 Extensions SDK\include" /I"..\..\src\native\common" /O2 /nologo /c ..\..\src\native\win32\org_lwjgl_Sys.cpp

but you should be able to just use the buildscript, and set the paths with ""s
this is my script:
@echo off

set JAVAHOME="C:\Java\jdk1.5.0"
set ALHOME="c:\Program Files\OpenAL 1.0 Software Development Kit"
set EAXHOME="c:\Program Files\Creative Labs\EAX 2.0 Extensions SDK"
set DXHOME="C:\Program Files\DX90SDK"
set PLTSDKHOME="C:\Program Files\Microsoft SDK"
set COPTIONS=/I%DXHOME%\Include /I%PLTSDKHOME%\include /I%JAVAHOME%\include /I%JAVAHOME%\include\win32 /I%ALHOME%\Include /I%EAXHOME%\Include /I..\..\src\native\common /O2 /nologo /c
set LINKEROPTS=/link /LIBPATH:%ALHOME%\libs /LIBPATH:%EAXHOME%\Libs /LIBPATH:%DXHOME%\Lib /LIBPATH:%PLTSDKHOME%\Lib
set LIBS=dinput.lib dxguid.lib OpenAL32.lib alut.lib eaxguid.lib OpenGL32.Lib Version.lib user32.lib Gdi32.lib Advapi32.lib

for %%x in (..\..\src\native\win32\*.cpp) do cl %COPTIONS% %%x
for %%x in (..\..\src\native\common\*.c) do cl %COPTIONS% %%x
for %%x in (..\..\src\native\common\arb\*.c) do cl %COPTIONS% %%x
for %%x in (..\..\src\native\common\nv\*.c) do cl %COPTIONS% %%x
for %%x in (..\..\src\native\common\ext\*.c) do cl %COPTIONS% %%x
for %%x in (..\..\src\native\common\ati\*.c) do cl %COPTIONS% %%x

cl /LD /Felwjgl.dll *.obj %LINKEROPTS% %LIBS%

del *.obj *.exp *.lib
copy lwjgl.dll ..\..\libs\
Title: Building LWJGL win32 with the MS free cmd line compiler
Post by: Matzon on October 07, 2004, 10:54:39
you could also try to use
http://lab.msdn.microsoft.com/express/visualc/default.aspx
but it has a even more complex setup :/
Title: Building LWJGL win32 with the MS free cmd line compiler
Post by: CaptainJester on October 07, 2004, 17:30:03
Quote from: "Matzon"you could also try to use
http://lab.msdn.microsoft.com/express/visualc/default.aspx
but it has a even more complex setup :/

No the other thing was the problem.  You would think Microsoft's own compiler could handle long file names without quotes.  I guess that is just the nature of the legacy of DOS.

Thanks.
Title: Building LWJGL win32 with the MS free cmd line compiler
Post by: CaptainJester on October 07, 2004, 17:35:11
You also need FMOD:

http://www.fmod.org/
Title: Building LWJGL win32 with the MS free cmd line compiler
Post by: Matzon on October 07, 2004, 18:43:10
should only need fmod if you build the fmod binding?