summaryrefslogtreecommitdiffstats
path: root/build.xml
blob: 9a83b03f139f99f1208a7de92485bff5350d80df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<?xml version="1.0" encoding="UTF-8"?>

<project name="jocl-demos" default="default" basedir=".">
    <description>Builds, tests, and runs the project jocl-demos.</description>

    <condition property="rootrel.build" value="build">
      <not>
          <isset property="rootrel.build"/>
      </not>
    </condition>

    <import file="nbproject/build-impl.xml"/>
    
    <property file="nbproject/project.properties" />

    <!-- Pull in GlueGen cpptasks build file -->
    <import file="${gluegen.root}/make/gluegen-cpptasks.xml" />
    <import file="${gluegen.root}/make/jogamp-env.xml" />
    <import file="${gluegen.root}/make/jogamp-archivetasks.xml" />

    <target name="set.debug">
        <property name="javacdebug"       value="true" /> 
        <property name="javacdebuglevel"  value="source,lines,vars" /> 
    </target>

    <target name="-pre-init" depends="jogamp.env.init">
        <property name="javac.debug" value="${javacdebug}"/>
        <property name="javac.debuglevel" value="${javacdebuglevel}"/>
        <property name="javac.source" value="${target.sourcelevel}"/>
        <property name="javac.target" value="${target.targetlevel}"/>
        <property name="javac.compilerargs" value="-bootclasspath '${target.rt.jar}' -Xlint -g:${javacdebuglevel}"/>
    </target>

    <target name="-pre-jar" depends="jogamp.env.init">
        <property name="jocl-demos.build.number" value="manual" />
        <property name="jocl-demos.build.id"     value="${version.timestamp}" />
        <property name="jocl-demos.build.branch" value="master" />
        <property name="jocl-demos.build.commit" value="manual" />

        <property name="jocl-demos.version" value="${jogamp.version.base}-b${jocl-demos.build.number}-${version.timestamp}" />
    </target>

    <target name="-post-jar" depends="tag.build,create-all-jnlps,gluegen.cpptasks.detect.os,build-archive"/>

    <target name="build-archive" if="build.archiveon">
        <property name="archive.zip.name" value="jocl-demos-${jocl-demos.version}-${os.and.arch}"/>
        
        <mkdir dir="${build.dir}/${archive.zip.name}"/>
        
        <copy todir="${build.dir}/${archive.zip.name}" >
            <fileset dir="." includes="www/**"/>
            <fileset dir="${build.dir}" includes="jar/**"/>
            <fileset dir="${build.dir}" includes="jnlp-files/**"/>
            <fileset dir="${build.dir}" includes="*.properties"/>
        </copy>
        
        <archive.7z basedir="${build.dir}" destfile="${build.dir}/${archive.zip.name}.7z"  includes="${archive.zip.name}/**"/>

        <delete dir="${build.dir}/${archive.zip.name}"/>
        
    </target>

    <target name="create-all-jnlps">

        <!-- preset properties for local testing -->
        <property name="jocl.codepase"       value="JOCL_CODEBASE_TAG"/>
        <property name="jogl.codepase"       value="JOGL_CODEBASE_TAG"/>
        <property name="jocl-demos.codepase" value="DEMO_CODEBASE_TAG"/>
        
        <antcall target="create-jnlp" inheritrefs="true">
            <param name="jnlp.name"         value="glclinterop"/>
            <param name="jnlp.title"        value="JOGL - JOCL interoperability example."/>
            <param name="jnlp.jogl"         value="true"/>
            <param name="jnlp.mainclass"    value="com.jogamp.opencl.demos.joglinterop.GLCLInteroperabilityDemo"/>
        </antcall>

        <antcall target="create-jnlp" inheritrefs="true">
            <param name="jnlp.name"         value="julia3d"/>
            <param name="jnlp.title"        value="3D Julia Set Fractal demo."/>
            <param name="jnlp.jogl"         value="true"/>
            <param name="jnlp.mainclass"    value="com.jogamp.opencl.demos.julia3d.Julia3d"/>
        </antcall>

        <antcall target="create-jnlp" inheritrefs="true">
            <param name="jnlp.name"         value="multi-device-fractal"/>
            <param name="jnlp.title"        value="Multi Device Mandelbrot Fractal example."/>
            <param name="jnlp.jogl"         value="true"/>
            <param name="jnlp.mainclass"    value="com.jogamp.opencl.demos.fractal.MultiDeviceFractal"/>
        </antcall>

        <antcall target="create-jnlp" inheritrefs="true">
            <param name="jnlp.name"         value="clinfo"/>
            <param name="jnlp.title"        value="OpenCL diagnostics."/>
            <param name="jnlp.jogl"         value="false"/>
            <param name="jnlp.mainclass"    value="com.jogamp.opencl.demos.info.CLInfo"/>
        </antcall>

        <antcall target="create-jnlp" inheritrefs="true">
            <param name="jnlp.name"         value="gamma"/>
            <param name="jnlp.title"        value="Simple gamma correction."/>
            <param name="jnlp.jogl"         value="false"/>
            <param name="jnlp.mainclass"    value="com.jogamp.opencl.demos.gamma.CLSimpleGammaCorrection"/>
        </antcall>
        
    </target>

    <target name="tag.build">
        <copy file="${jocl.root}/${rootrel.build}/artifact.properties" todir="${build.dir}" overwrite="true"/>
        <echo file="${build.dir}/artifact.properties" message="jocl-demos.build.number=${jocl-demos.build.number}${line.separator}" append="true" />
        <echo file="${build.dir}/artifact.properties" message="jocl-demos.build.id=${jocl-demos.build.id}${line.separator}" append="true" />
        <echo file="${build.dir}/artifact.properties" message="jocl-demos.build.branch=${jocl-demos.build.branch}${line.separator}" append="true" />
        <echo file="${build.dir}/artifact.properties" message="jocl-demos.build.commit=${jocl-demos.build.commit}${line.separator}" append="true" />
    </target>

    <target name="create-jnlp">
        <condition  property="jogl.extension"
                    value='&lt;extension name="jogl-all-awt" href="${jogl.codepase}/jogl-all-awt.jnlp"/&gt;'
                    else="">
            <istrue value="${jnlp.jogl}"/>
        </condition>
        <copy file="demo-template.jnlp" tofile="${build.dir}/jnlp-files/${jnlp.name}.jnlp">
            <filterchain>
                <replacestring from="DEMO_TITLE" to="${jnlp.title}"/>
                <replacestring from="NAME_TAG" to="${jnlp.name}"/>
                <replacestring from="CLASS_TAG" to="${jnlp.mainclass}"/>
                <replacestring from="DEMO_CODEBASE_TAG" to="${jocl-demos.codepase}"/>
                <replacestring from="JOCL_CODEBASE_TAG" to="${jocl.codepase}"/>
                <replacestring from="EXTENSION" to="${jogl.extension}"/>
            </filterchain>
        </copy>
    </target>

    <target name="all" description="Release build" depends="default"/>
    <target name="all.debug" description="Debug build" depends="set.debug, default"/>
    <target name="all.ide" description="Debug IDE build, no tagging or archives" depends="set.debug, compile"/>

</project>