Difference between revisions of "Building JOGL in Eclipse"

From JogampWiki
Jump to navigation Jump to search
Line 28: Line 28:
 
** Click "Finish"
 
** Click "Finish"
  
* Set up source directories and libraries
+
* Set up source directories
 
** Right-click "gluegen" project, select "Properties"
 
** Right-click "gluegen" project, select "Properties"
 
** Select "Java Build Path", click "Source" tab
 
** Select "Java Build Path", click "Source" tab
Line 35: Line 35:
 
** Set output folder, excluded pattern, and native library location to these. Remove any not in this list.
 
** Set output folder, excluded pattern, and native library location to these. Remove any not in this list.
  
    source                           native             output                   excluding
+
{| border="1"
    ------                          ------            -------                  --
+
! source
    build/gensrc/java               gluegen/build/obj build/classes
+
! native
    build/test/build/gensrc/classes gluegen/build/obj build/test/build/classes
+
! output
    src/java                         gluegen/build/obj build/classes             com/jogamp/gluegen/runtime/BufferFactoryInternal.java
+
! excluding
    src/junit                       gluegen/build/obj build/test/build/classes
+
|-
    test/junit                       gluegen/build/obj build/test/build/classes com/jogamp/gluegen/StructValidator.java
+
| build/gensrc/java
 +
| gluegen/build/obj
 +
| build/classes
 +
|
 +
|-
 +
| build/test/build/gensrc/classes
 +
| gluegen/build/obj
 +
| build/test/build/classes
 +
|
 +
|-
 +
| src/java
 +
| gluegen/build/obj
 +
| build/classes
 +
| com/jogamp/gluegen/runtime/BufferFactoryInternal.java
 +
|-
 +
| src/junit
 +
| gluegen/build/obj
 +
| build/test/build/classes
 +
|
 +
|-
 +
| test/junit
 +
| gluegen/build/obj
 +
| build/test/build/classes
 +
| com/jogamp/gluegen/StructValidator.java
 +
|}
  
 +
* Set up libraries
 
** Click Libraries tab
 
** Click Libraries tab
 
** Remove all JARs except gluegen/make/lib/antlr.jar
 
** Remove all JARs except gluegen/make/lib/antlr.jar
Line 48: Line 73:
 
** Click "Add External JARs...", select ant.jar from your Ant installation's lib dir, click "Open"
 
** Click "Add External JARs...", select ant.jar from your Ant installation's lib dir, click "Open"
 
** Click "Add External JARs...", select tools.jar from your JDK installation's lib dir, click "Open"
 
** Click "Add External JARs...", select tools.jar from your JDK installation's lib dir, click "Open"
** Click "OK" to save paths and dismiss the Properties dialog
+
** Click "OK" to dismiss the Properties dialog
  
 
* Set up the Ant builder
 
* Set up the Ant builder
Line 66: Line 91:
 
= Create jogl project =
 
= Create jogl project =
  
    default dir: jogl/build/jogl/classes
+
To create the jogl project, we do exactly what we did to create the gluegen project, but with different names and paths substituted.
  
    source                            native          output                      excluding
+
* Create new project
    ------                            ------          ------                      ---------
+
** Same, but use "jogl" for the new project name
    build/jogl/gensrc/classes          jogl/build/lib  build/jogl/classes
 
    build/nativewindow/gensrc/classes  jogl/build/lib  build/nativewindow/classes
 
    src/jogl/classes                  jogl/build/lib  build/jogl/classes          com/jogamp/audio/windows/waveout/TestSpatialization.java, com/jogamp/opengl/impl/gl2/fixme/**
 
    src/nativewindow/classes          jogl/build/lib  build/nativewindow/classes
 
    src/newt/classes                  jogl/build/lib  build/newt/classes
 
    src/test                          jogl/build/lib  build/test/build/classes
 
  
    - Click "Projects" tab, click "Add...", check "gluegen", click "OK"
+
* Set up source directories
    JUnit4, JRE
+
** Same, but use the default source directory jogl/build/jogl/classes, and set the source paths up as shown in this table.
    C:/Documents and Settings/wwalker/My Documents/apache-ant-1.8.2/lib/ant-junit.jar
 
    C:/Documents and Settings/wwalker/My Documents/apache-ant-1.8.2/lib/ant.jar
 
    - jogl builder, ${workspace_loc:/jogl/make/build.xml}, ${workspace_loc:/jogl/make}
 
  
  - Build
+
{| border="1"
    - Select Project > Clean, click "Clean all projects" and click "OK"
+
! source
 +
! native
 +
! output
 +
! excluding
 +
|-
 +
| build/jogl/gensrc/classes
 +
| jogl/build/lib
 +
| build/jogl/classes
 +
| none
 +
|-
 +
| build/nativewindow/gensrc/classes
 +
| jogl/build/lib
 +
| build/nativewindow/classes
 +
| none
 +
|-
 +
| src/jogl/classes
 +
| jogl/build/lib
 +
| build/jogl/classes
 +
| com/jogamp/audio/windows/waveout/TestSpatialization.java, com/jogamp/opengl/impl/gl2/fixme/**
 +
|-
 +
| src/nativewindow/classes
 +
| jogl/build/lib
 +
| build/nativewindow/classes
 +
| none
 +
|-
 +
| src/newt/classes
 +
| jogl/build/lib
 +
| build/newt/classes
 +
| none
 +
|-
 +
| src/test
 +
| jogl/build/lib
 +
| build/test/build/classes
 +
| none
 +
|}
 +
 
 +
* Set up project dependency
 +
** Click "Projects" tab, click "Add...", check "gluegen", click "OK"
 +
 
 +
* Set up libraries
 +
** Click Libraries tab
 +
** Remove all JARs except gluegen/make/lib/antlr.jar
 +
** Click "Add Library...", select "JUnit", click "Next", select "JUnit 4", click "Finish"
 +
** Click "Add External JARs...", select ant.jar from your Ant installation's lib dir, click "Open"
 +
** Click "Add External JARs...", select ant-junit.jar from your Ant installation's lib dir, click "Open"
 +
** Click "OK" to dismiss the Properties dialog
 +
 
 +
* Set up the Ant builder
 +
** Just like last time, except set the buildfile to ${workspace_loc:/gluegen/make/build.xml} and set the base directory to ${workspace_loc:/gluegen/make}
 +
 
 +
* Building
 +
 
 +
To build gluegen and jogl, select "Project > Clean", click "Clean all projects" and click "OK"
  
 
= Install EGit in Eclipse =
 
= Install EGit in Eclipse =

Revision as of 16:49, 10 January 2011

Why build in Eclipse?

Building JOGL inside Eclipse lets you use the Eclipse debugger, profiler, and unit test framework. It also gives you useful editing features like auto-complete and red underlines for syntax errors.

Prerequisites

Before you can build it in Eclipse, you'll need to have JOGL building from the command line.

Overview

To build JOGL in Eclipse, we'll create Eclipse projects for the gluegen and jogl projects, then add Ant builders to those projects to invoke the JOGL command-line Ant build.

Update Eclipse's Ant installation

Ant comes bundled in Eclipse, but to build JOGL we need Ant 1.8 or later, and Eclipse 3.6 still uses Ant 1.7. So we'll tell Eclipse to point at your local Ant installation.

  • On "Classpath" tab, click Window > Preferences, select Ant > Runtime, click "Ant Home..." button, select your Ant home dir and click "Open"
  • Click "Properties" tab, click "Add Property...", set name to java.home, set value to JDK jre dir
  • Click "OK" to exit Preferences dialog

Create gluegen project

  • Create new project
    • Select "File > New > Project..."
    • Expand "Java", click "Java Project", click the "Next" button
    • Put "gluegen" in project name, click the "Next" button
    • To "Remove all generated resources" dialog, click "Yes"
    • Click "Finish"
  • Set up source directories
    • Right-click "gluegen" project, select "Properties"
    • Select "Java Build Path", click "Source" tab
    • Click "Allow output folders for source folders"
    • Set default output folder to "gluegen\build\classes"
    • Set output folder, excluded pattern, and native library location to these. Remove any not in this list.
source native output excluding
build/gensrc/java gluegen/build/obj build/classes
build/test/build/gensrc/classes gluegen/build/obj build/test/build/classes
src/java gluegen/build/obj build/classes com/jogamp/gluegen/runtime/BufferFactoryInternal.java
src/junit gluegen/build/obj build/test/build/classes
test/junit gluegen/build/obj build/test/build/classes com/jogamp/gluegen/StructValidator.java
  • Set up libraries
    • Click Libraries tab
    • Remove all JARs except gluegen/make/lib/antlr.jar
    • Click "Add Library...", select "JUnit", click "Next", select "JUnit 4", click "Finish"
    • Click "Add External JARs...", select ant.jar from your Ant installation's lib dir, click "Open"
    • Click "Add External JARs...", select tools.jar from your JDK installation's lib dir, click "Open"
    • Click "OK" to dismiss the Properties dialog
  • Set up the Ant builder
    • Right-click "gluegen" project, select "Properties"
    • Click "Builders" tab on left
    • Click "New...", select "Ant Builder", and click "OK"
    • Type "gluegen builder" as the name
    • Set buildfile to ${workspace_loc:/gluegen/make/build.xml}
    • Set base directory to ${workspace_loc:/gluegen/make}
    • Click Refresh tab, check "Refresh resources upon completion", click "The project containing the selected resource"
    • Click Targets tab, click "Set Targets..." button to the right of "During a "Clean""
    • Uncheck "all", check "clean", click "OK"
    • Click "OK" to dismiss Edit Configuration dialog
    • Select "gluegen builder" and click the "Up" button
    • Click "OK" to save and dismiss the Properties dialog

Create jogl project

To create the jogl project, we do exactly what we did to create the gluegen project, but with different names and paths substituted.

  • Create new project
    • Same, but use "jogl" for the new project name
  • Set up source directories
    • Same, but use the default source directory jogl/build/jogl/classes, and set the source paths up as shown in this table.
source native output excluding
build/jogl/gensrc/classes jogl/build/lib build/jogl/classes none
build/nativewindow/gensrc/classes jogl/build/lib build/nativewindow/classes none
src/jogl/classes jogl/build/lib build/jogl/classes com/jogamp/audio/windows/waveout/TestSpatialization.java, com/jogamp/opengl/impl/gl2/fixme/**
src/nativewindow/classes jogl/build/lib build/nativewindow/classes none
src/newt/classes jogl/build/lib build/newt/classes none
src/test jogl/build/lib build/test/build/classes none
  • Set up project dependency
    • Click "Projects" tab, click "Add...", check "gluegen", click "OK"
  • Set up libraries
    • Click Libraries tab
    • Remove all JARs except gluegen/make/lib/antlr.jar
    • Click "Add Library...", select "JUnit", click "Next", select "JUnit 4", click "Finish"
    • Click "Add External JARs...", select ant.jar from your Ant installation's lib dir, click "Open"
    • Click "Add External JARs...", select ant-junit.jar from your Ant installation's lib dir, click "Open"
    • Click "OK" to dismiss the Properties dialog
  • Set up the Ant builder
    • Just like last time, except set the buildfile to ${workspace_loc:/gluegen/make/build.xml} and set the base directory to ${workspace_loc:/gluegen/make}
  • Building

To build gluegen and jogl, select "Project > Clean", click "Clean all projects" and click "OK"

Install EGit in Eclipse

Finally, install EGit in Eclipse so you can perform Git source control operations from inside Eclipse.

Associate Eclipse projects with git

  • Right-click "gluegen", select "Team > Share Project...", select "Git", click "Next", select the .git repository, click "Finish"
  • Do the same thing for the "jogl" project