forked from mhl/tubularity
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
executable file
·283 lines (255 loc) · 8.61 KB
/
Makefile
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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
.PHONY : all clean test
.PRECIOUS : build/linux64/libTubularGeodesics.so \
build/linux64/libOOFTubularityMeasure.so \
build/linux/libTubularGeodesics.so \
build/linux/libOOFTubularityMeasure.so \
FijiITKInterface/FijiITKInterface_TubularGeodesics.h \
FijiITKInterface/FijiITKInterface_OOFTubularityMeasure.h
# Ensure the JDK_INCLUDE_PATH is defined:
#
# Examples:
# On Linux it may well be:
# /usr/lib/jvm/java-6-openjdk/
# or /usr/lib/jvm/java-6-openjdk-i386/
# On Mac OS:
# /usr/lib/jvm/java-1.6.0-openjdk/include/
# On Windows:
# [not sure yet]
ifndef JDK_HOME
$(error The environment variable JDK_HOME must be defined.)
endif
# You must also set the environment variable FIJI_BINARY to point
# to a working instance of the Fiji launcher.
ifndef FIJI_LAUNCHER
$(info The environment variable FIJI_LAUNCHER must be defined.)
$(error FIJI_LAUNCHER undefined)
endif
# Finally, you have to set up the environment variable ITK to point to
# the root of an ITK installation. You can override the ITK library
# and header file location with ITK_LIBS and ITK_INCLUDE
ifndef ITK
$(info The environment variable ITK must be defined, and point)
$(info to the root of an ITK installation, in this case where)
$(info itkConfigure.h is found. The ITK libraries are expected)
$(info to be in $ITK/bin - if that is not the case, you should)
$(info also define ITK_LIBS to point to their location. Similarly,)
$(info header files are expected to be in $ITK - you can override)
$(info that with ITK_INCLUDE)
$(error ITK undefined)
endif
ifndef ITK_LIBS
ITK_LIBS=$(ITK)/bin/
endif
ifndef ITK_INCLUDE
ITK_INCLUDE=$(ITK)
endif
ifndef FFTW_PREFIX
FFTW_PREFIX=/usr/lib/
endif
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not')
ifeq ($(ARCH),)
ifeq ($(uname_S),Linux)
JAVA_ARCH_NAME=linux
LIBRARY_EXTENSION=so
ifeq ($(uname_M),x86_64)
ARCH=linux64
else
ARCH=linux
endif
endif
# FIXME: doesn't detect win64 at the moment
ifneq (,$(findstring MINGW,$(uname_S)))
ARCH=win32
endif
ifeq ($(uname_S),Darwin)
ARCH=macosx
LIBRARY_EXTENSION=dylib
endif
endif
ifndef ARCH
$(info The architecture could not be automatically discovered.)
$(info Please report this as a bug to [email protected],)
$(info including the following output:)
$(info uname_S is: $(uname_S))
$(info uname_M is: $(uname_M))
$(error)
endif
## -luuid \ TODO
# -framework CoreFoundation : works for macOS but not linux
LINK_LIBRARIES_ITK=-L$(ITK_LIBS) \
$(ITK_LIBS)libitksys-4.1.a \
$(ITK_LIBS)libitkvnl_algo-4.1.a \
$(ITK_LIBS)libitkvnl-4.1.a \
$(ITK_LIBS)libitkv3p_netlib-4.1.a \
$(ITK_LIBS)libITKCommon-4.1.a \
$(ITK_LIBS)libitkNetlibSlatec-4.1.a \
$(ITK_LIBS)libITKStatistics-4.1.a \
$(ITK_LIBS)libITKIOImageBase-4.1.a \
$(ITK_LIBS)libITKMesh-4.1.a \
$(ITK_LIBS)libitkzlib-4.1.a \
$(ITK_LIBS)libITKMetaIO-4.1.a \
$(ITK_LIBS)libITKSpatialObjects-4.1.a \
$(ITK_LIBS)libITKPath-4.1.a \
$(ITK_LIBS)libITKLabelMap-4.1.a \
$(ITK_LIBS)libITKQuadEdgeMesh-4.1.a \
$(ITK_LIBS)libITKOptimizers-4.1.a \
$(ITK_LIBS)libITKPolynomials-4.1.a \
$(ITK_LIBS)libITKBiasCorrection-4.1.a \
$(ITK_LIBS)libITKBioCell-4.1.a \
$(ITK_LIBS)libITKFFT-4.1.a \
$(ITK_LIBS)libITKDICOMParser-4.1.a \
$(ITK_LIBS)libITKEXPAT-4.1.a \
$(ITK_LIBS)libITKIOXML-4.1.a \
$(ITK_LIBS)libITKIOSpatialObjects-4.1.a \
$(ITK_LIBS)libITKFEM-4.1.a \
$(ITK_LIBS)libITKIOBMP-4.1.a \
$(ITK_LIBS)libITKIOBioRad-4.1.a \
$(ITK_LIBS)libitkopenjpeg-4.1.a \
$(ITK_LIBS)libITKIOIPL-4.1.a \
$(ITK_LIBS)libITKIOGE-4.1.a \
$(ITK_LIBS)libITKIOGIPL-4.1.a \
$(ITK_LIBS)libitkjpeg-4.1.a \
$(ITK_LIBS)libITKIOJPEG-4.1.a \
$(ITK_LIBS)libitktiff-4.1.a \
$(ITK_LIBS)libITKIOTIFF-4.1.a \
$(ITK_LIBS)libITKIOLSM-4.1.a \
$(ITK_LIBS)libITKIOMeta-4.1.a \
$(ITK_LIBS)libITKznz-4.1.a \
$(ITK_LIBS)libITKniftiio-4.1.a \
$(ITK_LIBS)libITKIONIFTI-4.1.a \
$(ITK_LIBS)libITKNrrdIO-4.1.a \
$(ITK_LIBS)libITKIONRRD-4.1.a \
$(ITK_LIBS)libitkpng-4.1.a \
$(ITK_LIBS)libITKIOPNG-4.1.a \
$(ITK_LIBS)libITKIOSiemens-4.1.a \
$(ITK_LIBS)libITKIOStimulate-4.1.a \
$(ITK_LIBS)libITKIOVTK-4.1.a \
$(ITK_LIBS)libITKKLMRegionGrowing-4.1.a \
$(ITK_LIBS)libITKVTK-4.1.a \
$(ITK_LIBS)libITKWatersheds-4.1.a \
$(ITK_LIBS)libITKDeprecated-4.1.a \
$(ITK_LIBS)libITKgiftiio-4.1.a \
$(ITK_LIBS)libitkhdf5_cpp-4.1.a \
$(ITK_LIBS)libitkhdf5-4.1.a \
$(ITK_LIBS)libITKIOCSV-4.1.a \
$(ITK_LIBS)libITKIOHDF5-4.1.a \
$(ITK_LIBS)libITKIOMesh-4.1.a \
$(ITK_LIBS)libITKIOTransformBase-4.1.a \
$(ITK_LIBS)libITKIOTransformHDF5-4.1.a \
$(ITK_LIBS)libITKIOTransformInsightLegacy-4.1.a \
$(ITK_LIBS)libITKIOTransformMatlab-4.1.a \
$(ITK_LIBS)libITKOptimizersv4-4.1.a \
$(ITK_LIBS)libITKReview-4.1.a \
$(ITK_LIBS)libITKVideoCore-4.1.a \
$(ITK_LIBS)libITKVideoIO-4.1.a \
-lfftw3 \
$(ITK_LIBS)libITKDICOMParser-4.1.a \
$(ITK_LIBS)libITKgiftiio-4.1.a \
$(ITK_LIBS)libITKLabelMap-4.1.a \
$(ITK_LIBS)libITKQuadEdgeMesh-4.1.a \
$(ITK_LIBS)libITKBiasCorrection-4.1.a \
$(ITK_LIBS)libITKPolynomials-4.1.a \
$(ITK_LIBS)libITKBioCell-4.1.a \
$(ITK_LIBS)libITKFFT-4.1.a \
-lfftw3 -lfftw3_threads -lfftw3f -lfftw3f_threads \
$(ITK_LIBS)libITKIOSpatialObjects-4.1.a \
$(ITK_LIBS)libITKIOXML-4.1.a \
$(ITK_LIBS)libITKFEM-4.1.a \
$(ITK_LIBS)libITKOptimizers-4.1.a \
$(ITK_LIBS)libITKIOBMP-4.1.a \
$(ITK_LIBS)libITKIOBioRad-4.1.a \
$(ITK_LIBS)libitkopenjpeg-4.1.a \
$(ITK_LIBS)libITKEXPAT-4.1.a \
$(ITK_LIBS)libITKIOGIPL-4.1.a \
$(ITK_LIBS)libITKIOJPEG-4.1.a \
$(ITK_LIBS)libITKIOLSM-4.1.a \
$(ITK_LIBS)libITKIOTIFF-4.1.a \
$(ITK_LIBS)libitktiff-4.1.a \
$(ITK_LIBS)libitkjpeg-4.1.a \
$(ITK_LIBS)libITKIOMeta-4.1.a \
$(ITK_LIBS)libITKMetaIO-4.1.a \
$(ITK_LIBS)libITKIONIFTI-4.1.a \
$(ITK_LIBS)libITKniftiio-4.1.a \
$(ITK_LIBS)libITKznz-4.1.a \
$(ITK_LIBS)libITKIONRRD-4.1.a \
$(ITK_LIBS)libITKNrrdIO-4.1.a \
$(ITK_LIBS)libITKIOPNG-4.1.a \
$(ITK_LIBS)libitkpng-4.1.a \
$(ITK_LIBS)libITKIOSiemens-4.1.a \
$(ITK_LIBS)libITKIOGE-4.1.a \
$(ITK_LIBS)libITKIOIPL-4.1.a \
$(ITK_LIBS)libITKIOStimulate-4.1.a \
$(ITK_LIBS)libITKIOVTK-4.1.a \
$(ITK_LIBS)libITKKLMRegionGrowing-4.1.a \
$(ITK_LIBS)libITKVTK-4.1.a \
$(ITK_LIBS)libITKWatersheds-4.1.a \
$(ITK_LIBS)libITKSpatialObjects-4.1.a \
$(ITK_LIBS)libITKMesh-4.1.a \
$(ITK_LIBS)libITKPath-4.1.a \
$(ITK_LIBS)libITKIOTransformHDF5-4.1.a \
$(ITK_LIBS)libitkhdf5_cpp-4.1.a \
$(ITK_LIBS)libitkhdf5-4.1.a \
$(ITK_LIBS)libitkzlib-4.1.a \
$(ITK_LIBS)libITKIOTransformInsightLegacy-4.1.a \
$(ITK_LIBS)libITKIOTransformMatlab-4.1.a \
$(ITK_LIBS)libITKIOTransformBase-4.1.a \
$(ITK_LIBS)libITKStatistics-4.1.a \
$(ITK_LIBS)libitkNetlibSlatec-4.1.a \
$(ITK_LIBS)libITKIOImageBase-4.1.a \
$(ITK_LIBS)libITKVideoCore-4.1.a \
$(ITK_LIBS)libITKCommon-4.1.a \
$(ITK_LIBS)libitksys-4.1.a \
$(ITK_LIBS)libITKVNLInstantiation-4.1.a \
$(ITK_LIBS)libitkvnl_algo-4.1.a \
$(ITK_LIBS)libitkv3p_lsqr-4.1.a \
$(ITK_LIBS)libitkvnl-4.1.a \
$(ITK_LIBS)libitkvcl-4.1.a \
$(ITK_LIBS)libitkv3p_netlib-4.1.a \
-lpthread \
-lm \
-ldl
FFTW_INCLUDE=$(FFTW_PREFIX)/include/
FFTW_LIB=$(FFTW_PREFIX)/
LINK_LIBRARIES_FFTW=-L$(FFTW_LIB) \
-lfftw3 \
-lfftw3f \
-lfftw3_threads \
-lfftw3f_threads
INCLUDE_ITK=-ftemplate-depth-50 -Wall -Wno-deprecated -msse2\
-IITKIOFactoryRegistration \
-I$(ITK_INCLUDE) \
-I$(ITK_INCLUDE)/vnl \
-IitkCVLab
all : plugins/OOFTubularityMeasure_Plugin.jar \
plugins/TubularGeodesics_Plugin.jar
plugins/%_Plugin.jar : FijiITKInterface/%.class \
FijiITKInterface/%_Plugin.class \
%.config \
fiji/jni/LibraryLoader.class \
build/$(ARCH)/lib%.$(LIBRARY_EXTENSION)
mkdir -p plugins
cp $*.config plugins.config
jar cvf plugins/$*_Plugin.jar \
FijiITKInterface/$*.class \
FijiITKInterface/$*_Plugin.class \
plugins.config \
fiji/jni/LibraryLoader.class \
-C build \
$(ARCH)/lib$*.$(LIBRARY_EXTENSION)
rm plugins.config
test :
java -jar ij.jar -eval 'run("Bridge (174K)"); run("Tubularity Measure Plugin");'
clean :
rm -fv *.class */*.class *.o *.$(LIBRARY_EXTENSION)
rm -rf build/$(ARCH)/*
rm -rf plugins
superclean: clean
rm -rf ij.jar
build/$(ARCH)/lib%.$(LIBRARY_EXTENSION) : FijiITKInterface/FijiITKInterface_%.h c++/%JNIImplementation.cpp
mkdir -p build/$(ARCH)/
g++ -Wall -O3 -DWITH_JAVA -DITK_IO_FACTORY_REGISTER_MANAGER -o $@ -I$(FFTW_INCLUDE) -I../c++ -fopenmp -lgomp c++/$*JNIImplementation.cpp -fPIC -shared -I$(JDK_HOME)/include/ -I$(JDK_HOME)/Headers/ -I$(JDK_HOME)/include/$(JAVA_ARCH_NAME)/ -lstdc++ -I./FijiITKInterface/ $(INCLUDE_ITK) $(LINK_LIBRARIES_ITK) $(LINK_LIBRARIES_FFTW)
FijiITKInterface/FijiITKInterface_%.h : FijiITKInterface/%.class
$(FIJI_LAUNCHER) --javah --class-path=.:$(JDK_HOME)/lib/tools.jar -jni -d FijiITKInterface FijiITKInterface.$*
%.class : %.java
$(FIJI_LAUNCHER) --javac --class-path=. $<