source: branches/hpc33/CMakeLists.txt@ 2497

Last change on this file since 2497 was 2400, checked in by Kana Sugimoto, 13 years ago

New Development: Yes

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

What Interface Changed:

Test Programs: build asap

Put in Release Notes: No

Module(s): asap

Description: Added cmake definitions to build asap on OSX 10.7 Lion


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