Skip to content

Commit da17675

Browse files
committed
[Build] Update native libraries build instruction
1 parent 4977e38 commit da17675

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

README.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -256,14 +256,28 @@ Dear ImGui by default uses a stb_strutype library to render a fonts atlas. It's
256256
Just keep in mind that you are able to do advanced stuff with it like: save pointers to the structs to modify them later.
257257
* Read [javadoc](https://javadoc.io/doc/io.imgui.java/binding) and sources comments to get more info.
258258

259-
## How to Build
260-
To build native libraries you need:
261-
- Unix-like system (MacOS to build natives for Mac)
262-
- Installed dependencies: `mingw-w64`, `ant`, `freetype2`
263-
264-
After you've configured everything, run `gradlew :imgui-binding:generateLibs -Denvs=${envShortcut} -Dlocal`.<br>
265-
`envShortcut` could be `win32`, `win64`, `linux32`, `linux64` or `mac64`.<br>
259+
## How to Build Native Libraries
260+
Using Windows:
261+
- Make sure you have installed and **available in PATH**:
262+
* Java 8 or higher
263+
* Ant
264+
* 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)
265+
- Build with command: `gradlew :imgui-binding:generateLibs -Denvs=win64 -Dlocal`
266+
- Then run example with built library: `gradlew :imgui-lwjgl3:startExample -DlibPath=../imgui-binding/build/libsNative/windows64`
267+
268+
Using Linux:
269+
- Install dependencies: `openjdk8`, `mingw-w64-gcc`, `ant`. Packages name could vary from system to system.
270+
- Build with command: `./gradlew :imgui-binding:generateLibs -Denvs=linux64 -Dlocal`
271+
- Then run example with built library: `./gradlew :imgui-lwjgl3:startExample -DlibPath=../imgui-binding/build/libsNative/linux64`
272+
273+
Using MacOS:
274+
- Check dependencies from "Using Linux" paragraph and make sure you have them installed.
275+
- Build with command: `./gradlew :imgui-binding:generateLibs -Denvs=mac64 -Dlocal`
276+
- Then run example with built library: `./gradlew :imgui-lwjgl3:startExample -DlibPath=../imgui-binding/build/libsNative/macosx64`
277+
278+
In `envs` parameter next values could be used `win32`, `win64`, `linux32`, `linux64` or `mac64`.<br>
266279
`-Dlocal` is optional and means that natives will be built under the `./imgui-binding/build/` folder. Otherwise `/tmp/imgui` folder will be used.
280+
On Windows OS always use local build.
267281

268282
## Credits
269283
Binding partly based on the work of [xpenatan](https://github.com/xpenatan) and his version [jDear-imgui](https://github.com/xpenatan/jDear-imgui).

imgui-lwjgl3/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ dependencies {
3838
task startExample(type: JavaExec, dependsOn: build) {
3939
main = 'ImGuiGlfwExample'
4040
classpath = sourceSets.test.runtimeClasspath
41-
jvmArgs = ['-Djava.library.path=../bin']
41+
jvmArgs = ["-Djava.library.path=${System.getProperty('libPath', '../bin')}"]
4242

4343
if (OperatingSystem.current().isMacOsX()) {
4444
jvmArgs += ['-XstartOnFirstThread', '-Djava.awt.headless=true']

0 commit comments

Comments
 (0)