Building JOGL in Eclipse

From JogampWiki
Revision as of 15:25, 10 January 2011 by Wwalker (talk | contribs) (Created page with '= 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-…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

  • File > New > Project...
  • Expand Java, click "Java Project", click "Next" button
  • Put "gluegen" in project name, click "Next" button
  • To "Remove all generated resources" dialog, click "Yes"
  • Click "Finish"
  • 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
  • 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 save paths and dismiss the Properties dialog
  • 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

   default dir: jogl/build/jogl/classes
   source                             native          output                      excluding
   ------                             ------          ------                      ---------
   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"
   JUnit4, JRE
   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
   - 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