diff options
author | Sven Gothel <[email protected]> | 2013-08-28 02:44:29 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-08-28 02:44:29 +0200 |
commit | 15ec34db947f89b1d20043b729a09413a425de5d (patch) | |
tree | d5545d00009717cdabbb6e52963dbcdea7cc48b9 /make/build-jogl.xml | |
parent | 5031a42647442b71ef32041d332ed5f22d3e6ecf (diff) |
Fix libav/ffmpeg compilation: Use 'dot less' dir/file names; Compile ffmpeg version dependent c-files individually and inject object files. ; ffmpeg *register_all() at setStream0(..)
- Use 'dot less' dir/file names
- Compile ffmpeg version dependent c-files individually and inject object files.
- ffmpeg *register_all() at setStream0(..)
- Only register devices if available _and_ camera is requested.
Diffstat (limited to 'make/build-jogl.xml')
-rw-r--r-- | make/build-jogl.xml | 108 |
1 files changed, 95 insertions, 13 deletions
diff --git a/make/build-jogl.xml b/make/build-jogl.xml index ee40c7e10..58ce64b6f 100644 --- a/make/build-jogl.xml +++ b/make/build-jogl.xml @@ -243,6 +243,7 @@ <!-- The compiler output directories. --> <property name="classes" value="${build.jogl}/classes" /> <property name="obj.joglsub" value="${obj.jogl}/jogl" /> + <property name="rootrel.obj.joglsub" value="${rootrel.obj.jogl}/jogl"/> <property name="obj.cgsub" value="${obj.jogl}/cg" /> <property name="javah.classpath" value="${gluegen-rt.jar}:${build.nativewindow}/classes:${classes}" /> @@ -1407,8 +1408,75 @@ <move file="${src}" tofile="${dest}" /> </target> + <!-- Only compile the ffmpeg version depending source files + against their respective header files! + We do not use the resulting static libraries directly, + but inject their obj-files in build.c for the jogl_* library! --> + <macrodef name="c.build.ffmpeg"> + <attribute name="version.lav" /> + <attribute name="compiler.cfg.id" /> + <attribute name="linker.cfg.id" /> + <attribute name="output.lib.name" /> + <attribute name="c.compiler.use-jawt" default="false"/> + <sequential> + <echo message="Output lib name = @{output.lib.name}" /> + + <condition property="c.compiler.use-debug"><istrue value="${c.compiler.debug}"/></condition> + + <patternset id="c.src.files.@{version.lav}"> + <include name="${rootrel.src.c.libav}/ffmpeg_@{version.lav}.c"/> + </patternset> + + <echo message="Compiling @{output.lib.name}" /> + + <!-- have to wrap cc task with outofdate, because otherwise cc links a new library + even when no files have been compiled --> + <outofdate> + <sourcefiles> + <fileset dir="${project.root}"><patternset refid="c.src.files.@{version.lav}"/></fileset> + <fileset dir="${project.root}" includes="${rootrel.src.c.libav}/*"/> + </sourcefiles> + <targetfiles> + <fileset dir="${obj.joglsub}" includes="lib@{output.lib.name}.so"/> + <fileset dir="${obj.joglsub}" includes="@{output.lib.name}.dll"/> + <fileset dir="${obj.joglsub}" includes="lib@{output.lib.name}.jnilib"/> + </targetfiles> + <sequential> + <cc outtype="shared" + objdir="${obj.joglsub}" + outfile="${obj.joglsub}/@{output.lib.name}" + optimize="${c.compiler.optimise}" + debug="${c.compiler.debug}" + multithreaded="true" + exceptions="false" + rtti="false"> + + <fileset dir="${project.root}"><patternset refid="c.src.files.@{version.lav}"/></fileset> + + <compiler extends="@{compiler.cfg.id}" > + <sysincludepath path="${java.includes.dir}"/> + <sysincludepath path="${java.includes.dir.platform}"/> + <sysincludepath path="${stub.includes.gluegen.cc}"/> + <includepath path="stub_includes/khr"/> + <includepath path="stub_includes/opengl"/> + <includepath path="stub_includes/libav/@{version.lav}"/> + + <!-- This is for the generated headers for handwritten C code --> + <includepath path="${src.c}"/> + <includepath path="${src.generated.c.libav}" /> + + <!-- This must come last to not override real include paths --> + <!-- includepath path="stub_includes/macosx" if="isOSX" / --> + </compiler> + </cc> + </sequential> + </outofdate> + </sequential> + </macrodef> + <macrodef name="c.build"> <attribute name="c.compiler.src.files" /> + <attribute name="c.compiler.obj.files" /> <attribute name="compiler.cfg.id" /> <attribute name="linker.cfg.id" /> <attribute name="output.lib.name" /> @@ -1416,13 +1484,15 @@ <sequential> <echo message="Output lib name = @{output.lib.name}" /> - <!-- NOTE: the value of the debug and optimise attributes will not be overridden if already set externally --> - <property name="c.compiler.debug" value="false" /> - <!-- Optimise flags one of { none, size, speed, minimal, full, aggressive, extreme, unsafe } --> - <property name="c.compiler.optimise" value="none" /> - <condition property="c.compiler.use-debug"><istrue value="${c.compiler.debug}"/></condition> + <patternset id="c.obj.files.none"> + </patternset> + <patternset id="c.obj.files.ffmpeg.inject"> + <include name="${rootrel.obj.joglsub}/ffmpeg_lavc53_lavf53_lavu51.*"/> + <include name="${rootrel.obj.joglsub}/ffmpeg_lavc54_lavf54_lavu52_lavr01.*"/> + </patternset> + <patternset id="c.src.files.jogl.desktop"> <include name="${rootrel.src.c}/JoglCommon.c"/> <include name="${rootrel.src.c}/GLDebugMessageHandler.c"/> @@ -1434,9 +1504,7 @@ <include name="${rootrel.src.c}/GLXGetProcAddressARB.c" if="isX11"/> <!-- FIXME: the Mixer should be moved to another library --> <!--include name="${rootrel.src.c}/Mixer.cpp" if="isWindows"/--> - <include name="${rootrel.src.c.libav}/jogamp_opengl_util_av_impl_FFMPEGStaticNatives.c"/> - <include name="${rootrel.src.c.libav}/lavc53.lavf53.lavu51/jogamp_opengl_util_av_impl_FFMPEGv08Natives.c"/> - <include name="${rootrel.src.c.libav}/lavc54.lavf54.lavu52.lavr01/jogamp_opengl_util_av_impl_FFMPEGv09Natives.c"/> + <include name="${rootrel.src.c.libav}/ffmpeg_static.c"/> <include name="${rootrel.src.c.openmax}/omx_tool.c" if="setup.addNativeOpenMAX"/> <include name="${rootrel.src.c.openmax}/jogamp_opengl_util_av_impl_OMXGLMediaPlayer.c" if="setup.addNativeOpenMAX"/> @@ -1453,9 +1521,7 @@ <include name="${rootrel.src.c}/JoglCommon.c"/> <include name="${rootrel.src.c}/GLDebugMessageHandler.c"/> <include name="${rootrel.src.c}/GLXGetProcAddressARB.c" if="isX11"/> - <include name="${rootrel.src.c.libav}/jogamp_opengl_util_av_impl_FFMPEGStaticNatives.c"/> - <include name="${rootrel.src.c.libav}/lavc53.lavf53.lavu51/jogamp_opengl_util_av_impl_FFMPEGv08Natives.c"/> - <include name="${rootrel.src.c.libav}/lavc54.lavf54.lavu52.lavr01/jogamp_opengl_util_av_impl_FFMPEGv09Natives.c"/> + <include name="${rootrel.src.c.libav}/ffmpeg_static.c"/> <include name="${rootrel.src.c.openmax}/omx_tool.c" if="setup.addNativeOpenMAX"/> <include name="${rootrel.src.c.openmax}/jogamp_opengl_util_av_impl_OMXGLMediaPlayer.c" if="setup.addNativeOpenMAX"/> @@ -1479,7 +1545,7 @@ <outofdate> <sourcefiles> <fileset dir="${project.root}"><patternset refid="@{c.compiler.src.files}"/></fileset> - <fileset dir="${project.root}" includes="${rootrel.src.c.libav}/jogamp_opengl_util_av_impl_FFMPEGvXXNatives.c"/> + <fileset dir="${obj.joglsub}" includes="*jogl_ffmpegv08*, *jogl_ffmpegv09*"/> <!-- requires linkage --> </sourcefiles> <targetfiles> <fileset dir="${obj.jogl}" includes="lib@{output.lib.name}.so"/> @@ -1496,7 +1562,10 @@ exceptions="false" rtti="false"> - <fileset dir="${project.root}"><patternset refid="@{c.compiler.src.files}"/></fileset> + <fileset dir="${project.root}"> + <patternset refid="@{c.compiler.src.files}"/> + <patternset refid="@{c.compiler.obj.files}"/> + </fileset> <compiler extends="@{compiler.cfg.id}" > <sysincludepath path="${java.includes.dir}"/> @@ -1564,10 +1633,21 @@ <!-- Generate the waveout Mixer header --> <!-- FIXME: this is temporary until we move this to another workspace --> <!--javah destdir="${build.jogl}/gensrc/native/jogl" classpath="${javah.classpath}" class="com.jogamp.audio.windows.waveout.Mixer" /--> + + <c.build.ffmpeg version.lav="lavc53_lavf53_lavu51" + output.lib.name="jogl_ffmpegv08" + compiler.cfg.id="${compiler.cfg.id}" + linker.cfg.id="${linker.cfg.id.os}"/> + + <c.build.ffmpeg version.lav="lavc54_lavf54_lavu52_lavr01" + output.lib.name="jogl_ffmpegv09" + compiler.cfg.id="${compiler.cfg.id}" + linker.cfg.id="${linker.cfg.id.os}"/> </target> <target name="c.build.jogl.desktop" unless="setup.noNativeDesktop"> <c.build c.compiler.src.files="c.src.files.jogl.desktop" + c.compiler.obj.files="c.obj.files.ffmpeg.inject" output.lib.name="jogl_desktop" compiler.cfg.id="${compiler.cfg.id}" linker.cfg.id="${linker.cfg.id.os}"/> @@ -1575,6 +1655,7 @@ <target name="c.build.jogl.mobile"> <c.build c.compiler.src.files="c.src.files.jogl.mobile" + c.compiler.obj.files="c.obj.files.ffmpeg.inject" output.lib.name="jogl_mobile" compiler.cfg.id="${compiler.cfg.id}" linker.cfg.id="${linker.cfg.id.os}"/> @@ -1582,6 +1663,7 @@ <target name="c.build.jogl.cg" if="setup.addNativeNVidiaCG"> <c.build c.compiler.src.files="c.src.files.cg" + c.compiler.obj.files="c.obj.files.none" output.lib.name="jogl_cg" compiler.cfg.id="${compiler.cfg.id}" linker.cfg.id="${linker.cfg.id.os}"/> |