Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows Support #28

Merged
merged 11 commits into from
Jan 2, 2023
Merged

Windows Support #28

merged 11 commits into from
Jan 2, 2023

Conversation

JFronny
Copy link
Contributor

@JFronny JFronny commented Jan 2, 2023

This PR adds the necessary bits to make creating cross-platform applications using java-gi easy, as is demonstrated here.
(Maybe that repo should be referenced in the README or cloned to your account for visibility?)

Changes to java-gi

  • To support the different names for natives on Windows, a class handling the loading of libraries is implemented in LibLoad (this name can, of course, be changed)
  • A manual CI task that builds GTK on GitHub actions and uploads the resulting binaries to a release titled natives is added.
    These natives can be used in applications instead of self-built ones
    In order to run it, select the task in the Actions tab on GitHub, click Run workflow, enter the GTK version to build and whether to add the binaries to the natives release, then run the workflow.
    It is never executed automatically.
  • The regression mentioned in Register types to fix casting #27 is fixed, allowing this to actually work

Features of javagi-multiplatform (the example project for these changes)

  • This example application is modular
  • An installer for Windows is built and contains the natives generated by the abovementioned tasks, so the user simply needs to install the application using it (and the msvc++ rt, though they likely already have that) for it to work
  • The generation of said installer (and linux packages) is automated through GitHub Actions
  • Theoretically, there's also a MacOS package, though that probably doesn't work (and I don't really want to figure out another platform)

@jwharm
Copy link
Owner

jwharm commented Jan 2, 2023

I don't have a Windows machine to test it on, so I did some regression testing and it works fine.
Very happy with the fix for modular applications too.

@jwharm jwharm merged commit 1f1a0d9 into main Jan 2, 2023
@jwharm
Copy link
Owner

jwharm commented Jan 2, 2023

Please be aware that you will need to account for the different sizeof(long) on Windows vs Linux. As it is, the generated memory layouts assume sizeof(long) == 64 so accessing struct fields on Windows will be problematic.

@JFronny JFronny deleted the windows-support branch January 2, 2023 19:51
@JFronny
Copy link
Contributor Author

JFronny commented Jan 2, 2023

I don't have a Windows machine to test it on

Setting up a quick Qemu VM should be enough for testing (that's what I do)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants