Skip to content

Commit 39a8699

Browse files
committed
[Build] Drop 32bit support
1 parent b4df8d8 commit 39a8699

File tree

10 files changed

+56
-98
lines changed

10 files changed

+56
-98
lines changed

.github/workflows/ci-build.yml

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,34 +22,24 @@ jobs:
2222
strategy:
2323
matrix:
2424
os: [ubuntu-latest, macos-latest]
25-
type: [win32, win64, linux32, linux64, mac64]
25+
type: [win, linux, mac]
2626
include:
2727
- os: ubuntu-latest
28-
type: win32
29-
expected: imgui-binding/build/libsNative/windows32/imgui-java.dll
28+
type: win
29+
expected: /tmp/imgui/libsNative/windows64/imgui-java64.dll
3030
- os: ubuntu-latest
31-
type: win64
32-
expected: imgui-binding/build/libsNative/windows64/imgui-java64.dll
33-
- os: ubuntu-latest
34-
type: linux32
35-
expected: imgui-binding/build/libsNative/linux32/libimgui-java.so
36-
- os: ubuntu-latest
37-
type: linux64
38-
expected: imgui-binding/build/libsNative/linux64/libimgui-java64.so
31+
type: linux
32+
expected: /tmp/imgui/libsNative/linux64/libimgui-java64.so
3933
- os: macos-latest
40-
type: mac64
41-
expected: imgui-binding/build/libsNative/macosx64/libimgui-java64.dylib
34+
type: mac
35+
expected: /tmp/imgui/libsNative/macosx64/libimgui-java64.dylib
4236
exclude:
4337
- os: ubuntu-latest
44-
type: mac64
45-
- os: macos-latest
46-
type: win32
47-
- os: macos-latest
48-
type: win64
38+
type: mac
4939
- os: macos-latest
50-
type: linux32
40+
type: win
5141
- os: macos-latest
52-
type: linux64
42+
type: linux
5343
name: Build Natives [${{ matrix.os }}]-[${{ matrix.type }}]
5444
runs-on: ${{ matrix.os }}
5545
steps:
@@ -69,9 +59,8 @@ jobs:
6959
- name: Build [${{ matrix.type }}]
7060
uses: eskatos/gradle-command-action@v1
7161
with:
72-
arguments: :imgui-binding:generateLibs -Denvs=${{ matrix.type }} -Dlocal
62+
arguments: :imgui-binding:generateLibs -Denvs=${{ matrix.type }}
7363
- name: Check [${{ matrix.expected }}]
7464
uses: andstor/file-existence-action@v1
7565
with:
7666
files: ${{ matrix.expected }}
77-

README.md

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,11 @@ You can refer to [imgui-app](https://github.com/SpaiR/imgui-java/blob/v1.82.2/im
137137
For simplicity, example of dependencies for Gradle/Maven only shows how to add natives for Windows.
138138
Feel free to add other platforms.
139139

140-
| Native Binaries | System |
141-
| ------------------------------ | ------------- |
142-
| imgui-java-natives-windows-x86 | Windows 32bit |
143-
| imgui-java-natives-windows | Windows 64bit |
144-
| imgui-java-natives-linux-x86 | Linux 32bit |
145-
| imgui-java-natives-linux | Linux 64bit |
146-
| imgui-java-natives-macos | MacOS |
140+
| Native Binaries | System |
141+
| ------------------------------ | ------- |
142+
| imgui-java-natives-windows | Windows |
143+
| imgui-java-natives-linux | Linux |
144+
| imgui-java-natives-macos | MacOS |
147145

148146
Take a note, that you also need to add dependencies to [LWJGL](https://www.lwjgl.org/). Examples below shows how to do it as well.
149147

@@ -250,10 +248,8 @@ dependencies {
250248

251249
1. Go to the [release page](https://github.com/SpaiR/imgui-java/releases/latest);
252250
2. Download `imgui-binding-${version}.jar`, `imgui-lwjgl3-${version}.jar` and binary libraries for your OS;
253-
- imgui-java.dll - Windows 32bit
254-
- imgui-java64.dll - Windows 64bit
255-
- libimgui-java.so - Linux 32bit
256-
- libimgui-java64.so - Linux 64bit
251+
- imgui-java64.dll - Windows
252+
- libimgui-java64.so - Linux
257253
- libimgui-java64.dylib - MacOS
258254
3. Add jars to your classpath;
259255
4. Provide a VM option: `imgui.library.path` or `java.library.path`. It should point to the folder where you've placed downloaded native libraries.
@@ -285,13 +281,11 @@ Don't forget to make clear for your Linux/Mac users, that they will need to inst
285281
- Maven/Gradle:<br>
286282
Use the same native libraries as you would, but with `-ft` suffix in the end.
287283

288-
| Native Binaries With FreeType | System |
289-
| --------------------------------- | ------------- |
290-
| imgui-java-natives-windows-x86-ft | Windows 32bit |
291-
| imgui-java-natives-windows-ft | Windows 64bit |
292-
| imgui-java-natives-linux-x86-ft | Linux 32bit |
293-
| imgui-java-natives-linux-ft | Linux 64bit |
294-
| imgui-java-natives-macos-ft | MacOS |
284+
| Native Binaries With FreeType | System |
285+
| --------------------------------- | ------- |
286+
| imgui-java-natives-windows-ft | Windows |
287+
| imgui-java-natives-linux-ft | Linux |
288+
| imgui-java-natives-macos-ft | MacOS |
295289
<details>
296290
<summary><b>Modified Gradle Example</b></summary>
297291

@@ -339,20 +333,20 @@ Read [javadoc](https://javadoc.io/doc/io.github.spair/imgui-java-binding) and so
339333
* Java 8 or higher
340334
* Ant
341335
* 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)
342-
- Build with: `./gradlew :imgui-binding:generateLibs -Denvs=win64 -Dlocal`
336+
- Build with: `./gradlew :imgui-binding:generateLibs -Denvs=win -Dlocal`
343337
- Run with: `./gradlew :example:run -PlibPath="../imgui-binding/build/libsNative/windows64"`
344338
345339
### Linux
346340
- Install dependencies: `openjdk8`, `mingw-w64-gcc`, `ant`. (Package names could vary from system to system.)
347-
- Build with: `./gradlew :imgui-binding:generateLibs -Denvs=linux64 -Dlocal`
341+
- Build with: `./gradlew :imgui-binding:generateLibs -Denvs=linux -Dlocal`
348342
- Run with: `./gradlew :example:run -PlibPath=../imgui-binding/build/libsNative/linux64`
349343
350344
### MacOS
351345
- Check dependencies from "Linux" section and make sure you have them installed.
352-
- Build with: `./gradlew :imgui-binding:generateLibs -Denvs=mac64 -Dlocal`
346+
- Build with: `./gradlew :imgui-binding:generateLibs -Denvs=mac -Dlocal`
353347
- Run with: `./gradlew :example:run -PlibPath=../imgui-binding/build/libsNative/macosx64`
354348
355-
In `envs` parameter next values could be used `win32`, `win64`, `linux32`, `linux64` or `mac64`.<br>
349+
In `envs` parameter next values could be used `win`, `linux` or `mac`.<br>
356350
`-Dlocal` is optional and means that natives will be built under the `./imgui-binding/build/` folder. Otherwise `/tmp/imgui` folder will be used.
357351
On Windows always use local build.
358352

bin/README.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@ Folder contains libraries used by the binding.
33
Provide 'imgui.library.path' VM option to the folder with one of those file (ex: -Dimgui.library.path=./some/folder).
44
In the same way you can use 'java.library.path' option instead.
55

6-
By default binding expects 'imgui-java' ('imgui-java64' for x64 arch) file name.
6+
By default binding expects 'imgui-java64' file name.
77
You can change that by using 'imgui.library.name' VM option (ex: -Dimgui.library.name=custom-lib-name).
88

9-
- imgui-java.dll << Windows 32bit
10-
- imgui-java64.dll << Windows 64bit
11-
- libimgui-java.so << Linux 32bit
12-
- libimgui-java64.so << Linux 64bit
9+
- imgui-java64.dll << Windows
10+
- libimgui-java64.so << Linux
1311
- libimgui-java64.dylib << MacOS
1412

1513
Freetype folder contains same libraries, but with Freetype support.

bin/freetype/imgui-java.dll

-3.35 MB
Binary file not shown.

bin/freetype/libimgui-java.so

-1.79 MB
Binary file not shown.

bin/imgui-java.dll

-2.6 MB
Binary file not shown.

bin/libimgui-java.so

-1.82 MB
Binary file not shown.

buildSrc/src/main/groovy/imgui/generate/GenerateLibs.groovy

Lines changed: 19 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@ class GenerateLibs extends DefaultTask {
1515
String description = 'Generate imgui-java native binaries.'
1616

1717
private final String[] buildEnvs = System.getProperty('envs')?.split(',')
18-
private final boolean forWin32 = buildEnvs?.contains('win32')
19-
private final boolean forWin64 = buildEnvs?.contains('win64')
20-
private final boolean forLinux32 = buildEnvs?.contains('linux32')
21-
private final boolean forLinux64 = buildEnvs?.contains('linux64')
22-
private final boolean forMac64 = buildEnvs?.contains('mac64')
18+
private final boolean forWindows = buildEnvs?.contains('win')
19+
private final boolean forLinux = buildEnvs?.contains('linux')
20+
private final boolean forMac = buildEnvs?.contains('mac')
2321

2422
private final boolean isLocal = System.properties.containsKey("local")
2523
private final boolean withFreeType = System.properties.containsKey("freetype")
@@ -68,29 +66,19 @@ class GenerateLibs extends DefaultTask {
6866
def buildConfig = new BuildConfig('imgui-java', tmpFolder, libsFolder, jniDir)
6967
def buildTargets = [] as BuildTarget[]
7068

71-
if (forWin32) {
72-
def win32 = BuildTarget.newDefaultTarget(BuildTarget.TargetOs.Windows, false)
73-
addFreeTypeIfEnabled(win32)
74-
buildTargets += win32
75-
}
76-
if (forWin64) {
69+
if (forWindows) {
7770
def win64 = BuildTarget.newDefaultTarget(BuildTarget.TargetOs.Windows, true)
7871
addFreeTypeIfEnabled(win64)
7972
buildTargets += win64
8073
}
8174

82-
if (forLinux32) {
83-
def linux32 = BuildTarget.newDefaultTarget(BuildTarget.TargetOs.Linux, false)
84-
addFreeTypeIfEnabled(linux32)
85-
buildTargets += linux32
86-
}
87-
if (forLinux64) {
75+
if (forLinux) {
8876
def linux64 = BuildTarget.newDefaultTarget(BuildTarget.TargetOs.Linux, true)
8977
addFreeTypeIfEnabled(linux64)
9078
buildTargets += linux64
9179
}
9280

93-
if (forMac64) {
81+
if (forMac) {
9482
def minMacOsVersion = '10.15'
9583
def mac64 = BuildTarget.newDefaultTarget(BuildTarget.TargetOs.MacOsX, true)
9684
mac64.cppFlags += ' -std=c++14'
@@ -107,15 +95,11 @@ class GenerateLibs extends DefaultTask {
10795

10896
def commonParams = ['-v', '-Dhas-compiler=true', '-Drelease=true', 'clean', 'postcompile'] as String[]
10997

110-
if (forWin32)
111-
BuildExecutor.executeAnt(jniDir + '/build-windows32.xml', commonParams)
112-
if (forWin64)
98+
if (forWindows)
11399
BuildExecutor.executeAnt(jniDir + '/build-windows64.xml', commonParams)
114-
if (forLinux32)
115-
BuildExecutor.executeAnt(jniDir + '/build-linux32.xml', commonParams)
116-
if (forLinux64)
100+
if (forLinux)
117101
BuildExecutor.executeAnt(jniDir + '/build-linux64.xml', commonParams)
118-
if (forMac64)
102+
if (forMac)
119103
BuildExecutor.executeAnt(jniDir + '/build-macosx64.xml', commonParams)
120104

121105
BuildExecutor.executeAnt(jniDir + '/build.xml', '-v', 'pack-natives')
@@ -126,19 +110,19 @@ class GenerateLibs extends DefaultTask {
126110
return
127111
}
128112

129-
if (target.os == BuildTarget.TargetOs.Windows) {
130-
if (!target.is64Bit) {
131-
target.cppFlags += ' -fstack-protector'
132-
}
133-
target.libraries += '-lbz2 -lssp'
113+
switch (target.os) {
114+
case BuildTarget.TargetOs.Windows:
115+
target.cppFlags += ' -I/usr/x86_64-w64-mingw32/include/freetype2'
116+
break
117+
case BuildTarget.TargetOs.Linux:
118+
target.cppFlags += ' -I/usr/include/freetype2'
119+
break
120+
case BuildTarget.TargetOs.MacOsX:
121+
target.cppFlags += ' -I/usr/local/include/freetype2'
122+
break
134123
}
135124

136-
target.cppFlags += ' -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include'
137125
target.libraries += ' -lfreetype'
138-
139-
if (target.os == BuildTarget.TargetOs.MacOsX) {
140-
target.cppFlags.replace('-I/usr/include/', '-I/usr/local/include/')
141-
}
142126
}
143127

144128
void enableDefine(String define) {

imgui-binding-natives/build.gradle

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,19 @@ plugins {
55
}
66

77
def packageName = 'imgui-java-natives-linux'
8-
def packageDesc = 'Native binaries for imgui-java binding for 64bit Linux'
8+
def packageDesc = 'Native binaries for imgui-java binding for Linux'
99
def fromDir = '../bin'
1010
def libName = 'libimgui-java64.so'
1111

12-
if (System.getProperty('deployWin32')) {
13-
packageName = 'imgui-java-natives-windows-x86'
14-
packageDesc = 'Native binaries for imgui-java binding for 32bit Windows'
15-
libName = 'imgui-java.dll'
16-
} else if (System.getProperty('deployWin64')) {
12+
if (System.getProperty('deployWin')) {
1713
packageName = 'imgui-java-natives-windows'
18-
packageDesc = 'Native binaries for imgui-java binding for 64bit Windows'
14+
packageDesc = 'Native binaries for imgui-java binding for Windows'
1915
libName = 'imgui-java64.dll'
20-
} else if (System.getProperty('deployLinux32')) {
21-
packageName = 'imgui-java-natives-linux-x86'
22-
packageDesc = 'Native binaries for imgui-java binding for 32bit Linux'
23-
libName = 'libimgui-java.so'
24-
} else if (System.getProperty('deployLinux64')) {
16+
} else if (System.getProperty('deployLinux')) {
2517
packageName = 'imgui-java-natives-linux'
26-
packageDesc = 'Native binaries for imgui-java binding for 64bit Linux'
18+
packageDesc = 'Native binaries for imgui-java binding for Linux'
2719
libName = 'libimgui-java64.so'
28-
} else if (System.getProperty('deployMacOs64')) {
20+
} else if (System.getProperty('deployMac')) {
2921
packageName = 'imgui-java-natives-macos'
3022
packageDesc = 'Native binaries for imgui-java binding for MacOS'
3123
libName = 'libimgui-java64.dylib'

imgui-binding/src/main/java/imgui/ImGui.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ private static String tryLoadFromClasspath(final String fullLibName) {
107107

108108
final Path libBin = tmpDir.resolve(fullLibName);
109109
Files.copy(is, libBin, StandardCopyOption.REPLACE_EXISTING);
110+
libBin.toFile().deleteOnExit();
110111

111112
return libBin.toFile().getAbsolutePath();
112113
} catch (IOException e) {

0 commit comments

Comments
 (0)