From 52a6d4ef4133a998824236af9bb48d0ea65359a9 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 17 Jun 2019 03:59:22 +0200 Subject: iOS: Initial iOS support commit: build.xml targets, java code-path etc Current build system for JogAmp iOS Build is: - Build Machine: OSX Mojave 10.14 - Using own (still proprietary) OpenJDK 9 iOS Build - OpenJDK 1.8 (This will be replaced by OpenJDK 11 soon) - Xcode 10.2 --- src/java/com/jogamp/common/os/MachineDataInfo.java | 10 +++++++--- src/java/com/jogamp/common/os/NativeLibrary.java | 5 ++++- src/java/com/jogamp/common/os/Platform.java | 5 +++-- src/java/com/jogamp/common/util/IOUtil.java | 3 ++- src/java/com/jogamp/common/util/JarUtil.java | 2 +- src/java/com/jogamp/common/util/VersionUtil.java | 1 + 6 files changed, 18 insertions(+), 8 deletions(-) (limited to 'src/java/com/jogamp/common') diff --git a/src/java/com/jogamp/common/os/MachineDataInfo.java b/src/java/com/jogamp/common/os/MachineDataInfo.java index 0192cd8..d6fa28c 100644 --- a/src/java/com/jogamp/common/os/MachineDataInfo.java +++ b/src/java/com/jogamp/common/os/MachineDataInfo.java @@ -64,6 +64,7 @@ public class MachineDataInfo { private final static int[] size_x86_32_windows = { 4, 4, 4, 8, 12, 4, 4096 }; private final static int[] size_lp64_unix = { 4, 8, 4, 8, 16, 8, 4096 }; private final static int[] size_x86_64_windows = { 4, 4, 4, 8, 16, 8, 4096 }; + private final static int[] size_arm64_ios = { 4, 8, 4, 8, 8, 8, 8192 }; /* arch os i8, i16, i32, i64, int, long, float, doubl, ldoubl, ptr */ private final static int[] align_arm_mips_32 = { 1, 2, 4, 8, 4, 4, 4, 8, 8, 4 }; @@ -74,11 +75,12 @@ public class MachineDataInfo { private final static int[] align_x86_32_windows = { 1, 2, 4, 8, 4, 4, 4, 8, 4, 4 }; private final static int[] align_lp64_unix = { 1, 2, 4, 8, 4, 8, 4, 8, 16, 8 }; private final static int[] align_x86_64_windows = { 1, 2, 4, 8, 4, 4, 4, 8, 16, 8 }; + private final static int[] align_arm64_ios = { 1, 2, 4, 8, 4, 8, 4, 8, 8, 8 }; /** * Static enumeration of {@link MachineDataInfo} instances * used for high performance data size and alignment lookups, - * e.g. for generated structures. + * e.g. for generated structures using the {@link MachineDataInfo.StaticConfig} index. *

* The value {@link MachineDataInfo#pageSizeInBytes} shall be ignored * for static instances! @@ -109,8 +111,10 @@ public class MachineDataInfo { /** LP64 Unix, e.g.: {@link Platform.CPUType#X86_64} Unix, {@link Platform.CPUType#ARM64} EABI, {@link Platform.CPUType#PPC64} Unix, .. */ LP64_UNIX( size_lp64_unix, align_lp64_unix), /** {@link Platform.CPUType#X86_64} Windows */ - X86_64_WINDOWS( size_x86_64_windows, align_x86_64_windows); - // 8 + X86_64_WINDOWS( size_x86_64_windows, align_x86_64_windows), + /** {@link Platform.CPUType#ARM64 } iOS */ + ARM64_IOS( size_arm64_ios, align_arm64_ios); + // 9 public final MachineDataInfo md; diff --git a/src/java/com/jogamp/common/os/NativeLibrary.java b/src/java/com/jogamp/common/os/NativeLibrary.java index 7c6aeca..6daceae 100644 --- a/src/java/com/jogamp/common/os/NativeLibrary.java +++ b/src/java/com/jogamp/common/os/NativeLibrary.java @@ -89,6 +89,7 @@ public final class NativeLibrary implements DynamicLookupHelper { break; case MACOS: + case IOS: prefixes = new String[] { "lib" }; suffixes = new String[] { ".dylib", ".jnilib" }; isOSX = true; @@ -217,6 +218,7 @@ public final class NativeLibrary implements DynamicLookupHelper { break; case MACOS: + case IOS: dynLink = new MacOSXDynamicLinkerImpl(); break; @@ -526,6 +528,7 @@ public final class NativeLibrary implements DynamicLookupHelper { return windowsLibName; case MACOS: + case IOS: return macOSXLibName; default: @@ -602,7 +605,7 @@ public final class NativeLibrary implements DynamicLookupHelper { private static Method findLibraryMethod = null; private static final String findLibraryImpl(final String libName, final ClassLoader loader) { if (loader == null) { - return null; + return null; } if (!initializedFindLibraryMethod) { AccessController.doPrivileged(new PrivilegedAction() { diff --git a/src/java/com/jogamp/common/os/Platform.java b/src/java/com/jogamp/common/os/Platform.java index 535b8a9..f995af3 100644 --- a/src/java/com/jogamp/common/os/Platform.java +++ b/src/java/com/jogamp/common/os/Platform.java @@ -58,7 +58,7 @@ import jogamp.common.os.PlatformPropsImpl; public class Platform extends PlatformPropsImpl { public enum OSType { - LINUX, FREEBSD, ANDROID, MACOS, SUNOS, HPUX, WINDOWS, OPENKODE; + LINUX, FREEBSD, ANDROID, MACOS, SUNOS, HPUX, WINDOWS, OPENKODE, IOS; } public enum CPUFamily { @@ -302,7 +302,8 @@ public class Platform extends PlatformPropsImpl { } _isRunningFromJarURL[0] = null != platformClassJarURI; - _USE_TEMP_JAR_CACHE[0] = ( OS_TYPE != OSType.ANDROID ) && ( null != platformClassJarURI ) && + _USE_TEMP_JAR_CACHE[0] = ( OS_TYPE != OSType.ANDROID ) && ( OS_TYPE != OSType.IOS ) && + ( null != platformClassJarURI ) && PropertyAccess.getBooleanProperty(useTempJarCachePropName, true, true); // load GluegenRT native library diff --git a/src/java/com/jogamp/common/util/IOUtil.java b/src/java/com/jogamp/common/util/IOUtil.java index 0bee22b..380cb00 100644 --- a/src/java/com/jogamp/common/util/IOUtil.java +++ b/src/java/com/jogamp/common/util/IOUtil.java @@ -863,6 +863,7 @@ public class IOUtil { switch(PlatformPropsImpl.OS_TYPE) { case ANDROID: case MACOS: + case IOS: case WINDOWS: case OPENKODE: return false; @@ -1273,7 +1274,7 @@ public class IOUtil { // 1) java.io.tmpdir/jogamp if( null == tempRootExec && null != java_io_tmpdir ) { - if( Platform.OSType.MACOS == PlatformPropsImpl.OS_TYPE ) { + if( Platform.OSType.MACOS == PlatformPropsImpl.OS_TYPE || Platform.OSType.IOS == PlatformPropsImpl.OS_TYPE ) { // Bug 865: Safari >= 6.1 [OSX] May employ xattr on 'com.apple.quarantine' on 'PluginProcess.app' // We attempt to fix this issue _after_ gluegen native lib is loaded, see JarUtil.fixNativeLibAttribs(File). tempRootExec = getSubTempDir(java_io_tmpdir, tmpSubDir, false /* executable */, "tempX1"); diff --git a/src/java/com/jogamp/common/util/JarUtil.java b/src/java/com/jogamp/common/util/JarUtil.java index d6c8fd4..aa5719c 100644 --- a/src/java/com/jogamp/common/util/JarUtil.java +++ b/src/java/com/jogamp/common/util/JarUtil.java @@ -660,7 +660,7 @@ public class JarUtil { // We tolerate UnsatisfiedLinkError (and derived) to solve the chicken and egg problem // of loading gluegen's native library. // On Safari(OSX), Bug 865, we simply hope the destination folder is executable. - if( Platform.OSType.MACOS == Platform.getOSType() ) { + if( Platform.OSType.MACOS == Platform.getOSType() || Platform.OSType.IOS == Platform.getOSType() ) { final String fileAbsPath = file.getAbsolutePath(); try { fixNativeLibAttribs(fileAbsPath); diff --git a/src/java/com/jogamp/common/util/VersionUtil.java b/src/java/com/jogamp/common/util/VersionUtil.java index 6fec8fa..b9e8568 100644 --- a/src/java/com/jogamp/common/util/VersionUtil.java +++ b/src/java/com/jogamp/common/util/VersionUtil.java @@ -75,6 +75,7 @@ public class VersionUtil { sb.append("Platform: Java Vendor: ").append(Platform.getJavaVendor()).append(", ").append(Platform.getJavaVendorURL()); sb.append(", JavaSE: ").append(PlatformPropsImpl.JAVA_SE); sb.append(", Java6: ").append(PlatformPropsImpl.JAVA_6); + sb.append(", dynamicLib: ").append(PlatformPropsImpl.useDynamicLibraries); sb.append(", AWT enabled: ").append(Platform.AWT_AVAILABLE); sb.append(Platform.getNewline()).append(SEPERATOR); -- cgit v1.2.3