source: trunk/CMakeLists.txt@ 2475

Last change on this file since 2475 was 2465, checked in by Takeshi Nakazato, 13 years ago

New Development: No

JIRA Issue: Yes CAS-3960

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: run sd unit/regression tests

Put in Release Notes: No

Module(s): Module Names change impacts.

Description: Describe your changes here...

The library _asap.so is separated into two pieces:

  • _asap.so now contains only python interfaces
  • C++ engines are moved to new library libasap.so

The _asap.so is installed in the same place as before
($CASAROOT/python/2.6/asap) while libasap.so is installed to
$CASAROOT/lib.

File size: 19.7 KB
RevLine 
[1954]1###
2# CMakeLists.txt for ASAP module
3###
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 )
15message( STATUS "USE_LIBCASACORE = " ${USE_LIBCASACORE} )
16message( STATUS "STANDALONE = " ${STANDALONE} )
[1958]17
[2445]18# Use casapy's fork of casacore
19if ( NOT STANDALONE )
20 add_definitions( -DUSE_CASAPY )
21endif ()
22
[1970]23# Define compiler paths on OSX 10.5. This must be done before invoking project()
24if( APPLE )
25 if( EXISTS /opt/casa/core2-apple-darwin8/3rd-party/bin/gfortran )
26 set( CMAKE_Fortran_COMPILER /opt/casa/core2-apple-darwin8/3rd-party/bin/gfortran )
27 set( CMAKE_CXX_COMPILER /opt/casa/core2-apple-darwin8/3rd-party/bin/g++ )
28 elseif( EXISTS /opt/local/bin/gfortran )
29 set( CMAKE_Fortran_COMPILER /opt/local/bin/gfortran )
30 elseif( EXISTS /opt/local/bin/gfortran-mp-4.4 )
31 set( CMAKE_Fortran_COMPILER /opt/local/bin/gfortran-mp-4.4 )
32 if( EXISTS /opt/local/bin/g++-mp-4.4 )
33 set( CMAKE_CXX_COMPILER /opt/local/bin/g++-mp-4.4 )
34 endif()
35 endif()
36endif()
37
[2296]38
[1970]39# project name is ASAP
40project( ASAP )
41
[2296]42
43#
44# build type and their flags
45#
46# CMAKE_BUILD_TYPE (Release, Debug, RelWithDebInfo, MinSizeRel, Profile)
47# default is RelWithDebInfo
48#
[2445]49
50
[2296]51if ( NOT CMAKE_BUILD_TYPE )
52 set( CMAKE_BUILD_TYPE RelWithDebInfo )
53endif()
54message( STATUS "CMAKE_BUILD_TYPE = " ${CMAKE_BUILD_TYPE} )
55
56# flags for Debug build
57if ( CMAKE_BUILD_TYPE STREQUAL Debug )
58 add_definitions( -DAIPS_DEBUG )
59endif()
60set( CMAKE_CXX_FLAGS_DEBUG "-ggdb3 -O0 -fno-omit-frame-pointer" )
61
62# flags for Profile build
63set( CMAKE_CXX_FLAGS_PROFILE "-g -O2 -pg -fprofile-arcs -fno-omit-frame-pointer" )
64
65# flags for Release build
[2297]66set( CMAKE_SHARED_LINKER_FLAGS_RELEASE "-Wl,-s" )
67set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-Wl,-s" )
[2296]68
69# flags for MinSizeRel build
[2297]70set( CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "-Wl,-s" )
71set( CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "-Wl,-s" )
[2296]72
[2298]73if ( DEFINED CXX_FLAGS_TAIL_END )
74 set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${CXX_FLAGS_TAIL_END}" )
75 set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${CXX_FLAGS_TAIL_END}" )
76 set( CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} ${CXX_FLAGS_TAIL_END}" )
77 set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${CXX_FLAGS_TAIL_END}" )
78 set( CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_PROFILE} ${CXX_FLAGS_TAIL_END}" )
79endif()
80
[2296]81# default flags
[1970]82set( DEFAULT_CXX_FLAGS
[2296]83 "-pipe -Wall -Wextra -Wno-non-template-friend -Wcast-align -Wno-comment" )
84
[1970]85find_package( OpenMP )
86if( OPENMP_FOUND )
87 set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" )
88endif()
89
90# environment dependent settings
91message( STATUS "CMAKE_SYSTEM = " ${CMAKE_SYSTEM} )
92message( STATUS "CMAKE_SYSTEM_PROCESSOR = " ${CMAKE_SYSTEM_PROCESSOR} )
93if( APPLE )
94 set( SO dylib )
[2400]95 if( CMAKE_SYSTEM MATCHES ^Darwin-10 OR
96 CMAKE_SYSTEM MATCHES ^Darwin-11 )
[1970]97 if( NOT archflag )
[2400]98 if( EXISTS /opt/casa/darwin11 )
[1970]99 set( archflag x86_64 )
[2400]100 elseif( EXISTS /opt/casa/darwin10-64b )
101 set( archflag x86_64 )
[1970]102 elseif( EXISTS /opt/casa/core2-apple-darwin10 )
103 set( archflag i386 )
104 else()
105 set( archflag x86_64 )
106 endif()
107 endif()
108 if( archflag STREQUAL x86_64 )
109 add_definitions( -DAIPS_64B )
110 endif()
111 execute_process( COMMAND ${CMAKE_CXX_COMPILER} --version
112 COMMAND head -1
113 COMMAND perl -pe "s|.*?(\\d+\\.\\d+)\\.\\d+$|$1|"
114 OUTPUT_VARIABLE _cxx_version
115 OUTPUT_STRIP_TRAILING_WHITESPACE )
116 if( NOT _cxx_version STREQUAL "4.4" )
117 set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} -arch ${archflag}" )
118 endif()
119 endif()
120elseif( CMAKE_SYSTEM_NAME STREQUAL Linux )
121 set( SO so )
122 add_definitions( -DAIPS_LINUX )
123 if( CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 )
124 add_definitions( -DAIPS_64B )
125 set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} -Wno-deprecated" )
126 else()
127 set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} -Wno-deprecated -Woverloaded-virtual" )
128 endif()
129endif()
130
[2296]131# set flags for cpp compiler
132set( CMAKE_CXX_FLAGS ${DEFAULT_CXX_FLAGS} )
[1970]133
[2296]134
[1960]135#
[2296]136# casacore definitions
137#
138set( CASACORE_DEFINITIONS ${CASACORE_DEFINITIONS}
139 -DCASA_USECASAPATH
140 -DCASACORE_NEEDS_RETHROW
141 -DAIPS_STDLIB
142 -DAIPS_AUTO_STL
143 -D_GNU_SOURCE )
144
145if( CMAKE_SYSTEM_NAME STREQUAL Linux )
146 set( CASACORE_DEFINITIONS ${CASACORE_DEFINITIONS}
147 -D_FILE_OFFSET_BITS=64
148 -D_LARGEFILE_SOURCE
149 )
150endif()
151
152add_definitions( ${CASACORE_DEFINITIONS} )
153
154
155#
[1968]156# mode specific settings
[1960]157#
[1968]158# STANDALONE=ON standalone build
159# STANDALONE=OFF build with casa
[1954]160#
[1968]161set( CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_SOURCE_DIR}/cmake" )
162message( STATUS "CMAKE_MODULE_PATH = " ${CMAKE_MODULE_PATH} )
163if( STANDALONE )
164 include( standalone )
[1956]165else()
[1968]166 include( withcasa )
[1956]167endif()
[1954]168
[1970]169message( STATUS "CMAKE_INSTALL_PREFIX = " ${CMAKE_INSTALL_PREFIX} )
[1957]170
[1970]171
[1954]172#
[1970]173# casacore
174#
175unset( CASACORE_INCLUDE_DIR CACHE )
176unset( CASACORE_LIBRARIES CACHE )
177if( NOT USE_LIBCASACORE )
178 # use casacore libraries
179 set( _includename casa/aipsdef.h )
180 find_path( CASACORE_INCLUDE_DIR ${_includename}
181 PATHS ${CASACORE_PATHS}
182 PATH_SUFFIXES include include/casacore
183 NO_DEFAULT_PATH )
184 find_path( CASACORE_INCLUDE_DIR ${_includename} )
185 if( CASACORE_INCLUDE_DIR MATCHES "NOTFOUND$" )
186 message( FATAL_ERROR "${_includename} could not be found. Please check!" )
187 endif()
188 set( CASACORE_LIBS casa
189 components
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 )
280 set( _names 2.6 2.5.2 2.5 )
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 )
469
470 if( _gfortran_lib_path )
471 try_compile( _have_gfortran ${CMAKE_BINARY_DIR} ${_try}
472 CMAKE_FLAGS -Wdev "-DCMAKE_EXE_LINKER_FLAGS=${_gfortran_lib_path}"
473 )
474 else()
475 try_compile( _have_gfortran ${CMAKE_BINARY_DIR} ${_try}
476 CMAKE_FLAGS -Wdev "-DCMAKE_EXE_LINKER_FLAGS=-lgfortran"
477 )
478 endif()
479 try_compile( _have_g2c ${CMAKE_BINARY_DIR} ${_try}
480 CMAKE_FLAGS -Wdev "-DCMAKE_EXE_LINKER_FLAGS=-lg2c"
481 )
482
483 if( _have_gfortran )
484 if( _gfortran_lib_path )
485 set( FORTRAN_LIBRARIES ${_gfortran_lib_path}
486 CACHE STRING "Fortran library linker option" FORCE )
487 else()
488 set( FORTRAN_LIBRARIES -lgfortran
489 CACHE STRING "Fortran library linker option" FORCE )
490 endif()
491 message( STATUS "Looking for Fortran runtime libraries -- ${FORTRAN_LIBRARIES}" )
492 elseif( _have_g2c )
493 set( FORTRAN_LIBRARIES -lg2c
494 CACHE STRING "Fortran library linker option" FORCE )
495 message( STATUS "Looking for Fortran runtime libraries -- ${FORTRAN_LIBRARIES}" )
496 else()
497 set( FORTRAN_LIBRARIES ""
498 CACHE STRING "Fortran library linker option" FORCE )
499 message( STATUS "Looking for Fortran runtime libraries -- <none>" )
500 # Not a fatal error because it might work, if all Fortran dependencies were
501 # already linked statically to the Fortran runtime...
502 endif()
503endif()
504
505
506#
507# RPFITS
508#
509if ( STANDALONE )
510 find_path( RPFITS_INCLUDE_DIRS RPFITS.h
511 PATHS /usr/local /usr
512 PATH_SUFFIXES include )
513 if( RPFITS_INCLUDE_DIRS MATCHES "NOTFOUND$" )
514 message( FATAL_ERROR "RPFITS.h could not be found. Please check!" )
515 endif()
516 find_library( RPFITS_LIBRARIES librpfits.so
517 PATHS /usr/local /usr
518 PATH_SUFFIXES lib64 lib )
519 if( RPFITS_LIBRARIES MATCHES "NOTFOUND$" )
520 message( FATAL_ERROR "librpfits.so could not be found. Please check!" )
521 endif()
522 list( APPEND RPFITS_LIBRARIES ${FORTRAN_LIBRARIES} )
523else()
524 casa_find( RPFITS
525 VERSION 2.11
526 INCLUDES RPFITS.h
527 LIBS rpfits
528 RUN_VERSION names_.rpfitsversion
529 DEPENDS FORTRAN )
530endif()
531message( STATUS "RPFITS_INCLUDE_DIRS = " ${RPFITS_INCLUDE_DIRS} )
532message( STATUS "RPFITS_LIBRARIES = " ${RPFITS_LIBRARIES} )
533
534
535#
536# wcslib
537#
538set( _wcslib libwcs.${SO} )
539set( _wcs_version 4.3 )
540find_library( WCSLIB ${_wcslib}
541 PATHS ${WCSLIB_PATHS}
542 PATH_SUFFIXES lib64 lib )
543if( WCSLIB MATCHES "NOTFOUND$" )
544 message( STATUS "${_wcslib} could not be found." )
545 unset( _wcslib CACHE )
546 unset( WCSLIB CACHE )
547 set( _wcslib libwcs.${_wcs_version}.${SO} )
548 message( STATUS "Try to find ${_wcslib}..." )
549 find_library( WCSLIB ${_wcslib}
550 PATHS ${WCSLIB_PATHS}
551 PATH_SUFFIXES lib64 lib )
552 if( WCSLIB MATCHES "NOTFOUND$" )
553 message( FATAL_ERROR "${_wcslib} could not be found. Please check!" )
554 endif()
555endif()
556message( STATUS "WCSLIB = " ${WCSLIB} )
557find_path( WCSLIB_INCLUDE_DIR wcslib/wcs.h
558 PATHS ${WCSLIB_PATHS}
559 PATH_SUFFIXES include )
560if( WCSLIB_INCLUDE_DIR MATCHES "NOTFOUND$" )
561 message( FATAL_ERROR "wcs.h could not be found. Please check!" )
562endif()
563message( STATUS "WCSLIB_INCLUDE_DIR = " ${WCSLIB_INCLUDE_DIR} )
564
565
566#
[1957]567# common include path
568#
[1954]569include_directories( ${CASACORE_INCLUDE_DIR}
570 ${Boost_INCLUDE_DIR}
[1962]571 ${PYTHON_INCLUDE_DIRS}
[1961]572 ${WCSLIB_INCLUDE_DIR}
573 ${CFITSIO_INCLUDE_DIRS}
[1962]574 ${RPFITS_INCLUDE_DIRS} )
[1954]575
576
[1957]577#
[1954]578# install directory
[1957]579#
[1954]580set( EXEC_INSTALL_DIR bin )
581set( LIB_INSTALL_DIR lib )
[1957]582set( PYTHON_INSTALL_DIR python/${PYTHONV}/asap )
[1954]583set( SHARED_INSTALL_DIR share/asap )
[2088]584
585#
586# execute getsvnrev.sh to create/update svninfo.txt
587# run chmod to make sure the script has executable
588#
589exec_program( chmod ARGS a+x ${ASAP_SOURCE_DIR}/getsvnrev.sh )
590exec_program( chmod ARGS a+x ${ASAP_SOURCE_DIR}/cmake/exec_getsvnrev.sh )
591exec_program( ${ASAP_SOURCE_DIR}/cmake/exec_getsvnrev.sh ARGS ${ASAP_SOURCE_DIR})
592
[1976]593# Add the modules to be built.
594#
595# Choose to have correct RPATHs both in the build tree and
596# in the install tree (at the cost of having to change the
597# rpath when installing)
598#
599set( CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib )
600set( CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
601set( CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib )
[1954]602
[1957]603
[1976]604
[1957]605#
606# libraries and executables
607#
[2465]608set( ASAPPYLIB _asap )
[1958]609set( ASAPLIB asap )
[1957]610set( PYRAPLIB pyrap )
611set( ATNFLIB atnf )
612set( ASAP2TO3 asap2to3 )
[2210]613if ( NOT STANDALONE )
[2417]614# set( ASDM2ASAP_OLD oldasdm2ASAP )
[2210]615 set( ASDM2ASAP asdm2ASAP )
616endif()
[1957]617
[1966]618#
619# always install by default
620#
621add_custom_target( inst ALL ${CMAKE_BUILD_TOOL} install/fast )
[1957]622
623#
[1954]624# subdirectories
[1957]625#
[1968]626asap_add_subdirectory()
Note: See TracBrowser for help on using the repository browser.