-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
executable file
·611 lines (515 loc) · 21.1 KB
/
CMakeLists.txt
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
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
PROJECT(EMAN)
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.4)
SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
IF(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
cmake_policy(SET CMP0002 OLD)
ENDIF(COMMAND cmake_policy)
MARK_AS_ADVANCED(FORCE CMAKE_BACKWARDS_COMPATIBILITY)
MARK_AS_ADVANCED(CLEAR CMAKE_VERBOSE_MAKEFILE)
OPTION(CMAKE_VERBOSE_MAKEFILE "if all commands will be echoed to the console during the make" ON)
SET(EMAN_INSTALL_PREFIX $ENV{HOME}/EMAN2 CACHE PATH "installation prefix")
SET(CMAKE_INSTALL_PREFIX ${EMAN_INSTALL_PREFIX} CACHE INTERNAL "installation prefix")
MARK_AS_ADVANCED(CLEAR EMAN_INSTALL_PREFIX)
SET(EXECUTABLE_OUTPUT_PATH ${EMAN_BINARY_DIR}/bin CACHE PATH "output directory for building all executables.")
SET(LIBRARY_OUTPUT_PATH ${EMAN_BINARY_DIR}/lib CACHE PATH "output directory for building all libraries.")
SET(EMAN_EXECUTABLE_PATH "${EXECUTABLE_OUTPUT_PATH}")
SET(EMAN_LIBRARY_PATH "${LIBRARY_OUTPUT_PATH}")
MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH)
OPTION(ENABLE_AUTODOC "enable latex/doxygen document generation and etc. " OFF)
OPTION(ENABLE_FFTW2 "enable fftw 2 support (LEGACY)" OFF)
OPTION(ENABLE_FFTW3 "enable fftw 3 support (USE THIS)" ON)
OPTION(ENABLE_FFTW_PLAN_CACHING "enable fftw caching" ON)
OPTION(ENABLE_NATIVE_FFT "enable native fft support (for non-GPL use)" OFF)
OPTION(ENABLE_ACML_FFT "enable AMD Core Math Library fft support" OFF)
OPTION(ENABLE_FFT_CACHING "enable FFT Caching" OFF)
MARK_AS_ADVANCED(ENABLE_ACML_FFT)
OPTION(ENABLE_DJBFFT "enable djbfft support" OFF)
MARK_AS_ADVANCED(ENABLE_DJBFFT)
OPTION(ENABLE_OPTPP "enable Opt++ support" OFF)
OPTION(ENABLE_TAO "enable TAO support" OFF)
MARK_AS_ADVANCED(ENABLE_TAO)
OPTION(ENABLE_TIFF "enable TIFF support" ON)
OPTION(ENABLE_HDF5 "enable HDF5 support" ON)
OPTION(ENABLE_V4L2 "enable V4L2 framegrabbing support" OFF)
OPTION(ENABLE_PNG "enable PNG support" ON)
OPTION(ENABLE_JPEG "enable JPEG support" ON)
OPTION(ENABLE_OPENGL "enable EMAN2 OpenGL usage" ON)
OPTION(ENABLE_SPARX_CUDA "enable SPARX CUDA usage" OFF)
OPTION(ENABLE_EMAN_CUDA "enable EMAN2 CUDA usage" OFF)
OPTION(ENABLE_FTGL "enable EMAN2 FTGL (3D fonts) usage" ON)
OPTION(ENABLE_STATIC_FTGL "If build EMAN with libftgl.a" OFF)
MARK_AS_ADVANCED(ENABLE_STATIC_FTGL)
#flags used for debugging and testing
OPTION(ENABLE_MEMDEBUG "enable memory debug support of objects" OFF)
OPTION(ENABLE_MEMDEBUG2 "enable memory debug support of EMData" OFF)
OPTION(ENABLE_BOUNDS_CHECKING "enable bounds checking support" OFF)
OPTION(ENABLE_RT "enable RT support" ON)
OPTION(ENABLE_IOCACHE "enable ImageIO caching" OFF)
# OPTION(ENABLE_HDFIOCACHE "enable HDF5 file caching" OFF)
#flags for optimization level. You can only turn one of following option to ON, or leave all of them to OFF.
OPTION(ENABLE_DEBUG "enable debug support" OFF)
OPTION(ENABLE_PROFILE "enable symbol generation without debug support" OFF)
OPTION(ENABLE_OPTIMIZE_X86_64 "GCC optimizations for generic X86_64" OFF)
OPTION(ENABLE_OPTIMIZE_MACHINE "Optimize code for this specific computer (typ 5-10% speedup). Binaries may incompatible with some other computers." OFF)
OPTION(ENABLE_OPTIMIZE_WINDOWS_VC "Windows visual c++ specific optimization" OFF)
IF(CMAKE_SYSTEM MATCHES "Darwin-12*")
OPTION(ENABLE_OPTIMIZE_MOUNTAIN_LION "enable OSX 10.8/9 support" ON)
ELSE(CMAKE_SYSTEM MATCHES "Darwin-12*")
OPTION(ENABLE_OPTIMIZE_MOUNTAIN_LION "enable OSX 10.8/9 support" OFF)
ENDIF(CMAKE_SYSTEM MATCHES "Darwin-12*")
#MESSAGE (FATAL_ERROR ${CMAKE_SYSTEM} )
# IF (ENABLE_LEOPARD)
# SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib")
# SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib")
# ENDIF (ENABLE_LEOPARD)
IF (ENABLE_OPTIMIZE_MOUNTAIN_LION)
SET(GL_LIBRARY /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib)
SET(GLU_LIBRARY /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.dylib)
SET(GL_INCLUDE_PATH /usr/include)
SET(GLU_INCLUDE_PATH /usr/include)
# SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.dylib")
# SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.dylib")
ENDIF (ENABLE_OPTIMIZE_MOUNTAIN_LION)
IF (ENABLE_MEMDEBUG)
ADD_DEFINITIONS(-DMEMDEBUG -W -Wall)
ENDIF (ENABLE_MEMDEBUG)
IF (ENABLE_MEMDEBUG2)
ADD_DEFINITIONS(-DMEMDEBUG2 -W -Wall)
ENDIF (ENABLE_MEMDEBUG2)
IF (ENABLE_V4L2)
ADD_DEFINITIONS(-DBOUNDS_CHECKING -DENABLE_V4L2)
ENDIF (ENABLE_V4L2)
IF (ENABLE_BOUNDS_CHECKING)
ADD_DEFINITIONS(-DBOUNDS_CHECKING)
ENDIF (ENABLE_BOUNDS_CHECKING)
IF (ENABLE_DEBUG)
SET (OPT_FLAGS "-DDEBUG -O2 -g -ansi -Wall -W -fno-inline")
ELSEIF(ENABLE_PROFILE)
SET (OPT_FLAGS "-O2 -ansi -march=native -m64 -ffast-math -pipe")
OPTION(ENABLE_DEBUG "enable debug support" OFF)
ELSEIF (ENABLE_OPTIMIZE_MOUNTAIN_LION)
# SET (OPT_FLAGS "-O3 -ffast-math")
SET (OPT_FLAGS "-O3")
# SET (OPT_FLAGS "-Os -ffast-math")
ELSEIF (ENABLE_OPTIMIZE_MACHINE)
SET (OPT_FLAGS "-O5 -ansi -march=native -m64 -ffast-math -pipe")
ELSEIF (ENABLE_OPTIMIZE_X86_64)
SET (OPT_FLAGS "-O5 -ansi -march=k8 -mfpmath=sse -m64 -ffast-math -pipe")
# SET (OPT_FLAGS "-O5 -ansi -mfpmath=both -march=core-avx-i -m64 -ffast-math -pipe")
ELSEIF (ENABLE_OPTIMIZE_WINDOWS_VC)
SET (OPT_FLAGS "/Ox /DHAVE_INLINE")
ELSE()
SET (OPT_FLAGS "-O3 -ansi -ffast-math") # This is the default
ENDIF()
#MESSAGE("OPT_FLAGS = " ${OPT_FLAGS})
IF (ENABLE_OPENGL)
# FIND_PATH(GL_INCLUDE_DIR gl.h /usr/include/GL)
# FIND_PATH(GLU_INCLUDE_DIR glu.h /usr/include/GL)
ENDIF (ENABLE_OPENGL)
IF(CMAKE_SYSTEM MATCHES "IRIX.*")
SET(PLATFORMLIB "/usr/lib32" CACHE INTERNAL "IRIX lib32")
#SET(EMAN_CXX_FLAGS "-n32 -LANG:std -w2 -fullwarn -LANG:ansi-for-init-scope=ON" CACHE INTERNAL "C++ compiler flags")
SET(EMAN_CXX_FLAGS "-n32 -woffall -LANG:std -LANG:ansi-for-init-scope=ON" CACHE INTERNAL "C++ compiler flags")
ENDIF(CMAKE_SYSTEM MATCHES "IRIX.*")
IF(CMAKE_SYSTEM MATCHES "AIX*")
SET(EMAN_CXX_FLAGS "" CACHE INTERNAL "C++ compiler flags")
ENDIF(CMAKE_SYSTEM MATCHES "AIX*")
IF(CMAKE_SYSTEM MATCHES "OSF1-V*")
SET(EMAN_CXX_FLAGS "-w0" CACHE INTERNAL "C++ compiler flags")
ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V*")
IF(CMAKE_COMPILER_IS_GNUCXX)
#SET(EMAN_CXX_FLAGS "-Wall -Werror" CACHE INTERNAL "EMAN CXX FLAGS")
IF (ENABLE_DEBUG)
SET(EMAN_CXX_FLAGS "-g -Wall -W -Wcast-qual -Wwrite-strings" CACHE INTERNAL "EMAN CXX FLAGS")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -g")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -g")
ELSE (ENABLE_DEBUG)
SET(EMAN_CXX_FLAGS "-Wall" CACHE INTERNAL "EMAN CXX FLAGS")
ENDIF (ENABLE_DEBUG)
SET(PLATFORMLIB "/usr/lib64" CACHE INTERNAL "lib64")
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_C_COMPILER ${CMAKE_CXX_COMPILER})
SET(CMAKE_ORIG_FLAGS ${CMAKE_CXX_FLAGS})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EMAN_CXX_FLAGS} ${OPT_FLAGS}")
MARK_AS_ADVANCED(CMAKE_C_FLAGS)
MARK_AS_ADVANCED(CMAKE_CXX_FLAGS)
# for 64-bit large file support
ADD_DEFINITIONS(-D_LARGEFILE_SOURCE)
ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64)
ADD_DEFINITIONS(-D_LARGE_FILES)
INCLUDE(${CMAKE_ROOT}/Modules/CheckIncludeFiles.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake)
INCLUDE(${CMAKE_ROOT}/Modules/CheckTypeSize.cmake)
MACRO(EMAN_CHECK_FUNCTION FUNCTION VARIABLE)
CHECK_FUNCTION_EXISTS(${FUNCTION} ${VARIABLE})
IF(${VARIABLE})
ADD_DEFINITIONS(-D${VARIABLE})
ENDIF(${VARIABLE})
ENDMACRO(EMAN_CHECK_FUNCTION)
EMAN_CHECK_FUNCTION(fseek64 HAVE_FSEEK64)
EMAN_CHECK_FUNCTION(fseeko HAVE_FSEEKO)
EMAN_CHECK_FUNCTION(ftell64 HAVE_FTELL64)
EMAN_CHECK_FUNCTION(ftello HAVE_FTELLO)
# end for 64-bit large file support
IF(ENABLE_IOCACHE)
ADD_DEFINITIONS(-DIMAGEIO_CACHE)
ENDIF(ENABLE_IOCACHE)
# IF(ENABLE_HDFIOCACHE)
# ADD_DEFINITIONS(-DHDFIO_CACHE)
# ENDIF(ENABLE_HDFIOCACHE)
SET(INCLUDE_DIRS
${EMAN_SOURCE_DIR}/libEM
$ENV{HOME}/include
$ENV{FFTWDIR}/include
$ENV{GSLDIR}/include
/usr/local/include
/usr/local/cuda/include
/usr/include
/sw/include
/usr/include/freetype2
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/OpenGL.framework/Headers
)
SET(LIB_DIRS
/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries
$ENV{EMANDIR}/lib
$ENV{HOME}/lib
${PLATFORMLIB}
$ENV{FFTWDIR}/lib
$ENV{GSLDIR}/lib
/usr/local/lib
/usr/local/cuda/lib
/usr/lib64
/usr/lib
/sw/lib
)
MACRO(CHECK_REQUIRED_LIB2 upper lower header lower2 header2)
FIND_PATH(${upper}_INCLUDE_PATH ${header} $ENV{${upper}DIR}/include ${INCLUDE_DIRS})
IF(${upper}_INCLUDE_PATH)
ELSE (${upper}_INCLUDE_PATH)
FIND_PATH(${upper}_INCLUDE_PATH ${header2} $ENV{${upper}DIR}/include ${INCLUDE_DIRS})
ENDIF(${upper}_INCLUDE_PATH)
IF(${upper}_INCLUDE_PATH)
FIND_LIBRARY(${upper}_LIBRARY NAMES ${lower} ${lower2} PATHS $ENV{${upper}DIR}/lib ${LIB_DIRS})
IF(${upper}_LIBRARY)
ELSE(${upper}_LIBRARY)
MESSAGE(SEND_ERROR "ERROR: ${upper} not found. please install ${upper} first!")
ENDIF(${upper}_LIBRARY)
ELSE(${upper}_INCLUDE_PATH)
MESSAGE(SEND_ERROR "ERROR: ${upper} not found. please install ${upper} first!")
ENDIF(${upper}_INCLUDE_PATH)
ENDMACRO(CHECK_REQUIRED_LIB2)
MACRO(CHECK_REQUIRED_LIB upper lower header)
CHECK_REQUIRED_LIB2(${upper} ${lower} ${header} "" "")
ENDMACRO(CHECK_REQUIRED_LIB)
MACRO(CHECK_OPTIONAL_LIB upper lower header)
FIND_PATH(${upper}_INCLUDE_PATH ${header} $ENV{${upper}DIR}/include ${INCLUDE_DIRS})
IF(${upper}_INCLUDE_PATH)
FIND_LIBRARY(${upper}_LIBRARY NAMES ${lower} PATHS $ENV{${upper}DIR}/lib ${LIB_DIRS})
IF(${upper}_LIBRARY)
ADD_DEFINITIONS(-DEM_${upper})
INCLUDE_DIRECTORIES(${${upper}_INCLUDE_PATH})
ELSE(${upper}_LIBRARY)
#MESSAGE("WARNING: ${upper} not found, ENABLE_${upper} is set back to OFF")
OPTION(ENABLE_${upper} "if enable ${upper} support" OFF)
ENDIF(${upper}_LIBRARY)
ELSE(${upper}_INCLUDE_PATH)
#MESSAGE("WARNING: ${upper} not found, ENABLE_${upper} is set back to OFF")
OPTION(ENABLE_${upper} "if enable ${upper} support" OFF)
ENDIF(${upper}_INCLUDE_PATH)
ENDMACRO(CHECK_OPTIONAL_LIB)
MACRO(CHECK_LIB_ONLY upper lower)
FIND_LIBRARY(${upper}_LIBRARY NAMES ${lower} PATHS $ENV{${upper}DIR}/lib ${LIB_DIRS})
ENDMACRO(CHECK_LIB_ONLY)
MACRO(CHECK_PYTHON)
SET(PYTHON_FOUND FALSE)
FOREACH(PYVER ${ARGV})
IF(NOT PYTHON_FOUND)
IF (WIN32)
FIND_PATH(PYTHON_INCLUDE_PATH Python.h
$ENV{PYTHON_ROOT}/include C:/Python${PYVER}/include)
FIND_LIBRARY(PYTHON_LIBRARY NAMES python${PYVER} PATHS
$ENV{PYTHON_ROOT}/libs C:/Python${PYVER}/libs)
ELSE (WIN32)
FIND_PATH(PYTHON_INCLUDE_PATH Python.h
$ENV{PYTHON_ROOT}/include/python${PYVER}
/usr/local/include/python${PYVER}
/usr/include/python${PYVER})
FIND_LIBRARY(PYTHON_LIBRARY NAMES python${PYVER} PATHS
$ENV{PYTHON_ROOT}/lib/python${PYVER}/config
/usr/local/lib/python${PYVER}/config
/usr/lib/python${PYVER}/config
/usr/lib64/python${PYVER}/config
$ENV{PYTHON_ROOT}/lib /usr/local/lib /usr/lib)
ENDIF (WIN32)
IF(PYTHON_INCLUDE_PATH)
IF(PYTHON_LIBRARY)
SET(PYTHON_FOUND TRUE)
ENDIF(PYTHON_LIBRARY)
ENDIF(PYTHON_INCLUDE_PATH)
ENDIF(NOT PYTHON_FOUND)
ENDFOREACH(PYVER)
ENDMACRO(CHECK_PYTHON)
IF(ENABLE_FFTW2)
OPTION(ENABLE_NFFT "enable nfft support" OFF)
OPTION(ENABLE_FFTW3 "enable fftw 3 support" OFF)
OPTION(ENABLE_NATIVE_FFT "enable native fft support" OFF)
OPTION(ENABLE_ACML_FFT "enable AMD Core Math Library fft support" OFF)
IF (WIN32)
CHECK_REQUIRED_LIB2(FFTW2 FFTW2dll sfftw.h fftw fftw.h)
CHECK_REQUIRED_LIB2(RFFTW2 RFFTW2dll srfftw.h rfftw rfftw.hx)
ELSE (WIN32)
CHECK_REQUIRED_LIB2(FFTW2 sfftw sfftw.h fftw fftw.h)
CHECK_REQUIRED_LIB2(RFFTW2 srfftw srfftw.h rfftw rfftw.hx)
ENDIF (WIN32)
ADD_DEFINITIONS(-DFFTW2)
SET(FFTW_LIBRARIES ${RFFTW2_LIBRARY} ${FFTW2_LIBRARY})
SET(FFTW_INCLUDE_PATH ${FFTW2_INCLUDE_PATH})
IF(ENABLE_NFFT)
CHECK_REQUIRED_LIB(FFTW2D fftw fftw.h)
CHECK_REQUIRED_LIB(NFFT nfft nfft.h)
ADD_DEFINITIONS(-DNFFT)
INCLUDE_DIRECTORIES(${NFFT_INCLUDE_PATH})
ENDIF(ENABLE_NFFT)
ENDIF(ENABLE_FFTW2)
IF(ENABLE_FFTW3)
OPTION(ENABLE_NFFT2 "enable nfft2 support" OFF)
OPTION(ENABLE_FFTW2 "enable fftw 2 support" OFF)
OPTION(ENABLE_NATIVE_FFT "enable native fft support" OFF)
OPTION(ENABLE_ACML_FFT "enable AMD Core Math Library fft support" OFF)
CHECK_REQUIRED_LIB(FFTW3 fftw3f fftw3.h)
ADD_DEFINITIONS(-DFFTW3)
SET(FFTW_LIBRARIES ${FFTW3_LIBRARY})
SET(FFTW_INCLUDE_PATH ${FFTW3_INCLUDE_PATH})
IF(ENABLE_NFFT2)
CHECK_REQUIRED_LIB(FFTW3D fftw3 fftw3.h)
CHECK_REQUIRED_LIB(NFFT2 nfft nfft.h)
ADD_DEFINITIONS(-DNFFT2)
INCLUDE_DIRECTORIES(${NFFT2_INCLUDE_PATH})
ENDIF(ENABLE_NFFT2)
ENDIF(ENABLE_FFTW3)
IF(ENABLE_FFTW_PLAN_CACHING)
ADD_DEFINITIONS(-DFFTW_PLAN_CACHING)
ENDIF(ENABLE_FFTW_PLAN_CACHING)
IF(ENABLE_ACML_FFT)
OPTION(ENABLE_FFTW2 "enable fftw 2 support" OFF)
OPTION(ENABLE_FFTW3 "enable fftw 3 support" OFF)
OPTION(ENABLE_NATIVE_FFT "enable native fft support" OFF)
CHECK_REQUIRED_LIB(ACML acml acml.h)
FIND_LIBRARY(G2C_LIBRARY NAMES g2c PATHS
/usr/lib64
/usr/lib
/usr/local/lib
$ENV{HOME}/lib )
ADD_DEFINITIONS(-DACML)
SET(ACML_LIBRARIES ${ACML_LIBRARY})
SET(ACML_INCLUDE_PATH ${ACML_INCLUDE_PATH})
ENDIF(ENABLE_ACML_FFT)
IF (ENABLE_FFT_CACHING)
ADD_DEFINITIONS(-DFFT_CACHING)
ENDIF(ENABLE_FFT_CACHING)
IF(ENABLE_NATIVE_FFT)
ADD_DEFINITIONS(-DNATIVE_FFT)
OPTION(ENABLE_FFTW2 "enable fftw 2 support" OFF)
OPTION(ENABLE_FFTW3 "enable fftw 3 support" OFF)
OPTION(ENABLE_ACML_FFT "enable AMD Core Math Library fft support" OFF)
ENDIF(ENABLE_NATIVE_FFT)
IF(ENABLE_DJBFFT)
OPTION(ENABLE_NFFT2 "enable nfft2 support" OFF)
CHECK_REQUIRED_LIB(DJBFFT fftc4.h fftr4.h)
ADD_DEFINITIONS(-DDJBFFT)
SET(DJBFFT_LIBRARIES ${DJBFFT_LIBRARY})
SET(DJBFFT_INCLUDE_PATH ${DJBFFT_INCLUDE_PATH})
ENDIF(ENABLE_DJBFFT)
IF(ENABLE_OPTPP)
FIND_PATH(OPTPP_INCLUDE_PATH Opt.h /usr/include /usr/include/opt++
/usr/local/include /usr/local/include/opt++ $ENV{HOME}/include
$ENV{HOME}/include/opt++)
FIND_PATH(NEWMAT_INCLUDE_PATH newmat.h /usr/include /usr/include/opt++
/usr/include/newmat /usr/local/include/newmat
/usr/local/include /usr/local/include/opt++ $ENV{HOME}/include
$ENV{HOME}/include/opt++)
FIND_LIBRARY(OPTPP_LIBRARY NAMES opt-linux PATHS /usr/lib /usr/local/lib)
FIND_LIBRARY(NEWMAT_LIBRARY NAMES newmat-linux PATHS /usr/lib /usr/local/lib)
ADD_DEFINITIONS(-DOPTPP)
INCLUDE_DIRECTORIES(${OPTPP_INCLUDE_PATH} ${NEWMAT_INCLUDE_PATH})
ENDIF(ENABLE_OPTPP)
CHECK_REQUIRED_LIB(GSL gsl gsl/gsl_linalg.h)
CHECK_REQUIRED_LIB(GSL_CBLAS gslcblas gsl/gsl_linalg.h)
IF (ENABLE_OPENGL)
CHECK_REQUIRED_LIB(GL GL GL/gl.h)
CHECK_REQUIRED_LIB(GLU GLU GL/glu.h)
ADD_DEFINITIONS(-DEMAN2_USING_OPENGL)
ENDIF (ENABLE_OPENGL)
IF (ENABLE_FTGL)
CHECK_REQUIRED_LIB2(FTGL ftgl FTGL/FTGL.h ftgl FTGL/ftgl.h)
ADD_DEFINITIONS(-DEMAN2_USING_FTGL)
IF(EXISTS ${FTGL_INCLUDE_PATH}/FTGL/FTGL.h AND COMMAND IF)
ADD_DEFINITIONS(-DOLD_FTGL)
ENDIF(EXISTS ${FTGL_INCLUDE_PATH}/FTGL/FTGL.h AND COMMAND IF)
ADD_SUBDIRECTORY(fonts)
FIND_PATH(FREETYPE_INCLUDE_PATH ft2build.h /usr/include/freetype2 /usr/include $ENV{${upper}DIR}/include ${INCLUDE_DIRS})
CHECK_REQUIRED_LIB(FREETYPE freetype freetype/config/ftheader.h )
IF (ENABLE_STATIC_FTGL)
IF(WIN32)
CHECK_REQUIRED_LIB(FREETYPE freetype ft2build.h)
ENDIF(WIN32)
ENDIF (ENABLE_STATIC_FTGL)
ENDIF (ENABLE_FTGL)
IF(ENABLE_TIFF)
CHECK_OPTIONAL_LIB(TIFF tiff tiffio.h)
CHECK_LIB_ONLY(JPEG jpeg)
ENDIF(ENABLE_TIFF)
IF(ENABLE_JPEG)
CHECK_OPTIONAL_LIB(JPEG jpeg jpeglib.h)
ENDIF(ENABLE_JPEG)
IF(ENABLE_HDF5)
IF (WIN32)
CHECK_OPTIONAL_LIB(HDF5 hdf5dll hdf5.h)
CHECK_LIB_ONLY(SZLIB szlibdll)
CHECK_LIB_ONLY(ZLIB zlib1d)
ADD_DEFINITIONS(-D_HDF5USEDLL_)
ELSE (WIN32)
CHECK_OPTIONAL_LIB(HDF5 hdf5 hdf5.h)
CHECK_LIB_ONLY(ZLIB z)
ENDIF (WIN32)
ENDIF(ENABLE_HDF5)
IF(ENABLE_PNG)
IF (WIN32)
CHECK_OPTIONAL_LIB(PNG libpng13d png.h)
CHECK_LIB_ONLY(ZLIB zlib1d)
ELSE (WIN32)
CHECK_OPTIONAL_LIB(PNG png png.h)
ENDIF (WIN32)
ENDIF(ENABLE_PNG)
FIND_PATH(NUMPY_INCLUDE_PATH numpy/arrayobject.h
$ENV{PYTHON_ROOT}/lib/python2.7/site-packages/numpy/core/include
$ENV{PYTHON_ROOT}/lib/python2.6/site-packages/numpy/core/include
$ENV{PYTHON_ROOT}/lib/python2.5/site-packages/numpy/core/include
$ENV{PYTHON_ROOT}/lib/python2.4/site-packages/numpy/core/include
/usr/local/lib/python2.7/site-packages/numpy/core/include
/usr/local/lib/python2.6/site-packages/numpy/core/include
/usr/lib64/python2.7/site-packages/numpy/core/include
/usr/lib64/python2.6/site-packages/numpy/core/include
/usr/lib64/python2.5/site-packages/numpy/core/include
/usr/lib64/python2.4/site-packages/numpy/core/include
/usr/lib/python2.7/site-packages/numpy/core/include
/usr/lib/python2.6/site-packages/numpy/core/include
/usr/lib/python2.5/site-packages/numpy/core/include
/Library/Python/2.5/site-packages/numpy/core/include
/usr/lib/python2.4/site-packages/numpy/core/include
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include
/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/numpy/core/include
/usr/include)
INCLUDE_DIRECTORIES(${NUMPY_INCLUDE_PATH})
IF(WIN32)
CHECK_PYTHON($ENV{PYTHON_VERSION} 27 26 25 24 23 22)
ELSE(WIN32)
CHECK_PYTHON($ENV{PYTHON_VERSION} 2.7 2.6 2.5 2.4 2.3 2.2)
ENDIF(WIN32)
IF(PYTHON_INCLUDE_PATH)
# Check the most generic name first (used by cctbx).
CHECK_REQUIRED_LIB(BOOST boost_python boost/python.hpp)
ELSE(PYTHON_INCLUDE_PATH)
MESSAGE("ERROR: Python.h not found")
ENDIF(PYTHON_INCLUDE_PATH)
# IF(ENABLE_HDFIOCACHE)
# IF(APPLE)
# CHECK_OPTIONAL_LIB(BOOST_THREAD boost_thread boost/thread.hpp)
# CHECK_OPTIONAL_LIB(BOOST_FILESYSTEM boost_filesystem boost/filesystem.hpp)
# CHECK_OPTIONAL_LIB(BOOST_SYSTEM boost_system boost/filesystem.hpp)
# ELSE(APPLE)
# CHECK_OPTIONAL_LIB(BOOST_THREAD boost_thread-mt boost/thread.hpp)
# CHECK_OPTIONAL_LIB(BOOST_FILESYSTEM boost_filesystem-mt boost/filesystem.hpp)
# CHECK_OPTIONAL_LIB(BOOST_SYSTEM boost_system-mt boost/filesystem.hpp)
# ENDIF(APPLE)
# ENDIF(ENABLE_HDFIOCACHE)
MARK_AS_ADVANCED(FORCE CMAKE_BACKWARDS_COMPATIBILITY)
INCLUDE_DIRECTORIES(.
${EMAN_SOURCE_DIR}
${EMAN_SOURCE_DIR}/libEM
${GL_INCLUDE_PATH}
${GSL_INCLUDE_PATH}
${GSL_INCLUDE_PATH}/gsl
${FFTW_INCLUDE_PATH}
${DJBFFT_INCLUDE_PATH}
${ACML_INCLUDE_PATH}
${BOOST_INCLUDE_PATH}
${PYTHON_INCLUDE_PATH}
${FREETYPE_INCLUDE_PATH}
)
# /usr/include/freetype2
# /usr/local/include/freetype2
IF(ENABLE_RT)
ADD_SUBDIRECTORY(rt)
ENDIF(ENABLE_RT)
IF (ENABLE_SPARX_CUDA)
INCLUDE(${CMAKE_SOURCE_DIR}/libEM/cuda/FindCUDA.cmake)
CUDA_INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/libEM)
CUDA_INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/libEM/sparx/cuda)
ADD_DEFINITIONS(-DSPARX_USING_CUDA)
INCLUDE_DIRECTORIES(${CUDA_TOOLKIT_INCLUDE})
ADD_SUBDIRECTORY(libEM/sparx/cuda)
ENDIF (ENABLE_SPARX_CUDA)
IF (ENABLE_EMAN_CUDA)
INCLUDE(${CMAKE_SOURCE_DIR}/libEM/cuda/FindCUDA.cmake)
CUDA_INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/libEM)
ADD_DEFINITIONS(-DEMAN2_USING_CUDA)
INCLUDE_DIRECTORIES(${CUDA_TOOLKIT_INCLUDE})
ADD_SUBDIRECTORY(libEM/cuda)
ENDIF (ENABLE_EMAN_CUDA)
IF(ENABLE_TAO)
ADD_SUBDIRECTORY(tao)
ENDIF(ENABLE_TAO)
ADD_SUBDIRECTORY(libEM)
ADD_SUBDIRECTORY(libpyEM)
ADD_SUBDIRECTORY(pyemtbx)
ADD_SUBDIRECTORY(sparx)
ADD_SUBDIRECTORY(utils)
ADD_SUBDIRECTORY(examples)
ADD_SUBDIRECTORY(programs)
ADD_SUBDIRECTORY(doc)
ADD_SUBDIRECTORY(images)
ADD_CUSTOM_TARGET( unittest
DEPENDS ${TEST_RESULTS}
)
ADD_CUSTOM_COMMAND(
TARGET unittest
POST_BUILD
COMMAND python
ARGS ${EMAN_INSTALL_PREFIX}/test/rt/rt.py
)
#set the list of unit test to run
#
SET (TESTS
test_vec
test_utils
test_typeconverter
test_transform
test_misc
test_imageio
test_emdata
test_processor
test_cmp
test_aligner
test_averager
)
#add the custom commands for each unit test program
#
FOREACH (TEST ${TESTS})
ADD_CUSTOM_COMMAND(
OUTPUT ${TEST}.PRINT_SPACE
COMMAND ${CMAKE_COMMAND} ARGS -E echo ""
)
#this is the trick to make the target run every time, DoUnitTest suppose is a file never been built
#
ADD_CUSTOM_COMMAND(
OUTPUT ${TEST}.DoUnitTest
COMMAND ${CMAKE_COMMAND} ARGS -E time ${EMAN_INSTALL_PREFIX}/test/rt/${TEST}.py
DEPENDS ${TEST}.PRINT_SPACE
)
#build a list of all the results
SET( TEST_RESULTS ${TEST_RESULTS}
${TEST}.DoUnitTest
)
ENDFOREACH (TEST)