Add support for MacOsX

This commit is contained in:
SpaiR committed 2020-06-02 22:02:40 +03:00
1 parent f327038f3b
commit 99bb339eae
6 files changed
+28 -5

No files matched your search

+5 -4
View File
@@ -4,7 +4,8 @@ The same way you can use 'java.library.path' option as well.
By default binding expects 'imgui-java' ('imgui-java64' for x64 arch) file name.
You can change that by using 'imgui.library.name' VM option (ex: -Dimgui.library.name=custom-lib-name).
- imgui-java.dll << win32
- imgui-java64.dll << win64
- libimgui-java.so << linux32
- libimgui-java64.so << linux64
- imgui-java.dll << win32
- imgui-java64.dll << win64
- libimgui-java.so << linux32
- libimgui-java64.so << linux64
- libimgui-java64.dylib << MacOs64
Binary file not shown.
@@ -38,6 +38,11 @@ class GenerateLibs extends DefaultTask {
def linux32 = BuildTarget.newDefaultTarget(BuildTarget.TargetOs.Linux, false)
def linux64 = BuildTarget.newDefaultTarget(BuildTarget.TargetOs.Linux, true)
def mac64 = BuildTarget.newDefaultTarget(BuildTarget.TargetOs.MacOsX, true)
mac64.cppFlags += " -stdlib=libc++"
mac64.cppFlags = mac64.cppFlags.replaceAll("10.5", "10.9")
mac64.linkerFlags = mac64.linkerFlags.replaceAll("10.5", "10.9")
// Freetype Deps Config
win32.cppFlags += " -fstack-protector -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"
win32.libraries += "-lfreetype -lbz2 -lssp"
@@ -47,6 +52,8 @@ class GenerateLibs extends DefaultTask {
linux32.linkerFlags += " -lfreetype"
linux64.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"
linux64.linkerFlags += " -lfreetype"
mac64.cppFlags += " -I/usr/local/include/freetype2 -I/usr/local/include/libpng16 -I/usr/local/include/harfbuzz -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include"
mac64.linkerFlags += " -lfreetype"
// End
new AntScriptGenerator().generate(buildConfig, win32, win64, linux32, linux64)
@@ -58,6 +65,7 @@ class GenerateLibs extends DefaultTask {
BuildExecutor.executeAnt(jniDir + '/build-windows64.xml', '-v', '-Dhas-compiler=true', '-Drelease=true', 'clean', 'postcompile')
BuildExecutor.executeAnt(jniDir + '/build-linux32.xml', '-v', '-Dhas-compiler=true', '-Drelease=true', 'clean', 'postcompile')
BuildExecutor.executeAnt(jniDir + '/build-linux64.xml', '-v', '-Dhas-compiler=true', '-Drelease=true', 'clean', 'postcompile')
BuildExecutor.executeAnt(jniDir + '/build-macosx64.xml', '-v', '-Dhas-compiler=true', '-Drelease=true', 'clean', 'postcompile')
BuildExecutor.executeAnt(jniDir + '/build.xml', '-v', 'pack-natives')
}
}
+3
View File
@@ -24,6 +24,9 @@ if (System.getProperty('deployWin32')) {
} else if (System.getProperty('deployLinux64')) {
packageName = 'natives-linux'
libName = 'libimgui-java64.so'
} else if (System.getProperty('deployMacOs64')) {
packageName = 'natives-macos'
libName = 'libimgui-java64.dylib'
}
jar {
+5 -1
View File
@@ -56,13 +56,17 @@ public final class ImGui {
private static String resolveFullLibName() {
final boolean isWin = System.getProperty("os.name").toLowerCase().contains("win");
final boolean isMac = System.getProperty("os.name").toLowerCase().contains("mac");
final String libPrefix;
final String libSuffix;
if (isWin) {
libPrefix = "";
libSuffix = ".dll";
} else { // Only linux as an alternative OS
} else if (isMac) {
libPrefix = "lib";
libSuffix = ".dylib";
} else {
libPrefix = "lib";
libSuffix = ".so";
}
+7
View File
@@ -16,6 +16,9 @@ switch (OperatingSystem.current()) {
case OperatingSystem.WINDOWS:
project.ext.lwjglNatives = 'natives-windows'
break
case OperatingSystem.MAC_OS:
project.ext.lwjglNatives = 'natives-macos'
break
}
dependencies {
@@ -36,6 +39,10 @@ task startExample(type: JavaExec, dependsOn: build) {
main = 'ImGuiGlfwExample'
classpath = sourceSets.test.runtimeClasspath
jvmArgs = ['-Djava.library.path=../bin']
if (OperatingSystem.current().isMacOsX()) {
jvmArgs += ['-XstartOnFirstThread', '-Djava.awt.headless=true']
}
}
task sourcesJar(type: Jar, dependsOn: classes) {