[Build] Drop 32bit support

This commit is contained in:
SpaiR committed 2021-05-30 14:30:00 +03:00
1 parent b4df8d8611
commit 39a86991f2
10 files changed
+52 -94

No files matched your search

+11 -22
View File
@@ -22,34 +22,24 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest, macos-latest] os: [ubuntu-latest, macos-latest]
type: [win32, win64, linux32, linux64, mac64] type: [win, linux, mac]
include: include:
- os: ubuntu-latest - os: ubuntu-latest
type: win32 type: win
expected: imgui-binding/build/libsNative/windows32/imgui-java.dll expected: /tmp/imgui/libsNative/windows64/imgui-java64.dll
- os: ubuntu-latest - os: ubuntu-latest
type: win64 type: linux
expected: imgui-binding/build/libsNative/windows64/imgui-java64.dll expected: /tmp/imgui/libsNative/linux64/libimgui-java64.so
- os: ubuntu-latest
type: linux32
expected: imgui-binding/build/libsNative/linux32/libimgui-java.so
- os: ubuntu-latest
type: linux64
expected: imgui-binding/build/libsNative/linux64/libimgui-java64.so
- os: macos-latest - os: macos-latest
type: mac64 type: mac
expected: imgui-binding/build/libsNative/macosx64/libimgui-java64.dylib expected: /tmp/imgui/libsNative/macosx64/libimgui-java64.dylib
exclude: exclude:
- os: ubuntu-latest - os: ubuntu-latest
type: mac64 type: mac
- os: macos-latest - os: macos-latest
type: win32 type: win
- os: macos-latest - os: macos-latest
type: win64 type: linux
- os: macos-latest
type: linux32
- os: macos-latest
type: linux64
name: Build Natives [${{ matrix.os }}]-[${{ matrix.type }}] name: Build Natives [${{ matrix.os }}]-[${{ matrix.type }}]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
@@ -69,9 +59,8 @@ jobs:
- name: Build [${{ matrix.type }}] - name: Build [${{ matrix.type }}]
uses: eskatos/gradle-command-action@v1 uses: eskatos/gradle-command-action@v1
with: with:
arguments: :imgui-binding:generateLibs -Denvs=${{ matrix.type }} -Dlocal arguments: :imgui-binding:generateLibs -Denvs=${{ matrix.type }}
- name: Check [${{ matrix.expected }}] - name: Check [${{ matrix.expected }}]
uses: andstor/file-existence-action@v1 uses: andstor/file-existence-action@v1
with: with:
files: ${{ matrix.expected }} files: ${{ matrix.expected }}
+12 -18
View File
@@ -138,11 +138,9 @@ For simplicity, example of dependencies for Gradle/Maven only shows how to add n
Feel free to add other platforms. Feel free to add other platforms.
| Native Binaries | System | | Native Binaries | System |
| ------------------------------ | ------------- | | ------------------------------ | ------- |
| imgui-java-natives-windows-x86 | Windows 32bit | | imgui-java-natives-windows | Windows |
| imgui-java-natives-windows | Windows 64bit | | imgui-java-natives-linux | Linux |
| imgui-java-natives-linux-x86 | Linux 32bit |
| imgui-java-natives-linux | Linux 64bit |
| imgui-java-natives-macos | MacOS | | imgui-java-natives-macos | MacOS |
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. 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.
@@ -250,10 +248,8 @@ dependencies {
1. Go to the [release page](https://github.com/SpaiR/imgui-java/releases/latest); 1. Go to the [release page](https://github.com/SpaiR/imgui-java/releases/latest);
2. Download `imgui-binding-${version}.jar`, `imgui-lwjgl3-${version}.jar` and binary libraries for your OS; 2. Download `imgui-binding-${version}.jar`, `imgui-lwjgl3-${version}.jar` and binary libraries for your OS;
- imgui-java.dll - Windows 32bit - imgui-java64.dll - Windows
- imgui-java64.dll - Windows 64bit - libimgui-java64.so - Linux
- libimgui-java.so - Linux 32bit
- libimgui-java64.so - Linux 64bit
- libimgui-java64.dylib - MacOS - libimgui-java64.dylib - MacOS
3. Add jars to your classpath; 3. Add jars to your classpath;
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. 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.
@@ -286,11 +282,9 @@ Don't forget to make clear for your Linux/Mac users, that they will need to inst
Use the same native libraries as you would, but with `-ft` suffix in the end. Use the same native libraries as you would, but with `-ft` suffix in the end.
| Native Binaries With FreeType | System | | Native Binaries With FreeType | System |
| --------------------------------- | ------------- | | --------------------------------- | ------- |
| imgui-java-natives-windows-x86-ft | Windows 32bit | | imgui-java-natives-windows-ft | Windows |
| imgui-java-natives-windows-ft | Windows 64bit | | imgui-java-natives-linux-ft | Linux |
| imgui-java-natives-linux-x86-ft | Linux 32bit |
| imgui-java-natives-linux-ft | Linux 64bit |
| imgui-java-natives-macos-ft | MacOS | | imgui-java-natives-macos-ft | MacOS |
<details> <details>
<summary><b>Modified Gradle Example</b></summary> <summary><b>Modified Gradle Example</b></summary>
@@ -339,20 +333,20 @@ Read [javadoc](https://javadoc.io/doc/io.github.spair/imgui-java-binding) and so
* Java 8 or higher * Java 8 or higher
* Ant * 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) * 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: `./gradlew :imgui-binding:generateLibs -Denvs=win64 -Dlocal` - Build with: `./gradlew :imgui-binding:generateLibs -Denvs=win -Dlocal`
- Run with: `./gradlew :example:run -PlibPath="../imgui-binding/build/libsNative/windows64"` - Run with: `./gradlew :example:run -PlibPath="../imgui-binding/build/libsNative/windows64"`
### Linux ### Linux
- Install dependencies: `openjdk8`, `mingw-w64-gcc`, `ant`. (Package names could vary from system to system.) - Install dependencies: `openjdk8`, `mingw-w64-gcc`, `ant`. (Package names could vary from system to system.)
- Build with: `./gradlew :imgui-binding:generateLibs -Denvs=linux64 -Dlocal` - Build with: `./gradlew :imgui-binding:generateLibs -Denvs=linux -Dlocal`
- Run with: `./gradlew :example:run -PlibPath=../imgui-binding/build/libsNative/linux64` - Run with: `./gradlew :example:run -PlibPath=../imgui-binding/build/libsNative/linux64`
### MacOS ### MacOS
- Check dependencies from "Linux" section and make sure you have them installed. - Check dependencies from "Linux" section and make sure you have them installed.
- Build with: `./gradlew :imgui-binding:generateLibs -Denvs=mac64 -Dlocal` - Build with: `./gradlew :imgui-binding:generateLibs -Denvs=mac -Dlocal`
- Run with: `./gradlew :example:run -PlibPath=../imgui-binding/build/libsNative/macosx64` - Run with: `./gradlew :example:run -PlibPath=../imgui-binding/build/libsNative/macosx64`
In `envs` parameter next values could be used `win32`, `win64`, `linux32`, `linux64` or `mac64`.<br> In `envs` parameter next values could be used `win`, `linux` or `mac`.<br>
`-Dlocal` is optional and means that natives will be built under the `./imgui-binding/build/` folder. Otherwise `/tmp/imgui` folder will be used. `-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 always use local build. On Windows always use local build.
+3 -5
View File
@@ -3,13 +3,11 @@ Folder contains libraries used by the binding.
Provide 'imgui.library.path' VM option to the folder with one of those file (ex: -Dimgui.library.path=./some/folder). Provide 'imgui.library.path' VM option to the folder with one of those file (ex: -Dimgui.library.path=./some/folder).
In the same way you can use 'java.library.path' option instead. In the same way you can use 'java.library.path' option instead.
By default binding expects 'imgui-java' ('imgui-java64' for x64 arch) file name. By default binding expects 'imgui-java64' file name.
You can change that by using 'imgui.library.name' VM option (ex: -Dimgui.library.name=custom-lib-name). You can change that by using 'imgui.library.name' VM option (ex: -Dimgui.library.name=custom-lib-name).
- imgui-java.dll << Windows 32bit - imgui-java64.dll << Windows
- imgui-java64.dll << Windows 64bit - libimgui-java64.so << Linux
- libimgui-java.so << Linux 32bit
- libimgui-java64.so << Linux 64bit
- libimgui-java64.dylib << MacOS - libimgui-java64.dylib << MacOS
Freetype folder contains same libraries, but with Freetype support. Freetype folder contains same libraries, but with Freetype support.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -15,11 +15,9 @@ class GenerateLibs extends DefaultTask {
String description = 'Generate imgui-java native binaries.' String description = 'Generate imgui-java native binaries.'
private final String[] buildEnvs = System.getProperty('envs')?.split(',') private final String[] buildEnvs = System.getProperty('envs')?.split(',')
private final boolean forWin32 = buildEnvs?.contains('win32') private final boolean forWindows = buildEnvs?.contains('win')
private final boolean forWin64 = buildEnvs?.contains('win64') private final boolean forLinux = buildEnvs?.contains('linux')
private final boolean forLinux32 = buildEnvs?.contains('linux32') private final boolean forMac = buildEnvs?.contains('mac')
private final boolean forLinux64 = buildEnvs?.contains('linux64')
private final boolean forMac64 = buildEnvs?.contains('mac64')
private final boolean isLocal = System.properties.containsKey("local") private final boolean isLocal = System.properties.containsKey("local")
private final boolean withFreeType = System.properties.containsKey("freetype") private final boolean withFreeType = System.properties.containsKey("freetype")
@@ -68,29 +66,19 @@ class GenerateLibs extends DefaultTask {
def buildConfig = new BuildConfig('imgui-java', tmpFolder, libsFolder, jniDir) def buildConfig = new BuildConfig('imgui-java', tmpFolder, libsFolder, jniDir)
def buildTargets = [] as BuildTarget[] def buildTargets = [] as BuildTarget[]
if (forWin32) { if (forWindows) {
def win32 = BuildTarget.newDefaultTarget(BuildTarget.TargetOs.Windows, false)
addFreeTypeIfEnabled(win32)
buildTargets += win32
}
if (forWin64) {
def win64 = BuildTarget.newDefaultTarget(BuildTarget.TargetOs.Windows, true) def win64 = BuildTarget.newDefaultTarget(BuildTarget.TargetOs.Windows, true)
addFreeTypeIfEnabled(win64) addFreeTypeIfEnabled(win64)
buildTargets += win64 buildTargets += win64
} }
if (forLinux32) { if (forLinux) {
def linux32 = BuildTarget.newDefaultTarget(BuildTarget.TargetOs.Linux, false)
addFreeTypeIfEnabled(linux32)
buildTargets += linux32
}
if (forLinux64) {
def linux64 = BuildTarget.newDefaultTarget(BuildTarget.TargetOs.Linux, true) def linux64 = BuildTarget.newDefaultTarget(BuildTarget.TargetOs.Linux, true)
addFreeTypeIfEnabled(linux64) addFreeTypeIfEnabled(linux64)
buildTargets += linux64 buildTargets += linux64
} }
if (forMac64) { if (forMac) {
def minMacOsVersion = '10.15' def minMacOsVersion = '10.15'
def mac64 = BuildTarget.newDefaultTarget(BuildTarget.TargetOs.MacOsX, true) def mac64 = BuildTarget.newDefaultTarget(BuildTarget.TargetOs.MacOsX, true)
mac64.cppFlags += ' -std=c++14' mac64.cppFlags += ' -std=c++14'
@@ -107,15 +95,11 @@ class GenerateLibs extends DefaultTask {
def commonParams = ['-v', '-Dhas-compiler=true', '-Drelease=true', 'clean', 'postcompile'] as String[] def commonParams = ['-v', '-Dhas-compiler=true', '-Drelease=true', 'clean', 'postcompile'] as String[]
if (forWin32) if (forWindows)
BuildExecutor.executeAnt(jniDir + '/build-windows32.xml', commonParams)
if (forWin64)
BuildExecutor.executeAnt(jniDir + '/build-windows64.xml', commonParams) BuildExecutor.executeAnt(jniDir + '/build-windows64.xml', commonParams)
if (forLinux32) if (forLinux)
BuildExecutor.executeAnt(jniDir + '/build-linux32.xml', commonParams)
if (forLinux64)
BuildExecutor.executeAnt(jniDir + '/build-linux64.xml', commonParams) BuildExecutor.executeAnt(jniDir + '/build-linux64.xml', commonParams)
if (forMac64) if (forMac)
BuildExecutor.executeAnt(jniDir + '/build-macosx64.xml', commonParams) BuildExecutor.executeAnt(jniDir + '/build-macosx64.xml', commonParams)
BuildExecutor.executeAnt(jniDir + '/build.xml', '-v', 'pack-natives') BuildExecutor.executeAnt(jniDir + '/build.xml', '-v', 'pack-natives')
@@ -126,19 +110,19 @@ class GenerateLibs extends DefaultTask {
return return
} }
if (target.os == BuildTarget.TargetOs.Windows) { switch (target.os) {
if (!target.is64Bit) { case BuildTarget.TargetOs.Windows:
target.cppFlags += ' -fstack-protector' target.cppFlags += ' -I/usr/x86_64-w64-mingw32/include/freetype2'
} break
target.libraries += '-lbz2 -lssp' case BuildTarget.TargetOs.Linux:
target.cppFlags += ' -I/usr/include/freetype2'
break
case BuildTarget.TargetOs.MacOsX:
target.cppFlags += ' -I/usr/local/include/freetype2'
break
} }
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'
target.libraries += ' -lfreetype' target.libraries += ' -lfreetype'
if (target.os == BuildTarget.TargetOs.MacOsX) {
target.cppFlags.replace('-I/usr/include/', '-I/usr/local/include/')
}
} }
void enableDefine(String define) { void enableDefine(String define) {
+6 -14
View File
@@ -5,27 +5,19 @@ plugins {
} }
def packageName = 'imgui-java-natives-linux' def packageName = 'imgui-java-natives-linux'
def packageDesc = 'Native binaries for imgui-java binding for 64bit Linux' def packageDesc = 'Native binaries for imgui-java binding for Linux'
def fromDir = '../bin' def fromDir = '../bin'
def libName = 'libimgui-java64.so' def libName = 'libimgui-java64.so'
if (System.getProperty('deployWin32')) { if (System.getProperty('deployWin')) {
packageName = 'imgui-java-natives-windows-x86'
packageDesc = 'Native binaries for imgui-java binding for 32bit Windows'
libName = 'imgui-java.dll'
} else if (System.getProperty('deployWin64')) {
packageName = 'imgui-java-natives-windows' packageName = 'imgui-java-natives-windows'
packageDesc = 'Native binaries for imgui-java binding for 64bit Windows' packageDesc = 'Native binaries for imgui-java binding for Windows'
libName = 'imgui-java64.dll' libName = 'imgui-java64.dll'
} else if (System.getProperty('deployLinux32')) { } else if (System.getProperty('deployLinux')) {
packageName = 'imgui-java-natives-linux-x86'
packageDesc = 'Native binaries for imgui-java binding for 32bit Linux'
libName = 'libimgui-java.so'
} else if (System.getProperty('deployLinux64')) {
packageName = 'imgui-java-natives-linux' packageName = 'imgui-java-natives-linux'
packageDesc = 'Native binaries for imgui-java binding for 64bit Linux' packageDesc = 'Native binaries for imgui-java binding for Linux'
libName = 'libimgui-java64.so' libName = 'libimgui-java64.so'
} else if (System.getProperty('deployMacOs64')) { } else if (System.getProperty('deployMac')) {
packageName = 'imgui-java-natives-macos' packageName = 'imgui-java-natives-macos'
packageDesc = 'Native binaries for imgui-java binding for MacOS' packageDesc = 'Native binaries for imgui-java binding for MacOS'
libName = 'libimgui-java64.dylib' libName = 'libimgui-java64.dylib'
@@ -107,6 +107,7 @@ public class ImGui {
final Path libBin = tmpDir.resolve(fullLibName); final Path libBin = tmpDir.resolve(fullLibName);
Files.copy(is, libBin, StandardCopyOption.REPLACE_EXISTING); Files.copy(is, libBin, StandardCopyOption.REPLACE_EXISTING);
libBin.toFile().deleteOnExit();
return libBin.toFile().getAbsolutePath(); return libBin.toFile().getAbsolutePath();
} catch (IOException e) { } catch (IOException e) {