summaryrefslogtreecommitdiffstats
path: root/samples/xpcom.ant
blob: b1da4b22e9c23206f80f9a14c170cfee264075b4 (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
<?xml version="1.0"?>
<!--

Copyright 2004 The Ant-Contrib project

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->

<!--  

Builds Mozilla xpcom/sample

-->
<project name="xpcom" default="test-all">

<property name="base.dir" value="."/>
<property name="debug" value="true"/>
<property name="compiler" value="gcc"/>
<property name="build.dir" location="build"/>
<property name="obj.dir" location="${build.dir}/obj"/>
<!-- specify api="unix" or api="win32" override platform default -->
<property name="api" value="default"/>
<property name="mozinclude.dir" location="${base.dir}/dist/include"/>
<property name="mozlib.dir" location="${base.dir}/dist/lib"/>

<taskdef resource="cpptasks.tasks"/>
<typedef resource="cpptasks.types"/>

<target name="usage">
	<echo message="Builds Mozilla xpcom/sample."/>
	<echo message="Usage:"/>
	<echo message="ant -f xpcom.ant -Dbase.dir=/home/someuser/mozilla"/>
	<echo message="    -Dcompiler=[gcc | msvc | icc | bcc ...]"/>
</target>

<target name="init">
	<mkdir dir="${build.dir}"/>
	<property name="obj.dir" value="${build.dir}/obj"/>
	<mkdir dir="${obj.dir}"/>
	<condition property="is-gcc">
		<or>
			<equals arg1="${compiler}" arg2="gcc"/>
			<equals arg1="${compiler}" arg2="g++"/>
		</or>
	</condition>
	<condition property="is-msvc">
		<or>
			<equals arg1="${compiler}" arg2="msvc"/>
		</or>
	</condition>
	<condition property="is-windows"><os family="windows"/></condition>
	<condition property="is-win32">
		<or>
			<equals arg1="${api}" arg2="win32"/>
			<and>
				<equals arg1="${api}" arg2="default"/>
				<isset property="is-windows"/>
			</and>
		</or>
	</condition>
	<property environment="env"/>
	<!--  in case not set in environment, use an insignificant value -->
	<property name="env.LD_LIBRARY_PATH" value="."/>
</target>

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


<target name="build-xpcomsample" depends="init">
    <mkdir dir="${obj.dir}"/>

       <!--  compile .idl files, places generated files on obj.dir  -->
	<cc objdir="${obj.dir}">
            <!--  runs xpidl twice to create .h and .xpt files   -->
            <compiler name="xpidl" inherit="false">
            	<includepath path="${base.dir}/dist/idl"/>
    			<fileset dir="${base.dir}/xpcom/sample" includes="*.idl"/>
            </compiler>
    </cc>
    <cc objdir="${obj.dir}" 
        outtype="shared" 
        outfile="${build.dir}/xpcomsample"
        rtti="false"
        exceptions="false">
    	<fileset dir="${base.dir}/xpcom/sample" includes="*.cpp"/>
    	<defineset define="XPCOM_GLUE,HAVE_DEPENDENT_LIBS,MOZILLA_CLIENT"/>
    	<defineset>
    		<define name="OSTYPE" value="Linux2.4"/>
    		<define name="OSARCH" value="Linux"/>
    	</defineset>
    	<defineset if="is-debug" define="DEBUG, _DEBUG, TRACING"/>
    	<includepath path="${obj.dir}"/>
    	<includepath path="${base.dir}/xpcom/sample"/>
    	<includepath path="${mozinclude.dir};${mozinclude.dir}/string:${mozinclude.dir}/xpcom;${mozinclude.dir}/nspr"/>
    	<compilerarg value="-fshort-wchar"/>
    	<compilerarg value="-pthread"/>
    	<libset dir="${mozlib.dir}" libs="xpcomglue, plds4, plc4, nspr4"/>
    	<syslibset libs="pthread, dl, m"/>    	
    </cc>
</target>



<target name="all" depends="build-xpcomsample"/>

<target name="test-all" depends="build-xpcomsample"/>

</project>