| 1 | ###
|
|---|
| 2 | # CMakeLists.txt for ASAP module
|
|---|
| 3 | ###
|
|---|
| 4 |
|
|---|
| 5 | # minimum requirement for cmake version
|
|---|
| 6 | cmake_minimum_required( VERSION 2.8 )
|
|---|
| 7 |
|
|---|
| 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 |
|
|---|
| 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 |
|
|---|
| 37 | # modules
|
|---|
| 38 | set( CMAKE_MODULE_PATH ${casaroot}/code/install )
|
|---|
| 39 | include( config )
|
|---|
| 40 | include( CASA )
|
|---|
| 41 |
|
|---|
| 42 | # flags
|
|---|
| 43 | set( DEFAULT_CXX_FLAGS
|
|---|
| 44 | "-pipe -Wall -Wextra -Wno-non-template-friend -Wcast-align -Wno-comment -O3" )
|
|---|
| 45 | find_package( OpenMP )
|
|---|
| 46 | if( OPENMP_FOUND )
|
|---|
| 47 | set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" )
|
|---|
| 48 | endif()
|
|---|
| 49 |
|
|---|
| 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 |
|
|---|
| 66 | # environment dependent settings
|
|---|
| 67 | message( STATUS "CMAKE_SYSTEM = " ${CMAKE_SYSTEM} )
|
|---|
| 68 | if( APPLE )
|
|---|
| 69 | set( SO dylib )
|
|---|
| 70 | if( NOT arch )
|
|---|
| 71 | set( arch darwin )
|
|---|
| 72 | endif()
|
|---|
| 73 | if( CMAKE_SYSTEM MATCHES ^Darwin-10 )
|
|---|
| 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 |
|
|---|
| 127 |
|
|---|
| 128 | #
|
|---|
| 129 | # DL
|
|---|
| 130 | #
|
|---|
| 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} )
|
|---|
| 136 |
|
|---|
| 137 |
|
|---|
| 138 | #
|
|---|
| 139 | # BLAS
|
|---|
| 140 | #
|
|---|
| 141 | find_library( BLAS_LIBRARIES libblas.${SO} )
|
|---|
| 142 | message( STATUS "BLAS_LIBRARIES = " ${BLAS_LIBRARIES} )
|
|---|
| 143 |
|
|---|
| 144 |
|
|---|
| 145 | #
|
|---|
| 146 | # LAPACK
|
|---|
| 147 | #
|
|---|
| 148 | find_library( LAPACK_LIBRARIES liblapack.${SO} )
|
|---|
| 149 | message( STATUS "LAPACK_LIBRARIES = " ${LAPACK_LIBRARIES} )
|
|---|
| 150 |
|
|---|
| 151 |
|
|---|
| 152 | #
|
|---|
| 153 | # casacore
|
|---|
| 154 | #
|
|---|
| 155 | if( NOT USE_LIBCASACORE )
|
|---|
| 156 | # use casacore libraries
|
|---|
| 157 | set( _includename casa/aipsdef.h )
|
|---|
| 158 | find_path( CASACORE_INCLUDE_DIR ${_includename}
|
|---|
| 159 | HINTS ${casaroot}/${arch}/include/
|
|---|
| 160 | PATH_SUFFIXES casacore )
|
|---|
| 161 | if( CASACORE_INCLUDE_DIR STREQUAL CASACORE_INCLUDE_DIR-NOTFOUND )
|
|---|
| 162 | message( FATAL_ERROR "${_includename} could not be found. Please check!" )
|
|---|
| 163 | endif()
|
|---|
| 164 | set( CASACORE_LIBS casa
|
|---|
| 165 | components
|
|---|
| 166 | coordinates
|
|---|
| 167 | fits
|
|---|
| 168 | images
|
|---|
| 169 | lattices
|
|---|
| 170 | measures
|
|---|
| 171 | mirlib
|
|---|
| 172 | ms
|
|---|
| 173 | msfits
|
|---|
| 174 | scimath
|
|---|
| 175 | scimath_f
|
|---|
| 176 | tables )
|
|---|
| 177 | set( _casacore_libs "" )
|
|---|
| 178 | foreach( _a ${CASACORE_LIBS} )
|
|---|
| 179 | set( _libname libcasa_${_a}.${SO} )
|
|---|
| 180 | unset( _casacore_lib CACHE )
|
|---|
| 181 | find_library( _casacore_lib ${_libname}
|
|---|
| 182 | PATHS ${CMAKE_INSTALL_PREFIX} PATH_SUFFIXES lib )
|
|---|
| 183 | if( NOT _casacore_lib-NOTFOUND )
|
|---|
| 184 | #list( APPEND _casacore_libs casa_${_a} )
|
|---|
| 185 | list( APPEND _casacore_libs ${_casacore_lib} )
|
|---|
| 186 | endif()
|
|---|
| 187 | endforeach()
|
|---|
| 188 | set( CASACORE_LIBRARIES ${_casacore_libs} )
|
|---|
| 189 | else()
|
|---|
| 190 | # use libcasacore
|
|---|
| 191 | set( _libname libcasacore.${SO} )
|
|---|
| 192 | find_library( CASACORE_LIBRARIES ${_libname} )
|
|---|
| 193 | if( CASACORE_LIBRARIES STREQUAL CASACORE_LIBRARIES-NOTFOUND )
|
|---|
| 194 | message( FATAL_ERROR "${_libname} could not be found. Please check!" )
|
|---|
| 195 | endif()
|
|---|
| 196 | set( _includename casa/aipsdef.h )
|
|---|
| 197 | find_path( CASACORE_INCLUDE_DIR ${_includename}
|
|---|
| 198 | PATH_SUFFIXES casacore )
|
|---|
| 199 | if( CASACORE_INCLUDE_DIR STREQUAL CASACORE_INCLUDE_DIR-NOTFOUND )
|
|---|
| 200 | message( FATAL_ERROR "${_includename} could not be found. Please check!" )
|
|---|
| 201 | endif()
|
|---|
| 202 | endif()
|
|---|
| 203 | message( STATUS "CASACORE_LIBRARIES = " ${CASACORE_LIBRARIES} )
|
|---|
| 204 | message( STATUS "CASACORE_INCLUDE_DIR = " ${CASACORE_INCLUDE_DIR} )
|
|---|
| 205 |
|
|---|
| 206 |
|
|---|
| 207 | #
|
|---|
| 208 | # Python
|
|---|
| 209 | #
|
|---|
| 210 | if( NOT PYTHON_FOUND )
|
|---|
| 211 |
|
|---|
| 212 | if ( NOT PYTHON_LIBNAME )
|
|---|
| 213 | set( _names 2.9 2.8 2.7 2.6 2.5.2 2.5 )
|
|---|
| 214 | # (The library named libpython.2.5.2.dylib seems to exist only in the CASA world.)
|
|---|
| 215 | else()
|
|---|
| 216 | set( _names ${PYTHON_LIBNAME} )
|
|---|
| 217 | endif()
|
|---|
| 218 |
|
|---|
| 219 | set( _found False )
|
|---|
| 220 | foreach( _v ${_names} )
|
|---|
| 221 |
|
|---|
| 222 | casa_find(
|
|---|
| 223 | PYTHON${_v}
|
|---|
| 224 | LIBS python${_v}
|
|---|
| 225 | NO_REQUIRE
|
|---|
| 226 | )
|
|---|
| 227 |
|
|---|
| 228 | if( PYTHON${_v}_FOUND )
|
|---|
| 229 | set( PYTHON_LIBNAME ${_v} )
|
|---|
| 230 | set( _found True )
|
|---|
| 231 | break()
|
|---|
| 232 | endif()
|
|---|
| 233 |
|
|---|
| 234 | endforeach()
|
|---|
| 235 |
|
|---|
| 236 | if( NOT _found )
|
|---|
| 237 | message( FATAL_ERROR "Could not find any PYTHON library with version one of ${_names}. Please check!" )
|
|---|
| 238 | endif()
|
|---|
| 239 |
|
|---|
| 240 | endif()
|
|---|
| 241 |
|
|---|
| 242 | if( NOT PYTHON_LIBNAME )
|
|---|
| 243 | # Found Python, but PYTHON_LIBNAME is undefined, that is impossible.
|
|---|
| 244 | 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*\")")
|
|---|
| 245 | endif()
|
|---|
| 246 |
|
|---|
| 247 | string( SUBSTRING ${PYTHON_LIBNAME} 0 3 PYTHONV )
|
|---|
| 248 | string( REPLACE "." "" PV ${PYTHONV} )
|
|---|
| 249 | set( python_library python${PYTHON_LIBNAME} )
|
|---|
| 250 |
|
|---|
| 251 | # Form the Python install prefix by stripping away "lib/libpython2.5.2.dylib" (example) from
|
|---|
| 252 | # the full python library path
|
|---|
| 253 | string( REGEX MATCH "/lib(64)?/lib${python_library}" _match ${PYTHON${PYTHON_LIBNAME}_LIBRARIES} )
|
|---|
| 254 | if( _match )
|
|---|
| 255 | string( REGEX REPLACE "/lib(64)?/lib${python_library}.*" "" python_prefix ${PYTHON${PYTHON_LIBNAME}_LIBRARIES} )
|
|---|
| 256 | else()
|
|---|
| 257 | # Python library was not in a lib(64) directory!
|
|---|
| 258 | message( WARNING "Python library path \"${PYTHON${PYTHON_LIBNAME}_LIBRARIES}\" does not contain \"/lib(64)/lib${python_library}\"" )
|
|---|
| 259 | set( python_prefix ${casa_packages} )
|
|---|
| 260 | endif()
|
|---|
| 261 |
|
|---|
| 262 | # The python version and prefix is known, do the actual search
|
|---|
| 263 | if( NOT PYTHON_FOUND )
|
|---|
| 264 | message( STATUS "Looking for PYTHON version ${PYTHONV}.x in ${python_prefix}" )
|
|---|
| 265 | endif()
|
|---|
| 266 |
|
|---|
| 267 | casa_find( PYTHON
|
|---|
| 268 | VERSION 2.5 # minimum required
|
|---|
| 269 | INCLUDES Python.h
|
|---|
| 270 | numpy/npy_interrupt.h # for numpy
|
|---|
| 271 | INCLUDES_SUFFIXES python${PYTHONV}
|
|---|
| 272 | PREFIX_HINTS
|
|---|
| 273 | ${python_prefix}/lib/python${PYTHONV}/site-packages/numpy/core
|
|---|
| 274 | ${python_prefix}/Library/Frameworks/Python.framework/Versions/${PYTHONV}
|
|---|
| 275 | ${python_prefix}/Library/Frameworks/Python.framework/Versions/${PYTHONV}/lib/python${PYTHONV}/site-packages/numpy/core
|
|---|
| 276 | LIBS ${python_library}
|
|---|
| 277 | CPP_VERSION PY_VERSION )
|
|---|
| 278 |
|
|---|
| 279 | # Store PYTHON_LIBNAME in the cache
|
|---|
| 280 | set( PYTHON_LIBNAME ${PYTHON_LIBNAME} CACHE STRING "Python major and minor version to use" FORCE )
|
|---|
| 281 |
|
|---|
| 282 | # Define pyroot to two directory levels above Python.h.
|
|---|
| 283 | string( REGEX REPLACE "/[^/]+/[^/]+/?$" "" pyroot ${PYTHON_Python.h} )
|
|---|
| 284 |
|
|---|
| 285 | message( STATUS "PYTHON_INCLUDE_DIRS = " ${PYTHON_INCLUDE_DIRS} )
|
|---|
| 286 | message( STATUS "PYTHON_LINRARIES = " ${PYTHON_LIBRARIES} )
|
|---|
| 287 | message( STATUS "PYTHONV = " ${PYTHONV} )
|
|---|
| 288 |
|
|---|
| 289 | set( PYTHON_DEFINITIONS ${PYTHON_DEFINITIONS}
|
|---|
| 290 | -DAIPSROOT=\"${CMAKE_SOURCE_DIR}\"
|
|---|
| 291 | -DAIPSARCH=\"${arch}\"
|
|---|
| 292 | -DAIPSSITE=\"garching\"
|
|---|
| 293 | -DPYTHONROOT=\"${pyroot}\"
|
|---|
| 294 | -DPYTHONVER=\"${PYTHONV}\"
|
|---|
| 295 | -DPYVERSION=${PV} )
|
|---|
| 296 |
|
|---|
| 297 |
|
|---|
| 298 | #
|
|---|
| 299 | # Boost
|
|---|
| 300 | #
|
|---|
| 301 | if( NOT BOOST_ROOT )
|
|---|
| 302 | set( BOOST_ROOT ${casa_packages} )
|
|---|
| 303 | endif()
|
|---|
| 304 |
|
|---|
| 305 | set( boost_components python )
|
|---|
| 306 | find_package( Boost REQUIRED ${boost_components} )
|
|---|
| 307 | if( NOT Boost_FOUND )
|
|---|
| 308 | message( FATAL_ERROR "Boost could not be found. Please check!" )
|
|---|
| 309 | endif()
|
|---|
| 310 | message( STATUS "BOOST_INCLUDE_DIR = " ${Boost_INCLUDE_DIR} )
|
|---|
| 311 | message( STATUS "BOOST_LIBRARIES = " ${Boost_LIBRARIES} )
|
|---|
| 312 |
|
|---|
| 313 |
|
|---|
| 314 | #
|
|---|
| 315 | # cfitsio
|
|---|
| 316 | #
|
|---|
| 317 | casa_find( CFITSIO
|
|---|
| 318 | VERSION 3.006
|
|---|
| 319 | INCLUDES fitsio.h fitsio2.h
|
|---|
| 320 | INCLUDES_SUFFIXES cfitsio
|
|---|
| 321 | LIBS cfitsio
|
|---|
| 322 | CPP_VERSION CFITSIO_VERSION
|
|---|
| 323 | RUN_VERSION "(ffvers(&v), v)" )
|
|---|
| 324 | if( NOT CFITSIO_FOUND )
|
|---|
| 325 | message( FATAL_ERROR "CFITSIO could not be found. Please check!" )
|
|---|
| 326 | endif()
|
|---|
| 327 | message( STATUS "CFITSIO_INCLUDE_DIRS = " ${CFITSIO_INCLUDE_DIRS} )
|
|---|
| 328 | message( STATUS "CFITSIO_LIBRARIES = " ${CFITSIO_LIBRARIES} )
|
|---|
| 329 |
|
|---|
| 330 |
|
|---|
| 331 | #
|
|---|
| 332 | # wcslib
|
|---|
| 333 | #
|
|---|
| 334 | set( _wcslib libwcs.${SO} )
|
|---|
| 335 | set( _wcs_version 4.3 )
|
|---|
| 336 | find_library( WCSLIB ${_wcslib}
|
|---|
| 337 | HINTS /usr/lib64 /usr/lib ${casaroot}/${arch}/lib )
|
|---|
| 338 | if( WCSLIB STREQUAL WCSLIB-NOTFOUND )
|
|---|
| 339 | message( STATUS "${_wcslib} could not be found." )
|
|---|
| 340 | unset( _wcslib CACHE )
|
|---|
| 341 | unset( WCSLIB CACHE )
|
|---|
| 342 | set( _wcslib libwcs.${_wcs_version}.${SO} )
|
|---|
| 343 | message( STATUS "Try to find ${_wcslib}..." )
|
|---|
| 344 | find_library( WCSLIB ${_wcslib}
|
|---|
| 345 | HINTS /usr/lib64 /usr/lib ${casaroot}/${arch}/lib )
|
|---|
| 346 | if( WCSLIB STREQUAL WCSLIB-NOTFOUND )
|
|---|
| 347 | message( FATAL_ERROR "${_wcslib} could not be found. Please check!" )
|
|---|
| 348 | endif()
|
|---|
| 349 | endif()
|
|---|
| 350 | message( STATUS "WCSLIB = " ${WCSLIB} )
|
|---|
| 351 | find_path( WCSLIB_INCLUDE_DIR wcslib/wcs.h
|
|---|
| 352 | HINTS /usr/include ${casaroot}/${arch}/include )
|
|---|
| 353 | if( WCSLIB_INCLUDE_DIR STREQUAL WCSLIB_INCLUDE_DIR-NOTFOUND )
|
|---|
| 354 | message( FATAL_ERROR "wcs.h could not be found. Please check!" )
|
|---|
| 355 | endif()
|
|---|
| 356 | message( STATUS "WCSLIB_INCLUDE_DIR = " ${WCSLIB_INCLUDE_DIR} )
|
|---|
| 357 |
|
|---|
| 358 |
|
|---|
| 359 | #
|
|---|
| 360 | # RPFITS (Fortran)
|
|---|
| 361 | #
|
|---|
| 362 | if( NOT FORTRAN_LIBRARIES )
|
|---|
| 363 |
|
|---|
| 364 | message( STATUS "Looking for Fortran runtime libraries" )
|
|---|
| 365 | set( _try ${CMAKE_BINARY_DIR}/try_fortran.cc )
|
|---|
| 366 | file( WRITE ${_try}
|
|---|
| 367 | "int main() { return 0; }\n"
|
|---|
| 368 | )
|
|---|
| 369 |
|
|---|
| 370 | if( _gfortran_lib_path )
|
|---|
| 371 | try_compile( _have_gfortran ${CMAKE_BINARY_DIR} ${_try}
|
|---|
| 372 | CMAKE_FLAGS -Wdev "-DCMAKE_EXE_LINKER_FLAGS=${_gfortran_lib_path}"
|
|---|
| 373 | )
|
|---|
| 374 | else()
|
|---|
| 375 | try_compile( _have_gfortran ${CMAKE_BINARY_DIR} ${_try}
|
|---|
| 376 | CMAKE_FLAGS -Wdev "-DCMAKE_EXE_LINKER_FLAGS=-lgfortran"
|
|---|
| 377 | )
|
|---|
| 378 | endif()
|
|---|
| 379 | try_compile( _have_g2c ${CMAKE_BINARY_DIR} ${_try}
|
|---|
| 380 | CMAKE_FLAGS -Wdev "-DCMAKE_EXE_LINKER_FLAGS=-lg2c"
|
|---|
| 381 | )
|
|---|
| 382 |
|
|---|
| 383 | if( _have_gfortran )
|
|---|
| 384 | if( _gfortran_lib_path )
|
|---|
| 385 | set( FORTRAN_LIBRARIES ${_gfortran_lib_path}
|
|---|
| 386 | CACHE STRING "Fortran library linker option" FORCE )
|
|---|
| 387 | else()
|
|---|
| 388 | set( FORTRAN_LIBRARIES -lgfortran
|
|---|
| 389 | CACHE STRING "Fortran library linker option" FORCE )
|
|---|
| 390 | endif()
|
|---|
| 391 | message( STATUS "Looking for Fortran runtime libraries -- ${FORTRAN_LIBRARIES}" )
|
|---|
| 392 | elseif( _have_g2c )
|
|---|
| 393 | set( FORTRAN_LIBRARIES -lg2c
|
|---|
| 394 | CACHE STRING "Fortran library linker option" FORCE )
|
|---|
| 395 | message( STATUS "Looking for Fortran runtime libraries -- ${FORTRAN_LIBRARIES}" )
|
|---|
| 396 | else()
|
|---|
| 397 | set( FORTRAN_LIBRARIES ""
|
|---|
| 398 | CACHE STRING "Fortran library linker option" FORCE )
|
|---|
| 399 | message( STATUS "Looking for Fortran runtime libraries -- <none>" )
|
|---|
| 400 | # Not a fatal error because it might work, if all Fortran dependencies were
|
|---|
| 401 | # already linked statically to the Fortran runtime...
|
|---|
| 402 | endif()
|
|---|
| 403 | endif()
|
|---|
| 404 |
|
|---|
| 405 | casa_find( RPFITS
|
|---|
| 406 | VERSION 2.11
|
|---|
| 407 | INCLUDES RPFITS.h
|
|---|
| 408 | LIBS rpfits
|
|---|
| 409 | RUN_VERSION names_.rpfitsversion
|
|---|
| 410 | DEPENDS FORTRAN
|
|---|
| 411 | )
|
|---|
| 412 | if( NOT RPFITS_FOUND )
|
|---|
| 413 | message( FATAL_ERROR "${_wcslib} could not be found. Please check!" )
|
|---|
| 414 | endif()
|
|---|
| 415 | message( STATUS "RPFITS_INCLUDE_DIRS = " ${RPFITS_INCLUDE_DIRS} )
|
|---|
| 416 | message( STATUS "RPFITS_LIBRARIES = " ${RPFITS_LIBRARIES} )
|
|---|
| 417 |
|
|---|
| 418 |
|
|---|
| 419 | #
|
|---|
| 420 | # common include path
|
|---|
| 421 | #
|
|---|
| 422 | include_directories( ${CASACORE_INCLUDE_DIR}
|
|---|
| 423 | ${Boost_INCLUDE_DIR}
|
|---|
| 424 | ${PYTHON_INCLUDE_DIRS}
|
|---|
| 425 | ${WCSLIB_INCLUDE_DIR}
|
|---|
| 426 | ${CFITSIO_INCLUDE_DIRS}
|
|---|
| 427 | ${RPFITS_INCLUDE_DIRS} )
|
|---|
| 428 |
|
|---|
| 429 |
|
|---|
| 430 | #
|
|---|
| 431 | # install directory
|
|---|
| 432 | #
|
|---|
| 433 | set( EXEC_INSTALL_DIR bin )
|
|---|
| 434 | set( LIB_INSTALL_DIR lib )
|
|---|
| 435 | set( PYTHON_INSTALL_DIR python/${PYTHONV}/asap )
|
|---|
| 436 | set( SHARED_INSTALL_DIR share/asap )
|
|---|
| 437 |
|
|---|
| 438 |
|
|---|
| 439 | #
|
|---|
| 440 | # libraries and executables
|
|---|
| 441 | #
|
|---|
| 442 | set( ASAPLIB asap )
|
|---|
| 443 | set( PYRAPLIB pyrap )
|
|---|
| 444 | set( ATNFLIB atnf )
|
|---|
| 445 | set( ASAP2TO3 asap2to3 )
|
|---|
| 446 |
|
|---|
| 447 |
|
|---|
| 448 | #
|
|---|
| 449 | # subdirectories
|
|---|
| 450 | # ASAP2TO3 asap2to3 apps
|
|---|
| 451 | # PYRAPLIB libpyrap.so external/libpyrap
|
|---|
| 452 | # ATNFLIB libatnf.so external-alma/atnf
|
|---|
| 453 | # ASAPLIB _asap.so src
|
|---|
| 454 | # python modules python
|
|---|
| 455 | # shared files share
|
|---|
| 456 | #
|
|---|
| 457 | add_subdirectory( apps )
|
|---|
| 458 | add_subdirectory( external/libpyrap )
|
|---|
| 459 | add_subdirectory( external-alma/atnf )
|
|---|
| 460 | add_subdirectory( src )
|
|---|
| 461 | add_subdirectory( python )
|
|---|
| 462 | add_subdirectory( share )
|
|---|
| 463 |
|
|---|
| 464 |
|
|---|