forked from micro-manager/micro-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
224 lines (192 loc) · 7.96 KB
/
build.xml
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
<!-- Build all components of Micro-Manager -->
<!-- Run 'ant -p' for usage -->
<project name="mm" basedir="." default="build">
<fail message="Micro-Manager Ant build files are currently designed for Windows only">
<condition><not><os family="winnt"/></not></condition>
</fail>
<include file="buildscripts/buildprops.xml"/>
<import file="buildscripts/version.xml"/>
<macrodef name="run-all-java-projects">
<attribute name="target"/>
<sequential>
<subant target="@{target}" inheritall="true">
<property name="mm.java.installdir" value="${mm.java.installdir}"/>
<property name="mm.java.plugin.installdir" value="${mm.java.plugin.installdir}"/>
<property name="mm.java.autofocus.installdir" value="${mm.java.autofocus.installdir}"/>
<filelist dir="${mm.basedir}">
<!-- Note: Order matters -->
<file name="MMCoreJ_wrap/build.xml"/>
<file name="mmstudio/build.xml"/>
<file name="acqEngine/build.xml"/>
<file name="plugins/build.xml"/>
<file name="autofocus/build.xml"/>
</filelist>
</subant>
</sequential>
</macrodef>
<target name="build-buildtools">
<ant antfile="buildscripts/AntExtensions/build.xml" useNativeBasedir="true" target="jar"/>
</target>
<target name="build-cpp" description="Build all C++ components">
<mm-msbuild project="micromanager.sln" target="Build" failonerror="${mm.build.failonerror}"
logbasename="msbuild-micromanager${mm.build.logsuffix}"/>
</target>
<target name="build-java" depends="build-buildtools"
description="Build all Java components (will NOT trigger build-cpp; requires MMCoreJ_wrap DLL)">
<run-all-java-projects target="jar"/>
</target>
<target name="build" depends="set-version,build-cpp,build-java" description="Build all components"/>
<target name="stage-deviceadapters" unless="mm.build.stage.demo.only">
<copy todir="${mm.dll.installdir}">
<fileset dir="${mm.cpp.outdir}" includes="mmgr_dal_*.dll"/>
</copy>
<ant antfile="DeviceAdapters/build.xml" useNativeBasedir="true" target="install">
<property name="mm.dll.installdir" value="${mm.dll.installdir}"/>
<property name="mm.dll.helper.installdir" value="${mm.dll.helper.installdir}"/>
</ant>
</target>
<target name="stage-deviceadapters-demo-only" if="mm.build.stage.demo.only">
<copy todir="${mm.dll.installdir}">
<fileset file="${mm.cpp.outdir}/mmgr_dal_DemoCamera.dll"/>
</copy>
</target>
<target name="stage-only" description="Gather files to be installed (will NOT trigger build)">
<antcall target="stage-deviceadapters"/>
<antcall target="stage-deviceadapters-demo-only"/>
<run-all-java-projects target="install-only"/>
<!-- MMCoreJ DLL -->
<!-- XXX Should be staged by MMCoreJ_wrap/build.xml -->
<copy todir="${mm.dll.installdir}">
<filelist dir="${mm.cpp.outdir}" files="MMCoreJ_wrap.dll"/>
</copy>
<!-- MMCorePy files -->
<!-- For staging purposes, MMCorePy is optional -->
<copy todir="${mm.installdir}" failonerror="${mm.build.failonerror}">
<filelist dir="${mm.cpp.outdir}" files="_MMCorePy.pyd"/>
<filelist dir="${mm.swig.pysrcdir}" files="MMCorePy.py"/>
</copy>
<!-- Files to distribute as is -->
<if>
<istrue value="${mm.build.for.imagej2updater}"/>
<then></then>
<else>
<copy todir="${mm.installdir}" failonerror="false">
<fileset dir="${mm.bindistdir}" includes="**"/>
<fileset dir="${mm.platform.bindistdir}" includes="**"/>
<fileset dir="${mm.common.bindistdir}" includes="**"/>
</copy>
</else>
</if>
<!-- XXX Remaining files to copy; should put elsewhere -->
<if>
<istrue value="${mm.build.for.imagej2updater}"/>
<then></then>
<else>
<copy todir="${mm.installdir}" file="${mm.thirdpartypublic}/JavaLauncher/ImageJ.exe"/>
<!-- Rename ij-*.jar to ij.jar and copy -->
<copy todir="${mm.installdir}" flatten="true">
<mapper type="regexp" from="ij-.*\.jar" to="ij.jar"/>
<fileset dir="${mm.ivy.lib.dir}/imagej" includes="ij-*.jar"/>
</copy>
</else>
</if>
<copy todir="${mm.java.installdir}">
<!-- Copy all JARs except for ij.jar -->
<fileset dir="${mm.ivy.lib.dir}/compile" includes="*.jar"/>
<fileset dir="${mm.ivy.lib.dir}/optional" includes="*.jar"/>
<fileset dir="${mm.ivy.lib.dir}/runtime" includes="*.jar"/>
</copy>
<if>
<istrue value="${mm.build.for.imagej2updater}"/>
<then></then>
<else>
<mkdir dir="${mm.scripts.installdir}"/>
<copy todir="${mm.scripts.installdir}">
<fileset dir="${mm.scripts.srcdir}" includes="*.bsh"/>
</copy>
</else>
</if>
<!-- Java runtime -->
<if>
<istrue value="${mm.build.for.imagej2updater}"/>
<then></then>
<else>
<copy todir="${mm.installdir}/jre" failonerror="false">
<fileset dir="${mm.java.runtime}"/>
</copy>
</else>
</if>
</target>
<target name="stage" depends="build-buildtools,set-version,build-cpp,build-java,stage-only"
description="Gather files to be installed (will trigger build)"/>
<target name="run" description="Run the staged application (will NOT trigger build or stage)">
<exec dir="${mm.installdir}" executable="${mm.installdir}/ImageJ.exe"/>
</target>
<target name="run-nolauncher" description="Run the staged application without using the ImageJ launcher">
<java classname="ij.ImageJ"
classpath="${mm.installdir}/ij.jar"
fork="yes" maxmemory="1000M"
dir="${mm.installdir}"/>
</target>
<target name="package" description="Create installer from staged files (will NOT trigger build or stage)">
<!-- Hack to allow the 'package' target to work in absence of
closed-source device adapters -->
<if>
<resourceexists>
<file file="${mm.installdir}/OlympusIX3Control/OlympusIX3Control.exe"/>
</resourceexists>
<then></then>
<else>
<mkdir dir="${mm.installdir}/OlympusIX3Control"/>
<touch file="${mm.installdir}/OlympusIX3Control/placeholder.txt"/>
</else>
</if>
<!-- Default name, if not set -->
<property name="mm.installer.basename" value="MMSetup_${mm.architecture.bits}bit"/>
<property name="mm.installer" value="${mm.installer.basename}.exe"/>
<mkdir dir="${mm.distdir}"/>
<delete file="${mm.distdir}/${mm.installer}"/>
<exec dir="${mm.basedir}" executable="${mm.basedir}/../3rdparty/Inno_Setup_5/iscc.exe"
failonerror="true">
<arg value="/O${mm.distdir}"/>
<arg value="/F${mm.installer.basename}"/>
<arg file="${mm.basedir}/buildscripts/installer-${mm.architecture}.iss"/>
</exec>
</target>
<target name="package-symbols" description="Create a ZIP archive of the PDB files (will NOT trigger build)">
<!-- Default name, if not set -->
<property name="mm.symbols.basename"
value="MMDebugSymbols_${mm.architecture}"/>
<property name="mm.symbols" value="${mm.symbols.basename}.zip"/>
<mkdir dir="${mm.symbolsdir}"/>
<zip destfile="${mm.symbolsdir}/${mm.symbols}"
basedir="${mm.cpp.outdir}"
includes="*.pdb"/>
</target>
<target name="clean-swig">
<!-- Delete SWIG-generated source
Sorry for the hard-coding, but even running the Clean
target using MSBuild doesn't seem to delete these. -->
<delete file="${mm.basedir}/MMCoreJ_wrap/MMCoreJ_wrap.cpp"/>
<delete file="${mm.basedir}/MMCoreJ_wrap/MMCoreJ_wrap.h"/>
<delete file="${mm.basedir}/MMCorePy_wrap/MMCorePy_wrap.cpp"/>
<delete file="${mm.basedir}/MMCorePy_wrap/MMCorePy_wrap.h"/>
</target>
<target name="clean-java" description="Clean only the Java components">
<run-all-java-projects target="clean"/>
</target>
<target name="clean" depends="clean-swig,clean-java" description="Delete build intermediate and output files">
<delete dir="${mm.cpp.outdir}"/>
<delete dir="${mm.cpp.intdir}"/>
</target>
<target name="clean-all" depends="clean-swig" description="Delete build files for all configurations and architectures">
<delete dir="${mm.outdir}"/>
<delete dir="${mm.intdir}"/>
</target>
<target name="unstage" description="Delete staged files">
<delete dir="${mm.installdir}"/>
</target>
<target name="unstage-all" description="Delete staged files for all configurations and architectures">
<delete dir="${mm.stagedir}"/>
</target>
</project>