diff options
-rw-r--r-- | make/build.xml | 46 | ||||
-rwxr-xr-x | make/gluegen-cpptasks-base.xml | 136 | ||||
-rwxr-xr-x | make/gluegen-properties.xml | 14 | ||||
-rw-r--r-- | make/jogamp-androidtasks.xml | 2 | ||||
-rwxr-xr-x | make/scripts/make.gluegen.all.ios.amd64.sh | 35 | ||||
-rwxr-xr-x | make/scripts/make.gluegen.all.ios.arm64.sh | 35 | ||||
-rw-r--r-- | src/java/com/jogamp/common/os/MachineDataInfo.java | 10 | ||||
-rw-r--r-- | src/java/com/jogamp/common/os/NativeLibrary.java | 5 | ||||
-rw-r--r-- | src/java/com/jogamp/common/os/Platform.java | 5 | ||||
-rw-r--r-- | src/java/com/jogamp/common/util/IOUtil.java | 3 | ||||
-rw-r--r-- | src/java/com/jogamp/common/util/JarUtil.java | 2 | ||||
-rw-r--r-- | src/java/com/jogamp/common/util/VersionUtil.java | 1 | ||||
-rw-r--r-- | src/java/jogamp/common/os/MachineDataInfoRuntime.java | 9 | ||||
-rw-r--r-- | src/java/jogamp/common/os/PlatformPropsImpl.java | 24 |
14 files changed, 298 insertions, 29 deletions
diff --git a/make/build.xml b/make/build.xml index 2b5c687..a03ef68 100644 --- a/make/build.xml +++ b/make/build.xml @@ -388,6 +388,24 @@ <property name="c.src.dir.os" value="unix" /> </target> + <linker id="linker.cfg.ios.amd64.gluegen" extends="linker.cfg.ios.amd64"> + <linkerarg value="-exported_symbols_list lib"/> + </linker> + + <target name="declare.ios.amd64" if="isIOSAmd64"> + <echo message="IOSAmd64" /> + <property name="compiler.cfg.id" value="compiler.cfg.ios.amd64" /> + <property name="linker.cfg.id" value="linker.cfg.ios.amd64" /> + <property name="c.src.dir.os" value="unix" /> + </target> + + <target name="declare.ios.arm64" if="isIOSArm64"> + <echo message="IOSArm64" /> + <property name="compiler.cfg.id" value="compiler.cfg.ios.arm64" /> + <property name="linker.cfg.id" value="linker.cfg.ios.arm64" /> + <property name="c.src.dir.os" value="unix" /> + </target> + <target name="declare.freebsd.amd64" if="isFreeBSDAMD64"> <echo message="FreeBSDAMD64" /> <property name="compiler.cfg.id" value="compiler.cfg.freebsd" /> @@ -413,7 +431,7 @@ <property name="c.src.dir.os" value="unix" /> </target> - <target name="c.configure" depends="gluegen.cpptasks.detect.os,gluegen.cpptasks.setup.compiler,declare.win32,declare.linux,declare.android,declare.solaris,declare.macosx,declare.freebsd,declare.hpux,gluegen.cpptasks.configure.compiler" /> + <target name="c.configure" depends="gluegen.cpptasks.detect.os,gluegen.cpptasks.setup.compiler,declare.win32,declare.linux,declare.android,declare.solaris,declare.macosx,declare.ios.amd64,declare.ios.arm64,declare.freebsd,declare.hpux,gluegen.cpptasks.configure.compiler" /> <target name="c.rename.lib.mingw" if="isMingW"> <!-- FIXME: this is a hack; the cpptask should have an option to change the @@ -451,6 +469,20 @@ <antcall target="gluegen.build.c.impl" inheritAll="true" inheritRefs="true" /> </target> + <target name="gluegen.build.a.symbols" depends="" if="${build.staticlibs}" unless="gluegen.build.skip.native"> + <!-- invoke nm in a most compatible way, tested on GNU/Linux and MacOS --> + <exec executable="nm" dir="${build}" output="${gluegen.lib.dir}/lib${output.lib.name}.symbols.raw"> + <arg value="--extern-only"/> + <arg value="--defined-only"/> + <arg value="${gluegen.lib.dir}/${output.lib.name.os}"/> + </exec> + <exec executable="awk" dir="${build}" output="${gluegen.lib.dir}/lib${output.lib.name}.symbols"> + <arg value="{ print $3 }"/> + <arg value="${gluegen.lib.dir}/lib${output.lib.name}.symbols.raw"/> + </exec> + <delete file="${gluegen.lib.dir}/lib${output.lib.name}.symbols.raw" quiet="true" failonerror="false" /> + </target> + <target name="gluegen.build.c.impl" depends="init, c.configure" unless="gluegen.build.skip.native"> <echo message="clearing gluegen.build.shasum.done (2) - was ${gluegen.build.shasum.done}"/> <var name="gluegen.build.shasum.done" unset="true"/> @@ -462,7 +494,7 @@ <javah destdir="${src.generated.c}/Unix" classpath="${classes}" class="jogamp.common.os.UnixDynamicLinkerImpl" /> <javah destdir="${src.generated.c}/Windows" classpath="${classes}" class="jogamp.common.os.WindowsDynamicLinkerImpl"/> - <echo message="Output lib name = ${output.lib.name} -> ${output.lib.name.os}" /> + <echo message="Output lib name = ${output.lib.name} -> ${output.lib.name.os} [${output.lib.type}]" /> <mkdir dir="${gluegen.lib.dir}"/> @@ -502,12 +534,14 @@ <includepath path="${src.generated.c}" /> <includepath path="${src.generated.c}/Unix" if="isUnix"/> <includepath path="${src.generated.c}/Unix" if="isOSX"/> + <includepath path="${src.generated.c}/Unix" if="isIOS"/> <includepath path="${src.generated.c}/Windows" if="isWindows"/> </compiler> <linker extends="${linker.cfg.id}" /> </cc> + <antcall target="gluegen.build.a.symbols" inheritAll="true" inheritRefs="true" /> <antcall target="c.rename.lib.mingw" inheritRefs="true" /> <antcall target="c.rename.lib.macosx" inheritRefs="true" /> @@ -542,7 +576,7 @@ nativejarfile="${build}/gluegen-rt-natives-${os.and.arch}.jar" manifestfile="${build}/Manifest-rt-natives.temp" module="common" - includelibs="*gluegen-rt.${native.library.suffix}" /> + includelibs="*${output.lib.name}.${native.library.suffix}" /> <!-- Produce duplicates for different configurations, since non-native-jar aliasing (Bug 1023/Bug 1024) --> <copy file="${build}/gluegen-rt-natives-${os.and.arch}.jar" tofile="${build}/gluegen-rt-android-natives-${os.and.arch}.jar"/> @@ -1206,7 +1240,7 @@ jarbuilddir="${build}" jarbasename="gluegen-rt-android" nativebuilddir="${gluegen.lib.dir}" - nativebasename="gluegen-rt" + nativebasename="${output.lib.name}" android.abi="${android.abi}" androidmanifest.path="resources/android/AndroidManifest-Runtime.xml" androidresources.path="resources/android/res" @@ -1244,11 +1278,11 @@ <echo message='gluegen.build.sha.natives=${gluegen.build.sha.natives}${line.separator}' file="${build}/artifact.properties" append="true"/> </target> - <target name="junit.compile" depends="init"> + <target name="junit.compile" depends="init" if="${build.dynamiclibs}"> <ant antfile="build-test.xml" target="junit.compile"/> </target> - <target name="junit.run" depends="init,junit.compile"> + <target name="junit.run" depends="init,junit.compile" if="${build.dynamiclibs}"> <ant antfile="build-test.xml" target="junit.run"/> </target> diff --git a/make/gluegen-cpptasks-base.xml b/make/gluegen-cpptasks-base.xml index adf8ab6..5e38e2a 100755 --- a/make/gluegen-cpptasks-base.xml +++ b/make/gluegen-cpptasks-base.xml @@ -56,6 +56,9 @@ - isLinuxSparc - isOSX - isOSXPPC + - isIOS + - isIOSAmd64 + - isIOSArm64 - isSolaris - isSolaris32Bit - isSolaris64Bit @@ -70,15 +73,21 @@ - jvmDataModel32Bit - jvmDataModel.arg either one of [ "-d64", "-d32" or "-Djnlp.no.jvm.data.model.set=true" ] + + - build.dynamiclibs + - build.staticlibs (usually = !build.dynamiclibs) + - output.lib.type + - - - isX11 is set if: !isWindows && !isOSX && !noX11 + - isX11 is set if: !isWindows && !isOSX !isIOS && !noX11 - - It also sets the following properties which are useful for - building native library jar files for Java Web Start and - understanding on what OS and architecture things are being built. - - os.and.arch (i.e., "windows-i586") - - native.library.suffix (i.e.., "so", "dll") + - native.library.prefix (i.e.., "lib", "") + - native.library.suffix (i.e.., "so", "dll", "dylib") - - The gluegen.cpptasks.setup.compiler target is the preferred target - to depend upon in your build.xml. It depends on gluegen.cpptasks.detect.compiler @@ -148,6 +157,8 @@ - compiler.cfg.win32.mingw - compiler.cfg.win32.msvc - compiler.cfg.macosx + - compiler.cfg.ios.amd64 + - compiler.cfg.ios.arm64 - compiler.cfg.freebsd - compiler.cfg.hpux - linker.cfg.linux @@ -173,6 +184,8 @@ - linker.cfg.win32.mingw - linker.cfg.win32.msvc - linker.cfg.macosx + - linker.cfg.ios.amd64 + - linker.cfg.ios.arm64 - linker.cfg.hpux - - This project file also defines a macrodef called "msvc.manifest" @@ -263,6 +276,8 @@ <condition property="is64Bit"> <or> <istrue value="${isAMD64}" /> + <istrue value="${isIOSAmd64}"/> + <istrue value="${isIOSArm64}"/> <os arch="IA64" /> <os arch="sparcv9" /> <os arch="armv8a" /> @@ -270,10 +285,19 @@ </or> </condition> + <condition property="isIOS"> + <or> + <istrue value="${isIOSAmd64}"/> + <istrue value="${isIOSArm64}"/> + </or> + </condition> <condition property="isOSX"> <and> <os family="mac"/> <os family="unix"/> + <not> + <istrue value="${isIOS}"/> + </not> </and> </condition> <condition property="isUnix"> @@ -540,6 +564,7 @@ <and> <isfalse value="${isWindows}" /> <isfalse value="${isOSX}" /> + <isfalse value="${isIOS}" /> <isfalse value="${isAndroid}" /> <isfalse value="${noX11}" /> </and> @@ -571,6 +596,9 @@ <condition property="jvmDataModel.arg" value="-d64"><isset property="jvmDataModel64Bit"/></condition> <condition property="jvmDataModel.arg" value="-d32"><isset property="jvmDataModel32Bit"/></condition> <property name="jvmDataModel.arg" value="-Djnlp.no.jvm.data.model.set=true" /> <!-- dummy placeholder, valid jvm arg, won't override above spec --> + <condition property="build.dynamiclibs" value="false" else="true"><istrue value="${isIOS}"/></condition> + <condition property="build.staticlibs" value="false" else="true"><istrue value="${build.dynamiclibs}"/></condition> + <condition property="output.lib.type" value="shared" else="static"><istrue value="${build.dynamiclibs}"/></condition> </target> <target name="gluegen.cpptasks.detect.os.refine" unless="gluegen.cpptasks.detected.os.2"> @@ -641,6 +669,9 @@ <echo message="OS X PPC=${use.macosppc}" /> <echo message="OS X x32=${use.macosx32}" /> <echo message="OS X x64=${use.macosx64}" /> + <echo message="iOS=${isIOS}" /> + <echo message="iOSAmd64=${isIOSAmd64}" /> + <echo message="iOSArm64=${isIOSArm64}" /> <echo message="Solaris=${isSolaris}" /> <echo message="Solaris32Bit=${isSolaris32Bit}" /> <echo message="Solaris64Bit=${isSolaris64Bit}" /> @@ -654,6 +685,9 @@ <echo message="os=${os.name}" /> <echo message="os=${os.version}" /> <echo message="arch=${os.arch}" /> + <echo message="build.dynamiclibs=${build.dynamiclibs}" /> + <echo message="build.staticlibs=${build.staticlibs}" /> + <echo message="output.lib.type=${output.lib.type}" /> </target> <!-- Consult jogamp.common.os.PlatformPropsImpl.getOSAndArch(..) to complete/sync mapping! --> @@ -755,10 +789,23 @@ <target name="gluegen.cpptasks.detect.os.linux" depends="gluegen.cpptasks.detect.os.linux.amd64,gluegen.cpptasks.detect.os.linux.ia64,gluegen.cpptasks.detect.os.linux.x86,gluegen.cpptasks.detect.os.linux.armv6.armel,gluegen.cpptasks.detect.os.linux.armv6.armhf,gluegen.cpptasks.detect.os.android.armv6.armel,gluegen.cpptasks.detect.os.linux.aarch64,gluegen.cpptasks.detect.os.android.armv6.armhf,gluegen.cpptasks.detect.os.android.aarch64,gluegen.cpptasks.detect.os.android.x86,gluegen.cpptasks.detect.os.linux.alpha,gluegen.cpptasks.detect.os.linux.hppa,gluegen.cpptasks.detect.os.linux.mips,gluegen.cpptasks.detect.os.linux.mipsel,gluegen.cpptasks.detect.os.linux.ppc,gluegen.cpptasks.detect.os.linux.ppc64,gluegen.cpptasks.detect.os.linux.ppc64le,gluegen.cpptasks.detect.os.linux.s390,gluegen.cpptasks.detect.os.linux.s390x,gluegen.cpptasks.detect.os.linux.sparc" unless="gluegen.cpptasks.detected.os.2" /> <target name="gluegen.cpptasks.detect.os.osx" unless="gluegen.cpptasks.detected.os.2" if="isOSX"> - <property name="native.library.suffix" value="*lib" /> + <property name="native.library.prefix" value="lib" /> + <property name="native.library.suffix" value="dylib" /> <property name="os.and.arch" value="macosx-universal" /> </target> + <target name="gluegen.cpptasks.detect.os.ios.amd64" unless="gluegen.cpptasks.detected.os.2" if="isIOSAmd64"> + <property name="native.library.prefix" value="lib" /> + <property name="native.library.suffix" value="a" /> + <property name="os.and.arch" value="ios-amd64" /> + </target> + + <target name="gluegen.cpptasks.detect.os.ios.arch64" unless="gluegen.cpptasks.detected.os.2" if="isIOSArm64"> + <property name="native.library.prefix" value="lib" /> + <property name="native.library.suffix" value="a" /> + <property name="os.and.arch" value="ios-arm64" /> + </target> + <target name="gluegen.cpptasks.detect.os.solaris.sparc" unless="gluegen.cpptasks.detected.os.2" if="isSolarisSparc"> <property name="os.and.arch" value="solaris-sparc" /> </target> @@ -778,6 +825,7 @@ <target name="gluegen.cpptasks.detect.os.solaris" depends="gluegen.cpptasks.detect.os.solaris.sparc,gluegen.cpptasks.detect.os.solaris.sparcv9,gluegen.cpptasks.detect.os.solaris.amd64,gluegen.cpptasks.detect.os.solaris.x86" unless="gluegen.cpptasks.detected.os.2" /> <target name="gluegen.cpptasks.detect.os.unix" unless="gluegen.cpptasks.detected.os.2" if="isUnix"> + <property name="native.library.prefix" value="lib" /> <property name="native.library.suffix" value="so" /> </target> @@ -790,10 +838,11 @@ </target> <target name="gluegen.cpptasks.detect.os.windows" depends="gluegen.cpptasks.detect.os.windows.amd64,gluegen.cpptasks.detect.os.windows.x86" unless="gluegen.cpptasks.detected.os.2" if="isWindows"> + <property name="native.library.prefix" value="" /> <property name="native.library.suffix" value="dll" /> </target> - <target name="gluegen.cpptasks.detect.os.2" depends="gluegen.cpptasks.detect.os.refine,gluegen.cpptasks.detect.os.freebsd,gluegen.cpptasks.detect.os.hpux,gluegen.cpptasks.detect.os.linux,gluegen.cpptasks.detect.os.osx,gluegen.cpptasks.detect.os.solaris,gluegen.cpptasks.detect.os.unix,gluegen.cpptasks.detect.os.windows" unless="gluegen.cpptasks.detected.os.2"> + <target name="gluegen.cpptasks.detect.os.2" depends="gluegen.cpptasks.detect.os.refine,gluegen.cpptasks.detect.os.freebsd,gluegen.cpptasks.detect.os.hpux,gluegen.cpptasks.detect.os.linux,gluegen.cpptasks.detect.os.osx,gluegen.cpptasks.detect.os.ios.amd64,gluegen.cpptasks.detect.os.ios.arch64,gluegen.cpptasks.detect.os.solaris,gluegen.cpptasks.detect.os.unix,gluegen.cpptasks.detect.os.windows" unless="gluegen.cpptasks.detected.os.2"> <propertyregex property="os.and.arch.dot" input="${os.and.arch}" regexp="-" @@ -819,6 +868,10 @@ <isset property="isOSX"/> </condition> <condition property="system.env.library.path" + value="DYLD_LIBRARY_PATH"> + <isset property="isIOS"/> + </condition> + <condition property="system.env.library.path" value="LD_LIBRARY_PATH"> <isset property="isUnix"/> </condition> @@ -830,6 +883,7 @@ <!-- NOTE: the value of the c.strip.tool and c.strip.args attribute will not be overridden if already set externally --> <property name="c.strip.tool" value="strip" /> <condition property="c.strip.args" value="-S -x"><isset property="isOSX"/></condition> + <condition property="c.strip.args" value="-S -x"><isset property="isIOS"/></condition> <property name="c.strip.args" value="" /> </target> @@ -1188,6 +1242,36 @@ </defineset> </compiler> + <compiler id="compiler.cfg.ios.amd64" name="${gcc.compat.compiler}"> + <compilerarg value="-v"/> + <compilerarg value="-arch"/> + <compilerarg value="x86_64"/> + <compilerarg value="-Wmost" /> + <compilerarg value="-ObjC" /> + <compilerarg value="-miphoneos-version-min=10.5"/> + <!-- sysincludepath path="${macosx.sdkroot}" if="macosx.sdkroot"/ --> + <defineset> + <define name="_DEBUG" if="c.compiler.use-debug"/> + <define name="DEBUG" if="c.compiler.use-debug"/> + <define name="NDEBUG" unless="c.compiler.use-debug"/> + </defineset> + </compiler> + + <compiler id="compiler.cfg.ios.arm64" name="${gcc.compat.compiler}"> + <compilerarg value="-v"/> + <compilerarg value="-arch"/> + <compilerarg value="arm64"/> + <compilerarg value="-Wmost" /> + <compilerarg value="-ObjC" /> + <compilerarg value="-miphoneos-version-min=10.5"/> + <!-- sysincludepath path="${macosx.sdkroot}" if="macosx.sdkroot"/ --> + <defineset> + <define name="_DEBUG" if="c.compiler.use-debug"/> + <define name="DEBUG" if="c.compiler.use-debug"/> + <define name="NDEBUG" unless="c.compiler.use-debug"/> + </defineset> + </compiler> + <!-- Windows compiler configuration --> <!--compiler id="compiler.cfg.linux64.mingw64" classname="net.sf.antcontrib.cpptasks.gcc.Gcc64CCompiler"--> @@ -1375,7 +1459,6 @@ <!-- MacOSX linker configuration --> <linker id="linker.cfg.macosx" name="${gcc.compat.compiler}"> - <!-- Note: Apple doesn't seem to provide ppc binaries on Snow Leopard --> <linkerarg value="-arch" if="use.macosppc"/> <linkerarg value="ppc" if="use.macosppc"/> <linkerarg value="-arch" if="use.macosx32"/> @@ -1385,7 +1468,24 @@ <linkerarg value="-mmacosx-version-min=10.5"/> <linkerarg value="-static-libgcc" if="isGCC"/> <linkerarg value="-static-libstdc++" if="isGCC"/> - <!-- Note: Apple doesn't seem to provide ppc64 binaries on Leopard --> + </linker> + + <linker id="linker.cfg.ios.amd64" name="${gcc.compat.compiler}"> + <linkerarg value="-v"/> + <linkerarg value="-arch"/> + <linkerarg value="x86_64"/> + <linkerarg value="-miphoneos-version-min=10.5"/> + <linkerarg value="-static-libgcc" if="isGCC"/> + <linkerarg value="-static-libstdc++" if="isGCC"/> + </linker> + + <linker id="linker.cfg.ios.arm64" name="${gcc.compat.compiler}"> + <linkerarg value="-v"/> + <linkerarg value="-arch"/> + <linkerarg value="arm64"/> + <linkerarg value="-miphoneos-version-min=10.5"/> + <linkerarg value="-static-libgcc" if="isGCC"/> + <linkerarg value="-static-libstdc++" if="isGCC"/> </linker> <!-- Windows linker configuration --> @@ -1639,6 +1739,28 @@ <property name="java.lib.dir.platform" value="/System/Library/Frameworks/JavaVM.framework/Libraries" /> </target> + <target name="gluegen.cpptasks.declare.compiler.ios.amd64" if="isIOSAmd64"> + <echo message="iOSAmd64" /> + <property name="compiler.cfg.id.base" value="compiler.cfg.ios.amd64" /> + <property name="linker.cfg.id.base" value="linker.cfg.ios.amd64" /> + <property name="java.includes.dir.platform" value="${java.includes.dir}/macosx" /> + <condition property="java.lib.dir.platform" + value="${java.home.dir}/jre/lib"> + <available file="${java.home.dir}/jre/lib/libjvm.a"/> + </condition> + </target> + + <target name="gluegen.cpptasks.declare.compiler.ios.arm64" if="isIOSArm64"> + <echo message="iOSArm64" /> + <property name="compiler.cfg.id.base" value="compiler.cfg.ios.arm64" /> + <property name="linker.cfg.id.base" value="linker.cfg.ios.arm64" /> + <property name="java.includes.dir.platform" value="${java.includes.dir}/macosx" /> + <condition property="java.lib.dir.platform" + value="${java.home.dir}/jre/lib"> + <available file="${java.home.dir}/jre/lib/libjvm.a"/> + </condition> + </target> + <target name="gluegen.cpptasks.declare.compiler.freebsd.x86" if="isFreeBSDX86"> <echo message="FreeBSD" /> <property name="compiler.cfg.id.base" value="compiler.cfg.freebsd" /> @@ -1665,7 +1787,7 @@ <property name="java.lib.dir.platform" value="${java.home.dir}/jre/lib/PA_RISC2.0" /> </target> - <target name="gluegen.cpptasks.declare.compiler" depends="gluegen.cpptasks.declare.compiler.environment,gluegen.cpptasks.declare.compiler.win32,gluegen.cpptasks.declare.compiler.linux,gluegen.cpptasks.declare.compiler.solaris,gluegen.cpptasks.declare.compiler.macosx,gluegen.cpptasks.declare.compiler.freebsd,gluegen.cpptasks.declare.compiler.hpux" > + <target name="gluegen.cpptasks.declare.compiler" depends="gluegen.cpptasks.declare.compiler.environment,gluegen.cpptasks.declare.compiler.win32,gluegen.cpptasks.declare.compiler.linux,gluegen.cpptasks.declare.compiler.solaris,gluegen.cpptasks.declare.compiler.macosx,gluegen.cpptasks.declare.compiler.ios.amd64,gluegen.cpptasks.declare.compiler.ios.arm64,gluegen.cpptasks.declare.compiler.freebsd,gluegen.cpptasks.declare.compiler.hpux" > <echo message="java.home.dir ${java.home.dir}" /> <echo message="java.includes.dir ${java.includes.dir}" /> <echo message="java.includes.dir.platform ${java.includes.dir.platform}" /> diff --git a/make/gluegen-properties.xml b/make/gluegen-properties.xml index 8038de3..54fbc8c 100755 --- a/make/gluegen-properties.xml +++ b/make/gluegen-properties.xml @@ -88,10 +88,16 @@ <!-- maybe overriden, e.g. with "clang" --> <echo message="Setting default gcc.compat.compiler" /> <condition property="gcc.compat.compiler" value="xcode.clang"> <!-- default for OSX --> - <and> - <os family="mac"/> - <os family="unix"/> - </and> + <or> + <istrue value="${isOSX}"/> + <istrue value="${isIOS}"/> + <istrue value="${isIOSAmd64}"/> + <istrue value="${isIOSArm64}"/> + <and> + <os family="mac"/> + <os family="unix"/> + </and> + </or> </condition> <property name="gcc.compat.compiler" value="gcc"/> <!-- default for all others .. --> <echo message="gcc.compat.compiler=${gcc.compat.compiler}" /> diff --git a/make/jogamp-androidtasks.xml b/make/jogamp-androidtasks.xml index 24aea10..82679c4 100644 --- a/make/jogamp-androidtasks.xml +++ b/make/jogamp-androidtasks.xml @@ -28,7 +28,7 @@ jarbuilddir="${build}" // jar build location jarbasename="gluegen-rt" // jar base file name nativebuilddir="${gluegen.lib.dir}" // native library build location - nativebasename="gluegen-rt" // native library base file name "*${nativebasename}*.${native.library.suffix}" + nativebasename="${output.lib.name}" // native library base file name "*${nativebasename}*.${native.library.suffix}" androidmanifest.path="resources/android/AndroidManifest.xml" androidresources.path="resources/android/res" jarmanifest.path="${build}/Manifest-rt.temp" // optional diff --git a/make/scripts/make.gluegen.all.ios.amd64.sh b/make/scripts/make.gluegen.all.ios.amd64.sh new file mode 100755 index 0000000..67831d3 --- /dev/null +++ b/make/scripts/make.gluegen.all.ios.amd64.sh @@ -0,0 +1,35 @@ +#! /bin/sh + +if [ -e /opt-share/etc/profile.ant ] ; then + . /opt-share/etc/profile.ant +fi + +# -Dc.compiler.debug=true +# +# -Dtarget.sourcelevel=1.6 \ +# -Dtarget.targetlevel=1.6 \ +# -Dtarget.rt.jar=/opt-share/jre1.6.0_30/lib/rt.jar \ + +# Force OSX SDK 10.6, if desired +# export SDKROOT=macosx10.6 + +export SDKROOT=iphonesimulator12.2 +xcrun --show-sdk-path + +JAVA_HOME=`/usr/libexec/java_home -version 1.8` +PATH=$JAVA_HOME/bin:$PATH +export JAVA_HOME PATH +which java +java -version + +export SOURCE_LEVEL=1.6 +export TARGET_LEVEL=1.6 +export TARGET_RT_JAR=/opt-share/jre1.6.0_30/lib/rt.jar + +#export JOGAMP_JAR_CODEBASE="Codebase: *.jogamp.org" +export JOGAMP_JAR_CODEBASE="Codebase: *.goethel.localnet" + +ant \ + -Drootrel.build=build-ios-amd64 \ + -DisIOSAmd64=true \ + $* 2>&1 | tee make.gluegen.all.ios-amd64.log diff --git a/make/scripts/make.gluegen.all.ios.arm64.sh b/make/scripts/make.gluegen.all.ios.arm64.sh new file mode 100755 index 0000000..77cc1e9 --- /dev/null +++ b/make/scripts/make.gluegen.all.ios.arm64.sh @@ -0,0 +1,35 @@ +#! /bin/sh + +if [ -e /opt-share/etc/profile.ant ] ; then + . /opt-share/etc/profile.ant +fi + +# -Dc.compiler.debug=true +# +# -Dtarget.sourcelevel=1.6 \ +# -Dtarget.targetlevel=1.6 \ +# -Dtarget.rt.jar=/opt-share/jre1.6.0_30/lib/rt.jar \ + +# Force OSX SDK 10.6, if desired +# export SDKROOT=macosx10.6 + +export SDKROOT=iphoneos12.2 +xcrun --show-sdk-path + +JAVA_HOME=`/usr/libexec/java_home -version 1.8` +PATH=$JAVA_HOME/bin:$PATH +export JAVA_HOME PATH +which java +java -version + +export SOURCE_LEVEL=1.6 +export TARGET_LEVEL=1.6 +export TARGET_RT_JAR=/opt-share/jre1.6.0_30/lib/rt.jar + +#export JOGAMP_JAR_CODEBASE="Codebase: *.jogamp.org" +export JOGAMP_JAR_CODEBASE="Codebase: *.goethel.localnet" + +ant \ + -Drootrel.build=build-ios-arm64 \ + -DisIOSArm64=true \ + $* 2>&1 | tee make.gluegen.all.ios-arm64.log 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. * <p> * 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<Object>() { 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); diff --git a/src/java/jogamp/common/os/MachineDataInfoRuntime.java b/src/java/jogamp/common/os/MachineDataInfoRuntime.java index af90cc5..625e537 100644 --- a/src/java/jogamp/common/os/MachineDataInfoRuntime.java +++ b/src/java/jogamp/common/os/MachineDataInfoRuntime.java @@ -71,6 +71,11 @@ public class MachineDataInfoRuntime { } throw new InternalError("Already initialized"); } + /** + * The static {@link MachineDataInfo} is utilized for high performance + * precompiled size, offset, etc table lookup within generated structures + * using the {@link MachineDataInfo.StaticConfig} index. + */ public static MachineDataInfo.StaticConfig getStatic() { if(!initialized) { synchronized(MachineDataInfo.class) { // volatile dbl-checked-locking OK @@ -110,8 +115,10 @@ public class MachineDataInfoRuntime { return StaticConfig.X86_32_UNIX; } } else { - if( osType == Platform.OSType.WINDOWS ) { + if( Platform.OSType.WINDOWS == osType ) { return StaticConfig.X86_64_WINDOWS; + } else if( Platform.OSType.IOS == osType && Platform.CPUType.ARM64 == cpuType ) { + return StaticConfig.ARM64_IOS; } else { // for all 64bit unix types (x86_64, aarch64, sparcv9, ..) return StaticConfig.LP64_UNIX; diff --git a/src/java/jogamp/common/os/PlatformPropsImpl.java b/src/java/jogamp/common/os/PlatformPropsImpl.java index 55335c1..f929ab7 100644 --- a/src/java/jogamp/common/os/PlatformPropsImpl.java +++ b/src/java/jogamp/common/os/PlatformPropsImpl.java @@ -38,7 +38,7 @@ import com.jogamp.common.util.VersionNumber; public abstract class PlatformPropsImpl { static final boolean DEBUG = Debug.debug("Platform"); - /** Selected {@link Platform.OSType#MACOS} {@link VersionNumber}s. */ + /** Selected {@link Platform.OSType#MACOS} or {@link Platform.OSType#IOS} {@link VersionNumber}s. */ public static class OSXVersion { /** OSX Tiger, i.e. 10.4.0 */ public static final VersionNumber Tiger = new VersionNumber(10,4,0); @@ -101,6 +101,14 @@ public abstract class PlatformPropsImpl { public static final ABIType ABI_TYPE; public static final OSType OS_TYPE; public static final String os_and_arch; + /** + * Usually GlueGen and subsequent JogAmp modules are build using dynamic libraries on supported platforms, + * hence this boolean is expected to be true. + * <p> + * However, on certain systems static libraries are being used on which native JNI library loading is disabled. + * </p> + */ + public static final boolean useDynamicLibraries; static { Version16 = new VersionNumber(1, 6, 0); @@ -318,8 +326,13 @@ public abstract class PlatformPropsImpl { strategy = 220; } } + if( OSType.IOS == OS_TYPE ) { + useDynamicLibraries = false; + } else { + useDynamicLibraries = true; + } if( DEBUG ) { - System.err.println("Platform.Hard: ARCH "+ARCH+", CPU_ARCH "+CPU_ARCH+", ABI_TYPE "+ABI_TYPE+" - strategy "+strategy+"(isAndroid "+isAndroid+", elfValid "+elfValid+")"); + System.err.println("Platform.Hard: ARCH "+ARCH+", CPU_ARCH "+CPU_ARCH+", ABI_TYPE "+ABI_TYPE+" - strategy "+strategy+"(isAndroid "+isAndroid+", elfValid "+elfValid+"), useDynLibs "+useDynamicLibraries); } os_and_arch = getOSAndArch(OS_TYPE, CPU_ARCH, ABI_TYPE, LITTLE_ENDIAN); } @@ -492,6 +505,9 @@ public abstract class PlatformPropsImpl { if ( osLower.startsWith("kd") ) { return OSType.OPENKODE; } + if ( osLower.startsWith("ios") ) { + return OSType.IOS; + } throw new RuntimeException("Please port OS detection to your platform (" + OS_lower + "/" + ARCH_lower + ")"); } @@ -607,6 +623,10 @@ public abstract class PlatformPropsImpl { os_ = "macosx"; _and_arch_final = "universal"; break; + case IOS: + os_ = "ios"; + _and_arch_final = _and_arch_tmp; + break; case WINDOWS: os_ = "windows"; _and_arch_final = _and_arch_tmp; |