imgui-java icon indicating copy to clipboard operation
imgui-java copied to clipboard

ARM64 native binaries for MacOS

Open zbx1425 opened this issue 2 years ago • 17 comments
trafficstars

Description

This PR attempts to finish #112 by merging it with the latest upstream updates and trying tofix the build scripts. Now the CI script can produce correct binary files. I have yet to test if these native binaries built actually works currently though.

Type of change

  • [x] Minor changes or tweaks (quality of life stuff)
  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [x] This change requires a documentation update

zbx1425 avatar Jul 14 '23 13:07 zbx1425

I don't think this has a problem. I built this repository and published it to my local maven repository. Then I run the example code on my test gradle project. It works with arm64 JVM. I tested it on M2 MacBook Air. image

kusaanko avatar Aug 18 '23 07:08 kusaanko

@SpaiR Hi, could you please merge this PR, It will be greatly appreciated, Much obliged, Maor.

manmaor avatar Sep 02 '23 07:09 manmaor

Excitedly waiting for this to be merged.

eclogues avatar Sep 04 '23 21:09 eclogues

Any update on this? Trying to use imgui on my m1

LawrenceB5477 avatar Oct 06 '23 23:10 LawrenceB5477

@SpaiR what's stopping this pr?

OlshaMB avatar Oct 14 '23 14:10 OlshaMB

@SpaiR I too would like to know what's stopping this PR

b7011343 avatar Oct 23 '23 16:10 b7011343

I think the branch needs to be merged with new changes, but apart from that i don't see any issues.

Not related to the pr I came to this pr because it prevents me from playing minecraft with [axiom](https://axiom.moulberry.com/), I had to provide the libs by path.
I think if the author won't merge someone should maintain the fork and release the mac m-series version, this fork should also have a guide for providing the forked version to a java program. At the moment, I am too busy.

OlshaMB avatar Oct 24 '23 21:10 OlshaMB

@zbx1425 Could you merge or give rights to @b7011343 or me to the fork, so we wouldn't have to make an another pr

OlshaMB avatar Oct 24 '23 21:10 OlshaMB

I think if the author won't merge someone should maintain the fork and release the mac m-series version, this fork should also have a guide for providing the forked version to a java program. At the moment, I am too busy.

I see there's workflows in the repo for releasing built bindings and natives to maven. But I'm new to gradle and maven, so I'd appreciate helps on getting it working on forked repository.

zbx1425 avatar Oct 25 '23 01:10 zbx1425

@zbx1425 i've forked your fork, merged changes from upstream and setup the workflows to publish to my maven repo: https://maven.realrobotix.me/#/imgui-java/io/github/spair https://github.com/realRobotix/imgui-java would be nice if someone could test the macos artifacts the build produced

realRobotix avatar Nov 10 '23 14:11 realRobotix

would be nice if someone could test the macos artifacts the build produced

Wow, this works! Thanks!!! @realRobotix. I'm on an M1 MacBook Pro running Sonoma.

bionicode avatar Nov 16 '23 14:11 bionicode

How do I use this dependency in a gradle project? I know i have to point it at the maven repo but I keep having build errors

b7011343 avatar Nov 20 '23 13:11 b7011343

How do I use this dependency in a gradle project? I know i have to point it at the maven repo but I keep having build errors

This worked for me.

project.ext.lwjglVersion = "3.3.3" project.ext.lwjglNatives = "natives-macos-arm64"

repositories {

maven {
    name "realrobotixImguiJava"
    url "https://maven.realrobotix.me/imgui-java"
}

mavenCentral()

}

dependencies {

// Imgui fork at real robotix
implementation "io.github.spair:imgui-java-app:1.86.11-10-g0dbf36c"
implementation "io.github.spair:imgui-java-natives-macos-ft:1.86.11-10-g0dbf36c"

// LWJGL
implementation platform("org.lwjgl:lwjgl-bom:$lwjglVersion")

implementation "org.lwjgl:lwjgl"
implementation "org.lwjgl:lwjgl-glfw"
implementation "org.lwjgl:lwjgl-opengl"
runtimeOnly "org.lwjgl:lwjgl::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-glfw::$lwjglNatives"
runtimeOnly "org.lwjgl:lwjgl-opengl::$lwjglNatives"

}

bionicode avatar Nov 20 '23 20:11 bionicode

I am getting build errors with the following build.gradle


repositories {
//    mavenLocal()

    maven {
        name "realrobotixImguiJava"
        url "https://maven.realrobotix.me/imgui-java"
    }

    mavenCentral()
}

project.ext.lwjglVersion = "3.3.3"
project.ext.jomlVersion = "1.10.5"
project.ext.imguiVersion = "1.82.2"

switch (OperatingSystem.current()) {
    case OperatingSystem.LINUX:
        def osArch = System.getProperty("os.arch")
        project.ext.lwjglNatives = osArch.startsWith("arm") || osArch.startsWith("aarch64")
                ? "natives-linux-${osArch.contains("64") || osArch.startsWith("armv8") ? "arm64" : "arm32"}"
                : "natives-linux"
        break
    case OperatingSystem.MAC_OS:
        project.ext.lwjglNatives = System.getProperty("os.arch").startsWith("aarch64") ? "natives-macos-arm64" : "natives-macos"
        break
    case OperatingSystem.WINDOWS:
        def osArch = System.getProperty("os.arch")
        project.ext.lwjglNatives = osArch.contains("64")
                ? "natives-windows${osArch.startsWith("aarch64") ? "-arm64" : ""}"
                : "natives-windows-x86"
        break
}

project.ext.lwjglNatives = "natives-macos-arm64"

dependencies {
    implementation platform("org.lwjgl:lwjgl-bom:$lwjglVersion")

    ['', '-opengl', '-glfw'].each {
        implementation "org.lwjgl:lwjgl$it:$lwjglVersion"
        implementation "org.lwjgl:lwjgl$it::natives-windows"
    }

    implementation "io.github.spair:imgui-java-binding:$imguiVersion"
    implementation "io.github.spair:imgui-java-lwjgl3:$imguiVersion"

    implementation "io.github.spair:imgui-java-natives-windows:$imguiVersion"
    implementation "io.github.spair:imgui-java-natives-windows-x86:$imguiVersion"
    implementation "io.github.spair:imgui-java-natives-linux:$imguiVersion"
    implementation "io.github.spair:imgui-java-natives-linux-x86:$imguiVersion"
//    implementation "io.github.spair:imgui-java-natives-macos:$imguiVersion"
    implementation "io.github.spair:imgui-java-natives-macos-ft:1.86.11-10-g0dbf36c"
    implementation "io.github.spair:imgui-java-app:1.86.11-10-g0dbf36c"
//    implementation "io.github.spair:imgui-java-natives-macos:1.86.11-10-g0dbf36c"
//    implementation "io.github.spair:imgui-java-natives-macosarm64"

    implementation "org.lwjgl:lwjgl"
    implementation "org.lwjgl:lwjgl-assimp"
    implementation "org.lwjgl:lwjgl-glfw"
    implementation "org.lwjgl:lwjgl-nfd"
    implementation "org.lwjgl:lwjgl-openal"
    implementation "org.lwjgl:lwjgl-opengl"
    implementation "org.lwjgl:lwjgl-stb"
    runtimeOnly "org.lwjgl:lwjgl::$lwjglNatives"
    runtimeOnly "org.lwjgl:lwjgl-assimp::$lwjglNatives"
    runtimeOnly "org.lwjgl:lwjgl-glfw::$lwjglNatives"
    runtimeOnly "org.lwjgl:lwjgl-nfd::$lwjglNatives"
    runtimeOnly "org.lwjgl:lwjgl-openal::$lwjglNatives"
    runtimeOnly "org.lwjgl:lwjgl-opengl::$lwjglNatives"
    runtimeOnly "org.lwjgl:lwjgl-stb::$lwjglNatives"
    implementation "org.joml:joml:${jomlVersion}"

Error


Exception in thread "main" java.lang.IllegalStateException: Failed to compile shader:
ERROR: 0:1: '' :  #version required and missing.
ERROR: 0:1: '330' : syntax error: syntax error

        at imgui.gl3.ImGuiImplGl3.createAndCompileShader(ImGuiImplGl3.java:463)
        at imgui.gl3.ImGuiImplGl3.createShaders(ImGuiImplGl3.java:313)
        at imgui.gl3.ImGuiImplGl3.createDeviceObjects(ImGuiImplGl3.java:272)
        at imgui.gl3.ImGuiImplGl3.init(ImGuiImplGl3.java:127)
        at jcw.jge2d.engine.gui.ImGuiLayer.initImGui(ImGuiLayer.java:233)
        at jcw.jge2d.engine.gui.Window.init(Window.java:187)
        at jcw.jge2d.engine.gui.Window.run(Window.java:117)
        at jcw.jge2d.Main.main(Main.java:9)

b7011343 avatar Nov 21 '23 22:11 b7011343

Would be nice if this was merged.

christopherweinhardt avatar Dec 18 '23 15:12 christopherweinhardt

Can this be merged?

Displee avatar May 06 '24 12:05 Displee

@SpaiR It would be great to get this (or #223 if that's better) merged and released (since the @realRobotix maven repo is not functional).

phraktle avatar Jul 04 '24 14:07 phraktle

@SpaiR It would be great to get this (or #223 if that's better) merged and released (since the @realRobotix maven repo is not functional).

sorry for the inconvenience, i have identified the issue with the maven it should be up again in a few minutes

realRobotix avatar Jul 04 '24 14:07 realRobotix

Closing in favor of #223 I'll mention this PR in changelog as well. Thanks for the contrib! 🙏

SpaiR avatar Aug 04 '24 21:08 SpaiR