| [1954] | 1 | ###
|
|---|
| 2 | # CMakeLists.txt for ASAP module
|
|---|
| 3 | ###
|
|---|
| 4 |
|
|---|
| 5 | # minimum requirement for cmake version
|
|---|
| 6 | cmake_minimum_required( VERSION 2.8 )
|
|---|
| 7 |
|
|---|
| [1958] | 8 | # Define compiler paths on OSX 10.5. This must be done before invoking project()
|
|---|
| 9 | if( APPLE )
|
|---|
| 10 | if( EXISTS /opt/casa/core2-apple-darwin8/3rd-party/bin/gfortran )
|
|---|
| 11 | set( SO dylib )
|
|---|
| 12 | set( CMAKE_Fortran_COMPILER /opt/casa/core2-apple-darwin8/3rd-party/bin/gfortran )
|
|---|
| 13 | set( CMAKE_CXX_COMPILER /opt/casa/core2-apple-darwin8/3rd-party/bin/g++ )
|
|---|
| 14 | elseif( EXISTS /opt/local/bin/gfortran )
|
|---|
| 15 | set( CMAKE_Fortran_COMPILER /opt/local/bin/gfortran )
|
|---|
| 16 | elseif( EXISTS /opt/local/bin/gfortran-mp-4.4 )
|
|---|
| 17 | set( CMAKE_Fortran_COMPILER /opt/local/bin/gfortran-mp-4.4 )
|
|---|
| 18 | if( EXISTS /opt/local/bin/g++-mp-4.4 )
|
|---|
| 19 | set( CMAKE_CXX_COMPILER /opt/local/bin/g++-mp-4.4 )
|
|---|
| 20 | endif()
|
|---|
| 21 | endif()
|
|---|
| 22 | endif()
|
|---|
| 23 |
|
|---|
| [1954] | 24 | # project name is ASAP
|
|---|
| 25 | project( ASAP )
|
|---|
| 26 |
|
|---|
| 27 | # install directory
|
|---|
| 28 | # set casaroot
|
|---|
| 29 | # the regular expression means '../'
|
|---|
| 30 | # [^ ] Matches any character(s) not inside the brackets
|
|---|
| 31 | # + Matches preceding pattern one or more times
|
|---|
| 32 | # ? Matches preceding pattern zero or once only
|
|---|
| 33 | # $ Mathces at end of a line
|
|---|
| 34 | string( REGEX REPLACE /[^/]+/?$ "" casaroot ${CMAKE_SOURCE_DIR} )
|
|---|
| 35 | message( STATUS "casaroot = " ${casaroot} )
|
|---|
| 36 |
|
|---|
| [1957] | 37 | # modules
|
|---|
| 38 | set( CMAKE_MODULE_PATH ${casaroot}/code/install )
|
|---|
| 39 | include( config )
|
|---|
| 40 | include( CASA )
|
|---|
| 41 |
|
|---|
| [1954] | 42 | # flags
|
|---|
| 43 | set( DEFAULT_CXX_FLAGS
|
|---|
| [1957] | 44 | "-pipe -Wall -Wextra -Wno-non-template-friend -Wcast-align -Wno-comment -O3" )
|
|---|
| [1954] | 45 | find_package( OpenMP )
|
|---|
| 46 | if( OPENMP_FOUND )
|
|---|
| 47 | set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" )
|
|---|
| 48 | endif()
|
|---|
| 49 |
|
|---|
| [1960] | 50 | set( CASACORE_DEFINITIONS ${CASACORE_DEFINITIONS}
|
|---|
| 51 | -DCASA_USECASAPATH
|
|---|
| 52 | -DCASACORE_NEEDS_RETHROW
|
|---|
| 53 | -DAIPS_STDLIB
|
|---|
| 54 | -DAIPS_AUTO_STL
|
|---|
| 55 | -D_GNU_SOURCE )
|
|---|
| 56 |
|
|---|
| 57 | if( CMAKE_SYSTEM_NAME STREQUAL Linux )
|
|---|
| 58 | set( CASACORE_DEFINITIONS ${CASACORE_DEFINITIONS}
|
|---|
| 59 | -D_FILE_OFFSET_BITS=64
|
|---|
| 60 | -D_LARGEFILE_SOURCE
|
|---|
| 61 | )
|
|---|
| 62 | endif()
|
|---|
| 63 |
|
|---|
| 64 | add_definitions( ${CASACORE_DEFINITIONS} )
|
|---|
| 65 |
|
|---|
| [1954] | 66 | # environment dependent settings
|
|---|
| [1958] | 67 | message( STATUS "CMAKE_SYSTEM = " ${CMAKE_SYSTEM} )
|
|---|
| [1954] | 68 | if( APPLE )
|
|---|
| 69 | set( SO dylib )
|
|---|
| 70 | if( NOT arch )
|
|---|
| 71 | set( arch darwin )
|
|---|
| 72 | endif()
|
|---|
| [1958] | 73 | if( CMAKE_SYSTEM MATCHES ^Darwin-10 )
|
|---|
| [1954] | 74 | if( NOT archflag )
|
|---|
| 75 | if( EXISTS /opt/casa/darwin10-64b )
|
|---|
| 76 | set( archflag x86_64 )
|
|---|
| 77 | elseif( EXISTS /opt/casa/core2-apple-darwin10 )
|
|---|
| 78 | set( archflag i386 )
|
|---|
| 79 | else()
|
|---|
| 80 | set( archflag x86_64 )
|
|---|
| 81 | endif()
|
|---|
| 82 | endif()
|
|---|
| 83 | if( archflag STREQUAL x86_64 )
|
|---|
| 84 | add_definitions( -DAIPS_64B )
|
|---|
| 85 | set( casa_packages /opt/casa/darwin10-64b )
|
|---|
| 86 | else()
|
|---|
| 87 | set( casa_packages /opt/casa/core2-apple-darwin10 )
|
|---|
| 88 | endif()
|
|---|
| 89 | execute_process( COMMAND ${CMAKE_CXX_COMPILER} --version
|
|---|
| 90 | COMMAND head -1
|
|---|
| 91 | COMMAND perl -pe "s|.*?(\\d+\\.\\d+)\\.\\d+$|$1|"
|
|---|
| 92 | OUTPUT_VARIABLE _cxx_version
|
|---|
| 93 | OUTPUT_STRIP_TRAILING_WHITESPACE )
|
|---|
| 94 | if( NOT _cxx_version STREQUAL "4.4" )
|
|---|
| 95 | set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} -arch ${archflag}" )
|
|---|
| 96 | endif()
|
|---|
| 97 | elseif( CMAKE_SYSTEM MATCHES ^Darwin-9 )
|
|---|
| 98 | set( casa_packages /opt/casa/core2-apple-darwin8/3rd-party )
|
|---|
| 99 | endif()
|
|---|
| 100 | elseif( CMAKE_SYSTEM_NAME STREQUAL Linux )
|
|---|
| 101 | set( SO so )
|
|---|
| 102 | add_definitions( -DAIPS_LINUX )
|
|---|
| 103 | if( CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 )
|
|---|
| 104 | set( casa_packages /usr/lib64/casapy )
|
|---|
| 105 | if( NOT arch )
|
|---|
| 106 | set( arch linux_64b )
|
|---|
| 107 | endif()
|
|---|
| 108 | add_definitions( -DAIPS_64B )
|
|---|
| 109 | set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} -Wno-deprecated" )
|
|---|
| 110 | else()
|
|---|
| 111 | set( casa_packages /usr/lib/casapy )
|
|---|
| 112 | if( NOT arch )
|
|---|
| 113 | set( arch linux_gnu )
|
|---|
| 114 | endif()
|
|---|
| 115 | set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} -Wno-deprecated -Woverloaded-virtual" )
|
|---|
| 116 | endif()
|
|---|
| 117 | endif()
|
|---|
| 118 | message( STATUS "arch = " ${arch} )
|
|---|
| 119 |
|
|---|
| 120 | # set root directory for installation
|
|---|
| 121 | set( CMAKE_INSTALL_PREFIX ${casaroot}/${arch} )
|
|---|
| 122 | message( STATUS "CMAKE_INSTALL_PREFIX = " ${CMAKE_INSTALL_PREFIX} )
|
|---|
| 123 |
|
|---|
| 124 | # set flags for cpp compiler
|
|---|
| 125 | set( CMAKE_CXX_FLAGS ${DEFAULT_CXX_FLAGS} )
|
|---|
| 126 |
|
|---|
| [1960] | 127 |
|
|---|
| 128 | #
|
|---|
| [1958] | 129 | # DL
|
|---|
| [1960] | 130 | #
|
|---|
| [1958] | 131 | set( DL_LIBRARIES ${CMAKE_DL_LIBS} CACHE STRING "dl libraries" FORCE )
|
|---|
| 132 | if( DL_LIBRARIES STREQUAL "dl" )
|
|---|
| 133 | set( DL_LIBRARIES "-ldl" CACHE STRING "dl libraries" FORCE )
|
|---|
| 134 | endif()
|
|---|
| 135 | message( STATUS "DL_LIBRARIES = " ${DL_LIBRARIES} )
|
|---|
| [1957] | 136 |
|
|---|
| [1960] | 137 |
|
|---|
| [1954] | 138 | #
|
|---|
| [1960] | 139 | # BLAS
|
|---|
| 140 | #
|
|---|
| 141 | find_library( BLAS_LIBRARIES libblas.${SO} )
|
|---|
| [1963] | 142 | if ( BLAS_LIBRARIES MATCHES "NOTFOUND$" )
|
|---|
| 143 | message( FATAL_ERROR "blas could not be found. Please check!" )
|
|---|
| 144 | endif()
|
|---|
| [1960] | 145 | message( STATUS "BLAS_LIBRARIES = " ${BLAS_LIBRARIES} )
|
|---|
| 146 |
|
|---|
| 147 |
|
|---|
| 148 | #
|
|---|
| 149 | # LAPACK
|
|---|
| 150 | #
|
|---|
| 151 | find_library( LAPACK_LIBRARIES liblapack.${SO} )
|
|---|
| [1963] | 152 | if ( LAPACK_LIBRARIES MATCHES "NOTFOUND$" )
|
|---|
| 153 | message( FATAL_ERROR "lapack could not be found. Please check!" )
|
|---|
| 154 | endif()
|
|---|
| [1960] | 155 | message( STATUS "LAPACK_LIBRARIES = " ${LAPACK_LIBRARIES} )
|
|---|
| 156 |
|
|---|
| 157 |
|
|---|
| 158 | #
|
|---|
| [1954] | 159 | # casacore
|
|---|
| 160 | #
|
|---|
| [1964] | 161 | unset( CASACORE_INCLUDE_DIR CACHE )
|
|---|
| 162 | unset( CASACORE_LIBRARIES CACHE )
|
|---|
| [1956] | 163 | if( NOT USE_LIBCASACORE )
|
|---|
| 164 | # use casacore libraries
|
|---|
| [1958] | 165 | set( _includename casa/aipsdef.h )
|
|---|
| 166 | find_path( CASACORE_INCLUDE_DIR ${_includename}
|
|---|
| [1956] | 167 | HINTS ${casaroot}/${arch}/include/
|
|---|
| [1958] | 168 | PATH_SUFFIXES casacore )
|
|---|
| [1963] | 169 | if( CASACORE_INCLUDE_DIR MATCHES "NOTFOUND$" )
|
|---|
| [1956] | 170 | message( FATAL_ERROR "${_includename} could not be found. Please check!" )
|
|---|
| [1954] | 171 | endif()
|
|---|
| [1956] | 172 | set( CASACORE_LIBS casa
|
|---|
| 173 | components
|
|---|
| 174 | coordinates
|
|---|
| 175 | fits
|
|---|
| 176 | images
|
|---|
| 177 | lattices
|
|---|
| 178 | measures
|
|---|
| 179 | mirlib
|
|---|
| 180 | ms
|
|---|
| 181 | msfits
|
|---|
| 182 | scimath
|
|---|
| 183 | scimath_f
|
|---|
| 184 | tables )
|
|---|
| 185 | set( _casacore_libs "" )
|
|---|
| 186 | foreach( _a ${CASACORE_LIBS} )
|
|---|
| 187 | set( _libname libcasa_${_a}.${SO} )
|
|---|
| 188 | unset( _casacore_lib CACHE )
|
|---|
| 189 | find_library( _casacore_lib ${_libname}
|
|---|
| 190 | PATHS ${CMAKE_INSTALL_PREFIX} PATH_SUFFIXES lib )
|
|---|
| [1963] | 191 | if( _casacore_lib MATCHES "NOTFOUND$" )
|
|---|
| 192 | message( FATAL_ERROR "${_libname} could not be found. Please check!" )
|
|---|
| 193 | else()
|
|---|
| [1958] | 194 | #list( APPEND _casacore_libs casa_${_a} )
|
|---|
| 195 | list( APPEND _casacore_libs ${_casacore_lib} )
|
|---|
| [1956] | 196 | endif()
|
|---|
| 197 | endforeach()
|
|---|
| 198 | set( CASACORE_LIBRARIES ${_casacore_libs} )
|
|---|
| 199 | else()
|
|---|
| 200 | # use libcasacore
|
|---|
| 201 | set( _libname libcasacore.${SO} )
|
|---|
| 202 | find_library( CASACORE_LIBRARIES ${_libname} )
|
|---|
| [1963] | 203 | if( CASACORE_LIBRARIES MATCHES "NOTFOUND$" )
|
|---|
| [1956] | 204 | message( FATAL_ERROR "${_libname} could not be found. Please check!" )
|
|---|
| 205 | endif()
|
|---|
| [1958] | 206 | set( _includename casa/aipsdef.h )
|
|---|
| 207 | find_path( CASACORE_INCLUDE_DIR ${_includename}
|
|---|
| 208 | PATH_SUFFIXES casacore )
|
|---|
| [1963] | 209 | if( CASACORE_INCLUDE_DIR MATCHES "NOTFOUND$" )
|
|---|
| [1956] | 210 | message( FATAL_ERROR "${_includename} could not be found. Please check!" )
|
|---|
| 211 | endif()
|
|---|
| 212 | endif()
|
|---|
| [1954] | 213 | message( STATUS "CASACORE_LIBRARIES = " ${CASACORE_LIBRARIES} )
|
|---|
| [1956] | 214 | message( STATUS "CASACORE_INCLUDE_DIR = " ${CASACORE_INCLUDE_DIR} )
|
|---|
| [1964] | 215 | unset( USE_LIBCASACORE CACHE )
|
|---|
| [1954] | 216 |
|
|---|
| 217 | #
|
|---|
| 218 | # Python
|
|---|
| 219 | #
|
|---|
| [1957] | 220 | if( NOT PYTHON_FOUND )
|
|---|
| 221 |
|
|---|
| 222 | if ( NOT PYTHON_LIBNAME )
|
|---|
| 223 | set( _names 2.9 2.8 2.7 2.6 2.5.2 2.5 )
|
|---|
| 224 | # (The library named libpython.2.5.2.dylib seems to exist only in the CASA world.)
|
|---|
| 225 | else()
|
|---|
| 226 | set( _names ${PYTHON_LIBNAME} )
|
|---|
| 227 | endif()
|
|---|
| 228 |
|
|---|
| 229 | set( _found False )
|
|---|
| 230 | foreach( _v ${_names} )
|
|---|
| 231 |
|
|---|
| 232 | casa_find(
|
|---|
| 233 | PYTHON${_v}
|
|---|
| 234 | LIBS python${_v}
|
|---|
| 235 | NO_REQUIRE
|
|---|
| 236 | )
|
|---|
| 237 |
|
|---|
| 238 | if( PYTHON${_v}_FOUND )
|
|---|
| 239 | set( PYTHON_LIBNAME ${_v} )
|
|---|
| 240 | set( _found True )
|
|---|
| 241 | break()
|
|---|
| 242 | endif()
|
|---|
| 243 |
|
|---|
| 244 | endforeach()
|
|---|
| 245 |
|
|---|
| 246 | if( NOT _found )
|
|---|
| 247 | message( FATAL_ERROR "Could not find any PYTHON library with version one of ${_names}. Please check!" )
|
|---|
| 248 | endif()
|
|---|
| 249 |
|
|---|
| [1954] | 250 | endif()
|
|---|
| 251 |
|
|---|
| [1957] | 252 | if( NOT PYTHON_LIBNAME )
|
|---|
| 253 | # Found Python, but PYTHON_LIBNAME is undefined, that is impossible.
|
|---|
| 254 | 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*\")")
|
|---|
| [1954] | 255 | endif()
|
|---|
| 256 |
|
|---|
| [1957] | 257 | string( SUBSTRING ${PYTHON_LIBNAME} 0 3 PYTHONV )
|
|---|
| 258 | string( REPLACE "." "" PV ${PYTHONV} )
|
|---|
| 259 | set( python_library python${PYTHON_LIBNAME} )
|
|---|
| 260 |
|
|---|
| 261 | # Form the Python install prefix by stripping away "lib/libpython2.5.2.dylib" (example) from
|
|---|
| 262 | # the full python library path
|
|---|
| 263 | string( REGEX MATCH "/lib(64)?/lib${python_library}" _match ${PYTHON${PYTHON_LIBNAME}_LIBRARIES} )
|
|---|
| 264 | if( _match )
|
|---|
| 265 | string( REGEX REPLACE "/lib(64)?/lib${python_library}.*" "" python_prefix ${PYTHON${PYTHON_LIBNAME}_LIBRARIES} )
|
|---|
| 266 | else()
|
|---|
| 267 | # Python library was not in a lib(64) directory!
|
|---|
| 268 | message( WARNING "Python library path \"${PYTHON${PYTHON_LIBNAME}_LIBRARIES}\" does not contain \"/lib(64)/lib${python_library}\"" )
|
|---|
| 269 | set( python_prefix ${casa_packages} )
|
|---|
| [1954] | 270 | endif()
|
|---|
| [1957] | 271 |
|
|---|
| 272 | # The python version and prefix is known, do the actual search
|
|---|
| 273 | if( NOT PYTHON_FOUND )
|
|---|
| 274 | message( STATUS "Looking for PYTHON version ${PYTHONV}.x in ${python_prefix}" )
|
|---|
| 275 | endif()
|
|---|
| 276 |
|
|---|
| 277 | casa_find( PYTHON
|
|---|
| 278 | VERSION 2.5 # minimum required
|
|---|
| 279 | INCLUDES Python.h
|
|---|
| 280 | numpy/npy_interrupt.h # for numpy
|
|---|
| 281 | INCLUDES_SUFFIXES python${PYTHONV}
|
|---|
| 282 | PREFIX_HINTS
|
|---|
| 283 | ${python_prefix}/lib/python${PYTHONV}/site-packages/numpy/core
|
|---|
| 284 | ${python_prefix}/Library/Frameworks/Python.framework/Versions/${PYTHONV}
|
|---|
| 285 | ${python_prefix}/Library/Frameworks/Python.framework/Versions/${PYTHONV}/lib/python${PYTHONV}/site-packages/numpy/core
|
|---|
| 286 | LIBS ${python_library}
|
|---|
| 287 | CPP_VERSION PY_VERSION )
|
|---|
| 288 |
|
|---|
| 289 | # Store PYTHON_LIBNAME in the cache
|
|---|
| 290 | set( PYTHON_LIBNAME ${PYTHON_LIBNAME} CACHE STRING "Python major and minor version to use" FORCE )
|
|---|
| 291 |
|
|---|
| 292 | # Define pyroot to two directory levels above Python.h.
|
|---|
| 293 | string( REGEX REPLACE "/[^/]+/[^/]+/?$" "" pyroot ${PYTHON_Python.h} )
|
|---|
| 294 |
|
|---|
| [1962] | 295 | message( STATUS "PYTHON_INCLUDE_DIRS = " ${PYTHON_INCLUDE_DIRS} )
|
|---|
| [1957] | 296 | message( STATUS "PYTHON_LINRARIES = " ${PYTHON_LIBRARIES} )
|
|---|
| 297 | message( STATUS "PYTHONV = " ${PYTHONV} )
|
|---|
| [1954] | 298 |
|
|---|
| [1957] | 299 | set( PYTHON_DEFINITIONS ${PYTHON_DEFINITIONS}
|
|---|
| 300 | -DAIPSROOT=\"${CMAKE_SOURCE_DIR}\"
|
|---|
| 301 | -DAIPSARCH=\"${arch}\"
|
|---|
| 302 | -DAIPSSITE=\"garching\"
|
|---|
| 303 | -DPYTHONROOT=\"${pyroot}\"
|
|---|
| 304 | -DPYTHONVER=\"${PYTHONV}\"
|
|---|
| 305 | -DPYVERSION=${PV} )
|
|---|
| 306 |
|
|---|
| 307 |
|
|---|
| [1954] | 308 | #
|
|---|
| 309 | # Boost
|
|---|
| 310 | #
|
|---|
| 311 | if( NOT BOOST_ROOT )
|
|---|
| 312 | set( BOOST_ROOT ${casa_packages} )
|
|---|
| 313 | endif()
|
|---|
| 314 |
|
|---|
| [1957] | 315 | set( boost_components python )
|
|---|
| [1954] | 316 | find_package( Boost REQUIRED ${boost_components} )
|
|---|
| 317 | if( NOT Boost_FOUND )
|
|---|
| 318 | message( FATAL_ERROR "Boost could not be found. Please check!" )
|
|---|
| 319 | endif()
|
|---|
| [1957] | 320 | message( STATUS "BOOST_INCLUDE_DIR = " ${Boost_INCLUDE_DIR} )
|
|---|
| 321 | message( STATUS "BOOST_LIBRARIES = " ${Boost_LIBRARIES} )
|
|---|
| [1954] | 322 |
|
|---|
| 323 |
|
|---|
| [1957] | 324 | #
|
|---|
| 325 | # cfitsio
|
|---|
| 326 | #
|
|---|
| 327 | casa_find( CFITSIO
|
|---|
| 328 | VERSION 3.006
|
|---|
| 329 | INCLUDES fitsio.h fitsio2.h
|
|---|
| 330 | INCLUDES_SUFFIXES cfitsio
|
|---|
| 331 | LIBS cfitsio
|
|---|
| 332 | CPP_VERSION CFITSIO_VERSION
|
|---|
| 333 | RUN_VERSION "(ffvers(&v), v)" )
|
|---|
| [1963] | 334 | #if( NOT CFITSIO_FOUND )
|
|---|
| 335 | # message( FATAL_ERROR "CFITSIO could not be found. Please check!" )
|
|---|
| 336 | #endif()
|
|---|
| [1957] | 337 | message( STATUS "CFITSIO_INCLUDE_DIRS = " ${CFITSIO_INCLUDE_DIRS} )
|
|---|
| 338 | message( STATUS "CFITSIO_LIBRARIES = " ${CFITSIO_LIBRARIES} )
|
|---|
| [1954] | 339 |
|
|---|
| [1957] | 340 |
|
|---|
| 341 | #
|
|---|
| 342 | # wcslib
|
|---|
| 343 | #
|
|---|
| 344 | set( _wcslib libwcs.${SO} )
|
|---|
| [1958] | 345 | set( _wcs_version 4.3 )
|
|---|
| [1957] | 346 | find_library( WCSLIB ${_wcslib}
|
|---|
| 347 | HINTS /usr/lib64 /usr/lib ${casaroot}/${arch}/lib )
|
|---|
| [1963] | 348 | if( WCSLIB MATCHES "NOTFOUND$" )
|
|---|
| [1958] | 349 | message( STATUS "${_wcslib} could not be found." )
|
|---|
| 350 | unset( _wcslib CACHE )
|
|---|
| 351 | unset( WCSLIB CACHE )
|
|---|
| 352 | set( _wcslib libwcs.${_wcs_version}.${SO} )
|
|---|
| 353 | message( STATUS "Try to find ${_wcslib}..." )
|
|---|
| 354 | find_library( WCSLIB ${_wcslib}
|
|---|
| 355 | HINTS /usr/lib64 /usr/lib ${casaroot}/${arch}/lib )
|
|---|
| [1963] | 356 | if( WCSLIB MATCHES "NOTFOUND$" )
|
|---|
| [1958] | 357 | message( FATAL_ERROR "${_wcslib} could not be found. Please check!" )
|
|---|
| 358 | endif()
|
|---|
| [1957] | 359 | endif()
|
|---|
| 360 | message( STATUS "WCSLIB = " ${WCSLIB} )
|
|---|
| [1958] | 361 | find_path( WCSLIB_INCLUDE_DIR wcslib/wcs.h
|
|---|
| 362 | HINTS /usr/include ${casaroot}/${arch}/include )
|
|---|
| [1963] | 363 | if( WCSLIB_INCLUDE_DIR MATCHES "NOTFOUND$" )
|
|---|
| [1958] | 364 | message( FATAL_ERROR "wcs.h could not be found. Please check!" )
|
|---|
| 365 | endif()
|
|---|
| 366 | message( STATUS "WCSLIB_INCLUDE_DIR = " ${WCSLIB_INCLUDE_DIR} )
|
|---|
| [1957] | 367 |
|
|---|
| 368 |
|
|---|
| 369 | #
|
|---|
| 370 | # RPFITS (Fortran)
|
|---|
| 371 | #
|
|---|
| 372 | if( NOT FORTRAN_LIBRARIES )
|
|---|
| 373 |
|
|---|
| 374 | message( STATUS "Looking for Fortran runtime libraries" )
|
|---|
| 375 | set( _try ${CMAKE_BINARY_DIR}/try_fortran.cc )
|
|---|
| 376 | file( WRITE ${_try}
|
|---|
| 377 | "int main() { return 0; }\n"
|
|---|
| 378 | )
|
|---|
| 379 |
|
|---|
| 380 | if( _gfortran_lib_path )
|
|---|
| 381 | try_compile( _have_gfortran ${CMAKE_BINARY_DIR} ${_try}
|
|---|
| 382 | CMAKE_FLAGS -Wdev "-DCMAKE_EXE_LINKER_FLAGS=${_gfortran_lib_path}"
|
|---|
| 383 | )
|
|---|
| 384 | else()
|
|---|
| 385 | try_compile( _have_gfortran ${CMAKE_BINARY_DIR} ${_try}
|
|---|
| 386 | CMAKE_FLAGS -Wdev "-DCMAKE_EXE_LINKER_FLAGS=-lgfortran"
|
|---|
| 387 | )
|
|---|
| [1954] | 388 | endif()
|
|---|
| [1957] | 389 | try_compile( _have_g2c ${CMAKE_BINARY_DIR} ${_try}
|
|---|
| 390 | CMAKE_FLAGS -Wdev "-DCMAKE_EXE_LINKER_FLAGS=-lg2c"
|
|---|
| 391 | )
|
|---|
| 392 |
|
|---|
| 393 | if( _have_gfortran )
|
|---|
| 394 | if( _gfortran_lib_path )
|
|---|
| 395 | set( FORTRAN_LIBRARIES ${_gfortran_lib_path}
|
|---|
| 396 | CACHE STRING "Fortran library linker option" FORCE )
|
|---|
| 397 | else()
|
|---|
| 398 | set( FORTRAN_LIBRARIES -lgfortran
|
|---|
| 399 | CACHE STRING "Fortran library linker option" FORCE )
|
|---|
| 400 | endif()
|
|---|
| 401 | message( STATUS "Looking for Fortran runtime libraries -- ${FORTRAN_LIBRARIES}" )
|
|---|
| 402 | elseif( _have_g2c )
|
|---|
| 403 | set( FORTRAN_LIBRARIES -lg2c
|
|---|
| 404 | CACHE STRING "Fortran library linker option" FORCE )
|
|---|
| 405 | message( STATUS "Looking for Fortran runtime libraries -- ${FORTRAN_LIBRARIES}" )
|
|---|
| 406 | else()
|
|---|
| 407 | set( FORTRAN_LIBRARIES ""
|
|---|
| 408 | CACHE STRING "Fortran library linker option" FORCE )
|
|---|
| 409 | message( STATUS "Looking for Fortran runtime libraries -- <none>" )
|
|---|
| 410 | # Not a fatal error because it might work, if all Fortran dependencies were
|
|---|
| 411 | # already linked statically to the Fortran runtime...
|
|---|
| 412 | endif()
|
|---|
| 413 | endif()
|
|---|
| [1954] | 414 |
|
|---|
| [1957] | 415 | casa_find( RPFITS
|
|---|
| 416 | VERSION 2.11
|
|---|
| 417 | INCLUDES RPFITS.h
|
|---|
| 418 | LIBS rpfits
|
|---|
| 419 | RUN_VERSION names_.rpfitsversion
|
|---|
| 420 | DEPENDS FORTRAN
|
|---|
| 421 | )
|
|---|
| [1963] | 422 | #if( NOT RPFITS_FOUND )
|
|---|
| 423 | # message( FATAL_ERROR "rpfits could not be found. Please check!" )
|
|---|
| 424 | #endif()
|
|---|
| [1962] | 425 | message( STATUS "RPFITS_INCLUDE_DIRS = " ${RPFITS_INCLUDE_DIRS} )
|
|---|
| [1957] | 426 | message( STATUS "RPFITS_LIBRARIES = " ${RPFITS_LIBRARIES} )
|
|---|
| [1954] | 427 |
|
|---|
| 428 |
|
|---|
| [1957] | 429 | #
|
|---|
| 430 | # common include path
|
|---|
| 431 | #
|
|---|
| [1954] | 432 | include_directories( ${CASACORE_INCLUDE_DIR}
|
|---|
| 433 | ${Boost_INCLUDE_DIR}
|
|---|
| [1962] | 434 | ${PYTHON_INCLUDE_DIRS}
|
|---|
| [1961] | 435 | ${WCSLIB_INCLUDE_DIR}
|
|---|
| 436 | ${CFITSIO_INCLUDE_DIRS}
|
|---|
| [1962] | 437 | ${RPFITS_INCLUDE_DIRS} )
|
|---|
| [1954] | 438 |
|
|---|
| 439 |
|
|---|
| [1957] | 440 | #
|
|---|
| [1954] | 441 | # install directory
|
|---|
| [1957] | 442 | #
|
|---|
| [1954] | 443 | set( EXEC_INSTALL_DIR bin )
|
|---|
| 444 | set( LIB_INSTALL_DIR lib )
|
|---|
| [1957] | 445 | set( PYTHON_INSTALL_DIR python/${PYTHONV}/asap )
|
|---|
| [1954] | 446 | set( SHARED_INSTALL_DIR share/asap )
|
|---|
| 447 |
|
|---|
| [1957] | 448 |
|
|---|
| 449 | #
|
|---|
| 450 | # libraries and executables
|
|---|
| 451 | #
|
|---|
| [1958] | 452 | set( ASAPLIB asap )
|
|---|
| [1957] | 453 | set( PYRAPLIB pyrap )
|
|---|
| 454 | set( ATNFLIB atnf )
|
|---|
| 455 | set( ASAP2TO3 asap2to3 )
|
|---|
| 456 |
|
|---|
| [1966] | 457 | #
|
|---|
| 458 | # always install by default
|
|---|
| 459 | #
|
|---|
| 460 | add_custom_target( inst ALL ${CMAKE_BUILD_TOOL} install/fast )
|
|---|
| [1957] | 461 |
|
|---|
| 462 | #
|
|---|
| [1954] | 463 | # subdirectories
|
|---|
| [1957] | 464 | # ASAP2TO3 asap2to3 apps
|
|---|
| 465 | # PYRAPLIB libpyrap.so external/libpyrap
|
|---|
| 466 | # ATNFLIB libatnf.so external-alma/atnf
|
|---|
| 467 | # ASAPLIB _asap.so src
|
|---|
| 468 | # python modules python
|
|---|
| 469 | # shared files share
|
|---|
| 470 | #
|
|---|
| [1954] | 471 | add_subdirectory( apps )
|
|---|
| 472 | add_subdirectory( external/libpyrap )
|
|---|
| 473 | add_subdirectory( external-alma/atnf )
|
|---|
| 474 | add_subdirectory( src )
|
|---|
| 475 | add_subdirectory( python )
|
|---|
| 476 | add_subdirectory( share )
|
|---|
| 477 |
|
|---|
| 478 |
|
|---|