diff options
author | Sven Gothel <[email protected]> | 2010-04-08 02:22:12 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-04-08 02:22:12 +0200 |
commit | 7cc4bb2a8bcc4c16b6a12826abbd874bf38f9dc1 (patch) | |
tree | eb932553d0f9b36dbe6d703356502bf352cc6eca /make/build-junit.xml | |
parent | 82ac66ba1e7494b0a76a2063f0d56d3b785c6c31 (diff) |
http://jogamp.org/bugzilla/show_bug.cgi?id=393
Fixed junit test: test1
- Create seperate native libraries to reflect a real world example:
test1 - the library to bind to (no more declaring __stdcall @nn functions)
BindingTest1p1 - the dynamic fixed linkage binding test1p1,
references dynamic library test1 at linktime.
BindingTest1p2 - the dynamic runtime linkage binding test1p2,
loads dynamic library test1 at runtime.
Generic:
- gluegen-cpptasks-base.xml
- target 'gluegen.cpptasks.detect.os'
Set new property 'system.env.library.path'
DYLD_LIBRARY_PATH (macosx)
LD_LIBRARY_PATH (unix)
PATH (windows)
- target 'gluegen.cpptasks.striplibs'
Strips the symbols out of the native libraries
in case c.compiler.debug is false.
Maybe configured with the properties:
c.strip.tool, c.strip.args
- Using system.env.library.path in junit call
to find the test1 library in case of runtime linkage and lookup (test1p2).
- Use gluegen.cpptasks.striplibs for all native libs ..
- Added macosx32 in analogy to macosx64, both defaults to true now
- com.jogamp.common.os.WindowsDynamicLinkerImpl:lookupSymbol()
- Added lookup for __stdcall @nn (stepping alignment 4, max-args: 12)
in case no undecorated __cdecl symbol is found.
Fixed Windows platform:
- Use proper path.seperator on Windows.
- test1.dll needs proper soname inside for fixed linkage (test1p1)
hence the output name must be test1.dll, not libtest1.so
+++
http://jogamp.org/bugzilla/show_bug.cgi?id=394
Fix MacOsX platform:
The commit of cpptasks.jar, git hash 129e783741d91e9ee5cd7da5d5c962c32ec96b0b,
broke the universal binary build on MacOSX.
The above change used cpptasks-1.05b with a few patches in regards to crosscompilation,
but missed one, which accepts the '-arch' argument for GccLinker undecorated.
The new cpptasks.jar is vanilla 1.05b + cpptasks-1.0b5-darwin-patch.diff,
the latter a more refined one.
This version accepts the '-arch' argument undecorated on the darwin platform.
+++
Diffstat (limited to 'make/build-junit.xml')
-rw-r--r-- | make/build-junit.xml | 103 |
1 files changed, 72 insertions, 31 deletions
diff --git a/make/build-junit.xml b/make/build-junit.xml index f1f3b6f..2da5997 100644 --- a/make/build-junit.xml +++ b/make/build-junit.xml @@ -121,10 +121,8 @@ <property name="linker.cfg.id" value="${linker.cfg.id.base}" /> </target> - <target name="rename.mingw.dll" if="isMingW"> - <move file="${src}" tofile="${dest}" /> - </target> - + <!-- FIXME: this is a hack; the cpptask should have an option to change the + suffix or at least understand the override from dylib to jnilib --> <target name="rename.dylib" if="isOSX"> <move file="${src}" tofile="${dest}" /> </target> @@ -172,33 +170,30 @@ <syslibset dir="${java.lib.dir.platform}/server" libs="jvm" if="@{output.lib.name}.useLibJVM"/> </linker> </cc> - - <!-- FIXME: this is a hack; the cpptask should have an option to change the - suffix or at least understand the override from dylib to jnilib --> - <antcall target="rename.dylib" inheritRefs="true"> - <param name="src" value="${build_t.lib}/lib@{output.lib.name}.dylib" /> - <param name="dest" value="${build_t.lib}/lib@{output.lib.name}.jnilib" /> - </antcall> - - <!-- FIXME: this is a hack; the cpptask should have an option to change the - suffix or at least understand the override from dylib to jnilib --> - <antcall target="rename.mingw.dll" inheritRefs="true"> - <param name="src" value="${build_t.lib}/lib@{output.lib.name}.so" /> - <param name="dest" value="${build_t.lib}/@{output.lib.name}.dll" /> - </antcall> </sequential> </macrodef> - <target name="junit.compile" depends="init, java.generate, java.build, c.build"/> + <target name="junit.compile" depends="init, java.generate, java.build, native.build"/> + + <target name="junit.run" depends="init,gluegen.cpptasks.detect.os"> + <!-- Use absolute path --> + <property name="gluegen.lib.abs" location="${gluegen.lib}" /> + <property name="build_t.lib.abs" location="${build_t.lib}" /> + - <target name="junit.run" depends="init"> <!-- Perform the junit tests--> <mkdir dir="${results}"/> <junit forkmode="once" showoutput="true" fork="true"> - <jvmarg value="-Djava.library.path=${gluegen.lib}:${build_t.lib}"/> + <env key="${system.env.library.path}" path="${gluegen.lib.abs}${path.separator}${build_t.lib.abs}"/> + <jvmarg value="-Djava.library.path=${gluegen.lib.abs}${path.separator}${build_t.lib.abs}"/> <jvmarg value="-Drootrel.build=${rootrel.build}"/> - <!--jvmarg value="-Dgluegen.debug.NativeLibrary=true"/--> - <!--jvmarg value="-Dgluegen.debug.ProcAddressHelper=true"/--> + <!-- + <jvmarg value="-Dgluegen.debug.NativeLibrary=true"/> + <jvmarg value="-Dgluegen.debug.ProcAddressHelper=true"/> + <jvmarg value="-verbose:jni"/> + <jvmarg value="-client"/> + <jvmarg value="-d32"/> + --> <formatter usefile="false" type="plain"/> <formatter usefile="true" type="xml"/> <classpath refid="junit.run.classpath"/> @@ -221,7 +216,12 @@ <target name="java.generate" depends="junit.test1.java.generate"/> - <target name="c.build" depends="c.configure, junit.test1.c.build" unless="build.javaonly" /> + <target name="native.build" depends="c.configure, junit.test1.c.build" unless="build.javaonly"> + <antcall target="gluegen.cpptasks.striplibs" inheritRefs="true"> + <param name="libdir" value="${build_t.lib}"/> + </antcall> + </target> + <!-- @@ -266,30 +266,71 @@ </gluegen> </target> - <target name="junit.test1.c.build" depends="junit.test1p1.c.build, junit.test1p2.c.build" unless="build.javaonly" /> + <target name="junit.test1.c.build" depends="junit.test1i.c.build, junit.test1p1.c.build, junit.test1p2.c.build" unless="build.javaonly" /> + + <!-- this is the test1 implementation --> + <target name="junit.test1i.c.build"> + <patternset id="junit.test1i.c.src.files"> + <include name="${test.junit.rootrel}/generation/test1.c"/> + </patternset> + + <!-- Windows hacks ro make a proper DLL --> + <linker id="linker.test1.dll.cfg.id" extends="${linker.cfg.id}"> + <linkerarg value="-Wl,-soname=test1.dll" if="isMingW"/> + <linkerarg value="-Wl,--output=test1.dll" if="isMingW"/> + </linker> + <c.build c.compiler.src.files="junit.test1i.c.src.files" + output.lib.name="test1" + compiler.cfg.id="${compiler.cfg.id}" + linker.cfg.id="linker.test1.dll.cfg.id"/> + </target> + + <!-- this is a fixed binding to the test1 implementation --> <target name="junit.test1p1.c.build"> + <linker id="linker.test1.fixed.cfg.id" extends="${linker.cfg.id}"> + <linkerarg value="-Wl,-soname=BindingTest1p1.dll" if="isMingW"/> + <linkerarg value="-Wl,--output=BindingTest1p1.dll" if="isMingW"/> + <syslibset dir="${build_t.lib}" libs="test1"/> + </linker> + <patternset id="junit.test1p1.c.src.files"> - <include name="${test.junit.rootrel}/generation/test1.c"/> <include name="${build_t.gen.rootrel}/native/BindingTest1p1Impl_JNI.c"/> </patternset> <c.build c.compiler.src.files="junit.test1p1.c.src.files" - output.lib.name="test1p1" + output.lib.name="BindingTest1p1" compiler.cfg.id="${compiler.cfg.id}" - linker.cfg.id="${linker.cfg.id}"/> + linker.cfg.id="linker.test1.fixed.cfg.id"/> + + <antcall target="rename.dylib" inheritRefs="true"> + <param name="src" value="${build_t.lib}/libBindingTest1p1.dylib" /> + <param name="dest" value="${build_t.lib}/libBindingTest1p1.jnilib" /> + </antcall> + </target> + <!-- this is a dynamic lookup binding to the test1 implementation --> <target name="junit.test1p2.c.build"> + <linker id="linker.test1.runtime.cfg.id" extends="${linker.cfg.id}"> + <linkerarg value="-Wl,-soname=BindingTest1p2.dll" if="isMingW"/> + <linkerarg value="-Wl,--output=BindingTest1p2.dll" if="isMingW"/> + </linker> + <patternset id="junit.test1p2.c.src.files"> - <include name="${test.junit.rootrel}/generation/test1.c"/> <include name="${build_t.gen.rootrel}/native/BindingTest1p2Impl_JNI.c"/> </patternset> <c.build c.compiler.src.files="junit.test1p2.c.src.files" - output.lib.name="test1p2" + output.lib.name="BindingTest1p2" compiler.cfg.id="${compiler.cfg.id}" - linker.cfg.id="${linker.cfg.id}"/> + linker.cfg.id="linker.test1.runtime.cfg.id"/> + + <antcall target="rename.dylib" inheritRefs="true"> + <param name="src" value="${build_t.lib}/libBindingTest1p2.dylib" /> + <param name="dest" value="${build_t.lib}/libBindingTest1p2.jnilib" /> + </antcall> + </target> <!-- |