diff --git a/README.md b/README.md index 2ec9807..8b27cdf 100644 --- a/README.md +++ b/README.md @@ -256,14 +256,28 @@ Dear ImGui by default uses a stb_strutype library to render a fonts atlas. It's Just keep in mind that you are able to do advanced stuff with it like: save pointers to the structs to modify them later. * Read [javadoc](https://javadoc.io/doc/io.imgui.java/binding) and sources comments to get more info. -## How to Build -To build native libraries you need: - - Unix-like system (MacOS to build natives for Mac) - - Installed dependencies: `mingw-w64`, `ant`, `freetype2` +## How to Build Native Libraries +Using Windows: + - Make sure you have installed and **available in PATH**: + * Java 8 or higher + * Ant + * Mingw-w64 (recommended way: use [MSYS2](https://www.msys2.org/) and install [mingw-w64-x86_64-toolchain](https://packages.msys2.org/group/mingw-w64-x86_64-toolchain) group) + - Build with command: `gradlew :imgui-binding:generateLibs -Denvs=win64 -Dlocal` + - Then run example with built library: `gradlew :imgui-lwjgl3:startExample -DlibPath=../imgui-binding/build/libsNative/windows64` + +Using Linux: + - Install dependencies: `openjdk8`, `mingw-w64-gcc`, `ant`. Packages name could vary from system to system. + - Build with command: `./gradlew :imgui-binding:generateLibs -Denvs=linux64 -Dlocal` + - Then run example with built library: `./gradlew :imgui-lwjgl3:startExample -DlibPath=../imgui-binding/build/libsNative/linux64` + +Using MacOS: + - Check dependencies from "Using Linux" paragraph and make sure you have them installed. + - Build with command: `./gradlew :imgui-binding:generateLibs -Denvs=mac64 -Dlocal` + - Then run example with built library: `./gradlew :imgui-lwjgl3:startExample -DlibPath=../imgui-binding/build/libsNative/macosx64` -After you've configured everything, run `gradlew :imgui-binding:generateLibs -Denvs=${envShortcut} -Dlocal`.
-`envShortcut` could be `win32`, `win64`, `linux32`, `linux64` or `mac64`.
+In `envs` parameter next values could be used `win32`, `win64`, `linux32`, `linux64` or `mac64`.
`-Dlocal` is optional and means that natives will be built under the `./imgui-binding/build/` folder. Otherwise `/tmp/imgui` folder will be used. +On Windows OS always use local build. ## Credits Binding partly based on the work of [xpenatan](https://github.com/xpenatan) and his version [jDear-imgui](https://github.com/xpenatan/jDear-imgui). diff --git a/imgui-lwjgl3/build.gradle b/imgui-lwjgl3/build.gradle index 9d7abd6..c0e5d75 100644 --- a/imgui-lwjgl3/build.gradle +++ b/imgui-lwjgl3/build.gradle @@ -38,7 +38,7 @@ dependencies { task startExample(type: JavaExec, dependsOn: build) { main = 'ImGuiGlfwExample' classpath = sourceSets.test.runtimeClasspath - jvmArgs = ['-Djava.library.path=../bin'] + jvmArgs = ["-Djava.library.path=${System.getProperty('libPath', '../bin')}"] if (OperatingSystem.current().isMacOsX()) { jvmArgs += ['-XstartOnFirstThread', '-Djava.awt.headless=true']