Difference between revisions of "Building JOGL in Eclipse"

From JogampWiki
Jump to navigation Jump to search
(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-…')
 
Line 21: Line 21:
 
= Create gluegen project =
 
= Create gluegen project =
  
* File > New > Project...
+
* Create new project
* Expand Java, click "Java Project", click "Next" button
+
** Select "File > New > Project..."
* Put "gluegen" in project name, click "Next" button
+
** Expand "Java", click "Java Project", click the "Next" button
* To "Remove all generated resources" dialog, click "Yes"
+
** Put "gluegen" in project name, click the "Next" button
* Click "Finish"
+
** To "Remove all generated resources" dialog, click "Yes"
* Right-click "gluegen" project, select "Properties"
+
** Click "Finish"
* Select "Java Build Path", click "Source" tab
+
 
* Click "Allow output folders for source folders"
+
* Set up source directories and libraries
* Set default output folder to "gluegen\build\classes"
+
** Right-click "gluegen" project, select "Properties"
* Set output folder, excluded pattern, and native library location to these. Remove any not in this list.
+
** 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
 
     source                          native            output                    excluding
Line 40: Line 43:
 
     test/junit                      gluegen/build/obj  build/test/build/classes  com/jogamp/gluegen/StructValidator.java
 
     test/junit                      gluegen/build/obj  build/test/build/classes  com/jogamp/gluegen/StructValidator.java
  
* Click Libraries tab
+
** Click Libraries tab
* Remove all JARs except gluegen/make/lib/antlr.jar
+
** Remove all JARs except gluegen/make/lib/antlr.jar
* Click "Add Library...", select "JUnit", click "Next", select "JUnit 4", click "Finish"
+
** 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.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 save paths and dismiss the Properties dialog
  
* Right-click "gluegen" project, select "Properties"
+
* Set up the Ant builder
* Click "Builders" tab on left
+
** Right-click "gluegen" project, select "Properties"
* Click "New...", select "Ant Builder", and click "OK"
+
** Click "Builders" tab on left
* Type "gluegen builder" as the name
+
** Click "New...", select "Ant Builder", and click "OK"
* Set buildfile to ${workspace_loc:/gluegen/make/build.xml}
+
** Type "gluegen builder" as the name
* Set base directory to ${workspace_loc:/gluegen/make}
+
** Set buildfile to ${workspace_loc:/gluegen/make/build.xml}
* Click Refresh tab, check "Refresh resources upon completion", click "The project containing the selected resource"
+
** Set base directory to ${workspace_loc:/gluegen/make}
* Click Targets tab, click "Set Targets..." button to the right of "During a "Clean""
+
** Click Refresh tab, check "Refresh resources upon completion", click "The project containing the selected resource"
* Uncheck "all", check "clean", click "OK"
+
** Click Targets tab, click "Set Targets..." button to the right of "During a "Clean""
* Click "OK" to dismiss Edit Configuration dialog
+
** Uncheck "all", check "clean", click "OK"
* Select "gluegen builder" and click the "Up" button
+
** Click "OK" to dismiss Edit Configuration dialog
* Click "OK" to save and dismiss the Properties dialog
+
** Select "gluegen builder" and click the "Up" button
 +
** Click "OK" to save and dismiss the Properties dialog
  
 
= Create jogl project =
 
= Create jogl project =

Revision as of 16:31, 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 and libraries
    • 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
  • 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

   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