source: trunk/CMakeLists.txt@ 3004

Last change on this file since 3004 was 3004, checked in by Kana Sugimoto, 11 years ago

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

What Interface Changed:

Test Programs:

Put in Release Notes: No

Module(s): build of asap by cmake

Description: minor modifications of removing white lines mainly to test merge.


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