diff options
21 files changed, 429 insertions, 83 deletions
diff --git a/make/build-test.xml b/make/build-test.xml index 6372696..f39f0bf 100644 --- a/make/build-test.xml +++ b/make/build-test.xml @@ -234,7 +234,7 @@ <condition property="c.compiler.use-debug"><istrue value="${c.compiler.debug}"/></condition> - <cc outtype="shared" + <cc outtype="${output.lib.type}" objdir="${build_t.obj}" outfile="${build_t.lib}/@{output.lib.name}" optimize="${c.compiler.optimise}" diff --git a/make/build.xml b/make/build.xml index 147cbe7..3d247f3 100644 --- a/make/build.xml +++ b/make/build.xml @@ -389,6 +389,20 @@ <property name="c.src.dir.os" value="unix" /> </target> + <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" /> @@ -414,31 +428,25 @@ <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 suffix or at least understand the override from .so to .dll --> - <move file="${build}/obj/libgluegen-rt.so" tofile="${build}/obj/gluegen-rt.dll" /> - </target> - - <target name="c.rename.lib.macosx" if="isOSX"> - <copy file="${build}/obj/libgluegen-rt.dylib" tofile="${build}/obj/libgluegen-rt.so" /> + <move file="${build}/obj/libgluegen_rt.so" tofile="${build}/obj/gluegen_rt.dll" /> </target> <target name="c.manifest" if="isVC8Family"> <!-- exec mt, the Microsoft Manifest Tool, to include DLL manifests in order to resolve the location of msvcr80.dll --> - <msvc.manifest objdir="${build}/obj" dllname="gluegen-rt" /> + <msvc.manifest objdir="${build}/obj" dllname="gluegen_rt" /> </target> <target name="gluegen.build.native" depends="init, c.configure" > <property name="c.compiler.src.files.common" value="src/native/common/*.c" /> <property name="c.compiler.src.files.os" value="src/native/${c.src.dir.os}/*.c" /> - <property name="output.lib.name" value="gluegen-rt" /> - <condition property="output.lib.name.os" value="lib${output.lib.name}.so"><isset property="isUnix"/></condition> - <condition property="output.lib.name.os" value="${output.lib.name}.dll"><isset property="isWindows"/></condition> - <condition property="output.lib.name.os" value="lib${output.lib.name}.dylib"><isset property="isOSX"/></condition> + <property name="output.lib.name" value="gluegen_rt" /> <!-- dash replaced by underscore to allow static linkage via JEP 178 --> + <property name="output.lib.name.os" value="${native.library.prefix}${output.lib.name}.${native.library.suffix}" /> <uptodate property="gluegen.build.skip.native"> <srcfiles dir= "${project.root}" includes="${c.compiler.src.files.os}"/> @@ -463,14 +471,15 @@ <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}"/> <echo message="Compiling ${c.compiler.src.files.os} ${c.compiler.src.files.common}" /> <echo message="user.dir=${user.dir}" /> - <cc outtype="shared" + <cc outtype="${output.lib.type}" + usehighleveltool="true" objdir="${gluegen.lib.dir}" outfile="${gluegen.lib.dir}/${output.lib.name}" optimize="${c.compiler.optimise}" @@ -502,6 +511,7 @@ <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> @@ -509,7 +519,10 @@ </cc> <antcall target="c.rename.lib.mingw" inheritRefs="true" /> - <antcall target="c.rename.lib.macosx" inheritRefs="true" /> + + <gluegen.make.libsymbols builddir="${build}" + nativelib="${gluegen.lib.dir}/${output.lib.name.os}" + symbolsfile="${gluegen.lib.dir}/${native.library.prefix}${output.lib.name}.symbols" /> <antcall target="gluegen.cpptasks.striplibs" inheritRefs="true"> <param name="libdir" value="${gluegen.lib.dir}"/> @@ -542,7 +555,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 +1219,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" @@ -1227,8 +1240,9 @@ <target name="all.ide" description="Debug IDE build including all junit tests, but don't tag the build or create archives" depends="init.debug, base.compile, tag.build, junit.compile" /> <target name="clean" depends="init"> - <delete includeEmptyDirs="true"> + <delete includeEmptyDirs="true" failonerror="false"> <fileset dir="${build}" /> + <fileset dir="${project.root}/build-temp" /> <fileset dir="${project.root}" includes="make/GnuCTreeParserTokenTypes.txt make/STDCTokenTypes.txt" /> </delete> </target> @@ -1244,11 +1258,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 e31707a..7aee9c9 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" @@ -255,6 +268,8 @@ <condition property="is64Bit"> <or> <istrue value="${isAMD64}" /> + <istrue value="${isIOSAmd64}"/> + <istrue value="${isIOSArm64}"/> <os arch="IA64" /> <os arch="sparcv9" /> <os arch="armv8a" /> @@ -262,10 +277,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"> @@ -532,6 +556,7 @@ <and> <isfalse value="${isWindows}" /> <isfalse value="${isOSX}" /> + <isfalse value="${isIOS}" /> <isfalse value="${isAndroid}" /> <isfalse value="${noX11}" /> </and> @@ -563,6 +588,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"> @@ -633,6 +661,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}" /> @@ -646,6 +677,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! --> @@ -747,10 +781,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> @@ -770,6 +817,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> @@ -782,10 +830,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="-" @@ -811,6 +860,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> @@ -822,6 +875,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> @@ -1180,6 +1234,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=11.0"/> + <!-- 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=11.0"/> + <!-- 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"--> @@ -1367,7 +1451,7 @@ <!-- MacOSX linker configuration --> <linker id="linker.cfg.macosx" name="${gcc.compat.compiler}"> - <!-- Note: Apple doesn't seem to provide ppc binaries on Snow Leopard --> + <!-- compilerarg value="-v"/ --> <linkerarg value="-arch" if="use.macosppc"/> <linkerarg value="ppc" if="use.macosppc"/> <linkerarg value="-arch" if="use.macosx32"/> @@ -1377,7 +1461,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}"> + <!-- compilerarg value="-v"/ --> + <linkerarg value="-arch"/> + <linkerarg value="x86_64"/> + <linkerarg value="-miphoneos-version-min=11.0"/> + <linkerarg value="-static-libgcc" if="isGCC"/> + <linkerarg value="-static-libstdc++" if="isGCC"/> + </linker> + + <linker id="linker.cfg.ios.arm64" name="${gcc.compat.compiler}"> + <!-- compilerarg value="-v"/ --> + <linkerarg value="-arch"/> + <linkerarg value="arm64"/> + <linkerarg value="-miphoneos-version-min=11.0"/> + <linkerarg value="-static-libgcc" if="isGCC"/> + <linkerarg value="-static-libstdc++" if="isGCC"/> </linker> <!-- Windows linker configuration --> @@ -1631,6 +1732,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" /> @@ -1657,7 +1780,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}" /> @@ -1746,4 +1869,23 @@ </delete> </sequential> </macrodef> + + <macrodef name="gluegen.make.libsymbols"> + <attribute name="builddir" /> + <attribute name="nativelib" /> + <attribute name="symbolsfile" /> + <sequential> + <!-- invoke nm in a most compatible way, tested on GNU/Linux and MacOS --> + <exec executable="nm" dir="@{builddir}" output="@{symbolsfile}.raw"> + <arg value="--extern-only"/> + <arg value="--defined-only"/> + <arg value="@{nativelib}"/> + </exec> + <exec executable="awk" dir="@{builddir}" output="@{symbolsfile}"> + <arg value="{ print $3 }"/> + <arg value="@{symbolsfile}.raw"/> + </exec> + <delete file="@{symbolsfile}.raw" quiet="true" failonerror="false" /> + </sequential> + </macrodef> </project> 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/lib/cpptasks.jar b/make/lib/cpptasks.jar Binary files differindex 44a82ed..152e69d 100644 --- a/make/lib/cpptasks.jar +++ b/make/lib/cpptasks.jar 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/make/stub_includes/jni/jni.h b/make/stub_includes/jni/jni.h index b4c6c1d..eac2640 100644 --- a/make/stub_includes/jni/jni.h +++ b/make/stub_includes/jni/jni.h @@ -164,6 +164,7 @@ typedef long JNIEnv; #define JDK1_2 #define JDK1_4 +#define JDK1_8 #define _JNI_IMPORT_OR_EXPORT_ JNIIMPORT @@ -171,6 +172,7 @@ typedef long JNIEnv; #define JNI_VERSION_1_2 0x00010002 #define JNI_VERSION_1_4 0x00010004 #define JNI_VERSION_1_6 0x00010006 +#define JNI_VERSION_1_8 0x00010008 #else /* __GLUEGEN__ */ @@ -1859,6 +1861,7 @@ typedef struct JavaVMAttachArgs { #define JDK1_2 #define JDK1_4 +#define JDK1_8 struct JNIInvokeInterface_ { void *reserved0; @@ -1923,6 +1926,7 @@ JNI_OnUnload(JavaVM *vm, void *reserved); #define JNI_VERSION_1_2 0x00010002 #define JNI_VERSION_1_4 0x00010004 #define JNI_VERSION_1_6 0x00010006 +#define JNI_VERSION_1_8 0x00010008 #endif /* __GLUEGEN__ */ diff --git a/src/java/com/jogamp/common/os/DynamicLibraryBundle.java b/src/java/com/jogamp/common/os/DynamicLibraryBundle.java index a3d6198..fee3c01 100644 --- a/src/java/com/jogamp/common/os/DynamicLibraryBundle.java +++ b/src/java/com/jogamp/common/os/DynamicLibraryBundle.java @@ -282,7 +282,7 @@ public class DynamicLibraryBundle implements DynamicLookupHelper { } } else { if( null == dynLinkGlobal ) { - dynLinkGlobal = lib.getDynamicLinker(); + dynLinkGlobal = lib.dynamicLinker(); } nativeLibraries.add(lib); toolLibLoaded[i]=true; 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..1b05700 100644 --- a/src/java/com/jogamp/common/os/NativeLibrary.java +++ b/src/java/com/jogamp/common/os/NativeLibrary.java @@ -94,6 +94,12 @@ public final class NativeLibrary implements DynamicLookupHelper { isOSX = true; break; + case IOS: + prefixes = new String[] { "lib" }; + suffixes = new String[] { ".dylib" }; + isOSX = true; + break; + /* case ANDROID: case FREEBSD: @@ -210,28 +216,7 @@ public final class NativeLibrary implements DynamicLookupHelper { loader); Platform.initSingleton(); // loads native gluegen-rt library - final DynamicLinker dynLink; - switch (PlatformPropsImpl.OS_TYPE) { - case WINDOWS: - dynLink = new WindowsDynamicLinkerImpl(); - break; - - case MACOS: - dynLink = new MacOSXDynamicLinkerImpl(); - break; - - case ANDROID: - if( PlatformPropsImpl.CPU_ARCH.is32Bit ) { - dynLink = new BionicDynamicLinker32bitImpl(); - } else { - dynLink = new BionicDynamicLinker64BitImpl(); - } - break; - - default: - dynLink = new PosixDynamicLinkerImpl(); - break; - } + final DynamicLinker dynLink = getDynamicLinker(); // Iterate down these and see which one if any we can actually find. for (final Iterator<String> iter = possiblePaths.iterator(); iter.hasNext(); ) { @@ -310,7 +295,34 @@ public final class NativeLibrary implements DynamicLookupHelper { return dynLink.lookupSymbolGlobal(funcName); } - /* pp */ final DynamicLinker getDynamicLinker() { return dynLink; } + /* pp */ final DynamicLinker dynamicLinker() { return dynLink; } + + /* pp */ static DynamicLinker getDynamicLinker() { + final DynamicLinker dynLink; + switch (PlatformPropsImpl.OS_TYPE) { + case WINDOWS: + dynLink = new WindowsDynamicLinkerImpl(); + break; + + case MACOS: + case IOS: + dynLink = new MacOSXDynamicLinkerImpl(); + break; + + case ANDROID: + if( PlatformPropsImpl.CPU_ARCH.is32Bit ) { + dynLink = new BionicDynamicLinker32bitImpl(); + } else { + dynLink = new BionicDynamicLinker64BitImpl(); + } + break; + + default: + dynLink = new PosixDynamicLinkerImpl(); + break; + } + return dynLink; + } /** Retrieves the low-level library handle from this NativeLibrary object. On the Windows platform this is an HMODULE, and on Unix @@ -431,9 +443,9 @@ public final class NativeLibrary implements DynamicLookupHelper { // Add probable Mac OS X-specific paths if ( isOSX ) { // Add historical location - addPaths("/Library/Frameworks/" + libName + ".Framework", baseNames, paths); + addPaths("/Library/Frameworks/" + libName + ".framework", baseNames, paths); // Add current location - addPaths("/System/Library/Frameworks/" + libName + ".Framework", baseNames, paths); + addPaths("/System/Library/Frameworks/" + libName + ".framework", baseNames, paths); } } @@ -526,6 +538,7 @@ public final class NativeLibrary implements DynamicLookupHelper { return windowsLibName; case MACOS: + case IOS: return macOSXLibName; default: @@ -601,8 +614,11 @@ public final class NativeLibrary implements DynamicLookupHelper { private static boolean initializedFindLibraryMethod = false; private static Method findLibraryMethod = null; private static final String findLibraryImpl(final String libName, final ClassLoader loader) { + if( PlatformPropsImpl.JAVA_9 ) { + return null; + } 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..1bd3b9d 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 { @@ -255,8 +255,11 @@ public class Platform extends PlatformPropsImpl { private static final String useTempJarCachePropName = "jogamp.gluegen.UseTempJarCache"; - /** fixed basename of JAR file and native library */ - private static final String libBaseName = "gluegen-rt"; + /** + * Fixed basename of JAR file and native library. + * Dash replaced by underscore to allow static linkage via JEP 178. + */ + private static final String libBaseName = "gluegen_rt"; // // static initialization order: @@ -302,7 +305,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..1e09034 100644 --- a/src/java/com/jogamp/common/util/VersionUtil.java +++ b/src/java/com/jogamp/common/util/VersionUtil.java @@ -74,7 +74,9 @@ public class VersionUtil { sb.append(", Runtime: ").append(Platform.getJavaRuntimeName()).append(Platform.getNewline()); sb.append("Platform: Java Vendor: ").append(Platform.getJavaVendor()).append(", ").append(Platform.getJavaVendorURL()); sb.append(", JavaSE: ").append(PlatformPropsImpl.JAVA_SE); + sb.append(", Java9: ").append(PlatformPropsImpl.JAVA_9); 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/DynamicLinkerImpl.java b/src/java/jogamp/common/os/DynamicLinkerImpl.java index 56a909e..5ce94c1 100644 --- a/src/java/jogamp/common/os/DynamicLinkerImpl.java +++ b/src/java/jogamp/common/os/DynamicLinkerImpl.java @@ -144,14 +144,15 @@ import com.jogamp.common.util.SecurityUtil; @Override public final void closeLibrary(final long libraryHandle, final boolean debug) throws SecurityException, IllegalArgumentException { final LibRef libRef = decrLibRefCount( libraryHandle ); - if( null == libRef ) { - throw new IllegalArgumentException("Library handle 0x"+Long.toHexString(libraryHandle)+" unknown."); - } - checkLinkPermission(libRef.getName()); + if( null != libRef ) { + checkLinkPermission(libRef.getName()); + } // else null libRef is OK for global lookup if( DEBUG || debug ) { System.err.println("DynamicLinkerImpl.closeLibrary(0x"+Long.toHexString(libraryHandle)+" -> "+libRef+")"); } - closeLibraryImpl(libraryHandle); + if( 0 != libraryHandle ) { + closeLibraryImpl(libraryHandle); + } } protected abstract void closeLibraryImpl(final long libraryHandle) throws SecurityException; 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..2900c99 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); @@ -65,8 +65,8 @@ public abstract class PlatformPropsImpl { public static final VersionNumber Version17; /** Version 1.8. As a JVM version, it enables certain JVM 1.8 features. */ public static final VersionNumber Version18; - /** Version 1.9. As a JVM version, it enables certain JVM 1.9 features. */ - public static final VersionNumber Version19; + /** Version 1.9. As a JVM version, it enables certain JVM 1.9 features. Note the skipped first version number due to JEP 223. */ + public static final VersionNumber Version9; public static final String OS; public static final String OS_lower; @@ -93,6 +93,17 @@ public abstract class PlatformPropsImpl { * </p> */ public static final boolean JAVA_6; + /** + * True only if being compatible w/ language level 9, e.g. JRE 9. + * <p> + * Implies {@link #isJavaSE()} and {@link #JAVA_6}. + * </p> + * <p> + * Since JRE 9, the version string has dropped the major release number, + * see JEP 223: http://openjdk.java.net/jeps/223 + * </p> + */ + public static final boolean JAVA_9; public static final String NEWLINE; public static final boolean LITTLE_ENDIAN; @@ -101,12 +112,20 @@ 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); Version17 = new VersionNumber(1, 7, 0); Version18 = new VersionNumber(1, 8, 0); - Version19 = new VersionNumber(1, 9, 0); + Version9 = new VersionNumber(9, 0, 0); // We don't seem to need an AccessController.doPrivileged() block // here as these system properties are visible even to unsigned Applets. @@ -135,7 +154,8 @@ public abstract class PlatformPropsImpl { JAVA_VM_NAME = System.getProperty("java.vm.name"); JAVA_RUNTIME_NAME = getJavaRuntimeNameImpl(); JAVA_SE = initIsJavaSE(); - JAVA_6 = JAVA_SE && ( isAndroid || JAVA_VERSION_NUMBER.compareTo(Version16) >= 0 ) ; + JAVA_9 = JAVA_SE && JAVA_VERSION_NUMBER.compareTo(Version9) >= 0; + JAVA_6 = JAVA_SE && ( isAndroid || JAVA_9 || JAVA_VERSION_NUMBER.compareTo(Version16) >= 0 ) ; NEWLINE = System.getProperty("line.separator"); @@ -318,8 +338,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 +517,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 +635,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; diff --git a/src/java/jogamp/common/os/UnixDynamicLinkerImpl.java b/src/java/jogamp/common/os/UnixDynamicLinkerImpl.java index 5e8ba9d..ddaeea2 100644 --- a/src/java/jogamp/common/os/UnixDynamicLinkerImpl.java +++ b/src/java/jogamp/common/os/UnixDynamicLinkerImpl.java @@ -49,15 +49,16 @@ package jogamp.common.os; @Override protected final long lookupSymbolLocalImpl(final long libraryHandle, final String symbolName) throws SecurityException { - return dlsym(libraryHandle, symbolName); + return 0 != libraryHandle ? dlsym(libraryHandle, symbolName) : 0; } @Override protected final void closeLibraryImpl(final long libraryHandle) throws SecurityException { - dlclose(libraryHandle); + if( 0 != libraryHandle ) { + dlclose(libraryHandle); + } } - @Override public final String getLastError() { return dlerror(); diff --git a/src/native/common/JVM_JNI8.c b/src/native/common/JVM_JNI8.c new file mode 100644 index 0000000..8b9848c --- /dev/null +++ b/src/native/common/JVM_JNI8.c @@ -0,0 +1,42 @@ +/** + * Copyright 2019 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ + +#include <stdio.h> //required by android to identify NULL +#include <jni.h> + +#if defined (JNI_VERSION_1_8) + +JNIEXPORT jint JNICALL JNI_OnLoad_gluegen_rt(JavaVM *vm, void *reserved) { + return JNI_VERSION_1_8; +} + +JNIEXPORT void JNICALL JNI_OnUnload_gluegen_rt(JavaVM *vm, void *reserved) { +} + +#endif /* defined (JNI_VERSION_1_8) */ + |