source: branches/hpc34/CMakeLists.txt@ 2641

Last change on this file since 2641 was 2640, checked in by WataruKawasaki, 12 years ago

added a new parameter 'csvformat' to sd.scantable.*baseline() and the relevant functions in the C++ side. (2012/08/10 WK)

File size: 20.0 KB
Line 
1###
2# CMakeLists.txt for ASAP module
3###
4
5# minimum requirement for cmake version
6cmake_minimum_required( VERSION 2.8 )
7
8set( MY_OPT_FLAGS "-O3 -funroll-loops -m64 -march=native -msse4.1 -floop-interchange" )
9
10# options
11option( USE_LIBCASACORE
12 "set ON to use libcasacore.so instead of libcasa_*.so"
13 OFF )
14option( STANDALONE
15 "set ON to build standalone mode"
16 OFF )
17option( PKSMS
18 "set ON to diable to build PKSMS2reader/writer"
19 OFF )
20message( STATUS "USE_LIBCASACORE = " ${USE_LIBCASACORE} )
21message( STATUS "STANDALONE = " ${STANDALONE} )
22message( STATUS "PKSMS = " ${PKSMS} )
23
24# Use casapy's fork of casacore
25if ( NOT STANDALONE )
26 add_definitions( -DUSE_CASAPY )
27endif ()
28
29# Define compiler paths on OSX 10.5. This must be done before invoking project()
30if( APPLE )
31 if( EXISTS /opt/casa/core2-apple-darwin8/3rd-party/bin/gfortran )
32 set( CMAKE_Fortran_COMPILER /opt/casa/core2-apple-darwin8/3rd-party/bin/gfortran )
33 set( CMAKE_CXX_COMPILER /opt/casa/core2-apple-darwin8/3rd-party/bin/g++ )
34 elseif( EXISTS /opt/local/bin/gfortran )
35 set( CMAKE_Fortran_COMPILER /opt/local/bin/gfortran )
36 elseif( EXISTS /opt/local/bin/gfortran-mp-4.4 )
37 set( CMAKE_Fortran_COMPILER /opt/local/bin/gfortran-mp-4.4 )
38 if( EXISTS /opt/local/bin/g++-mp-4.4 )
39 set( CMAKE_CXX_COMPILER /opt/local/bin/g++-mp-4.4 )
40 endif()
41 endif()
42endif()
43
44
45# project name is ASAP
46project( ASAP )
47
48
49#
50# build type and their flags
51#
52# CMAKE_BUILD_TYPE (Release, Debug, RelWithDebInfo, MinSizeRel, Profile)
53# default is RelWithDebInfo
54#
55
56
57if ( NOT CMAKE_BUILD_TYPE )
58 set( CMAKE_BUILD_TYPE RelWithDebInfo )
59endif()
60message( STATUS "CMAKE_BUILD_TYPE = " ${CMAKE_BUILD_TYPE} )
61
62# flags for Debug build
63if ( CMAKE_BUILD_TYPE STREQUAL Debug )
64 add_definitions( -DAIPS_DEBUG )
65endif()
66set( CMAKE_CXX_FLAGS_DEBUG "-ggdb3 -O0 -fno-omit-frame-pointer" )
67
68# flags for Profile build
69set( CMAKE_CXX_FLAGS_PROFILE "-g -O2 -pg -fprofile-arcs -fno-omit-frame-pointer" )
70
71# flags for Release build
72set( CMAKE_SHARED_LINKER_FLAGS_RELEASE "-Wl,-s" )
73set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-Wl,-s" )
74
75# flags for MinSizeRel build
76set( CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "-Wl,-s" )
77set( CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "-Wl,-s" )
78
79if ( DEFINED CXX_FLAGS_TAIL_END )
80 set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${CXX_FLAGS_TAIL_END}" )
81 set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${CXX_FLAGS_TAIL_END}" )
82 set( CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} ${CXX_FLAGS_TAIL_END}" )
83 set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${CXX_FLAGS_TAIL_END}" )
84 set( CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_PROFILE} ${CXX_FLAGS_TAIL_END}" )
85endif()
86
87# default flags
88set( DEFAULT_CXX_FLAGS
89 "${MY_OPT_FLAGS} -pipe -Wall -Wextra -Wno-non-template-friend -Wcast-align -Wno-comment" )
90
91find_package( OpenMP )
92if( OPENMP_FOUND )
93 set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" )
94endif()
95
96# environment dependent settings
97message( STATUS "CMAKE_SYSTEM = " ${CMAKE_SYSTEM} )
98message( STATUS "CMAKE_SYSTEM_PROCESSOR = " ${CMAKE_SYSTEM_PROCESSOR} )
99if( APPLE )
100 set( SO dylib )
101 if( CMAKE_SYSTEM MATCHES ^Darwin-10 OR
102 CMAKE_SYSTEM MATCHES ^Darwin-11 )
103 if( NOT archflag )
104 if( EXISTS /opt/casa/darwin11 )
105 set( archflag x86_64 )
106 elseif( EXISTS /opt/casa/darwin10-64b )
107 set( archflag x86_64 )
108 elseif( EXISTS /opt/casa/core2-apple-darwin10 )
109 set( archflag i386 )
110 else()
111 set( archflag x86_64 )
112 endif()
113 endif()
114 if( archflag STREQUAL x86_64 )
115 add_definitions( -DAIPS_64B )
116 endif()
117 execute_process( COMMAND ${CMAKE_CXX_COMPILER} --version
118 COMMAND head -1
119 COMMAND perl -pe "s|.*?(\\d+\\.\\d+)\\.\\d+$|$1|"
120 OUTPUT_VARIABLE _cxx_version
121 OUTPUT_STRIP_TRAILING_WHITESPACE )
122 if( NOT _cxx_version STREQUAL "4.4" )
123 set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} -arch ${archflag}" )
124 endif()
125 endif()
126elseif( CMAKE_SYSTEM_NAME STREQUAL Linux )
127 set( SO so )
128 add_definitions( -DAIPS_LINUX )
129 if( CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 )
130 add_definitions( -DAIPS_64B )
131 set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} -Wno-deprecated" )
132 else()
133 set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} -Wno-deprecated -Woverloaded-virtual" )
134 endif()
135endif()
136
137# set flags for cpp compiler
138set( CMAKE_CXX_FLAGS ${DEFAULT_CXX_FLAGS} )
139
140
141#
142# casacore definitions
143#
144set( CASACORE_DEFINITIONS ${CASACORE_DEFINITIONS}
145 -DCASA_USECASAPATH
146 -DCASACORE_NEEDS_RETHROW
147 -DAIPS_STDLIB
148 -DAIPS_AUTO_STL
149 -D_GNU_SOURCE )
150
151if( CMAKE_SYSTEM_NAME STREQUAL Linux )
152 set( CASACORE_DEFINITIONS ${CASACORE_DEFINITIONS}
153 -D_FILE_OFFSET_BITS=64
154 -D_LARGEFILE_SOURCE
155 )
156endif()
157
158add_definitions( ${CASACORE_DEFINITIONS} )
159
160#
161# mode specific settings
162#
163# STANDALONE=ON standalone build
164# STANDALONE=OFF build with casa
165#
166set( CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_SOURCE_DIR}/cmake" )
167message( STATUS "CMAKE_MODULE_PATH = " ${CMAKE_MODULE_PATH} )
168if( STANDALONE )
169 include( standalone )
170else()
171 include( withcasa )
172endif()
173
174message( STATUS "CMAKE_INSTALL_PREFIX = " ${CMAKE_INSTALL_PREFIX} )
175
176
177#
178# casacore
179#
180unset( CASACORE_INCLUDE_DIR CACHE )
181unset( CASACORE_LIBRARIES CACHE )
182if( NOT USE_LIBCASACORE )
183 # use casacore libraries
184 set( _includename casa/aipsdef.h )
185 find_path( CASACORE_INCLUDE_DIR ${_includename}
186 PATHS ${CASACORE_PATHS}
187 PATH_SUFFIXES include include/casacore
188 NO_DEFAULT_PATH )
189 find_path( CASACORE_INCLUDE_DIR ${_includename} )
190 if( CASACORE_INCLUDE_DIR MATCHES "NOTFOUND$" )
191 message( FATAL_ERROR "${_includename} could not be found. Please check!" )
192 endif()
193 set( CASACORE_LIBS casa
194 components
195 coordinates
196 fits
197 images
198 lattices
199 measures
200 mirlib
201 ms
202 msfits
203 scimath
204 scimath_f
205 tables )
206 set( _casacore_libs "" )
207 foreach( _a ${CASACORE_LIBS} )
208 set( _libname libcasa_${_a}.${SO} )
209 unset( _casacore_lib CACHE )
210 find_library( _casacore_lib ${_libname}
211 PATHS ${CASACORE_PATHS}
212 PATH_SUFFIXES lib64 lib )
213 if( _casacore_lib MATCHES "NOTFOUND$" )
214 message( FATAL_ERROR "${_libname} could not be found. Please check!" )
215 else()
216 #list( APPEND _casacore_libs casa_${_a} )
217 list( APPEND _casacore_libs ${_casacore_lib} )
218 endif()
219 endforeach()
220 set( CASACORE_LIBRARIES ${_casacore_libs} )
221else()
222 # use libcasacore
223 set( _libname libcasacore.${SO} )
224 find_library( CASACORE_LIBRARIES ${_libname}
225 PATHS ${CASACORE_PATHS}
226 PATH_SUFFIXES lib64 lib )
227 if( CASACORE_LIBRARIES MATCHES "NOTFOUND$" )
228 message( FATAL_ERROR "${_libname} could not be found. Please check!" )
229 endif()
230 set( _includename casa/aipsdef.h )
231 string( REGEX REPLACE /[^/]+/[^/]+/?$ "" _coreroot ${CASACORE_LIBRARIES} )
232 find_path( CASACORE_INCLUDE_DIR ${_includename}
233 PATHS ${_coreroot}
234 PATH_SUFFIXES include include/casacore
235 NO_DEFAULT_PATH )
236 find_path( CASACORE_INCLUDE_DIR ${_includename}
237 PATHS ${CASACORE_PATHS}
238 PATH_SUFFIXES include include/casacore
239 NO_DEFAULT_PATH )
240 find_path( CASACORE_INCLUDE_DIR ${_includename} )
241 if( CASACORE_INCLUDE_DIR MATCHES "NOTFOUND$" )
242 message( FATAL_ERROR "${_includename} could not be found. Please check!" )
243 endif()
244endif()
245message( STATUS "CASACORE_LIBRARIES = " ${CASACORE_LIBRARIES} )
246message( STATUS "CASACORE_INCLUDE_DIR = " ${CASACORE_INCLUDE_DIR} )
247unset( USE_LIBCASACORE CACHE )
248
249
250#
251# Python
252#
253if( STANDALONE )
254 include( FindPythonLibs )
255 if( NOT PYTHONLIBS_FOUND )
256 message( FATAL_ERROR "Python could not be found. Please check!" )
257 endif()
258
259 # Define pyroot
260 string( REGEX REPLACE "/[^/]+/[^/]+/?$" "" pyroot ${PYTHON_INCLUDE_DIRS} )
261
262 # find numpy
263 string( REGEX MATCH [0-9].[0-9] PYTHONV ${PYTHON_INCLUDE_DIRS} )
264 string( REPLACE "." "" PV ${PYTHONV} )
265 find_path( NUMPY_INCLUDE_DIR numpy/npy_interrupt.h
266 PATHS
267 ${pyroot}/lib/python${PYTHONV}/site-packages/numpy/core
268 ${pyroot}/Library/Frameworks/Python.framework/Versions/${PYTHONV}
269 ${pyroot}/Library/Frameworks/Python.framework/Versions/${PYTHONV}/lib/python${PYTHONV}/site-packages/numpy/core
270 PATH_SUFFIXES include )
271 if( NUMPY_INCLUDE_DIR MATCHES "NOTFOUND$" )
272 message( FATAL_ERROR "numpy/npy_interrupt.h could not be found. Please check!" )
273 endif()
274 list( APPEND PYTHON_INCLUDE_DIRS ${NUMPY_INCLUDE_DIR} )
275
276 set( PYTHON_DEFINITIONS ${PYTHON_DEFINITIONS}
277 -DPYTHONROOT=\"${pyroot}\"
278 -DPYTHONVER=\"${PYTHONV}\"
279 -DPYVERSION=${PV} )
280else()
281 # with CASA
282 if( NOT PYTHON_FOUND )
283 if ( NOT PYTHON_LIBNAME )
284 #set( _names 2.9 2.8 2.7 2.6 2.5.2 2.5 )
285 set( _names 2.6 2.5.2 2.5 )
286 # OSX 10.7 has Python2.7 by default. CASA has't yet supported python > 2.6 anyway.
287 # (The library named libpython.2.5.2.dylib seems to exist only in the CASA world.)
288 else()
289 set( _names ${PYTHON_LIBNAME} )
290 endif()
291
292 set( _found False )
293 foreach( _v ${_names} )
294
295 casa_find(
296 PYTHON${_v}
297 #PREFIX_HINTS ${PYTHON_ROOT_DIR}
298 LIBS python${_v}
299 NO_REQUIRE
300 )
301
302 if( PYTHON${_v}_FOUND )
303 set( PYTHON_LIBNAME ${_v} )
304 set( _found True )
305 break()
306 endif()
307
308 endforeach()
309
310 if( NOT _found )
311 message( FATAL_ERROR "Could not find any PYTHON library with version one of ${_names}. Please check!" )
312 endif()
313
314 endif()
315
316 if( NOT PYTHON_LIBNAME )
317 # Found Python, but PYTHON_LIBNAME is undefined, that is impossible.
318 message( FATAL_ERROR "The variable PYTHON_LIBNAME is undefined. Most likely, CMake's cache is out of date and you need to redetect your PYTHON installation (\"cmake -U PYTHON*\")")
319 endif()
320
321 string( SUBSTRING ${PYTHON_LIBNAME} 0 3 PYTHONV )
322 string( REPLACE "." "" PV ${PYTHONV} )
323 set( python_library python${PYTHON_LIBNAME} )
324
325 # Form the Python install prefix by stripping away "lib/libpython2.5.2.dylib" (example) from
326 # the full python library path
327 string( REGEX MATCH "/lib(64)?/lib${python_library}" _match ${PYTHON${PYTHON_LIBNAME}_LIBRARIES} )
328 if( _match )
329 string( REGEX REPLACE "/lib(64)?/lib${python_library}.*" "" python_prefix ${PYTHON${PYTHON_LIBNAME}_LIBRARIES} )
330 else()
331 # Python library was not in a lib(64) directory!
332 message( WARNING "Python library path \"${PYTHON${PYTHON_LIBNAME}_LIBRARIES}\" does not contain \"/lib(64)/lib${python_library}\"" )
333 set( python_prefix ${casa_packages} )
334 endif()
335
336 #
337 # For some unknown reason cmake sets the /usr for Lion
338 #
339 if( APPLE )
340 set( python_prefix ${casa_packages} )
341 endif()
342
343 # The python version and prefix is known, do the actual search
344 if( NOT PYTHON_FOUND )
345 message( STATUS "Looking for PYTHON version ${PYTHONV}.x in ${python_prefix}" )
346 endif()
347
348 casa_find( PYTHON
349 VERSION 2.5 # minimum required
350 INCLUDES Python.h
351 numpy/npy_interrupt.h # for numpy
352 INCLUDES_SUFFIXES python${PYTHONV}
353 PREFIX_HINTS
354 ${python_prefix}/lib/python${PYTHONV}/site-packages/numpy/core
355 ${python_prefix}/Library/Frameworks/Python.framework/Versions/${PYTHONV}
356 ${python_prefix}/Library/Frameworks/Python.framework/Versions/${PYTHONV}/lib/python${PYTHONV}/site-packages/numpy/core
357 LIBS ${python_library}
358 CPP_VERSION PY_VERSION )
359
360 # Store PYTHON_LIBNAME in the cache
361 set( PYTHON_LIBNAME ${PYTHON_LIBNAME} CACHE STRING "Python major and minor version to use" FORCE )
362
363 # Define pyroot to two directory levels above Python.h.
364 string( REGEX REPLACE "/[^/]+/[^/]+/?$" "" pyroot ${PYTHON_Python.h} )
365
366 set( PYTHON_DEFINITIONS ${PYTHON_DEFINITIONS}
367 -DAIPSROOT=\"${CMAKE_SOURCE_DIR}\"
368 -DAIPSARCH=\"${arch}\"
369 -DAIPSSITE=\"garching\"
370 -DPYTHONROOT=\"${pyroot}\"
371 -DPYTHONVER=\"${PYTHONV}\"
372 -DPYVERSION=${PV} )
373endif()
374message( STATUS "PYTHON_INCLUDE_DIRS = " ${PYTHON_INCLUDE_DIRS} )
375message( STATUS "PYTHON_LINRARIES = " ${PYTHON_LIBRARIES} )
376message( STATUS "PYTHONV = " ${PYTHONV} )
377
378
379#
380# DL
381#
382set( DL_LIBRARIES ${CMAKE_DL_LIBS} CACHE STRING "dl libraries" FORCE )
383if( DL_LIBRARIES STREQUAL "dl" )
384 set( DL_LIBRARIES "-ldl" CACHE STRING "dl libraries" FORCE )
385endif()
386message( STATUS "DL_LIBRARIES = " ${DL_LIBRARIES} )
387
388
389#
390# BLAS
391#
392find_library( BLAS_LIBRARIES libblas.${SO} )
393if ( BLAS_LIBRARIES MATCHES "NOTFOUND$" )
394 message( FATAL_ERROR "blas could not be found. Please check!" )
395endif()
396message( STATUS "BLAS_LIBRARIES = " ${BLAS_LIBRARIES} )
397
398
399#
400# LAPACK
401#
402find_library( LAPACK_LIBRARIES liblapack.${SO} )
403if ( LAPACK_LIBRARIES MATCHES "NOTFOUND$" )
404 message( FATAL_ERROR "lapack could not be found. Please check!" )
405endif()
406message( STATUS "LAPACK_LIBRARIES = " ${LAPACK_LIBRARIES} )
407
408
409#
410# Boost
411#
412set( boost_components python )
413if( NOT STANDALONE )
414 set( boost_components ${boost_components} system )
415endif()
416find_package( Boost REQUIRED ${boost_components} )
417if( NOT Boost_FOUND )
418 message( FATAL_ERROR "Boost could not be found. Please check!" )
419endif()
420message( STATUS "BOOST_INCLUDE_DIR = " ${Boost_INCLUDE_DIR} )
421message( STATUS "BOOST_LIBRARIES = " ${Boost_LIBRARIES} )
422
423
424#
425# cfitsio
426#
427if( STANDALONE )
428 find_path( CFITSIO_INCLUDE_DIRS fitsio.h
429 PATH_SUFFIXES cfitsio )
430 if( CFITSIO_INCLUDE_DIRS MATCHES "NOTFOUND$" )
431 message( FATAL_ERROR "fitsio.h could not be found. Please check!" )
432 endif()
433 string( REGEX REPLACE "/[^/]+/?$" "" CFITSIO_ROOT ${CFITSIO_INCLUDE_DIRS} )
434 message( STATUS "CFITSIO_ROOT=" ${CFITSIO_ROOT} )
435 find_library( CFITSIO_LIBRARIES libcfitsio.${SO}
436 PATHS ${CFITSIO_ROOT}
437 PATH_SUFFIXES lib64 lib
438 NO_DEFAULT_PATH )
439 if( CFITSIO_LIBRARIES MATCHES "NOTFOUND$" )
440 find_library( CFITSIO_LIBRARIES libcfitsio.a
441 PATHS ${CFITSIO_ROOT}
442 PATH_SUFFIXES lib64 lib
443 NO_DEFAULT_PATH )
444 endif()
445 find_library( CFITSIO_LIBRARIES libcfitsio.${SO}
446 PATHS /usr/local /usr
447 PATH_SUFFIXES lib64 lib )
448 if( CFITSIO_LIBRARIES MATCHES "NOTFOUND$" )
449 message( FATAL_ERROR "libcfitsio.so could not be found. Please check!" )
450 endif()
451else()
452 casa_find( CFITSIO
453 VERSION 3.006
454 INCLUDES fitsio.h fitsio2.h
455 INCLUDES_SUFFIXES cfitsio
456 LIBS cfitsio
457 CPP_VERSION CFITSIO_VERSION
458 RUN_VERSION "(ffvers(&v), v)" )
459endif()
460message( STATUS "CFITSIO_INCLUDE_DIRS = " ${CFITSIO_INCLUDE_DIRS} )
461message( STATUS "CFITSIO_LIBRARIES = " ${CFITSIO_LIBRARIES} )
462
463
464#
465# Fortran
466#
467if( NOT FORTRAN_LIBRARIES )
468
469 message( STATUS "Looking for Fortran runtime libraries" )
470 set( _try ${CMAKE_BINARY_DIR}/try_fortran.cc )
471 file( WRITE ${_try}
472 "int main() { return 0; }\n"
473 )
474
475 if( _gfortran_lib_path )
476 try_compile( _have_gfortran ${CMAKE_BINARY_DIR} ${_try}
477 CMAKE_FLAGS -Wdev "-DCMAKE_EXE_LINKER_FLAGS=${_gfortran_lib_path}"
478 )
479 else()
480 try_compile( _have_gfortran ${CMAKE_BINARY_DIR} ${_try}
481 CMAKE_FLAGS -Wdev "-DCMAKE_EXE_LINKER_FLAGS=-lgfortran"
482 )
483 endif()
484 try_compile( _have_g2c ${CMAKE_BINARY_DIR} ${_try}
485 CMAKE_FLAGS -Wdev "-DCMAKE_EXE_LINKER_FLAGS=-lg2c"
486 )
487
488 if( _have_gfortran )
489 if( _gfortran_lib_path )
490 set( FORTRAN_LIBRARIES ${_gfortran_lib_path}
491 CACHE STRING "Fortran library linker option" FORCE )
492 else()
493 set( FORTRAN_LIBRARIES -lgfortran
494 CACHE STRING "Fortran library linker option" FORCE )
495 endif()
496 message( STATUS "Looking for Fortran runtime libraries -- ${FORTRAN_LIBRARIES}" )
497 elseif( _have_g2c )
498 set( FORTRAN_LIBRARIES -lg2c
499 CACHE STRING "Fortran library linker option" FORCE )
500 message( STATUS "Looking for Fortran runtime libraries -- ${FORTRAN_LIBRARIES}" )
501 else()
502 set( FORTRAN_LIBRARIES ""
503 CACHE STRING "Fortran library linker option" FORCE )
504 message( STATUS "Looking for Fortran runtime libraries -- <none>" )
505 # Not a fatal error because it might work, if all Fortran dependencies were
506 # already linked statically to the Fortran runtime...
507 endif()
508endif()
509
510
511#
512# RPFITS
513#
514if ( STANDALONE )
515 find_path( RPFITS_INCLUDE_DIRS RPFITS.h
516 PATHS /usr/local /usr
517 PATH_SUFFIXES include )
518 if( RPFITS_INCLUDE_DIRS MATCHES "NOTFOUND$" )
519 message( FATAL_ERROR "RPFITS.h could not be found. Please check!" )
520 endif()
521 find_library( RPFITS_LIBRARIES librpfits.so
522 PATHS /usr/local /usr
523 PATH_SUFFIXES lib64 lib )
524 if( RPFITS_LIBRARIES MATCHES "NOTFOUND$" )
525 message( FATAL_ERROR "librpfits.so could not be found. Please check!" )
526 endif()
527 list( APPEND RPFITS_LIBRARIES ${FORTRAN_LIBRARIES} )
528else()
529 casa_find( RPFITS
530 VERSION 2.11
531 INCLUDES RPFITS.h
532 LIBS rpfits
533 RUN_VERSION names_.rpfitsversion
534 DEPENDS FORTRAN )
535endif()
536message( STATUS "RPFITS_INCLUDE_DIRS = " ${RPFITS_INCLUDE_DIRS} )
537message( STATUS "RPFITS_LIBRARIES = " ${RPFITS_LIBRARIES} )
538
539
540#
541# wcslib
542#
543set( _wcslib libwcs.${SO} )
544set( _wcs_version 4.3 )
545find_library( WCSLIB ${_wcslib}
546 PATHS ${WCSLIB_PATHS}
547 PATH_SUFFIXES lib64 lib )
548if( WCSLIB MATCHES "NOTFOUND$" )
549 message( STATUS "${_wcslib} could not be found." )
550 unset( _wcslib CACHE )
551 unset( WCSLIB CACHE )
552 set( _wcslib libwcs.${_wcs_version}.${SO} )
553 message( STATUS "Try to find ${_wcslib}..." )
554 find_library( WCSLIB ${_wcslib}
555 PATHS ${WCSLIB_PATHS}
556 PATH_SUFFIXES lib64 lib )
557 if( WCSLIB MATCHES "NOTFOUND$" )
558 message( FATAL_ERROR "${_wcslib} could not be found. Please check!" )
559 endif()
560endif()
561message( STATUS "WCSLIB = " ${WCSLIB} )
562find_path( WCSLIB_INCLUDE_DIR wcslib/wcs.h
563 PATHS ${WCSLIB_PATHS}
564 PATH_SUFFIXES include )
565if( WCSLIB_INCLUDE_DIR MATCHES "NOTFOUND$" )
566 message( FATAL_ERROR "wcs.h could not be found. Please check!" )
567endif()
568message( STATUS "WCSLIB_INCLUDE_DIR = " ${WCSLIB_INCLUDE_DIR} )
569
570
571#
572# common include path
573#
574include_directories( ${CASACORE_INCLUDE_DIR}
575 ${Boost_INCLUDE_DIR}
576 ${PYTHON_INCLUDE_DIRS}
577 ${WCSLIB_INCLUDE_DIR}
578 ${CFITSIO_INCLUDE_DIRS}
579 ${RPFITS_INCLUDE_DIRS} )
580
581
582#
583# install directory
584#
585set( EXEC_INSTALL_DIR bin )
586set( LIB_INSTALL_DIR lib )
587set( PYTHON_INSTALL_DIR python/${PYTHONV}/asap )
588set( SHARED_INSTALL_DIR share/asap )
589
590#
591# execute getsvnrev.sh to create/update svninfo.txt
592# run chmod to make sure the script has executable
593#
594exec_program( chmod ARGS a+x ${ASAP_SOURCE_DIR}/getsvnrev.sh )
595exec_program( chmod ARGS a+x ${ASAP_SOURCE_DIR}/cmake/exec_getsvnrev.sh )
596exec_program( ${ASAP_SOURCE_DIR}/cmake/exec_getsvnrev.sh ARGS ${ASAP_SOURCE_DIR})
597
598# Add the modules to be built.
599#
600# Choose to have correct RPATHs both in the build tree and
601# in the install tree (at the cost of having to change the
602# rpath when installing)
603#
604set( CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib )
605set( CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
606set( CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib )
607
608#
609# PKSMS
610#
611if ( NOT PKSMS )
612 add_definitions( -DNOPKSMS )
613endif()
614
615#
616# libraries and executables
617#
618set( ASAPPYLIB _asap )
619set( ASAPLIB asap )
620set( PYRAPLIB pyrap )
621set( ATNFLIB atnf )
622set( ASAP2TO3 asap2to3 )
623if ( NOT STANDALONE )
624# set( ASDM2ASAP_OLD oldasdm2ASAP )
625 set( ASDM2ASAP asdm2ASAP )
626endif()
627
628#
629# always install by default
630#
631add_custom_target( inst ALL ${CMAKE_BUILD_TOOL} install/fast )
632
633#
634# subdirectories
635#
636asap_add_subdirectory()
Note: See TracBrowser for help on using the repository browser.