Hello Guest

[SOLVED] Building for windows/linux from macos and vicaversa

  • 2 Replies
  • 126 Views
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:
Code: [Select]
...
<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.
« Last Edit: August 22, 2018, 05:37:42 by mudlee »

*

Offline KaiHH

  • ***
  • 131
Re: Building for windows/linux from macos and vicaversa
« Reply #1 on: August 21, 2018, 19:10:06 »
It should work when you activate the profile using
Code: [Select]
-P by using
Code: [Select]
mvn -Plwjgl-natives-linux <lifecycle-phase> or
Code: [Select]
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.

Re: Building for windows/linux from macos and vicaversa
« Reply #2 on: August 22, 2018, 05:37:25 »
It worked, thx!