Changeset 1970 for trunk/cmake
- Timestamp:
- 12/16/10 16:27:11 (14 years ago)
- Location:
- trunk/cmake
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cmake/standalone.cmake
r1968 r1970 2 2 # CMakeLists.txt for standalone build 3 3 ### 4 5 # Define compiler paths on OSX 10.5. This must be done before invoking project()6 if( APPLE )7 if( EXISTS /opt/casa/core2-apple-darwin8/3rd-party/bin/gfortran )8 set( CMAKE_Fortran_COMPILER /opt/casa/core2-apple-darwin8/3rd-party/bin/gfortran )9 set( CMAKE_CXX_COMPILER /opt/casa/core2-apple-darwin8/3rd-party/bin/g++ )10 elseif( EXISTS /opt/local/bin/gfortran )11 set( CMAKE_Fortran_COMPILER /opt/local/bin/gfortran )12 elseif( EXISTS /opt/local/bin/gfortran-mp-4.4 )13 set( CMAKE_Fortran_COMPILER /opt/local/bin/gfortran-mp-4.4 )14 if( EXISTS /opt/local/bin/g++-mp-4.4 )15 set( CMAKE_CXX_COMPILER /opt/local/bin/g++-mp-4.4 )16 endif()17 endif()18 endif()19 20 # project name is ASAP21 project( ASAP )22 23 # flags24 set( DEFAULT_CXX_FLAGS25 "-pipe -Wall -Wextra -Wno-non-template-friend -Wcast-align -Wno-comment -O3" )26 find_package( OpenMP )27 if( OPENMP_FOUND )28 set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" )29 endif()30 31 set( CASACORE_DEFINITIONS ${CASACORE_DEFINITIONS}32 -DCASA_USECASAPATH33 -DCASACORE_NEEDS_RETHROW34 -DAIPS_STDLIB35 -DAIPS_AUTO_STL36 -D_GNU_SOURCE )37 38 if( CMAKE_SYSTEM_NAME STREQUAL Linux )39 set( CASACORE_DEFINITIONS ${CASACORE_DEFINITIONS}40 -D_FILE_OFFSET_BITS=6441 -D_LARGEFILE_SOURCE42 )43 endif()44 45 add_definitions( ${CASACORE_DEFINITIONS} )46 47 # environment dependent settings48 message( STATUS "CMAKE_SYSTEM = " ${CMAKE_SYSTEM} )49 if( APPLE )50 set( SO dylib )51 if( CMAKE_SYSTEM MATCHES ^Darwin-10 )52 if( NOT archflag )53 if( EXISTS /opt/casa/darwin10-64b )54 set( archflag x86_64 )55 elseif( EXISTS /opt/casa/core2-apple-darwin10 )56 set( archflag i386 )57 else()58 set( archflag x86_64 )59 endif()60 endif()61 if( archflag STREQUAL x86_64 )62 add_definitions( -DAIPS_64B )63 set( casa_packages /opt/casa/darwin10-64b )64 else()65 set( casa_packages /opt/casa/core2-apple-darwin10 )66 endif()67 execute_process( COMMAND ${CMAKE_CXX_COMPILER} --version68 COMMAND head -169 COMMAND perl -pe "s|.*?(\\d+\\.\\d+)\\.\\d+$|$1|"70 OUTPUT_VARIABLE _cxx_version71 OUTPUT_STRIP_TRAILING_WHITESPACE )72 if( NOT _cxx_version STREQUAL "4.4" )73 set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} -arch ${archflag}" )74 endif()75 elseif( CMAKE_SYSTEM MATCHES ^Darwin-9 )76 set( casa_packages /opt/casa/core2-apple-darwin8/3rd-party )77 endif()78 elseif( CMAKE_SYSTEM_NAME STREQUAL Linux )79 set( SO so )80 add_definitions( -DAIPS_LINUX )81 if( CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 )82 set( casa_packages /usr/lib64/casapy )83 add_definitions( -DAIPS_64B )84 set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} -Wno-deprecated" )85 else()86 set( casa_packages /usr/lib/casapy )87 set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} -Wno-deprecated -Woverloaded-virtual" )88 endif()89 endif()90 91 message( STATUS "CMAKE_INSTALL_PREFIX = " ${CMAKE_INSTALL_PREFIX} )92 93 # set flags for cpp compiler94 set( CMAKE_CXX_FLAGS ${DEFAULT_CXX_FLAGS} )95 96 97 #98 # DL99 #100 set( DL_LIBRARIES ${CMAKE_DL_LIBS} CACHE STRING "dl libraries" FORCE )101 if( DL_LIBRARIES STREQUAL "dl" )102 set( DL_LIBRARIES "-ldl" CACHE STRING "dl libraries" FORCE )103 endif()104 message( STATUS "DL_LIBRARIES = " ${DL_LIBRARIES} )105 106 107 #108 # BLAS109 #110 find_library( BLAS_LIBRARIES libblas.${SO} )111 if ( BLAS_LIBRARIES MATCHES "NOTFOUND$" )112 message( FATAL_ERROR "blas could not be found. Please check!" )113 endif()114 message( STATUS "BLAS_LIBRARIES = " ${BLAS_LIBRARIES} )115 116 117 #118 # LAPACK119 #120 find_library( LAPACK_LIBRARIES liblapack.${SO} )121 if ( LAPACK_LIBRARIES MATCHES "NOTFOUND$" )122 message( FATAL_ERROR "lapack could not be found. Please check!" )123 endif()124 message( STATUS "LAPACK_LIBRARIES = " ${LAPACK_LIBRARIES} )125 4 126 5 … … 130 9 # always use libcasacore.so 131 10 set( USE_LIBCASACORE ON ) 132 unset( CASACORE_INCLUDE_DIR CACHE ) 133 unset( CASACORE_LIBRARIES CACHE ) 134 if( USE_LIBCASACORE ) 135 # use libcasacore 136 set( _libname libcasacore.${SO} ) 137 find_library( CASACORE_LIBRARIES ${_libname} ) 138 if( CASACORE_LIBRARIES MATCHES "NOTFOUND$" ) 139 message( FATAL_ERROR "${_libname} could not be found. Please check!" ) 140 endif() 141 set( _includename casa/aipsdef.h ) 142 find_path( CASACORE_INCLUDE_DIR ${_includename} 143 PATH_SUFFIXES casacore ) 144 if( CASACORE_INCLUDE_DIR MATCHES "NOTFOUND$" ) 145 message( FATAL_ERROR "${_includename} could not be found. Please check!" ) 146 endif() 147 else() 148 # use casacore libraries 149 set( _includename casa/aipsdef.h ) 150 find_path( CASACORE_INCLUDE_DIR ${_includename} 151 PATH_SUFFIXES casacore ) 152 if( CASACORE_INCLUDE_DIR MATCHES "NOTFOUND$" ) 153 message( FATAL_ERROR "${_includename} could not be found. Please check!" ) 154 endif() 155 set( CASACORE_LIBS casa 156 components 157 coordinates 158 fits 159 images 160 lattices 161 measures 162 mirlib 163 ms 164 msfits 165 scimath 166 scimath_f 167 tables ) 168 set( _casacore_libs "" ) 169 foreach( _a ${CASACORE_LIBS} ) 170 set( _libname libcasa_${_a}.${SO} ) 171 unset( _casacore_lib CACHE ) 172 find_library( _casacore_lib ${_libname} 173 PATHS ${CMAKE_INSTALL_PREFIX} PATH_SUFFIXES lib ) 174 if( _casacore_lib MATCHES "NOTFOUND$" ) 175 message( FATAL_ERROR "${_libname} could not be found. Please check!" ) 176 else() 177 #list( APPEND _casacore_libs casa_${_a} ) 178 list( APPEND _casacore_libs ${_casacore_lib} ) 179 endif() 180 endforeach() 181 set( CASACORE_LIBRARIES ${_casacore_libs} ) 182 endif() 183 message( STATUS "CASACORE_LIBRARIES = " ${CASACORE_LIBRARIES} ) 184 message( STATUS "CASACORE_INCLUDE_DIR = " ${CASACORE_INCLUDE_DIR} ) 185 unset( USE_LIBCASACORE CACHE ) 186 187 # 188 # Python 189 # 190 include( FindPythonLibs ) 191 if( NOT PYTHONLIBS_FOUND ) 192 message( FATAL_ERROR "Python could not be found. Please check!" ) 193 endif() 194 195 # find numpy 196 string( REGEX MATCH [0-9].[0-9] PYTHONV ${PYTHON_INCLUDE_DIRS} ) 197 set( PYTHON_PREFIX ${PYTHON_INCLUDE_DIRS}/../.. ) 198 find_path( NUMPY_INCLUDE_DIR numpy/npy_interrupt.h 199 HINTS 200 ${PYTHON_PREFIX}/lib/python${PYTHONV}/site-packages/numpy/core 201 ${PYTHON_PREFIX}/Library/Frameworks/Python.framework/Versions/${PYTHONV} 202 ${PYTHON_PREFIX}/Library/Frameworks/Python.framework/Versions/${PYTHONV}/lib/python${PYTHONV}/site-packages/numpy/core 203 PATH_SUFFIXES include ) 204 if( NUMPY_INCLUDE_DIR MATCHES "NOTFOUND$" ) 205 message( FATAL_ERROR "numpy/npy_interrupt.h could not be found. Please check!" ) 206 endif() 207 list( APPEND PYTHON_INCLUDE_DIRS ${NUMPY_INCLUDE_DIR} ) 208 209 message( STATUS "PYTHON_INCLUDE_DIRS = " ${PYTHON_INCLUDE_DIRS} ) 210 message( STATUS "PYTHON_LINRARIES = " ${PYTHON_LIBRARIES} ) 211 message( STATUS "PYTHONV = " ${PYTHONV} ) 212 213 set( PYTHON_DEFINITIONS ${PYTHON_DEFINITIONS} 214 -DPYTHONROOT=\"${pyroot}\" 215 -DPYTHONVER=\"${PYTHONV}\" 216 -DPYVERSION=${PYTHONV} ) 217 218 219 # 220 # Boost 221 # 222 set( boost_components python ) 223 find_package( Boost REQUIRED ${boost_components} ) 224 if( NOT Boost_FOUND ) 225 message( FATAL_ERROR "Boost could not be found. Please check!" ) 226 endif() 227 message( STATUS "BOOST_INCLUDE_DIR = " ${Boost_INCLUDE_DIR} ) 228 message( STATUS "BOOST_LIBRARIES = " ${Boost_LIBRARIES} ) 229 230 231 # 232 # cfitsio 233 # 234 find_path( CFITSIO_INCLUDE_DIRS fitsio.h 235 PATH_SUFFIXES cfitsio ) 236 if( CFITSIO_INCLUDE_DIRS MATCHES "NOTFOUND$" ) 237 message( FATAL_ERROR "fitsio.h could not be found. Please check!" ) 238 endif() 239 find_library( CFITSIO_LIBRARIES libcfitsio.${SO} 240 HINTS /usr/local /usr 241 PATH_SUFFIXES lib64 lib ) 242 if( CFITSIO_LIBRARIES MATCHES "NOTFOUND$" ) 243 message( FATAL_ERROR "libcfitsio.so could not be found. Please check!" ) 244 endif() 245 message( STATUS "CFITSIO_INCLUDE_DIRS = " ${CFITSIO_INCLUDE_DIRS} ) 246 message( STATUS "CFITSIO_LIBRARIES = " ${CFITSIO_LIBRARIES} ) 11 set( CASACORE_PATHS "/usr/local;/usr" ) 247 12 248 13 … … 250 15 # wcslib 251 16 # 252 set( _wcslib libwcs.${SO} ) 253 set( _wcs_version 4.3 ) 254 find_library( WCSLIB ${_wcslib} 255 HINTS /usr/lib64 /usr/lib ) 256 if( WCSLIB MATCHES "NOTFOUND$" ) 257 message( STATUS "${_wcslib} could not be found." ) 258 unset( _wcslib CACHE ) 259 unset( WCSLIB CACHE ) 260 set( _wcslib libwcs.${_wcs_version}.${SO} ) 261 message( STATUS "Try to find ${_wcslib}..." ) 262 find_library( WCSLIB ${_wcslib} 263 HINTS /usr/local /usr 264 PATH_SUFFIXES lib64 lib ) 265 if( WCSLIB MATCHES "NOTFOUND$" ) 266 message( FATAL_ERROR "${_wcslib} could not be found. Please check!" ) 267 endif() 268 endif() 269 message( STATUS "WCSLIB = " ${WCSLIB} ) 270 find_path( WCSLIB_INCLUDE_DIR wcslib/wcs.h 271 HINTS /usr/local /usr 272 PATH_SUFFIXES include ) 273 if( WCSLIB_INCLUDE_DIR MATCHES "NOTFOUND$" ) 274 message( FATAL_ERROR "wcs.h could not be found. Please check!" ) 275 endif() 276 message( STATUS "WCSLIB_INCLUDE_DIR = " ${WCSLIB_INCLUDE_DIR} ) 17 set( WCSLIB_PATHS "/usr/local;/usr" ) 277 18 278 279 #280 # RPFITS (Fortran)281 #282 if( NOT FORTRAN_LIBRARIES )283 284 message( STATUS "Looking for Fortran runtime libraries" )285 set( _try ${CMAKE_BINARY_DIR}/try_fortran.cc )286 file( WRITE ${_try}287 "int main() { return 0; }\n"288 )289 290 if( _gfortran_lib_path )291 try_compile( _have_gfortran ${CMAKE_BINARY_DIR} ${_try}292 CMAKE_FLAGS -Wdev "-DCMAKE_EXE_LINKER_FLAGS=${_gfortran_lib_path}"293 )294 else()295 try_compile( _have_gfortran ${CMAKE_BINARY_DIR} ${_try}296 CMAKE_FLAGS -Wdev "-DCMAKE_EXE_LINKER_FLAGS=-lgfortran"297 )298 endif()299 try_compile( _have_g2c ${CMAKE_BINARY_DIR} ${_try}300 CMAKE_FLAGS -Wdev "-DCMAKE_EXE_LINKER_FLAGS=-lg2c"301 )302 303 if( _have_gfortran )304 if( _gfortran_lib_path )305 set( FORTRAN_LIBRARIES ${_gfortran_lib_path}306 CACHE STRING "Fortran library linker option" FORCE )307 else()308 set( FORTRAN_LIBRARIES -lgfortran309 CACHE STRING "Fortran library linker option" FORCE )310 endif()311 message( STATUS "Looking for Fortran runtime libraries -- ${FORTRAN_LIBRARIES}" )312 elseif( _have_g2c )313 set( FORTRAN_LIBRARIES -lg2c314 CACHE STRING "Fortran library linker option" FORCE )315 message( STATUS "Looking for Fortran runtime libraries -- ${FORTRAN_LIBRARIES}" )316 else()317 set( FORTRAN_LIBRARIES ""318 CACHE STRING "Fortran library linker option" FORCE )319 message( STATUS "Looking for Fortran runtime libraries -- <none>" )320 # Not a fatal error because it might work, if all Fortran dependencies were321 # already linked statically to the Fortran runtime...322 endif()323 endif()324 325 find_path( RPFITS_INCLUDE_DIRS RPFITS.h326 HINTS /usr/local /usr327 PATH_SUFFIXES include )328 if( RPFITS_INCLUDE_DIRS MATCHES "NOTFOUND$" )329 message( FATAL_ERROR "RPFITS.h could not be found. Please check!" )330 endif()331 find_library( RPFITS_LIBRARIES librpfits.so332 HINTS /usr/local /usr333 PATH_SUFFIXES lib64 lib )334 if( RPFITS_LIBRARIES MATCHES "NOTFOUND$" )335 message( FATAL_ERROR "librpfits.so could not be found. Please check!" )336 endif()337 338 list( APPEND RPFITS_LIBRARIES ${FORTRAN_LIBRARIES} )339 message( STATUS "RPFITS_INCLUDE_DIRS = " ${RPFITS_INCLUDE_DIRS} )340 message( STATUS "RPFITS_LIBRARIES = " ${RPFITS_LIBRARIES} )341 19 342 20 # -
trunk/cmake/withcasa.cmake
r1968 r1970 3 3 ### 4 4 5 # Define compiler paths on OSX 10.5. This must be done before invoking project()6 if( APPLE )7 if( EXISTS /opt/casa/core2-apple-darwin8/3rd-party/bin/gfortran )8 set( CMAKE_Fortran_COMPILER /opt/casa/core2-apple-darwin8/3rd-party/bin/gfortran )9 set( CMAKE_CXX_COMPILER /opt/casa/core2-apple-darwin8/3rd-party/bin/g++ )10 elseif( EXISTS /opt/local/bin/gfortran )11 set( CMAKE_Fortran_COMPILER /opt/local/bin/gfortran )12 elseif( EXISTS /opt/local/bin/gfortran-mp-4.4 )13 set( CMAKE_Fortran_COMPILER /opt/local/bin/gfortran-mp-4.4 )14 if( EXISTS /opt/local/bin/g++-mp-4.4 )15 set( CMAKE_CXX_COMPILER /opt/local/bin/g++-mp-4.4 )16 endif()17 endif()18 endif()19 20 # project name is ASAP21 project( ASAP )22 5 23 6 # install directory … … 36 19 include( CASA ) 37 20 38 # flags39 set( DEFAULT_CXX_FLAGS40 "-pipe -Wall -Wextra -Wno-non-template-friend -Wcast-align -Wno-comment -O3" )41 find_package( OpenMP )42 if( OPENMP_FOUND )43 set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" )44 endif()45 46 set( CASACORE_DEFINITIONS ${CASACORE_DEFINITIONS}47 -DCASA_USECASAPATH48 -DCASACORE_NEEDS_RETHROW49 -DAIPS_STDLIB50 -DAIPS_AUTO_STL51 -D_GNU_SOURCE )52 53 if( CMAKE_SYSTEM_NAME STREQUAL Linux )54 set( CASACORE_DEFINITIONS ${CASACORE_DEFINITIONS}55 -D_FILE_OFFSET_BITS=6456 -D_LARGEFILE_SOURCE57 )58 endif()59 60 add_definitions( ${CASACORE_DEFINITIONS} )61 62 21 # environment dependent settings 63 message( STATUS "CMAKE_SYSTEM = " ${CMAKE_SYSTEM} )64 22 if( APPLE ) 65 set( SO dylib )66 23 if( NOT arch ) 67 24 set( arch darwin ) … … 78 35 endif() 79 36 if( archflag STREQUAL x86_64 ) 80 add_definitions( -DAIPS_64B )81 37 set( casa_packages /opt/casa/darwin10-64b ) 82 38 else() 83 39 set( casa_packages /opt/casa/core2-apple-darwin10 ) 84 endif()85 execute_process( COMMAND ${CMAKE_CXX_COMPILER} --version86 COMMAND head -187 COMMAND perl -pe "s|.*?(\\d+\\.\\d+)\\.\\d+$|$1|"88 OUTPUT_VARIABLE _cxx_version89 OUTPUT_STRIP_TRAILING_WHITESPACE )90 if( NOT _cxx_version STREQUAL "4.4" )91 set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} -arch ${archflag}" )92 40 endif() 93 41 elseif( CMAKE_SYSTEM MATCHES ^Darwin-9 ) … … 95 43 endif() 96 44 elseif( CMAKE_SYSTEM_NAME STREQUAL Linux ) 97 set( SO so )98 add_definitions( -DAIPS_LINUX )99 45 if( CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 ) 100 46 set( casa_packages /usr/lib64/casapy ) … … 102 48 set( arch linux_64b ) 103 49 endif() 104 add_definitions( -DAIPS_64B )105 set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} -Wno-deprecated" )106 50 else() 107 51 set( casa_packages /usr/lib/casapy ) … … 109 53 set( arch linux_gnu ) 110 54 endif() 111 set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} -Wno-deprecated -Woverloaded-virtual" )112 55 endif() 113 56 endif() … … 116 59 # set root directory for installation 117 60 set( CMAKE_INSTALL_PREFIX ${casaroot}/${arch} ) 118 message( STATUS "CMAKE_INSTALL_PREFIX = " ${CMAKE_INSTALL_PREFIX} )119 120 # set flags for cpp compiler121 set( CMAKE_CXX_FLAGS ${DEFAULT_CXX_FLAGS} )122 123 124 #125 # DL126 #127 set( DL_LIBRARIES ${CMAKE_DL_LIBS} CACHE STRING "dl libraries" FORCE )128 if( DL_LIBRARIES STREQUAL "dl" )129 set( DL_LIBRARIES "-ldl" CACHE STRING "dl libraries" FORCE )130 endif()131 message( STATUS "DL_LIBRARIES = " ${DL_LIBRARIES} )132 133 134 #135 # BLAS136 #137 find_library( BLAS_LIBRARIES libblas.${SO} )138 if ( BLAS_LIBRARIES MATCHES "NOTFOUND$" )139 message( FATAL_ERROR "blas could not be found. Please check!" )140 endif()141 message( STATUS "BLAS_LIBRARIES = " ${BLAS_LIBRARIES} )142 143 144 #145 # LAPACK146 #147 find_library( LAPACK_LIBRARIES liblapack.${SO} )148 if ( LAPACK_LIBRARIES MATCHES "NOTFOUND$" )149 message( FATAL_ERROR "lapack could not be found. Please check!" )150 endif()151 message( STATUS "LAPACK_LIBRARIES = " ${LAPACK_LIBRARIES} )152 61 153 62 … … 155 64 # casacore 156 65 # 157 unset( CASACORE_INCLUDE_DIR CACHE ) 158 unset( CASACORE_LIBRARIES CACHE ) 159 if( NOT USE_LIBCASACORE ) 160 # use casacore libraries 161 set( _includename casa/aipsdef.h ) 162 find_path( CASACORE_INCLUDE_DIR ${_includename} 163 HINTS ${casaroot}/${arch}/include/ 164 PATH_SUFFIXES casacore ) 165 if( CASACORE_INCLUDE_DIR MATCHES "NOTFOUND$" ) 166 message( FATAL_ERROR "${_includename} could not be found. Please check!" ) 167 endif() 168 set( CASACORE_LIBS casa 169 components 170 coordinates 171 fits 172 images 173 lattices 174 measures 175 mirlib 176 ms 177 msfits 178 scimath 179 scimath_f 180 tables ) 181 set( _casacore_libs "" ) 182 foreach( _a ${CASACORE_LIBS} ) 183 set( _libname libcasa_${_a}.${SO} ) 184 unset( _casacore_lib CACHE ) 185 find_library( _casacore_lib ${_libname} 186 PATHS ${CMAKE_INSTALL_PREFIX} PATH_SUFFIXES lib ) 187 if( _casacore_lib MATCHES "NOTFOUND$" ) 188 message( FATAL_ERROR "${_libname} could not be found. Please check!" ) 189 else() 190 #list( APPEND _casacore_libs casa_${_a} ) 191 list( APPEND _casacore_libs ${_casacore_lib} ) 192 endif() 193 endforeach() 194 set( CASACORE_LIBRARIES ${_casacore_libs} ) 195 else() 196 # use libcasacore 197 set( _libname libcasacore.${SO} ) 198 find_library( CASACORE_LIBRARIES ${_libname} ) 199 if( CASACORE_LIBRARIES MATCHES "NOTFOUND$" ) 200 message( FATAL_ERROR "${_libname} could not be found. Please check!" ) 201 endif() 202 set( _includename casa/aipsdef.h ) 203 find_path( CASACORE_INCLUDE_DIR ${_includename} 204 PATH_SUFFIXES casacore ) 205 if( CASACORE_INCLUDE_DIR MATCHES "NOTFOUND$" ) 206 message( FATAL_ERROR "${_includename} could not be found. Please check!" ) 207 endif() 208 endif() 209 message( STATUS "CASACORE_LIBRARIES = " ${CASACORE_LIBRARIES} ) 210 message( STATUS "CASACORE_INCLUDE_DIR = " ${CASACORE_INCLUDE_DIR} ) 211 unset( USE_LIBCASACORE CACHE ) 212 213 # 214 # Python 215 # 216 if( NOT PYTHON_FOUND ) 217 218 if ( NOT PYTHON_LIBNAME ) 219 set( _names 2.9 2.8 2.7 2.6 2.5.2 2.5 ) 220 # (The library named libpython.2.5.2.dylib seems to exist only in the CASA world.) 221 else() 222 set( _names ${PYTHON_LIBNAME} ) 223 endif() 224 225 set( _found False ) 226 foreach( _v ${_names} ) 227 228 casa_find( 229 PYTHON${_v} 230 LIBS python${_v} 231 NO_REQUIRE 232 ) 233 234 if( PYTHON${_v}_FOUND ) 235 set( PYTHON_LIBNAME ${_v} ) 236 set( _found True ) 237 break() 238 endif() 239 240 endforeach() 241 242 if( NOT _found ) 243 message( FATAL_ERROR "Could not find any PYTHON library with version one of ${_names}. Please check!" ) 244 endif() 245 246 endif() 247 248 if( NOT PYTHON_LIBNAME ) 249 # Found Python, but PYTHON_LIBNAME is undefined, that is impossible. 250 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*\")") 251 endif() 252 253 string( SUBSTRING ${PYTHON_LIBNAME} 0 3 PYTHONV ) 254 string( REPLACE "." "" PV ${PYTHONV} ) 255 set( python_library python${PYTHON_LIBNAME} ) 256 257 # Form the Python install prefix by stripping away "lib/libpython2.5.2.dylib" (example) from 258 # the full python library path 259 string( REGEX MATCH "/lib(64)?/lib${python_library}" _match ${PYTHON${PYTHON_LIBNAME}_LIBRARIES} ) 260 if( _match ) 261 string( REGEX REPLACE "/lib(64)?/lib${python_library}.*" "" python_prefix ${PYTHON${PYTHON_LIBNAME}_LIBRARIES} ) 262 else() 263 # Python library was not in a lib(64) directory! 264 message( WARNING "Python library path \"${PYTHON${PYTHON_LIBNAME}_LIBRARIES}\" does not contain \"/lib(64)/lib${python_library}\"" ) 265 set( python_prefix ${casa_packages} ) 266 endif() 267 268 # The python version and prefix is known, do the actual search 269 if( NOT PYTHON_FOUND ) 270 message( STATUS "Looking for PYTHON version ${PYTHONV}.x in ${python_prefix}" ) 271 endif() 272 273 casa_find( PYTHON 274 VERSION 2.5 # minimum required 275 INCLUDES Python.h 276 numpy/npy_interrupt.h # for numpy 277 INCLUDES_SUFFIXES python${PYTHONV} 278 PREFIX_HINTS 279 ${python_prefix}/lib/python${PYTHONV}/site-packages/numpy/core 280 ${python_prefix}/Library/Frameworks/Python.framework/Versions/${PYTHONV} 281 ${python_prefix}/Library/Frameworks/Python.framework/Versions/${PYTHONV}/lib/python${PYTHONV}/site-packages/numpy/core 282 LIBS ${python_library} 283 CPP_VERSION PY_VERSION ) 284 285 # Store PYTHON_LIBNAME in the cache 286 set( PYTHON_LIBNAME ${PYTHON_LIBNAME} CACHE STRING "Python major and minor version to use" FORCE ) 287 288 # Define pyroot to two directory levels above Python.h. 289 string( REGEX REPLACE "/[^/]+/[^/]+/?$" "" pyroot ${PYTHON_Python.h} ) 290 291 message( STATUS "PYTHON_INCLUDE_DIRS = " ${PYTHON_INCLUDE_DIRS} ) 292 message( STATUS "PYTHON_LINRARIES = " ${PYTHON_LIBRARIES} ) 293 message( STATUS "PYTHONV = " ${PYTHONV} ) 294 295 set( PYTHON_DEFINITIONS ${PYTHON_DEFINITIONS} 296 -DAIPSROOT=\"${CMAKE_SOURCE_DIR}\" 297 -DAIPSARCH=\"${arch}\" 298 -DAIPSSITE=\"garching\" 299 -DPYTHONROOT=\"${pyroot}\" 300 -DPYTHONVER=\"${PYTHONV}\" 301 -DPYVERSION=${PV} ) 66 set( CASACORE_PATHS "${casaroot}/${arch};/usr/local;/usr" ) 302 67 303 68 … … 309 74 endif() 310 75 311 set( boost_components python )312 find_package( Boost REQUIRED ${boost_components} )313 if( NOT Boost_FOUND )314 message( FATAL_ERROR "Boost could not be found. Please check!" )315 endif()316 message( STATUS "BOOST_INCLUDE_DIR = " ${Boost_INCLUDE_DIR} )317 message( STATUS "BOOST_LIBRARIES = " ${Boost_LIBRARIES} )318 319 320 #321 # cfitsio322 #323 casa_find( CFITSIO324 VERSION 3.006325 INCLUDES fitsio.h fitsio2.h326 INCLUDES_SUFFIXES cfitsio327 LIBS cfitsio328 CPP_VERSION CFITSIO_VERSION329 RUN_VERSION "(ffvers(&v), v)" )330 #if( NOT CFITSIO_FOUND )331 # message( FATAL_ERROR "CFITSIO could not be found. Please check!" )332 #endif()333 message( STATUS "CFITSIO_INCLUDE_DIRS = " ${CFITSIO_INCLUDE_DIRS} )334 message( STATUS "CFITSIO_LIBRARIES = " ${CFITSIO_LIBRARIES} )335 336 76 337 77 # 338 78 # wcslib 339 79 # 340 set( _wcslib libwcs.${SO} ) 341 set( _wcs_version 4.3 ) 342 find_library( WCSLIB ${_wcslib} 343 HINTS /usr/lib64 /usr/lib ${casaroot}/${arch}/lib ) 344 if( WCSLIB MATCHES "NOTFOUND$" ) 345 message( STATUS "${_wcslib} could not be found." ) 346 unset( _wcslib CACHE ) 347 unset( WCSLIB CACHE ) 348 set( _wcslib libwcs.${_wcs_version}.${SO} ) 349 message( STATUS "Try to find ${_wcslib}..." ) 350 find_library( WCSLIB ${_wcslib} 351 HINTS /usr/lib64 /usr/lib ${casaroot}/${arch}/lib ) 352 if( WCSLIB MATCHES "NOTFOUND$" ) 353 message( FATAL_ERROR "${_wcslib} could not be found. Please check!" ) 354 endif() 355 endif() 356 message( STATUS "WCSLIB = " ${WCSLIB} ) 357 find_path( WCSLIB_INCLUDE_DIR wcslib/wcs.h 358 HINTS /usr/include ${casaroot}/${arch}/include ) 359 if( WCSLIB_INCLUDE_DIR MATCHES "NOTFOUND$" ) 360 message( FATAL_ERROR "wcs.h could not be found. Please check!" ) 361 endif() 362 message( STATUS "WCSLIB_INCLUDE_DIR = " ${WCSLIB_INCLUDE_DIR} ) 80 set( WCSLIB_PATHS "${casaroot}/${arch};/usr/local;/usr" ) 363 81 364 365 #366 # RPFITS (Fortran)367 #368 if( NOT FORTRAN_LIBRARIES )369 370 message( STATUS "Looking for Fortran runtime libraries" )371 set( _try ${CMAKE_BINARY_DIR}/try_fortran.cc )372 file( WRITE ${_try}373 "int main() { return 0; }\n"374 )375 376 if( _gfortran_lib_path )377 try_compile( _have_gfortran ${CMAKE_BINARY_DIR} ${_try}378 CMAKE_FLAGS -Wdev "-DCMAKE_EXE_LINKER_FLAGS=${_gfortran_lib_path}"379 )380 else()381 try_compile( _have_gfortran ${CMAKE_BINARY_DIR} ${_try}382 CMAKE_FLAGS -Wdev "-DCMAKE_EXE_LINKER_FLAGS=-lgfortran"383 )384 endif()385 try_compile( _have_g2c ${CMAKE_BINARY_DIR} ${_try}386 CMAKE_FLAGS -Wdev "-DCMAKE_EXE_LINKER_FLAGS=-lg2c"387 )388 389 if( _have_gfortran )390 if( _gfortran_lib_path )391 set( FORTRAN_LIBRARIES ${_gfortran_lib_path}392 CACHE STRING "Fortran library linker option" FORCE )393 else()394 set( FORTRAN_LIBRARIES -lgfortran395 CACHE STRING "Fortran library linker option" FORCE )396 endif()397 message( STATUS "Looking for Fortran runtime libraries -- ${FORTRAN_LIBRARIES}" )398 elseif( _have_g2c )399 set( FORTRAN_LIBRARIES -lg2c400 CACHE STRING "Fortran library linker option" FORCE )401 message( STATUS "Looking for Fortran runtime libraries -- ${FORTRAN_LIBRARIES}" )402 else()403 set( FORTRAN_LIBRARIES ""404 CACHE STRING "Fortran library linker option" FORCE )405 message( STATUS "Looking for Fortran runtime libraries -- <none>" )406 # Not a fatal error because it might work, if all Fortran dependencies were407 # already linked statically to the Fortran runtime...408 endif()409 endif()410 411 casa_find( RPFITS412 VERSION 2.11413 INCLUDES RPFITS.h414 LIBS rpfits415 RUN_VERSION names_.rpfitsversion416 DEPENDS FORTRAN417 )418 #if( NOT RPFITS_FOUND )419 # message( FATAL_ERROR "rpfits could not be found. Please check!" )420 #endif()421 message( STATUS "RPFITS_INCLUDE_DIRS = " ${RPFITS_INCLUDE_DIRS} )422 message( STATUS "RPFITS_LIBRARIES = " ${RPFITS_LIBRARIES} )423 82 424 83 #
Note:
See TracChangeset
for help on using the changeset viewer.