LWJGL / lwjgl3

LWJGL is a Java library that enables cross-platform access to popular native APIs useful in the development of graphics (OpenGL, Vulkan, bgfx), audio (OpenAL, Opus), parallel computing (OpenCL, CUDA) and XR (OpenVR, LibOVR, OpenXR) applications.
https://www.lwjgl.org
BSD 3-Clause "New" or "Revised" License
4.76k stars 636 forks source link

Port Eclipse project to the new directory layout #367

Open Spasi opened 6 years ago

Spasi commented 6 years ago

As of 00e1f52cf95c16b0cea34c83372145532b4745ba the LWJGL codebase has a new directory layout. This has broken the included Eclipse project.

upsonp commented 6 years ago

Glad I finally checked the issue tracker... I thought it was just me.

I've been playing around with it a bit to see if I can fix the build path issues, but I seem to be missing a libs/testng.jar, which I'm assuming is where the org.testing.* package is coming from and why most of the modules/lwjgl/core/src/test/java/ classes are broken.

The other thing that's showing up broken for me is the @Nullable annotation. I'm not sure where that's linked from. Eclipse is telling me to import the com.sun.istack.internal package, but something tells me that's not right and the annotation is defined in one of the other source folders that was refactored.

Lots of other missing and broken imports as well, it'll take me some time to track them all down. I tried to run the build.xml with ant from the root, but it craps out on me when it gets to building the config/linux/build.xml

unfortunately Ant and Gradle are foreign territory for me so I'm not sure how to debug them.

Spasi commented 6 years ago

You should first do a successful Ant build before attempting to setup the Eclipse project.

This will download all dependencies and build the project.

upsonp commented 6 years ago

ant compile-templates compile-tests completed successfully

ant test failed in the same place in the linux build as it did before. I think it might be related to the BUILD FAILED /home/pram/development/eclipse/lwjgl3/build.xml:442: The following error occurred while executing this line: /home/pram/development/eclipse/lwjgl3/config/linux/build.xml:197: The following error occurred while executing this line: /home/pram/development/eclipse/lwjgl3/config/linux/build.xml:201: exec returned: 1 The following error occurred while executing this line: /home/pram/development/eclipse/lwjgl3/config/linux/build.xml:83: The following error occurred while executing this line: /home/pram/development/eclipse/lwjgl3/config/linux/build.xml:33: apply returned: 1

I did get things working, but probably not in the way you'd like. I added a pom.xml file and used Maven to gather the missing libraries.

It mainly grabs the TestNG testing.jar file and points to the missing resource jars jsr305-3.0.5.jar (for the missing nullable, and a couple other, annotations.)

The one thing that gave me problems is the com.sun.javadoc.* package. I had to manually add the tools.jar from my /usr/lib/jvm/jdk1.8.0_121_64/lib/ directory. Apparently that's a common issue.

Spasi commented 6 years ago

ant test failed in the same place in the linux build as it did before.

Looks like you're missing libgtk-3-dev.

I did get things working, but probably not in the way you'd like. I added a pom.xml file and used Maven to gather the missing libraries.

If ant compile-templates compile-tests was successful, then you should already have the necessary libraries in bin/libs/java/.

The one thing that gave me problems is the com.sun.javadoc.* package. I had to manually add the tools.jar

Correct, this needs to be set up in the IDE project using tools.jar from the JDK. There's a related issue: #349

upsonp commented 6 years ago

I finally went back and cleaned up my linux system. (I really need to spend more time on keeping things up-to-date.)

I got libgtk-3-dev but when I run ant tests I still get an error

      [gcc] Linking lwjgl_opengl
      [g++] Linking lwjgl_tootle

BUILD FAILED
~/development/eclipse/lwjgl3/build.xml:442: The following error occurred while executing this line:
~/development/eclipse/lwjgl3/config/linux/build.xml:237: The following error occurred while executing this line:
~/development/eclipse/lwjgl3/config/linux/build.xml:83: The following error occurred while executing this line:
~/development/eclipse/lwjgl3/config/linux/build.xml:33: apply returned: 1

which seems to be this section of the config/linux/build.xml

        <sequential>
            <local name="cpp"/>
            <condition property="cpp"><not><equals arg1="@{lang}" arg2="c"/></not></condition>
            <local name="gcc"/>
            <condition property="gcc" value="gcc" else="g++"><equals arg1="@{lang}" arg2="c"/></condition>

            <mkdir dir="@{dest}"/>
This line--> <apply dir="@{dest}" executable="${gcc}" dest="@{dest}" skipemptyfilesets="true" failonerror="true" parallel="true" taskname="Compiler">
                <arg line="-c -std=c11" unless:set="cpp"/>
                <arg line="-c -std=c++11" if:set="cpp"/>
                <arg line="-m64" if:true="${build.arch.x64}"/>
                <arg line="-m32 -mfpmath=sse -msse -msse2" unless:true="${build.arch.x64}"/>
                <arg line="-O3 @{lto} -fPIC @{flags} -pthread -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -D_GNU_SOURCE -DNDEBUG -DLWJGL_LINUX -DLWJGL_${build.arch}"/>

                <arg value="-I${jni.headers}"/>
                <arg value="-I${jni.headers}/linux"/>

                <arg value="-I${module.lwjgl.rel}/core/src/main/c"/>
                <arg value="-I${module.lwjgl.rel}/core/src/main/c/${platform}"/>

                <arg value="-I${src.main.rel}" if:true="@{simple}"/>

                <source/>
                <fileset dir="." includes="${src.generated}/*.c" if:true="@{simple}"/>

                <regexpmapper from="(\w+)\.c(?:c|pp)?$" to="\1.o"/>
            </apply>
        </sequential>
Spasi commented 6 years ago

Looks like it's failing at remotery now (build.xml:237). Try installing xorg-dev.

For reference, here's how the official binaries are built.

upsonp commented 6 years ago

It wasn't xorg-dev, but that was helpful. I was on gcc and g++ 5, I updated to gcc and g++ 6 and it's compiling properly now.

demo/FiraSans.ttf is missing. I got a copy of fire-sans.regular.ttf here and renamed it and it worked fine. I could add that to the git repo.

also missing demo/Phero.ogg

Spasi commented 6 years ago

They are not missing. Assets are downloaded automatically when you run the demo target, to avoid bloating the repository. For example:

ant demo -Dclass=org.lwjgl.demo.stb.Vorbis

Ealrann commented 5 years ago

Which source folders should appear in Eclipse ? From the netbeans project file, I can see :

Anything else ?


I see that the core project contains 3 src/java folder:

These folder redefine some classes (e.g. CheckIntrinsics.java). I'm not sure if I can put all of them in the project.

Spasi commented 5 years ago

The simpler way to get a clear picture is to examine the IntelliJ project setup. It's not complicated, but it is verbose, every binding is a separate IntelliJ "module". See modules.xml to get a sense of the high level organization. Each module is configured as you would expect, with its own source/test/resource folders and its own class output path.

The modules/lwjgl/core/src/main/java10 for example belongs to the lwjgl.core10 module. It depends on lwjgl.core and lwjgl.core9 and is configured to be built with a JDK 10, while the rest of the project uses JDK 8 (and lwjgl.core9 uses JDK 9). This is necessary to support the multi-release JAR file functionality and works nicely in IntelliJ. I'm not sure how other IDEs handle it, but if no clean solution exists, you could simply ignore those folders.

kukel commented 3 years ago

Seriously? Like others before me, it took me ages. And like others I finally checked the issue tracker.

If no one wants to fix this, then at least remove eclipse AND maven from the documentation etc...

Very, very bad impression from this project.