Changeset 1957
- Timestamp:
- 12/06/10 16:38:24 (14 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/CMakeLists.txt
r1956 r1957 19 19 message( STATUS "casaroot = " ${casaroot} ) 20 20 21 # modules 22 set( CMAKE_MODULE_PATH ${casaroot}/code/install ) 23 include( config ) 24 include( CASA ) 25 21 26 # flags 22 27 set( DEFAULT_CXX_FLAGS 23 "-pipe -Wall -Wextra -Wno-non-template-friend -Wcast-align -Wno-comment " )28 "-pipe -Wall -Wextra -Wno-non-template-friend -Wcast-align -Wno-comment -O3" ) 24 29 find_package( OpenMP ) 25 30 if( OPENMP_FOUND ) … … 86 91 # set flags for cpp compiler 87 92 set( CMAKE_CXX_FLAGS ${DEFAULT_CXX_FLAGS} ) 93 88 94 89 95 # … … 144 150 message( STATUS "CASACORE_INCLUDE_DIR = " ${CASACORE_INCLUDE_DIR} ) 145 151 152 146 153 # 147 154 # Python 148 155 # 149 # tentative 150 set( PYVERSION 2.6 ) 151 if (NOT PYTHON_ROOT ) 152 set( PYTHON_ROOT ${casa_packages} ) 153 endif() 154 find_package( PythonLibs REQUIRED python${PYVERSION} ) 155 156 if( NOT PYTHONLIBS_FOUND ) 157 message( FATAL_ERROR "Python could not be found. Please check!" ) 158 endif() 159 message( STATUS "PYTHON_INCLUDE_PATH = " ${PYTHON_INCLUDE_PATH} ) 160 message( STATUS "PYTHON_LIBRARIES = " ${PYTHON_LIBRARIES} ) 161 162 set( PYTHON_INCLUDE_DIR ${PYTHON_INCLUDE_PATH} ) 163 find_path( NUMPY_INC_DIR numpy/npy_interrupt.h 164 PATHS ${casa_packages}/lib/python${PYVERSION}/site-packages/numpy/core/include ) 165 message( STATUS "NUMPY_INC_DIR = " ${NUMPY_INC_DIR} ) 166 if( NOT NUMPY_INC_DIR STREQUAL NUMPY_INC_DIR-NOTFOUND ) 167 list( APPEND PYTHON_INCLUDE_DIR ${NUMPY_INC_DIR} ) 168 endif() 156 if( NOT PYTHON_FOUND ) 157 158 if ( NOT PYTHON_LIBNAME ) 159 set( _names 2.9 2.8 2.7 2.6 2.5.2 2.5 ) 160 # (The library named libpython.2.5.2.dylib seems to exist only in the CASA world.) 161 else() 162 set( _names ${PYTHON_LIBNAME} ) 163 endif() 164 165 set( _found False ) 166 foreach( _v ${_names} ) 167 168 casa_find( 169 PYTHON${_v} 170 LIBS python${_v} 171 NO_REQUIRE 172 ) 173 174 if( PYTHON${_v}_FOUND ) 175 set( PYTHON_LIBNAME ${_v} ) 176 set( _found True ) 177 break() 178 endif() 179 180 endforeach() 181 182 if( NOT _found ) 183 message( FATAL_ERROR "Could not find any PYTHON library with version one of ${_names}. Please check!" ) 184 endif() 185 186 endif() 187 188 if( NOT PYTHON_LIBNAME ) 189 # Found Python, but PYTHON_LIBNAME is undefined, that is impossible. 190 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*\")") 191 endif() 192 193 string( SUBSTRING ${PYTHON_LIBNAME} 0 3 PYTHONV ) 194 string( REPLACE "." "" PV ${PYTHONV} ) 195 set( python_library python${PYTHON_LIBNAME} ) 196 197 # Form the Python install prefix by stripping away "lib/libpython2.5.2.dylib" (example) from 198 # the full python library path 199 string( REGEX MATCH "/lib(64)?/lib${python_library}" _match ${PYTHON${PYTHON_LIBNAME}_LIBRARIES} ) 200 if( _match ) 201 string( REGEX REPLACE "/lib(64)?/lib${python_library}.*" "" python_prefix ${PYTHON${PYTHON_LIBNAME}_LIBRARIES} ) 202 else() 203 # Python library was not in a lib(64) directory! 204 message( WARNING "Python library path \"${PYTHON${PYTHON_LIBNAME}_LIBRARIES}\" does not contain \"/lib(64)/lib${python_library}\"" ) 205 set( python_prefix ${casa_packages} ) 206 endif() 207 208 # The python version and prefix is known, do the actual search 209 if( NOT PYTHON_FOUND ) 210 message( STATUS "Looking for PYTHON version ${PYTHONV}.x in ${python_prefix}" ) 211 endif() 212 213 casa_find( PYTHON 214 VERSION 2.5 # minimum required 215 INCLUDES Python.h 216 numpy/npy_interrupt.h # for numpy 217 INCLUDES_SUFFIXES python${PYTHONV} 218 PREFIX_HINTS 219 ${python_prefix}/lib/python${PYTHONV}/site-packages/numpy/core 220 ${python_prefix}/Library/Frameworks/Python.framework/Versions/${PYTHONV} 221 ${python_prefix}/Library/Frameworks/Python.framework/Versions/${PYTHONV}/lib/python${PYTHONV}/site-packages/numpy/core 222 LIBS ${python_library} 223 CPP_VERSION PY_VERSION ) 224 225 # Store PYTHON_LIBNAME in the cache 226 set( PYTHON_LIBNAME ${PYTHON_LIBNAME} CACHE STRING "Python major and minor version to use" FORCE ) 227 228 # Define pyroot to two directory levels above Python.h. 229 string( REGEX REPLACE "/[^/]+/[^/]+/?$" "" pyroot ${PYTHON_Python.h} ) 230 169 231 message( STATUS "PYTHON_INCLUDE_DIR = " ${PYTHON_INCLUDE_DIR} ) 232 message( STATUS "PYTHON_LINRARIES = " ${PYTHON_LIBRARIES} ) 233 message( STATUS "PYTHONV = " ${PYTHONV} ) 234 235 set( PYTHON_DEFINITIONS ${PYTHON_DEFINITIONS} 236 -DAIPSROOT=\"${CMAKE_SOURCE_DIR}\" 237 -DAIPSARCH=\"${arch}\" 238 -DAIPSSITE=\"garching\" 239 -DPYTHONROOT=\"${pyroot}\" 240 -DPYTHONVER=\"${PYTHONV}\" 241 -DPYVERSION=${PV} ) 242 170 243 171 244 # … … 176 249 endif() 177 250 178 set( boost_components regex program_options filesystem)251 set( boost_components python ) 179 252 find_package( Boost REQUIRED ${boost_components} ) 180 181 253 if( NOT Boost_FOUND ) 182 254 message( FATAL_ERROR "Boost could not be found. Please check!" ) 183 255 endif() 184 185 # For boost >= 1.35, we need to link also to boost-system 186 if( Boost_VERSION GREATER 103499 ) 187 188 # Force redetection by resetting these variables 189 if( NOT Boost_SYSTEM_FOUND ) 190 message( STATUS "Boost version (${Boost_VERSION}) is 1.35.0 or newer" ) 191 unset( Boost_FOUND ) 192 unset( Boost_INCLUDE_DIR CACHE ) 256 message( STATUS "BOOST_INCLUDE_DIR = " ${Boost_INCLUDE_DIR} ) 257 message( STATUS "BOOST_LIBRARIES = " ${Boost_LIBRARIES} ) 258 259 260 # 261 # cfitsio 262 # 263 casa_find( CFITSIO 264 VERSION 3.006 265 INCLUDES fitsio.h fitsio2.h 266 INCLUDES_SUFFIXES cfitsio 267 LIBS cfitsio 268 CPP_VERSION CFITSIO_VERSION 269 RUN_VERSION "(ffvers(&v), v)" ) 270 if( NOT CFITSIO_FOUND ) 271 message( FATAL_ERROR "CFITSIO could not be found. Please check!" ) 272 endif() 273 message( STATUS "CFITSIO_INCLUDE_DIRS = " ${CFITSIO_INCLUDE_DIRS} ) 274 message( STATUS "CFITSIO_LIBRARIES = " ${CFITSIO_LIBRARIES} ) 275 276 277 # 278 # wcslib 279 # 280 set( _wcslib libwcs.${SO} ) 281 find_library( WCSLIB ${_wcslib} 282 HINTS /usr/lib64 /usr/lib ${casaroot}/${arch}/lib ) 283 if( WCSLIB STREQUAL WCSLIB-NOTFOUND ) 284 message( FATAL_ERROR "${_wcslib} could not be found. Please check!" ) 285 endif() 286 message( STATUS "WCSLIB = " ${WCSLIB} ) 287 288 289 # 290 # RPFITS (Fortran) 291 # 292 if( NOT FORTRAN_LIBRARIES ) 293 294 message( STATUS "Looking for Fortran runtime libraries" ) 295 set( _try ${CMAKE_BINARY_DIR}/try_fortran.cc ) 296 file( WRITE ${_try} 297 "int main() { return 0; }\n" 298 ) 299 300 if( _gfortran_lib_path ) 301 try_compile( _have_gfortran ${CMAKE_BINARY_DIR} ${_try} 302 CMAKE_FLAGS -Wdev "-DCMAKE_EXE_LINKER_FLAGS=${_gfortran_lib_path}" 303 ) 304 else() 305 try_compile( _have_gfortran ${CMAKE_BINARY_DIR} ${_try} 306 CMAKE_FLAGS -Wdev "-DCMAKE_EXE_LINKER_FLAGS=-lgfortran" 307 ) 193 308 endif() 194 set( boost_components regex program_options filesystem system ) 195 find_package( Boost REQUIRED ${boost_components} ) 196 197 if( NOT Boost_FOUND ) 198 message( FATAL_ERROR "Boost-system could not be found. Please check!" ) 309 try_compile( _have_g2c ${CMAKE_BINARY_DIR} ${_try} 310 CMAKE_FLAGS -Wdev "-DCMAKE_EXE_LINKER_FLAGS=-lg2c" 311 ) 312 313 if( _have_gfortran ) 314 if( _gfortran_lib_path ) 315 set( FORTRAN_LIBRARIES ${_gfortran_lib_path} 316 CACHE STRING "Fortran library linker option" FORCE ) 317 else() 318 set( FORTRAN_LIBRARIES -lgfortran 319 CACHE STRING "Fortran library linker option" FORCE ) 320 endif() 321 message( STATUS "Looking for Fortran runtime libraries -- ${FORTRAN_LIBRARIES}" ) 322 elseif( _have_g2c ) 323 set( FORTRAN_LIBRARIES -lg2c 324 CACHE STRING "Fortran library linker option" FORCE ) 325 message( STATUS "Looking for Fortran runtime libraries -- ${FORTRAN_LIBRARIES}" ) 326 else() 327 set( FORTRAN_LIBRARIES "" 328 CACHE STRING "Fortran library linker option" FORCE ) 329 message( STATUS "Looking for Fortran runtime libraries -- <none>" ) 330 # Not a fatal error because it might work, if all Fortran dependencies were 331 # already linked statically to the Fortran runtime... 199 332 endif() 200 endif() 201 202 if( NOT Boost_VERSION GREATER 103199 AND NOT CASA_IGNORE_VERSION ) 203 message( FATAL_ERROR "Boost version (${Boost_VERSION}) is too old! Must be 103200 (1.32.0) or newer. Please check!" ) 204 endif() 205 206 207 208 # include path 333 endif() 334 335 casa_find( RPFITS 336 VERSION 2.11 337 INCLUDES RPFITS.h 338 LIBS rpfits 339 RUN_VERSION names_.rpfitsversion 340 DEPENDS FORTRAN 341 ) 342 if( NOT RPFITS_FOUND ) 343 message( FATAL_ERROR "${_wcslib} could not be found. Please check!" ) 344 endif() 345 message( STATUS "RPFITS_INCLUDE_DIR = " ${RPFITS_INCLUDE_DIR} ) 346 message( STATUS "RPFITS_LIBRARIES = " ${RPFITS_LIBRARIES} ) 347 348 349 # 350 # common include path 351 # 209 352 message( STATUS "Boost_INCLUDE_DIR = " ${Boost_INCLUDE_DIR} ) 210 353 include_directories( ${CASACORE_INCLUDE_DIR} … … 212 355 ${PYTHON_INCLUDE_DIR} ) 213 356 357 # 214 358 # link path 359 # 215 360 set( CASACORE_LIBRARY_DIR ${casaroot}/${arch}/lib ) 216 361 link_directories( ${CASACORE_LIBRARY_DIR} ) 217 362 218 363 364 # 219 365 # install directory 366 # 220 367 set( EXEC_INSTALL_DIR bin ) 221 368 set( LIB_INSTALL_DIR lib ) 222 set( PYTHON_INSTALL_DIR python/${PY VERSION}/asap )369 set( PYTHON_INSTALL_DIR python/${PYTHONV}/asap ) 223 370 set( SHARED_INSTALL_DIR share/asap ) 224 371 372 373 # 374 # libraries and executables 375 # 376 set( ASAPLIB _asap ) 377 set( PYRAPLIB pyrap ) 378 set( ATNFLIB atnf ) 379 set( ASAP2TO3 asap2to3 ) 380 381 382 # 225 383 # subdirectories 226 # asap2to3 apps 227 # libpyrap.so external/libpyrap 228 # libatnf.so external-alma/atnf 229 # _asap.so src 230 # python modules python 384 # ASAP2TO3 asap2to3 apps 385 # PYRAPLIB libpyrap.so external/libpyrap 386 # ATNFLIB libatnf.so external-alma/atnf 387 # ASAPLIB _asap.so src 388 # python modules python 389 # shared files share 390 # 231 391 add_subdirectory( apps ) 232 392 add_subdirectory( external/libpyrap ) -
trunk/apps/CMakeLists.txt
r1954 r1957 2 2 # CMakeLists.txt for asap2to3 3 3 ### 4 5 # executable name is asap2to36 set( ASAP2TO3 asap2to3 )7 4 8 5 # source code -
trunk/external-alma/atnf/CMakeLists.txt
r1954 r1957 2 2 # CMakeLists.txt for libatnf.so 3 3 ### 4 5 # library name is libatnf.so6 set( ATNFLIB atnf )7 4 8 5 # root for libatnf … … 13 10 14 11 # include path 15 include_directories( ${ATNFROOT} ) 16 #include_directories( ${ATNFDIR}/${PKSIO} ) 12 include_directories( ${ATNFROOT} 13 ${CFITSIO_INCLUDE_DIR} 14 ${RPFITS_INCLUDE_DIR} ) 17 15 18 16 # link path … … 25 23 ${ATNFDIR}/${PKSIO}/ASTEFXDataset.cc 26 24 ${ATNFDIR}/${PKSIO}/ASTEReader.cc 25 ${ATNFDIR}/${PKSIO}/ASTEFXReader.cc 27 26 ${ATNFDIR}/${PKSIO}/FITSreader.cc 28 27 ${ATNFDIR}/${PKSIO}/GBTFITSreader.cc … … 43 42 ${ATNFDIR}/${PKSIO}/SDFITSwriter.cc ) 44 43 add_library( ${ATNFLIB} SHARED ${ATNF_SRCS} ) 45 target_link_libraries( ${ATNFLIB} ${CASACORE_LIBRARIES} ) 44 target_link_libraries( ${ATNFLIB} 45 ${CASACORE_LIBRARIES} 46 ${CFITSIO_LIBRARIES} 47 ${RPFITS_LIBRARIES} ) 46 48 47 49 # install directory -
trunk/external/libpyrap/CMakeLists.txt
r1954 r1957 2 2 # CMakeLists.txt for libpyrap.so 3 3 ### 4 5 # library name is libpyrap.so6 set( PYRAPLIB pyrap )7 4 8 5 # root for libpyrap … … 12 9 13 10 # include path 14 include_directories( ${PYRAPROOT} ) 11 include_directories( ${PYRAPROOT} 12 ${Boost_INCLUDE_DIR} ) 15 13 16 14 # link path … … 28 26 ${PYRAPDIR}/${MODULE}/PycRecord.cc 29 27 ${PYRAPDIR}/${MODULE}/PycValueHolder.cc ) 28 30 29 add_library( ${PYRAPLIB} SHARED ${PYRAP_SRCS} ) 31 target_link_libraries( ${PYRAPLIB} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES} ${CASACORE_LIBRARIES} ) 30 target_link_libraries( ${PYRAPLIB} 31 ${Boost_LIBRARIES} 32 ${PYTHON_LIBRARIES} 33 ${CASACORE_LIBRARIES} ) 32 34 33 35 # install directory -
trunk/src/CMakeLists.txt
r1954 r1957 2 2 # CMakeLists.txt for _asap.so 3 3 ### 4 5 # library name is _asap.so6 set( ASAPLIB _asap.so )7 4 8 5 # root for libatnf … … 11 8 12 9 # include path 13 include_directories( ${SRCDIR} ) 14 include_directories( ${ASAPROOT}/external-alma ) 10 include_directories( ${SRCDIR} 11 ${Boost_INCLUDE_DIR} 12 ${ASAPROOT}/external-alma 13 ${ASAPROOT}/external/libpyrap/pyrap-0.3.2 ) 15 14 16 15 # link path 17 16 link_directories( ${SRCDIR} ) 17 18 # use libpyrap 19 add_definitions( -DHAVE_LIBPYRAP ) 18 20 19 21 # source files for libpyrap … … 73 75 74 76 add_library( ${ASAPLIB} SHARED ${ASAP_SRCS} ${ASAP_PYSRCS} ) 77 78 # library name must be _asap.so 75 79 set_target_properties( ${ASAPLIB} 76 80 PROPERTIES 77 PREFIX "" 78 SUFFIX "" ) 79 target_link_libraries( ${ASAPLIB} pyrap atnf ${CASACORE_LIBRARIES} ) 81 PREFIX "" ) 82 83 target_link_libraries( ${ASAPLIB} 84 ${Boost_LIBRARIES} 85 ${PYRAPLIB} 86 ${ATNFLIB} 87 ${CASACORE_LIBRARIES} 88 ${WCSLIB} ) 80 89 81 90 # install directory
Note:
See TracChangeset
for help on using the changeset viewer.