UPDATE: I just found this topic: http://forum.lwjgl.org/index.php?topic=6647.0
I think this is the answer, but let's wait for a confirm.
Hi.
I refactored my app to be able to use java9 modules and I also successfully created a build pipeline with jlink, so now I have a standalone app from my game, which is good. However, I could not figure out, how can I build for windows/linux on osx, or vica-versa.
I handle dependencies with maven this way:
...
<dependencies>
...
<dependency>
<groupId>org.lwjgl</groupId>
<artifactId>lwjgl</artifactId>
<version>${lwjgl.version}</version>
</dependency>
<dependency>
<groupId>org.lwjgl</groupId>
<artifactId>lwjgl-glfw</artifactId>
<version>${lwjgl.version}</version>
</dependency>
<dependency>
<groupId>org.lwjgl</groupId>
<artifactId>lwjgl-nanovg</artifactId>
<version>${lwjgl.version}</version>
</dependency>
<dependency>
<groupId>org.lwjgl</groupId>
<artifactId>lwjgl-opengl</artifactId>
<version>${lwjgl.version}</version>
</dependency>
<dependency>
<groupId>org.lwjgl</groupId>
<artifactId>lwjgl-stb</artifactId>
<version>${lwjgl.version}</version>
</dependency>
<dependency>
<groupId>org.lwjgl</groupId>
<artifactId>lwjgl</artifactId>
<version>${lwjgl.version}</version>
<classifier>${lwjgl.natives}</classifier>
</dependency>
<dependency>
<groupId>org.lwjgl</groupId>
<artifactId>lwjgl-glfw</artifactId>
<version>${lwjgl.version}</version>
<classifier>${lwjgl.natives}</classifier>
</dependency>
<dependency>
<groupId>org.lwjgl</groupId>
<artifactId>lwjgl-nanovg</artifactId>
<version>${lwjgl.version}</version>
<classifier>${lwjgl.natives}</classifier>
</dependency>
<dependency>
<groupId>org.lwjgl</groupId>
<artifactId>lwjgl-opengl</artifactId>
<version>${lwjgl.version}</version>
<classifier>${lwjgl.natives}</classifier>
</dependency>
<dependency>
<groupId>org.lwjgl</groupId>
<artifactId>lwjgl-stb</artifactId>
<version>${lwjgl.version}</version>
<classifier>${lwjgl.natives}</classifier>
</dependency>
<dependency>
<groupId>org.lwjgl</groupId>
<artifactId>lwjgl-openal</artifactId>
<version>${lwjgl.version}</version>
<classifier>${lwjgl.natives}</classifier>
</dependency>
<dependency>
<groupId>org.lwjgl</groupId>
<artifactId>lwjgl-assimp</artifactId>
<version>${lwjgl.version}</version>
</dependency>
<dependency>
<groupId>org.lwjgl</groupId>
<artifactId>lwjgl-assimp</artifactId>
<version>${lwjgl.version}</version>
<classifier>${lwjgl.natives}</classifier>
</dependency>
....
</dependencies>
<profiles>
<profile>
<id>lwjgl-natives-linux</id>
<activation>
<os>
<family>unix</family>
</os>
</activation>
<properties>
<lwjgl.natives>natives-linux</lwjgl.natives>
</properties>
</profile>
<profile>
<id>lwjgl-natives-macos</id>
<activation>
<os>
<family>mac</family>
</os>
</activation>
<properties>
<lwjgl.natives>natives-macos</lwjgl.natives>
</properties>
</profile>
<profile>
<id>lwjgl-natives-windows</id>
<activation>
<os>
<family>windows</family>
</os>
</activation>
<properties>
<lwjgl.natives>natives-windows</lwjgl.natives>
</properties>
</profile>
</profiles>
No matter what I turn on/off in Intellij Idea at the profiles tab, it always builds packages the same way. See the attached image.
It should work when you activate the profile using -P
by using mvn -Plwjgl-natives-linux <lifecycle-phase>
or mvn -Plwjgl-natives-windows <lifecycle-phase>
.
This project ( https://github.com/LWJGL/lwjgl3-demos/blob/master/pom.xml ) uses the same os profile activation and the natives (i.e. the active profile) can be overwritten using the -P mvn switch.
It worked, thx!
Didn't want to open a new topic, I got this on windows:
[ERROR] Failed to execute goal on project engine: Could not resolve dependencies for project xy:jar:1.0-SNAPSHOT: Could not find artifact org.lwjgl:lwjgl-vulkan:jar:natives-windows:3.2.1-20181014.235349-6 in sonatype-snapshots (https://oss.sonatype.org/content/repositories/snapshots) -> [Help 1]
Command was:
mvn -Plwjgl-natives-windows compile
Tried to run on windows and on osx, same error. Compilation for linux and macos works fine.
OK, one more:
java.lang.IllegalAccessError: class org.lwjgl.vulkan.VkApplicationInfo (in module org.lwjgl.vulkan) cannot access class sun.misc.Unsafe (in module jdk.unsupported) because module org.lwjgl.vulkan does not read module jdk.unsupported
First error: the Vulkan bindings do not have a natives artifact.
Second error: This is a problem with the latest 3.2.1 snapshot, I'll try to find a solution soon.
Thanks!
Regarding to the first error: after mvn clean, it happened for all platforms, and then I added the required natives and then the I got the second. Sometimes maven and/or intellij do really weird caches...
The second error should be fixed in 3.2.1 snapshot 6.
The module visibility error gone, thx. However I have the same problem now with the natives:
[ERROR] Failed to execute goal on project engine: Could not resolve dependencies for project xy:jar:1.0-SNAPSHOT: Could not find artifact org.lwjgl:lwjgl-vulkan:jar:natives-windows:3.2.1-SNAPSHOT in sonatype-snapshots (https://oss.sonatype.org/content/repositories/snapshots) -> [Help 1]
OSX/Linux works fine.
As I said above, there is no natives artifact for Vulkan on Windows/Linux. It's only necessary on macOS for the MoltenVK shared library.
Ah, my bad, sorry!
A question tough. Would it be a good way if I ask the user during the installation process to install vulkan too? As on osx it will be automatic with moltenvk, on win/linux I have to rely on the os's sdk, right?
You do not need the Vulkan SDK to use Vulkan. On Windows & Linux, it's enough to have a GPU driver with Vulkan support installed. On macOS, MoltenVK simply requires an OS version that supports Metal (i.e. macOS 10.11 or higher).
Quote from: spasi on October 15, 2018, 18:55:40
First error: the Vulkan bindings do not have a natives artifact.
Second error: This is a problem with the latest 3.2.1 snapshot, I'll try to find a solution soon.
Your First error has not been wholly solved yet.
I download the pom.xml from here : https://www.lwjgl.org/customize
And it still contains this:
<dependency>
<groupId>org.lwjgl</groupId>
<artifactId>lwjgl-vulkan</artifactId>
<version>${lwjgl.version}</version>
<classifier>${lwjgl.natives}</classifier>
</dependency>
If I not happened to see the forum here I might never found out what goes wrong.
I strongly suggest you fix it when you have some spare time.