Compile the Xith3d sources

Hi,

in several different threads of this Xith3d’s forum people said they compiled Xith3d from the CVS. Maybe we could merge the steps needed in compiling Xith3d in a new thread?

Unfortunately when I try to compile Xith3d from the current community bundle’s source I got tons of errors, probably it’s because there is some dependency on LWJGL…?

Is it necessary to compile Xith3d against -source 1.4 ? Doesn’t help, though…

I’d be happy if a single line would do the trick, for example like the following does it usually:

dir /b /s *.java | gawk "{system(\"javac -d bin \" $0)}"

Be sure to look at the appropriate section in the Getting Started Guide: Bleeding Edge Source

The following command is enough to compile Xith3D:

ant

The only thing you need is an installation of Apache Ant. Ant looks for a file called “build.xml” in the current directory. build.xml contains all the necessary instructions to create a new build of Xith3D.

Ant is a very powerful tool. It’s used for creating the Getting Started Guide, too. In the case of the GSG a single ant call creates the PDF file, the HTML files, zipped files for every section, self-executing jars for every example and more.

I read somewhere that you are familiar with C/C++. You probably know the “make” command and Makefiles. Ant is similar, but in my opinion easier to use and designed to be platform independant.

[quote]Be sure to look at the appropriate section in the Getting Started Guide: (…) The only thing you need is an installation of Apache Ant. Ant looks for a file called “build.xml” in the current directory. build.xml contains all the necessary instructions to create a new build of Xith3D.
[/quote]
Yes, thanks Jens. Of course I’ve already read your nice tutorial. :slight_smile:
Still I wonder what ANT would do different compared to my single AWK command line (which really just compiles all .java files of Xith3d) and even more: how does ANT resolve the LWJGL dependency? Several Xith3d source files contain lines like:


import org.lwjgl.*;
import org.lwjgl.opengl.*;
import org.lwjgl.input.*;

So I suppose I can’t compile Xith3d currently without these import files? (which I don’t have got at the mo)

[quote]I read somewhere that you are familiar with C/C++. You probably know the “make” command and Makefiles. Ant is similar, but in my opinion easier to use and designed to be platform independant.
[/quote]
“Make”, yes I know this fossil but are no fan of it (the step from Object Pascal to C/C++ “make” has been rigid).
If possible I’d like to use GNU AWK before installing “yet another tool”. :slight_smile:

This tutorial was written by Will, who has contributed a lot to the Getting Started Guide. :slight_smile:

[quote]Still I wonder what ANT would do different compared to my single AWK command line (which really just compiles all .java files of Xith3d) and even more: how does ANT resolve the LWJGL dependency?
[/quote]
If you download Xith3D from CVS you’ll have all the third-party libraries in one directory. Ant puts them all in the classpath when compiling, so you should not have any problems. Besides this Ant generates xith3d.jar, which is pretty useful. ;D Ant can also be used to generate Javadoc (ant javadoc) or a community build (ant cbuild).

Btw. your script doesn’t work for me (dir: *.java: No such file or directory).

[quote]If possible I’d like to use GNU AWK before installing “yet another tool”. :slight_smile:
[/quote]
I think Ant is used by a lot of projects, is integrated in Eclipse and has won several awards. It’s really worth downloading. :slight_smile:

However if you don’t want Ant you can still put lwjgl.jar in your classpath when compiling Xith3D. This does the trick, too.

[quote]This tutorial was written by Will, who has contributed a lot to the Getting Started Guide. :slight_smile:
[/quote]
I see! So it’s Will’s nice tutorial. You produced the PDF? :wink:

[quote]If you download Xith3D from CVS you’ll have all the third-party libraries in one directory.
[/quote]
I’ve downloaded the community build tar.gz but just used the Xith3d src directory. Now I get the point that I’ve to include the lwjgl.jar too… That’s it. Thanks.
This leads to the question: Why does the Xith3d source need lwjgl? I definitely don’t need the lwjgl.jar in order to run all the Xith3d demos. :wink:

[quote]Btw. your script doesn’t work for me (dir: *.java: No such file or directory).
[/quote]
Yes, it should read

dir /b /s *.java | gawk "{sub(/^.+src\\/, \"\"); system(\"javac -d bin \" $0)}"

… and you’ve to start it from within the “src/” directory (where a “dir” shows the “com/” folder then). These braindead " are just needed for the sucking Win32 dosbox. On a real console (Unix) it would read:

ls -dontknowswitch *java | gawk '{sub(/^.+src\\/, ""); system("javac -d bin " $0)}'

(A very good reason to switch to Linux in the future :slight_smile:

[quote]I think Ant is used by a lot of projects, is integrated in Eclipse and has won several awards. It’s really worth downloading. :slight_smile:
[/quote]
:slight_smile: For distributing sources this is a good idea. For my home stuff I’ve added a one line AWK to JBuilder to do Javadocs and JARs. :wink: (I really love GAWK.)

I am using Eclipse 3.0 on a windows platform. Here’s an example what I did:

I’ve first created a java project called Xith3d. Then I used the CVS view for checking out the whole Xith3d CVS into existing project (Xith3d). Next I click the project with right mb and select properties. From there I did the following:

  1. select tab “Java Build Path”.
    I remove current build path and add new one by clicking button “Add new folder”, now my build path reads “xith3d/src” (right) instead of the default “xith3d” (wrong).

  2. select tab “Libraries”
    Click button “Add JARs…”
    Add the following libraries to your classpath
    third-party/misc/junit.jar
    third-party/misc/log4j.jar
    third-party/misc/vorbis.jar
    third-party/vecmath/vecmath.jar
    third-party/xith/xith_utilities.jar
    third-party/lwjgl/examples.jar
    third-party/lwjgl/lwjgl.jar
    third-party/joal/windows/joal.jar
    third-party/jogl/jogl-win32/jogl.jar

  3. Select tab “Order and export” (not mandatory for Xith examples)
    Check every library that you wish to use on a project that depends on Xith3d, e.g. your own Xith3d related test project.

One thing, when you run e.g. Xith3d tests, tell JVM from where to find native libraries. You can do it by selecting run from the menus and then selecting “Arguments” tab and then adding the following (fix pathes) to VM arguments: box:
-Djava.library.path=“D:\eclipse\workspace\xith3d\third-party\jogl\jogl-win32;”
This makes sure that you use always the same jogl that Xith3d revision is meant to be using. Add lwjgl libraries also there if you need them.

Information for linux users,
Currently Xith does not contain linux native libraries of lwjgl for some reason, I assume you can download them from here:
http://sourceforge.net/project/showfiles.php?group_id=58488
Download lwjgl-0.8-glibc2.3-linux.zip

Ant is a great tool, but not required (at least not currently) for building Xith3d, Eclipse handles everything nicely.

Hi
Install ant :), it’s easy, really, and it’s not a huge download, and like Jens said, it does everything for you :), I use it for my ac3d loader, and when the time comes, the distributions for my game will be compiled and packaged using it. It’s worth it, and far quicker than trying to debug your own make or gawk or whatever command :slight_smile:

Endolf

Ant is so much better suited to Java applications than ‘make’ or just shell commands IMHO - especially since most Windows boxes don’t have unix tools installed. Considering it’s only a meg and a half to download and is the only build tool supported by the Xith3D developers I’d say that’s your best at least for this project.

I don’t use Eclipse - but wouldn’t it have some sort of Ant integration/plugin/whatever?

Will.

[quote]I don’t use Eclipse - but wouldn’t it have some sort of Ant integration/plugin/whatever?
[/quote]
Yes, Eclipse has an Ant plugin.