[3004] | 1 | ###
|
---|
[1954] | 2 | # CMakeLists.txt for ASAP module
|
---|
[3004] | 3 | ###
|
---|
[1954] | 4 |
|
---|
| 5 | # minimum requirement for cmake version
|
---|
| 6 | cmake_minimum_required( VERSION 2.8 )
|
---|
| 7 |
|
---|
[3106] | 8 | add_definitions ("-DUseCasacoreNamespace")
|
---|
| 9 |
|
---|
[1968] | 10 | # options
|
---|
[3053] | 11 | option (CXX11 "Compile as C++11 if possible" YES)
|
---|
[3036] | 12 |
|
---|
[1968] | 13 | option( USE_LIBCASACORE
|
---|
| 14 | "set ON to use libcasacore.so instead of libcasa_*.so"
|
---|
| 15 | OFF )
|
---|
| 16 | option( STANDALONE
|
---|
| 17 | "set ON to build standalone mode"
|
---|
| 18 | OFF )
|
---|
[2577] | 19 | option( PKSMS
|
---|
| 20 | "set ON to diable to build PKSMS2reader/writer"
|
---|
| 21 | OFF )
|
---|
[3053] | 22 | message( STATUS "CXX11 = " ${CXX11} )
|
---|
[1968] | 23 | message( STATUS "USE_LIBCASACORE = " ${USE_LIBCASACORE} )
|
---|
| 24 | message( STATUS "STANDALONE = " ${STANDALONE} )
|
---|
[2577] | 25 | message( STATUS "PKSMS = " ${PKSMS} )
|
---|
[1958] | 26 |
|
---|
[3005] | 27 | # Use casapy's fork of casacore
|
---|
[2445] | 28 | if ( NOT STANDALONE )
|
---|
| 29 | add_definitions( -DUSE_CASAPY )
|
---|
[3096] | 30 | option( PYTHON_SHARED_LINKER_FLAGS
|
---|
| 31 | "set extra LINK_FLAGS for python shared objects and libraries"
|
---|
| 32 | OFF )
|
---|
[2445] | 33 | endif ()
|
---|
| 34 |
|
---|
[1970] | 35 | # Define compiler paths on OSX 10.5. This must be done before invoking project()
|
---|
| 36 | if( APPLE )
|
---|
| 37 | if( EXISTS /opt/casa/core2-apple-darwin8/3rd-party/bin/gfortran )
|
---|
| 38 | set( CMAKE_Fortran_COMPILER /opt/casa/core2-apple-darwin8/3rd-party/bin/gfortran )
|
---|
| 39 | set( CMAKE_CXX_COMPILER /opt/casa/core2-apple-darwin8/3rd-party/bin/g++ )
|
---|
| 40 | elseif( EXISTS /opt/local/bin/gfortran )
|
---|
| 41 | set( CMAKE_Fortran_COMPILER /opt/local/bin/gfortran )
|
---|
| 42 | elseif( EXISTS /opt/local/bin/gfortran-mp-4.4 )
|
---|
| 43 | set( CMAKE_Fortran_COMPILER /opt/local/bin/gfortran-mp-4.4 )
|
---|
| 44 | if( EXISTS /opt/local/bin/g++-mp-4.4 )
|
---|
| 45 | set( CMAKE_CXX_COMPILER /opt/local/bin/g++-mp-4.4 )
|
---|
| 46 | endif()
|
---|
| 47 | endif()
|
---|
| 48 | endif()
|
---|
| 49 |
|
---|
[2296] | 50 |
|
---|
[1970] | 51 | # project name is ASAP
|
---|
| 52 | project( ASAP )
|
---|
| 53 |
|
---|
[2296] | 54 |
|
---|
| 55 | #
|
---|
[3005] | 56 | # build type and their flags
|
---|
[2296] | 57 | #
|
---|
| 58 | # CMAKE_BUILD_TYPE (Release, Debug, RelWithDebInfo, MinSizeRel, Profile)
|
---|
| 59 | # default is RelWithDebInfo
|
---|
| 60 | #
|
---|
| 61 | if ( NOT CMAKE_BUILD_TYPE )
|
---|
| 62 | set( CMAKE_BUILD_TYPE RelWithDebInfo )
|
---|
| 63 | endif()
|
---|
| 64 | message( STATUS "CMAKE_BUILD_TYPE = " ${CMAKE_BUILD_TYPE} )
|
---|
| 65 |
|
---|
| 66 | # flags for Debug build
|
---|
| 67 | if ( CMAKE_BUILD_TYPE STREQUAL Debug )
|
---|
| 68 | add_definitions( -DAIPS_DEBUG )
|
---|
| 69 | endif()
|
---|
[3113] | 70 | set( CMAKE_CXX_FLAGS_DEBUG " -O0" )
|
---|
| 71 | if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
|
---|
| 72 | set( CMAKE_CXX_FLAGS_DEBUG "-ggdb3 -fno-omit-frame-pointer" )
|
---|
| 73 | endif( )
|
---|
[2296] | 74 |
|
---|
| 75 | # flags for Profile build
|
---|
| 76 | set( CMAKE_CXX_FLAGS_PROFILE "-g -O2 -pg -fprofile-arcs -fno-omit-frame-pointer" )
|
---|
| 77 |
|
---|
| 78 |
|
---|
[3027] | 79 | # flags for Release and MinSizeRel build
|
---|
| 80 | if ( APPLE )
|
---|
| 81 | # OS X
|
---|
| 82 | # On 10.8 (Darwin-12) with llvm clang, -s option for linker
|
---|
| 83 | # causes link error. This may be because that -s option is
|
---|
| 84 | # obsolete and is different behavior from Linux.
|
---|
| 85 | if ( CMAKE_SYSTEM MATCHES ^Darwin-11 AND NOT LLVMCOMPILER )
|
---|
| 86 | set( CMAKE_SHARED_LINKER_FLAGS_RELEASE "-Wl,-s" )
|
---|
| 87 | set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-Wl,-s" )
|
---|
| 88 | set( CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "-Wl,-s" )
|
---|
| 89 | set( CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "-Wl,-s" )
|
---|
| 90 | endif()
|
---|
| 91 | else()
|
---|
| 92 | # Linux
|
---|
| 93 | set( CMAKE_SHARED_LINKER_FLAGS_RELEASE "-Wl,-s" )
|
---|
| 94 | set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-Wl,-s" )
|
---|
| 95 | set( CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "-Wl,-s" )
|
---|
| 96 | set( CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "-Wl,-s" )
|
---|
| 97 | endif()
|
---|
[2296] | 98 |
|
---|
[2298] | 99 | if ( DEFINED CXX_FLAGS_TAIL_END )
|
---|
| 100 | set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${CXX_FLAGS_TAIL_END}" )
|
---|
| 101 | set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${CXX_FLAGS_TAIL_END}" )
|
---|
| 102 | set( CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} ${CXX_FLAGS_TAIL_END}" )
|
---|
| 103 | set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${CXX_FLAGS_TAIL_END}" )
|
---|
| 104 | set( CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_PROFILE} ${CXX_FLAGS_TAIL_END}" )
|
---|
| 105 | endif()
|
---|
| 106 |
|
---|
[2296] | 107 | # default flags
|
---|
[3051] | 108 | if( APPLE )
|
---|
[3113] | 109 | set( DEFAULT_CXX_FLAGS "-pipe -Wall -Wextra -Wno-comment" )
|
---|
[3051] | 110 | else ()
|
---|
[3113] | 111 | set( DEFAULT_CXX_FLAGS "-pipe -Wall -Wextra -Wno-comment" )
|
---|
[3051] | 112 | endif()
|
---|
[3113] | 113 | if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
|
---|
| 114 | set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} -Wcast-align" )
|
---|
| 115 | if (NOT APPLE)
|
---|
| 116 | set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} -Wno-non-template-friend" )
|
---|
| 117 | endif( )
|
---|
| 118 | endif( )
|
---|
[2296] | 119 |
|
---|
[3022] | 120 | # additional flag for fortran complex div/mul rules.
|
---|
| 121 | include( CheckCXXCompilerFlag )
|
---|
| 122 | include( CheckCCompilerFlag )
|
---|
| 123 | check_cxx_compiler_flag( -fcx-fortran-rules HAS_GXX_FORTRAN_RULES )
|
---|
| 124 | check_c_compiler_flag( -fcx-fortran-rules HAS_GCC_FORTRAN_RULES )
|
---|
| 125 | if( HAS_GXX_FORTRAN_RULES )
|
---|
| 126 | set( DEFAULT_CXX_FLAGS "-fcx-fortran-rules ${DEFAULT_CXX_FLAGS}")
|
---|
| 127 | endif()
|
---|
| 128 | if( HAS_GCC_FORTRAN_RULES )
|
---|
| 129 | set( CMAKE_C_FLAGS "-fcx-fortran-rules ${CMAKE_C_FLAGS}" )
|
---|
| 130 | endif()
|
---|
| 131 |
|
---|
[3036] | 132 | # Detect if the compiler supports C++11 if we want to use it.
|
---|
| 133 | if (CXX11)
|
---|
| 134 | if ((CMAKE_COMPILER_IS_GNUCXX AND NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 4.6) OR
|
---|
| 135 | (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 4.3))
|
---|
| 136 | set(DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} -std=c++11 -DCXX11")
|
---|
| 137 | else()
|
---|
| 138 | option(CXX11 "" NO)
|
---|
| 139 | endif()
|
---|
| 140 | endif()
|
---|
| 141 |
|
---|
[3113] | 142 | if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
|
---|
| 143 | ## setting intel libraries with e.g.
|
---|
| 144 | ##
|
---|
| 145 | ## find_library( INTEL_IRNG irng HINTS ${INTEL_PATH} )
|
---|
| 146 | ##
|
---|
| 147 | ## causes CMAKE to substitute fully qualified paths which makes
|
---|
| 148 | ## python shared object unrelocatable in the case of libirng.so
|
---|
| 149 | ##
|
---|
| 150 | get_filename_component(INTEL_PATH ${CMAKE_CXX_COMPILER} DIRECTORY)
|
---|
| 151 | set(INTEL_LIB_PATH ${INTEL_PATH}/../lib/intel64)
|
---|
| 152 | set(INTEL_LIBS -limf -lsvml -lirng -lintlc -lifport -lifcore -liomp5)
|
---|
| 153 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,${INTEL_LIB_PATH}")
|
---|
| 154 | set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-rpath,${INTEL_LIB_PATH}")
|
---|
| 155 | endif()
|
---|
| 156 |
|
---|
[1970] | 157 | find_package( OpenMP )
|
---|
| 158 | if( OPENMP_FOUND )
|
---|
[3113] | 159 | if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
|
---|
| 160 | set(DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} -qopenmp")
|
---|
| 161 | else( )
|
---|
| 162 | set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" )
|
---|
| 163 | endif( )
|
---|
[1970] | 164 | endif()
|
---|
| 165 |
|
---|
| 166 | # environment dependent settings
|
---|
| 167 | message( STATUS "CMAKE_SYSTEM = " ${CMAKE_SYSTEM} )
|
---|
| 168 | message( STATUS "CMAKE_SYSTEM_PROCESSOR = " ${CMAKE_SYSTEM_PROCESSOR} )
|
---|
| 169 | if( APPLE )
|
---|
| 170 | set( SO dylib )
|
---|
[2400] | 171 | if( CMAKE_SYSTEM MATCHES ^Darwin-10 OR
|
---|
| 172 | CMAKE_SYSTEM MATCHES ^Darwin-11 )
|
---|
[1970] | 173 | if( NOT archflag )
|
---|
[3006] | 174 | if( EXISTS /opt/casa/01 )
|
---|
[1970] | 175 | set( archflag x86_64 )
|
---|
[3006] | 176 | elseif( EXISTS /opt/casa/darwin11 )
|
---|
| 177 | set( archflag x86_64 )
|
---|
[2400] | 178 | elseif( EXISTS /opt/casa/darwin10-64b )
|
---|
| 179 | set( archflag x86_64 )
|
---|
[1970] | 180 | elseif( EXISTS /opt/casa/core2-apple-darwin10 )
|
---|
| 181 | set( archflag i386 )
|
---|
| 182 | else()
|
---|
| 183 | set( archflag x86_64 )
|
---|
| 184 | endif()
|
---|
| 185 | endif()
|
---|
| 186 | if( archflag STREQUAL x86_64 )
|
---|
| 187 | add_definitions( -DAIPS_64B )
|
---|
| 188 | endif()
|
---|
| 189 | execute_process( COMMAND ${CMAKE_CXX_COMPILER} --version
|
---|
| 190 | COMMAND head -1
|
---|
| 191 | COMMAND perl -pe "s|.*?(\\d+\\.\\d+)\\.\\d+$|$1|"
|
---|
| 192 | OUTPUT_VARIABLE _cxx_version
|
---|
| 193 | OUTPUT_STRIP_TRAILING_WHITESPACE )
|
---|
| 194 | if( NOT _cxx_version STREQUAL "4.4" )
|
---|
| 195 | set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} -arch ${archflag}" )
|
---|
| 196 | endif()
|
---|
[3005] | 197 | endif()
|
---|
[1970] | 198 | elseif( CMAKE_SYSTEM_NAME STREQUAL Linux )
|
---|
| 199 | set( SO so )
|
---|
| 200 | add_definitions( -DAIPS_LINUX )
|
---|
| 201 | if( CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 )
|
---|
| 202 | add_definitions( -DAIPS_64B )
|
---|
| 203 | set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} -Wno-deprecated" )
|
---|
| 204 | else()
|
---|
| 205 | set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} -Wno-deprecated -Woverloaded-virtual" )
|
---|
| 206 | endif()
|
---|
| 207 | endif()
|
---|
| 208 |
|
---|
[2296] | 209 | # set flags for cpp compiler
|
---|
| 210 | set( CMAKE_CXX_FLAGS ${DEFAULT_CXX_FLAGS} )
|
---|
[1970] | 211 |
|
---|
[2296] | 212 |
|
---|
[1960] | 213 | #
|
---|
[2296] | 214 | # casacore definitions
|
---|
| 215 | #
|
---|
| 216 | set( CASACORE_DEFINITIONS ${CASACORE_DEFINITIONS}
|
---|
| 217 | -DCASA_USECASAPATH
|
---|
| 218 | -DCASACORE_NEEDS_RETHROW
|
---|
| 219 | -DAIPS_STDLIB
|
---|
| 220 | -DAIPS_AUTO_STL
|
---|
| 221 | -D_GNU_SOURCE )
|
---|
| 222 |
|
---|
| 223 | if( CMAKE_SYSTEM_NAME STREQUAL Linux )
|
---|
| 224 | set( CASACORE_DEFINITIONS ${CASACORE_DEFINITIONS}
|
---|
| 225 | -D_FILE_OFFSET_BITS=64
|
---|
| 226 | -D_LARGEFILE_SOURCE
|
---|
| 227 | )
|
---|
| 228 | endif()
|
---|
| 229 |
|
---|
| 230 | add_definitions( ${CASACORE_DEFINITIONS} )
|
---|
| 231 |
|
---|
| 232 | #
|
---|
[1968] | 233 | # mode specific settings
|
---|
[1960] | 234 | #
|
---|
[1968] | 235 | # STANDALONE=ON standalone build
|
---|
| 236 | # STANDALONE=OFF build with casa
|
---|
[1954] | 237 | #
|
---|
[1968] | 238 | set( CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_SOURCE_DIR}/cmake" )
|
---|
| 239 | message( STATUS "CMAKE_MODULE_PATH = " ${CMAKE_MODULE_PATH} )
|
---|
| 240 | if( STANDALONE )
|
---|
| 241 | include( standalone )
|
---|
[1956] | 242 | else()
|
---|
[1968] | 243 | include( withcasa )
|
---|
[1956] | 244 | endif()
|
---|
[1954] | 245 |
|
---|
[1970] | 246 | message( STATUS "CMAKE_INSTALL_PREFIX = " ${CMAKE_INSTALL_PREFIX} )
|
---|
[1957] | 247 |
|
---|
[1970] | 248 |
|
---|
[1954] | 249 | #
|
---|
[1970] | 250 | # casacore
|
---|
| 251 | #
|
---|
| 252 | unset( CASACORE_INCLUDE_DIR CACHE )
|
---|
| 253 | unset( CASACORE_LIBRARIES CACHE )
|
---|
| 254 | if( NOT USE_LIBCASACORE )
|
---|
| 255 | # use casacore libraries
|
---|
| 256 | set( _includename casa/aipsdef.h )
|
---|
[3005] | 257 | find_path( CASACORE_INCLUDE_DIR ${_includename}
|
---|
[3102] | 258 | PATHS ${CASACORE_PATHS} ${CMAKE_INSTALL_PREFIX}
|
---|
[3005] | 259 | PATH_SUFFIXES include include/casacore
|
---|
[1970] | 260 | NO_DEFAULT_PATH )
|
---|
| 261 | find_path( CASACORE_INCLUDE_DIR ${_includename} )
|
---|
| 262 | if( CASACORE_INCLUDE_DIR MATCHES "NOTFOUND$" )
|
---|
| 263 | message( FATAL_ERROR "${_includename} could not be found. Please check!" )
|
---|
| 264 | endif()
|
---|
| 265 | set( CASACORE_LIBS casa
|
---|
| 266 | coordinates
|
---|
| 267 | fits
|
---|
| 268 | images
|
---|
| 269 | lattices
|
---|
| 270 | measures
|
---|
| 271 | mirlib
|
---|
| 272 | ms
|
---|
| 273 | msfits
|
---|
| 274 | scimath
|
---|
| 275 | scimath_f
|
---|
[3035] | 276 | tables
|
---|
| 277 | python )
|
---|
[1970] | 278 | set( _casacore_libs "" )
|
---|
| 279 | foreach( _a ${CASACORE_LIBS} )
|
---|
| 280 | set( _libname libcasa_${_a}.${SO} )
|
---|
| 281 | unset( _casacore_lib CACHE )
|
---|
| 282 | find_library( _casacore_lib ${_libname}
|
---|
[3005] | 283 | PATHS ${CASACORE_PATHS}
|
---|
[1970] | 284 | PATH_SUFFIXES lib64 lib )
|
---|
| 285 | if( _casacore_lib MATCHES "NOTFOUND$" )
|
---|
| 286 | message( FATAL_ERROR "${_libname} could not be found. Please check!" )
|
---|
| 287 | else()
|
---|
| 288 | #list( APPEND _casacore_libs casa_${_a} )
|
---|
| 289 | list( APPEND _casacore_libs ${_casacore_lib} )
|
---|
| 290 | endif()
|
---|
| 291 | endforeach()
|
---|
[3014] | 292 | set ( _libname libcomponents.${SO} )
|
---|
| 293 | unset( _casacore_lib CACHE )
|
---|
| 294 | find_library( _casacore_lib ${_libname}
|
---|
| 295 | PATHS ${CASACORE_PATHS}
|
---|
| 296 | PATH_SUFFIXES lib64 lib )
|
---|
| 297 | if( _casacore_lib MATCHES "NOTFOUND$" )
|
---|
| 298 | message( FATAL_ERROR "${_libname} could not be found. Please check!" )
|
---|
| 299 | else()
|
---|
| 300 | list( APPEND _casacore_libs ${_casacore_lib} )
|
---|
| 301 | endif()
|
---|
[1970] | 302 | set( CASACORE_LIBRARIES ${_casacore_libs} )
|
---|
| 303 | else()
|
---|
| 304 | # use libcasacore
|
---|
| 305 | set( _libname libcasacore.${SO} )
|
---|
[3005] | 306 | find_library( CASACORE_LIBRARIES ${_libname}
|
---|
[1970] | 307 | PATHS ${CASACORE_PATHS}
|
---|
| 308 | PATH_SUFFIXES lib64 lib )
|
---|
| 309 | if( CASACORE_LIBRARIES MATCHES "NOTFOUND$" )
|
---|
| 310 | message( FATAL_ERROR "${_libname} could not be found. Please check!" )
|
---|
| 311 | endif()
|
---|
| 312 | set( _includename casa/aipsdef.h )
|
---|
[1972] | 313 | string( REGEX REPLACE /[^/]+/[^/]+/?$ "" _coreroot ${CASACORE_LIBRARIES} )
|
---|
| 314 | find_path( CASACORE_INCLUDE_DIR ${_includename}
|
---|
| 315 | PATHS ${_coreroot}
|
---|
| 316 | PATH_SUFFIXES include include/casacore
|
---|
| 317 | NO_DEFAULT_PATH )
|
---|
[3005] | 318 | find_path( CASACORE_INCLUDE_DIR ${_includename}
|
---|
[1970] | 319 | PATHS ${CASACORE_PATHS}
|
---|
[3005] | 320 | PATH_SUFFIXES include include/casacore
|
---|
| 321 | NO_DEFAULT_PATH )
|
---|
| 322 | find_path( CASACORE_INCLUDE_DIR ${_includename} )
|
---|
[1970] | 323 | if( CASACORE_INCLUDE_DIR MATCHES "NOTFOUND$" )
|
---|
| 324 | message( FATAL_ERROR "${_includename} could not be found. Please check!" )
|
---|
| 325 | endif()
|
---|
| 326 | endif()
|
---|
| 327 | message( STATUS "CASACORE_LIBRARIES = " ${CASACORE_LIBRARIES} )
|
---|
| 328 | message( STATUS "CASACORE_INCLUDE_DIR = " ${CASACORE_INCLUDE_DIR} )
|
---|
| 329 | unset( USE_LIBCASACORE CACHE )
|
---|
| 330 |
|
---|
| 331 | #
|
---|
| 332 | # Python
|
---|
| 333 | #
|
---|
| 334 | if( STANDALONE )
|
---|
| 335 | include( FindPythonLibs )
|
---|
| 336 | if( NOT PYTHONLIBS_FOUND )
|
---|
| 337 | message( FATAL_ERROR "Python could not be found. Please check!" )
|
---|
| 338 | endif()
|
---|
| 339 |
|
---|
| 340 | # Define pyroot
|
---|
| 341 | string( REGEX REPLACE "/[^/]+/[^/]+/?$" "" pyroot ${PYTHON_INCLUDE_DIRS} )
|
---|
| 342 |
|
---|
| 343 | # find numpy
|
---|
| 344 | string( REGEX MATCH [0-9].[0-9] PYTHONV ${PYTHON_INCLUDE_DIRS} )
|
---|
| 345 | string( REPLACE "." "" PV ${PYTHONV} )
|
---|
[3005] | 346 | find_path( NUMPY_INCLUDE_DIR numpy/npy_interrupt.h
|
---|
[1970] | 347 | PATHS
|
---|
[3005] | 348 | ${pyroot}/lib/python${PYTHONV}/site-packages/numpy/core
|
---|
| 349 | ${pyroot}/Library/Frameworks/Python.framework/Versions/${PYTHONV}
|
---|
| 350 | ${pyroot}/Library/Frameworks/Python.framework/Versions/${PYTHONV}/lib/python${PYTHONV}/site-packages/numpy/core
|
---|
[1970] | 351 | PATH_SUFFIXES include )
|
---|
| 352 | if( NUMPY_INCLUDE_DIR MATCHES "NOTFOUND$" )
|
---|
| 353 | message( FATAL_ERROR "numpy/npy_interrupt.h could not be found. Please check!" )
|
---|
| 354 | endif()
|
---|
| 355 | list( APPEND PYTHON_INCLUDE_DIRS ${NUMPY_INCLUDE_DIR} )
|
---|
| 356 |
|
---|
| 357 | set( PYTHON_DEFINITIONS ${PYTHON_DEFINITIONS}
|
---|
| 358 | -DPYTHONROOT=\"${pyroot}\"
|
---|
| 359 | -DPYTHONVER=\"${PYTHONV}\"
|
---|
| 360 | -DPYVERSION=${PV} )
|
---|
| 361 | else()
|
---|
[2400] | 362 | # with CASA
|
---|
[1970] | 363 | if( NOT PYTHON_FOUND )
|
---|
| 364 | if ( NOT PYTHON_LIBNAME )
|
---|
[2400] | 365 | #set( _names 2.9 2.8 2.7 2.6 2.5.2 2.5 )
|
---|
[2847] | 366 | set( _names 2.7 2.6 2.5.2 2.5 )
|
---|
[2400] | 367 | # OSX 10.7 has Python2.7 by default. CASA has't yet supported python > 2.6 anyway.
|
---|
[1970] | 368 | # (The library named libpython.2.5.2.dylib seems to exist only in the CASA world.)
|
---|
| 369 | else()
|
---|
| 370 | set( _names ${PYTHON_LIBNAME} )
|
---|
| 371 | endif()
|
---|
| 372 |
|
---|
| 373 | set( _found False )
|
---|
| 374 | foreach( _v ${_names} )
|
---|
| 375 |
|
---|
[3005] | 376 | casa_find(
|
---|
[2400] | 377 | PYTHON${_v}
|
---|
[3107] | 378 | PREFIX_HINTS ${PYTHON_ROOT_DIR}
|
---|
[3005] | 379 | LIBS python${_v}
|
---|
| 380 | NO_REQUIRE
|
---|
[1970] | 381 | )
|
---|
| 382 |
|
---|
| 383 | if( PYTHON${_v}_FOUND )
|
---|
| 384 | set( PYTHON_LIBNAME ${_v} )
|
---|
| 385 | set( _found True )
|
---|
| 386 | break()
|
---|
| 387 | endif()
|
---|
| 388 |
|
---|
| 389 | endforeach()
|
---|
| 390 |
|
---|
| 391 | if( NOT _found )
|
---|
| 392 | message( FATAL_ERROR "Could not find any PYTHON library with version one of ${_names}. Please check!" )
|
---|
| 393 | endif()
|
---|
| 394 |
|
---|
| 395 | endif()
|
---|
| 396 |
|
---|
| 397 | if( NOT PYTHON_LIBNAME )
|
---|
| 398 | # Found Python, but PYTHON_LIBNAME is undefined, that is impossible.
|
---|
| 399 | 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*\")")
|
---|
| 400 | endif()
|
---|
| 401 |
|
---|
| 402 | string( SUBSTRING ${PYTHON_LIBNAME} 0 3 PYTHONV )
|
---|
| 403 | string( REPLACE "." "" PV ${PYTHONV} )
|
---|
| 404 | set( python_library python${PYTHON_LIBNAME} )
|
---|
| 405 |
|
---|
[3005] | 406 | # Form the Python install prefix by stripping away "lib/libpython2.5.2.dylib" (example) from
|
---|
[1970] | 407 | # the full python library path
|
---|
| 408 | string( REGEX MATCH "/lib(64)?/lib${python_library}" _match ${PYTHON${PYTHON_LIBNAME}_LIBRARIES} )
|
---|
| 409 | if( _match )
|
---|
| 410 | string( REGEX REPLACE "/lib(64)?/lib${python_library}.*" "" python_prefix ${PYTHON${PYTHON_LIBNAME}_LIBRARIES} )
|
---|
| 411 | else()
|
---|
| 412 | # Python library was not in a lib(64) directory!
|
---|
| 413 | message( WARNING "Python library path \"${PYTHON${PYTHON_LIBNAME}_LIBRARIES}\" does not contain \"/lib(64)/lib${python_library}\"" )
|
---|
| 414 | set( python_prefix ${casa_packages} )
|
---|
| 415 | endif()
|
---|
| 416 |
|
---|
[2400] | 417 | #
|
---|
| 418 | # For some unknown reason cmake sets the /usr for Lion
|
---|
| 419 | #
|
---|
| 420 | if( APPLE )
|
---|
| 421 | set( python_prefix ${casa_packages} )
|
---|
| 422 | endif()
|
---|
| 423 |
|
---|
[1970] | 424 | # The python version and prefix is known, do the actual search
|
---|
| 425 | if( NOT PYTHON_FOUND )
|
---|
| 426 | message( STATUS "Looking for PYTHON version ${PYTHONV}.x in ${python_prefix}" )
|
---|
| 427 | endif()
|
---|
| 428 |
|
---|
| 429 | casa_find( PYTHON
|
---|
| 430 | VERSION 2.5 # minimum required
|
---|
[3005] | 431 | INCLUDES Python.h
|
---|
[1970] | 432 | numpy/npy_interrupt.h # for numpy
|
---|
| 433 | INCLUDES_SUFFIXES python${PYTHONV}
|
---|
[3005] | 434 | PREFIX_HINTS
|
---|
[3107] | 435 | ${PYTHON_ROOT_DIR}
|
---|
[3088] | 436 | ${NUMPY_ROOT_DIR}
|
---|
[1970] | 437 | ${python_prefix}/lib/python${PYTHONV}/site-packages/numpy/core
|
---|
| 438 | ${python_prefix}/Library/Frameworks/Python.framework/Versions/${PYTHONV}
|
---|
| 439 | ${python_prefix}/Library/Frameworks/Python.framework/Versions/${PYTHONV}/lib/python${PYTHONV}/site-packages/numpy/core
|
---|
| 440 | LIBS ${python_library}
|
---|
| 441 | CPP_VERSION PY_VERSION )
|
---|
| 442 |
|
---|
| 443 | # Store PYTHON_LIBNAME in the cache
|
---|
| 444 | set( PYTHON_LIBNAME ${PYTHON_LIBNAME} CACHE STRING "Python major and minor version to use" FORCE )
|
---|
| 445 |
|
---|
| 446 | # Define pyroot to two directory levels above Python.h.
|
---|
| 447 | string( REGEX REPLACE "/[^/]+/[^/]+/?$" "" pyroot ${PYTHON_Python.h} )
|
---|
| 448 |
|
---|
| 449 | set( PYTHON_DEFINITIONS ${PYTHON_DEFINITIONS}
|
---|
| 450 | -DAIPSROOT=\"${CMAKE_SOURCE_DIR}\"
|
---|
| 451 | -DAIPSARCH=\"${arch}\"
|
---|
| 452 | -DAIPSSITE=\"garching\"
|
---|
| 453 | -DPYTHONROOT=\"${pyroot}\"
|
---|
| 454 | -DPYTHONVER=\"${PYTHONV}\"
|
---|
| 455 | -DPYVERSION=${PV} )
|
---|
| 456 | endif()
|
---|
| 457 | message( STATUS "PYTHON_INCLUDE_DIRS = " ${PYTHON_INCLUDE_DIRS} )
|
---|
| 458 | message( STATUS "PYTHON_LINRARIES = " ${PYTHON_LIBRARIES} )
|
---|
| 459 | message( STATUS "PYTHONV = " ${PYTHONV} )
|
---|
| 460 |
|
---|
| 461 |
|
---|
| 462 | #
|
---|
| 463 | # DL
|
---|
| 464 | #
|
---|
| 465 | set( DL_LIBRARIES ${CMAKE_DL_LIBS} CACHE STRING "dl libraries" FORCE )
|
---|
| 466 | if( DL_LIBRARIES STREQUAL "dl" )
|
---|
| 467 | set( DL_LIBRARIES "-ldl" CACHE STRING "dl libraries" FORCE )
|
---|
| 468 | endif()
|
---|
| 469 | message( STATUS "DL_LIBRARIES = " ${DL_LIBRARIES} )
|
---|
| 470 |
|
---|
| 471 |
|
---|
| 472 | #
|
---|
| 473 | # BLAS
|
---|
| 474 | #
|
---|
| 475 | find_library( BLAS_LIBRARIES libblas.${SO} )
|
---|
| 476 | if ( BLAS_LIBRARIES MATCHES "NOTFOUND$" )
|
---|
| 477 | message( FATAL_ERROR "blas could not be found. Please check!" )
|
---|
| 478 | endif()
|
---|
| 479 | message( STATUS "BLAS_LIBRARIES = " ${BLAS_LIBRARIES} )
|
---|
| 480 |
|
---|
| 481 |
|
---|
| 482 | #
|
---|
| 483 | # LAPACK
|
---|
| 484 | #
|
---|
| 485 | find_library( LAPACK_LIBRARIES liblapack.${SO} )
|
---|
| 486 | if ( LAPACK_LIBRARIES MATCHES "NOTFOUND$" )
|
---|
| 487 | message( FATAL_ERROR "lapack could not be found. Please check!" )
|
---|
| 488 | endif()
|
---|
[3005] | 489 | message( STATUS "LAPACK_LIBRARIES = " ${LAPACK_LIBRARIES} )
|
---|
[1970] | 490 |
|
---|
| 491 |
|
---|
| 492 | #
|
---|
| 493 | # Boost
|
---|
| 494 | #
|
---|
| 495 | set( boost_components python )
|
---|
[2280] | 496 | if( NOT STANDALONE )
|
---|
| 497 | set( boost_components ${boost_components} system )
|
---|
| 498 | endif()
|
---|
[1970] | 499 | find_package( Boost REQUIRED ${boost_components} )
|
---|
| 500 | if( NOT Boost_FOUND )
|
---|
| 501 | message( FATAL_ERROR "Boost could not be found. Please check!" )
|
---|
| 502 | endif()
|
---|
[3065] | 503 |
|
---|
| 504 | if(CMAKE_SYSTEM_NAME STREQUAL Linux AND Boost_LIBRARIES)
|
---|
| 505 | if(EXISTS "/usr/lib64/libicuuc.so")
|
---|
| 506 | set( Boost_LIBRARIES "${Boost_LIBRARIES};/usr/lib64/libicuuc.so" )
|
---|
| 507 | endif( )
|
---|
| 508 | if(EXISTS "/usr/lib64/libicudata.so")
|
---|
| 509 | set( Boost_LIBRARIES "${Boost_LIBRARIES};/usr/lib64/libicudata.so" )
|
---|
| 510 | endif( )
|
---|
| 511 | if(EXISTS "/usr/lib64/libicui18n.so")
|
---|
| 512 | set( Boost_LIBRARIES "${Boost_LIBRARIES};/usr/lib64/libicui18n.so" )
|
---|
| 513 | endif( )
|
---|
| 514 | message(STATUS "Boost_LIBRARIES=${Boost_LIBRARIES}")
|
---|
| 515 | endif( )
|
---|
| 516 |
|
---|
| 517 |
|
---|
[1970] | 518 | message( STATUS "BOOST_INCLUDE_DIR = " ${Boost_INCLUDE_DIR} )
|
---|
| 519 | message( STATUS "BOOST_LIBRARIES = " ${Boost_LIBRARIES} )
|
---|
| 520 |
|
---|
| 521 |
|
---|
| 522 | #
|
---|
| 523 | # cfitsio
|
---|
| 524 | #
|
---|
| 525 | if( STANDALONE )
|
---|
| 526 | find_path( CFITSIO_INCLUDE_DIRS fitsio.h
|
---|
| 527 | PATH_SUFFIXES cfitsio )
|
---|
| 528 | if( CFITSIO_INCLUDE_DIRS MATCHES "NOTFOUND$" )
|
---|
| 529 | message( FATAL_ERROR "fitsio.h could not be found. Please check!" )
|
---|
| 530 | endif()
|
---|
[1971] | 531 | string( REGEX REPLACE "/[^/]+/?$" "" CFITSIO_ROOT ${CFITSIO_INCLUDE_DIRS} )
|
---|
| 532 | message( STATUS "CFITSIO_ROOT=" ${CFITSIO_ROOT} )
|
---|
| 533 | find_library( CFITSIO_LIBRARIES libcfitsio.${SO}
|
---|
| 534 | PATHS ${CFITSIO_ROOT}
|
---|
| 535 | PATH_SUFFIXES lib64 lib
|
---|
| 536 | NO_DEFAULT_PATH )
|
---|
| 537 | if( CFITSIO_LIBRARIES MATCHES "NOTFOUND$" )
|
---|
[3005] | 538 | find_library( CFITSIO_LIBRARIES libcfitsio.a
|
---|
[1971] | 539 | PATHS ${CFITSIO_ROOT}
|
---|
| 540 | PATH_SUFFIXES lib64 lib
|
---|
| 541 | NO_DEFAULT_PATH )
|
---|
| 542 | endif()
|
---|
[3005] | 543 | find_library( CFITSIO_LIBRARIES libcfitsio.${SO}
|
---|
[1970] | 544 | PATHS /usr/local /usr
|
---|
| 545 | PATH_SUFFIXES lib64 lib )
|
---|
| 546 | if( CFITSIO_LIBRARIES MATCHES "NOTFOUND$" )
|
---|
| 547 | message( FATAL_ERROR "libcfitsio.so could not be found. Please check!" )
|
---|
| 548 | endif()
|
---|
| 549 | else()
|
---|
| 550 | casa_find( CFITSIO
|
---|
| 551 | VERSION 3.006
|
---|
| 552 | INCLUDES fitsio.h fitsio2.h
|
---|
| 553 | INCLUDES_SUFFIXES cfitsio
|
---|
| 554 | LIBS cfitsio
|
---|
| 555 | CPP_VERSION CFITSIO_VERSION
|
---|
| 556 | RUN_VERSION "(ffvers(&v), v)" )
|
---|
| 557 | endif()
|
---|
| 558 | message( STATUS "CFITSIO_INCLUDE_DIRS = " ${CFITSIO_INCLUDE_DIRS} )
|
---|
| 559 | message( STATUS "CFITSIO_LIBRARIES = " ${CFITSIO_LIBRARIES} )
|
---|
| 560 |
|
---|
| 561 |
|
---|
| 562 | #
|
---|
| 563 | # Fortran
|
---|
| 564 | #
|
---|
| 565 | if( NOT FORTRAN_LIBRARIES )
|
---|
| 566 |
|
---|
| 567 | message( STATUS "Looking for Fortran runtime libraries" )
|
---|
| 568 | set( _try ${CMAKE_BINARY_DIR}/try_fortran.cc )
|
---|
| 569 | file( WRITE ${_try}
|
---|
| 570 | "int main() { return 0; }\n"
|
---|
| 571 | )
|
---|
[2931] | 572 |
|
---|
| 573 | execute_process( COMMAND ${CMAKE_Fortran_COMPILER} -print-search-dirs
|
---|
[3049] | 574 | 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; last; }} last if $found; } last if $found;}"
|
---|
| 575 | # 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;}"
|
---|
[2931] | 576 | OUTPUT_VARIABLE _gfortran_lib_path
|
---|
| 577 | OUTPUT_STRIP_TRAILING_WHITESPACE )
|
---|
| 578 |
|
---|
[1970] | 579 | if( _gfortran_lib_path )
|
---|
| 580 | try_compile( _have_gfortran ${CMAKE_BINARY_DIR} ${_try}
|
---|
| 581 | CMAKE_FLAGS -Wdev "-DCMAKE_EXE_LINKER_FLAGS=${_gfortran_lib_path}"
|
---|
| 582 | )
|
---|
| 583 | else()
|
---|
| 584 | try_compile( _have_gfortran ${CMAKE_BINARY_DIR} ${_try}
|
---|
| 585 | CMAKE_FLAGS -Wdev "-DCMAKE_EXE_LINKER_FLAGS=-lgfortran"
|
---|
| 586 | )
|
---|
| 587 | endif()
|
---|
| 588 | try_compile( _have_g2c ${CMAKE_BINARY_DIR} ${_try}
|
---|
| 589 | CMAKE_FLAGS -Wdev "-DCMAKE_EXE_LINKER_FLAGS=-lg2c"
|
---|
| 590 | )
|
---|
| 591 |
|
---|
| 592 | if( _have_gfortran )
|
---|
| 593 | if( _gfortran_lib_path )
|
---|
| 594 | set( FORTRAN_LIBRARIES ${_gfortran_lib_path}
|
---|
| 595 | CACHE STRING "Fortran library linker option" FORCE )
|
---|
| 596 | else()
|
---|
[3005] | 597 | set( FORTRAN_LIBRARIES -lgfortran
|
---|
[1970] | 598 | CACHE STRING "Fortran library linker option" FORCE )
|
---|
| 599 | endif()
|
---|
| 600 | message( STATUS "Looking for Fortran runtime libraries -- ${FORTRAN_LIBRARIES}" )
|
---|
| 601 | elseif( _have_g2c )
|
---|
| 602 | set( FORTRAN_LIBRARIES -lg2c
|
---|
| 603 | CACHE STRING "Fortran library linker option" FORCE )
|
---|
| 604 | message( STATUS "Looking for Fortran runtime libraries -- ${FORTRAN_LIBRARIES}" )
|
---|
| 605 | else()
|
---|
| 606 | set( FORTRAN_LIBRARIES ""
|
---|
| 607 | CACHE STRING "Fortran library linker option" FORCE )
|
---|
| 608 | message( STATUS "Looking for Fortran runtime libraries -- <none>" )
|
---|
| 609 | # Not a fatal error because it might work, if all Fortran dependencies were
|
---|
| 610 | # already linked statically to the Fortran runtime...
|
---|
| 611 | endif()
|
---|
| 612 | endif()
|
---|
| 613 |
|
---|
[2830] | 614 | # X11.
|
---|
| 615 | if( NOT APPLE )
|
---|
| 616 | find_package( X11 REQUIRED )
|
---|
| 617 | # Rename
|
---|
| 618 | set( X11_INCLUDE_DIRS ${X11_INCLUDE_DIR} )
|
---|
| 619 | endif()
|
---|
[1970] | 620 |
|
---|
[2830] | 621 | # PGPLOT (FORTRAN plotting package).
|
---|
| 622 | # depends on X11
|
---|
[2833] | 623 | # not require in standalone mode
|
---|
| 624 | if( NOT STANDALONE )
|
---|
[2830] | 625 | if( APPLE )
|
---|
| 626 | set( _deps FORTRAN )
|
---|
| 627 | else()
|
---|
| 628 | set( _deps X11 FORTRAN )
|
---|
| 629 | endif()
|
---|
| 630 | if (CMAKE_SYSTEM MATCHES ^Darwin-11 AND NOT LLVMCOMPILER )
|
---|
| 631 | set( CMAKE_SHARED_LINKER_FLAGS "-Wl,-undefined -Wl,error -framework AppKit -lgfortran" )
|
---|
| 632 | else()
|
---|
| 633 | if (APPLE)
|
---|
| 634 | set( CMAKE_SHARED_LINKER_FLAGS "-Wl,-undefined -Wl,error -framework AppKit" )
|
---|
| 635 | else()
|
---|
[3113] | 636 | set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-undefined -Wl,error" )
|
---|
[2830] | 637 | endif()
|
---|
| 638 | endif()
|
---|
| 639 | casa_find( PGPLOT
|
---|
| 640 | VERSION 5.3.1
|
---|
| 641 | PREFIX_HINTS ${PGPLOT_ROOT_DIR}
|
---|
| 642 | INCLUDES cpgplot.h
|
---|
| 643 | LIBS pgplot${pgplot_ext} cpgplot${pgplot_ext}
|
---|
| 644 | DEPENDS ${_deps} )
|
---|
[2833] | 645 |
|
---|
| 646 | add_definitions( -DENABLE_PLOTTER2 )
|
---|
[2830] | 647 | endif()
|
---|
| 648 |
|
---|
[1970] | 649 | #
|
---|
| 650 | # RPFITS
|
---|
| 651 | #
|
---|
[3005] | 652 | if ( STANDALONE )
|
---|
[1970] | 653 | find_path( RPFITS_INCLUDE_DIRS RPFITS.h
|
---|
| 654 | PATHS /usr/local /usr
|
---|
| 655 | PATH_SUFFIXES include )
|
---|
| 656 | if( RPFITS_INCLUDE_DIRS MATCHES "NOTFOUND$" )
|
---|
| 657 | message( FATAL_ERROR "RPFITS.h could not be found. Please check!" )
|
---|
| 658 | endif()
|
---|
| 659 | find_library( RPFITS_LIBRARIES librpfits.so
|
---|
| 660 | PATHS /usr/local /usr
|
---|
| 661 | PATH_SUFFIXES lib64 lib )
|
---|
| 662 | if( RPFITS_LIBRARIES MATCHES "NOTFOUND$" )
|
---|
| 663 | message( FATAL_ERROR "librpfits.so could not be found. Please check!" )
|
---|
| 664 | endif()
|
---|
| 665 | list( APPEND RPFITS_LIBRARIES ${FORTRAN_LIBRARIES} )
|
---|
| 666 | else()
|
---|
| 667 | casa_find( RPFITS
|
---|
| 668 | VERSION 2.11
|
---|
| 669 | INCLUDES RPFITS.h
|
---|
| 670 | LIBS rpfits
|
---|
| 671 | RUN_VERSION names_.rpfitsversion
|
---|
| 672 | DEPENDS FORTRAN )
|
---|
| 673 | endif()
|
---|
| 674 | message( STATUS "RPFITS_INCLUDE_DIRS = " ${RPFITS_INCLUDE_DIRS} )
|
---|
| 675 | message( STATUS "RPFITS_LIBRARIES = " ${RPFITS_LIBRARIES} )
|
---|
| 676 |
|
---|
| 677 |
|
---|
| 678 | #
|
---|
| 679 | # wcslib
|
---|
| 680 | #
|
---|
| 681 | set( _wcslib libwcs.${SO} )
|
---|
| 682 | set( _wcs_version 4.3 )
|
---|
| 683 | find_library( WCSLIB ${_wcslib}
|
---|
[3107] | 684 | PATHS ${WCSLIB_ROOT_DIR} ${WCSLIB_PATHS}
|
---|
[1970] | 685 | PATH_SUFFIXES lib64 lib )
|
---|
| 686 | if( WCSLIB MATCHES "NOTFOUND$" )
|
---|
| 687 | message( STATUS "${_wcslib} could not be found." )
|
---|
| 688 | unset( _wcslib CACHE )
|
---|
[3005] | 689 | unset( WCSLIB CACHE )
|
---|
[1970] | 690 | set( _wcslib libwcs.${_wcs_version}.${SO} )
|
---|
| 691 | message( STATUS "Try to find ${_wcslib}..." )
|
---|
[3107] | 692 | message( STATUS "looking in ${WCSLIB_PATHS}..." )
|
---|
[3005] | 693 | find_library( WCSLIB ${_wcslib}
|
---|
[3107] | 694 | PATHS ${WCSLIB_ROOT_DIR} ${WCSLIB_PATHS}
|
---|
[1970] | 695 | PATH_SUFFIXES lib64 lib )
|
---|
| 696 | if( WCSLIB MATCHES "NOTFOUND$" )
|
---|
| 697 | message( FATAL_ERROR "${_wcslib} could not be found. Please check!" )
|
---|
| 698 | endif()
|
---|
| 699 | endif()
|
---|
| 700 | message( STATUS "WCSLIB = " ${WCSLIB} )
|
---|
| 701 | find_path( WCSLIB_INCLUDE_DIR wcslib/wcs.h
|
---|
[3107] | 702 | PATHS ${WCSLIB_ROOT_DIR} ${WCSLIB_PATHS}
|
---|
[1970] | 703 | PATH_SUFFIXES include )
|
---|
| 704 | if( WCSLIB_INCLUDE_DIR MATCHES "NOTFOUND$" )
|
---|
| 705 | message( FATAL_ERROR "wcs.h could not be found. Please check!" )
|
---|
| 706 | endif()
|
---|
| 707 | message( STATUS "WCSLIB_INCLUDE_DIR = " ${WCSLIB_INCLUDE_DIR} )
|
---|
| 708 |
|
---|
| 709 |
|
---|
| 710 | #
|
---|
[1957] | 711 | # common include path
|
---|
| 712 | #
|
---|
[3029] | 713 | include_directories( ${CASACORE_INCLUDE_DIR}/..
|
---|
| 714 | ${CASACORE_INCLUDE_DIR}
|
---|
[3005] | 715 | ${Boost_INCLUDE_DIR}
|
---|
| 716 | ${X11_INCLUDE_DIRS}
|
---|
| 717 | ${PGPLOT_INCLUDE_DIRS}
|
---|
| 718 | ${PYTHON_INCLUDE_DIRS}
|
---|
| 719 | ${WCSLIB_INCLUDE_DIR}
|
---|
| 720 | ${CFITSIO_INCLUDE_DIRS}
|
---|
[1962] | 721 | ${RPFITS_INCLUDE_DIRS} )
|
---|
[1954] | 722 |
|
---|
| 723 |
|
---|
[1957] | 724 | #
|
---|
[1954] | 725 | # install directory
|
---|
[1957] | 726 | #
|
---|
[1954] | 727 | set( EXEC_INSTALL_DIR bin )
|
---|
| 728 | set( LIB_INSTALL_DIR lib )
|
---|
[1957] | 729 | set( PYTHON_INSTALL_DIR python/${PYTHONV}/asap )
|
---|
[1954] | 730 | set( SHARED_INSTALL_DIR share/asap )
|
---|
[3107] | 731 | if( NOT STANDALONE )
|
---|
[3108] | 732 | if( EXISTS ${CMAKE_INSTALL_PREFIX}/lib/python${PYTHONV} )
|
---|
| 733 | message( STATUS "adjusting PYTHON_INSTALL_DIR to lib/python${PYTHONV}/asap" )
|
---|
| 734 | set( PYTHON_INSTALL_DIR lib/python${PYTHONV}/asap )
|
---|
[3107] | 735 | endif()
|
---|
| 736 | endif()
|
---|
[2088] | 737 |
|
---|
| 738 | #
|
---|
| 739 | # execute getsvnrev.sh to create/update svninfo.txt
|
---|
| 740 | # run chmod to make sure the script has executable
|
---|
| 741 | #
|
---|
[3054] | 742 | execute_process( COMMAND svn info
|
---|
| 743 | RESULT_VARIABLE SVNINFOSTATUS
|
---|
| 744 | WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
---|
| 745 | )
|
---|
| 746 | message("SVNINFOSTATUS: ${SVNINFOSTATUS}")
|
---|
[2088] | 747 |
|
---|
[3054] | 748 | if(${SVNINFOSTATUS} STREQUAL "0")
|
---|
| 749 | message("Running svn scripts.")
|
---|
| 750 | exec_program( chmod ARGS a+x ${ASAP_SOURCE_DIR}/getsvnrev.sh )
|
---|
| 751 | exec_program( chmod ARGS a+x ${ASAP_SOURCE_DIR}/cmake/exec_getsvnrev.sh )
|
---|
| 752 | exec_program( ${ASAP_SOURCE_DIR}/cmake/exec_getsvnrev.sh ARGS ${ASAP_SOURCE_DIR})
|
---|
| 753 | else ()
|
---|
| 754 | message("Couldn't get svn info. Running git scripts.")
|
---|
| 755 | exec_program( chmod ARGS a+x ${ASAP_SOURCE_DIR}/getgitrev.sh )
|
---|
| 756 | exec_program( chmod ARGS a+x ${ASAP_SOURCE_DIR}/cmake/exec_getgitrev.sh )
|
---|
| 757 | exec_program( ${ASAP_SOURCE_DIR}/cmake/exec_getgitrev.sh ARGS ${ASAP_SOURCE_DIR})
|
---|
| 758 | endif ()
|
---|
| 759 |
|
---|
[1976] | 760 | # Add the modules to be built.
|
---|
| 761 | #
|
---|
| 762 | # Choose to have correct RPATHs both in the build tree and
|
---|
| 763 | # in the install tree (at the cost of having to change the
|
---|
| 764 | # rpath when installing)
|
---|
| 765 | #
|
---|
| 766 | set( CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib )
|
---|
| 767 | set( CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
---|
| 768 | set( CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib )
|
---|
[1954] | 769 |
|
---|
[2577] | 770 | #
|
---|
| 771 | # PKSMS
|
---|
| 772 | #
|
---|
| 773 | if ( NOT PKSMS )
|
---|
| 774 | add_definitions( -DNOPKSMS )
|
---|
| 775 | endif()
|
---|
[1957] | 776 |
|
---|
| 777 | #
|
---|
| 778 | # libraries and executables
|
---|
| 779 | #
|
---|
[2465] | 780 | set( ASAPPYLIB _asap )
|
---|
[1958] | 781 | set( ASAPLIB asap )
|
---|
[3035] | 782 | #set( PYRAPLIB pyrap )
|
---|
[3050] | 783 | #set( ATNFLIB atnf )
|
---|
| 784 | set( ATNFLIB atnf_asap )
|
---|
[1957] | 785 | set( ASAP2TO3 asap2to3 )
|
---|
[3055] | 786 | #if ( NOT STANDALONE )
|
---|
[2417] | 787 | # set( ASDM2ASAP_OLD oldasdm2ASAP )
|
---|
[3055] | 788 | # set( ASDM2ASAP asdm2ASAP )
|
---|
| 789 | #endif()
|
---|
[1957] | 790 |
|
---|
[1966] | 791 | #
|
---|
| 792 | # always install by default
|
---|
| 793 | #
|
---|
| 794 | add_custom_target( inst ALL ${CMAKE_BUILD_TOOL} install/fast )
|
---|
[1957] | 795 |
|
---|
| 796 | #
|
---|
[1954] | 797 | # subdirectories
|
---|
[1957] | 798 | #
|
---|
[1968] | 799 | asap_add_subdirectory()
|
---|
[3096] | 800 |
|
---|
| 801 | if (NOT STANDALONE AND PYTHON_SHARED_LINKER_FLAGS)
|
---|
| 802 | set_target_properties(${ATNFLIB} PROPERTIES LINK_FLAGS ${PYTHON_SHARED_LINKER_FLAGS})
|
---|
| 803 | set_target_properties(${ASAPLIB} PROPERTIES LINK_FLAGS ${PYTHON_SHARED_LINKER_FLAGS})
|
---|
| 804 | set_target_properties(${ASAPPYLIB} PROPERTIES LINK_FLAGS ${PYTHON_SHARED_LINKER_FLAGS})
|
---|
| 805 | endif (NOT STANDALONE AND PYTHON_SHARED_LINKER_FLAGS)
|
---|