[1968] | 1 | ###
|
---|
| 2 | # CMakeLists.txt for build with casa
|
---|
| 3 | ###
|
---|
| 4 |
|
---|
| 5 |
|
---|
| 6 | # environment dependent settings
|
---|
| 7 | if( APPLE )
|
---|
[2400] | 8 | if( CMAKE_SYSTEM MATCHES ^Darwin-10 OR
|
---|
[2893] | 9 | CMAKE_SYSTEM MATCHES ^Darwin-11 OR
|
---|
| 10 | CMAKE_SYSTEM MATCHES ^Darwin-12 )
|
---|
[2399] | 11 | if ( NOT arch )
|
---|
| 12 | set( arch darwin64 )
|
---|
| 13 | endif()
|
---|
[1968] | 14 | if( NOT archflag )
|
---|
[2893] | 15 | if( EXISTS /opt/casa/darwin12 )
|
---|
[1968] | 16 | set( archflag x86_64 )
|
---|
[2893] | 17 | elseif( EXISTS /opt/casa/darwin11 )
|
---|
| 18 | set( archflag x86_64 )
|
---|
[2400] | 19 | elseif( EXISTS /opt/casa/darwin10-64b )
|
---|
| 20 | set( archflag x86_64 )
|
---|
[1968] | 21 | elseif( EXISTS /opt/casa/core2-apple-darwin10 )
|
---|
| 22 | set( archflag i386 )
|
---|
| 23 | else()
|
---|
| 24 | set( archflag x86_64 )
|
---|
| 25 | endif()
|
---|
| 26 | endif()
|
---|
| 27 | if( archflag STREQUAL x86_64 )
|
---|
[2893] | 28 | if( CMAKE_SYSTEM MATCHES ^Darwin-12 )
|
---|
| 29 | set( casa_packages /opt/local )
|
---|
| 30 | elseif( CMAKE_SYSTEM MATCHES ^Darwin-11 )
|
---|
[2400] | 31 | set( casa_packages /opt/casa/darwin11 )
|
---|
| 32 | else()
|
---|
| 33 | set( casa_packages /opt/casa/darwin10-64b )
|
---|
| 34 | endif()
|
---|
[1968] | 35 | else()
|
---|
| 36 | set( casa_packages /opt/casa/core2-apple-darwin10 )
|
---|
| 37 | endif()
|
---|
| 38 | elseif( CMAKE_SYSTEM MATCHES ^Darwin-9 )
|
---|
[2399] | 39 | if ( NOT arch )
|
---|
| 40 | set( arch darwin )
|
---|
| 41 | endif()
|
---|
[1968] | 42 | set( casa_packages /opt/casa/core2-apple-darwin8/3rd-party )
|
---|
| 43 | endif()
|
---|
| 44 | elseif( CMAKE_SYSTEM_NAME STREQUAL Linux )
|
---|
| 45 | if( CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 )
|
---|
[2847] | 46 | if ( EXISTS /usr/lib64/casa/01 )
|
---|
| 47 | set( casa_packages /usr/lib64/casa/01 )
|
---|
| 48 | else( )
|
---|
| 49 | set( casa_packages /usr/lib64/casapy )
|
---|
| 50 | endif( )
|
---|
[1968] | 51 | if( NOT arch )
|
---|
| 52 | set( arch linux_64b )
|
---|
| 53 | endif()
|
---|
| 54 | else()
|
---|
| 55 | set( casa_packages /usr/lib/casapy )
|
---|
| 56 | if( NOT arch )
|
---|
| 57 | set( arch linux_gnu )
|
---|
| 58 | endif()
|
---|
| 59 | endif()
|
---|
| 60 | endif()
|
---|
| 61 | message( STATUS "arch = " ${arch} )
|
---|
| 62 |
|
---|
[1991] | 63 | # install directory
|
---|
| 64 | #
|
---|
| 65 | # The layout of the source+install directory trees
|
---|
| 66 | # is rather hard-coded in much source code. However,
|
---|
| 67 | # with care CASA can be built and installed elsewhere...
|
---|
| 68 | #
|
---|
| 69 | IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
---|
| 70 | # the regular expression means '../'
|
---|
| 71 | # [^ ] Matches any character(s) not inside the brackets
|
---|
| 72 | # + Matches preceding pattern one or more times
|
---|
| 73 | # ? Matches preceding pattern zero or once only
|
---|
| 74 | # $ Mathces at end of a line
|
---|
| 75 | string( REGEX REPLACE /[^/]+/?$ "" casaroot ${CMAKE_SOURCE_DIR} )
|
---|
[2092] | 76 | set( CMAKE_INSTALL_PREFIX ${casaroot}/${arch} CACHE PATH "casa architecture directory" FORCE )
|
---|
[1991] | 77 | ELSE()
|
---|
[2092] | 78 | set( casaroot ${CMAKE_INSTALL_PREFIX}/.. CACHE PATH "casa architecture directory" FORCE )
|
---|
[1991] | 79 | ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
---|
[1968] | 80 |
|
---|
[1991] | 81 | message( STATUS "casaroot = " ${casaroot} )
|
---|
[1968] | 82 |
|
---|
[1991] | 83 | # modules
|
---|
[2183] | 84 | IF ( NOT DEFINED CASA_CODE_PATH )
|
---|
| 85 | IF ( EXISTS ${casaroot}/code/install )
|
---|
| 86 | set( CASA_CODE_PATH ${casaroot}/code )
|
---|
| 87 | ELSE()
|
---|
| 88 | set( CASA_CODE_PATH ${CMAKE_SOURCE_DIR}/../code )
|
---|
| 89 | ENDIF()
|
---|
[1991] | 90 | ENDIF()
|
---|
[2183] | 91 | message( STATUS "CASA_CODE_PATH = " ${CASA_CODE_PATH} )
|
---|
| 92 | set( CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CASA_CODE_PATH}/install" )
|
---|
[2181] | 93 | message( STATUS "CMAKE_MODULE_PATH = " ${CMAKE_MODULE_PATH} )
|
---|
[1991] | 94 |
|
---|
| 95 | include( config )
|
---|
| 96 | include( CASA )
|
---|
| 97 |
|
---|
[1968] | 98 | #
|
---|
| 99 | # casacore
|
---|
| 100 | #
|
---|
[1976] | 101 | set( CASACORE_PATHS "${casaroot}/${arch};${casaroot};/usr/local;/usr" )
|
---|
[1968] | 102 |
|
---|
[2872] | 103 | set( epochdelta 1385403204 )
|
---|
| 104 | if ( EXISTS ${CMAKE_INSTALL_PREFIX}/${arch}/casa_sover.txt )
|
---|
| 105 | execute_process( COMMAND perl -e "while (<>) { chomp and print if (! m/^\#/ ) }" ${CMAKE_INSTALL_PREFIX}/${arch}/casa_sover.txt
|
---|
| 106 | OUTPUT_VARIABLE __asap_soversion )
|
---|
| 107 | elseif( EXISTS ${CMAKE_INSTALL_PREFIX}/casa_sover.txt )
|
---|
| 108 | execute_process( COMMAND perl -e "while (<>) { chomp and print if (! m/^#/ ) }" ${CMAKE_INSTALL_PREFIX}/casa_sover.txt
|
---|
| 109 | OUTPUT_VARIABLE __asap_soversion )
|
---|
| 110 | else( )
|
---|
| 111 | execute_process( COMMAND perl -e "$t=time( )-${epochdelta};$z=$t & 0xff; $y=($t>>8)&0xff; $x=($t>>16)&0xffff; print \"$x.$y.$z\""
|
---|
| 112 | OUTPUT_VARIABLE __asap_soversion )
|
---|
| 113 | endif( )
|
---|
| 114 | set(asap_soversion ${__asap_soversion} CACHE STRING "version for shared objects")
|
---|
| 115 | message( STATUS "shared object version number ${asap_soversion}" )
|
---|
[1968] | 116 |
|
---|
| 117 | #
|
---|
| 118 | # Boost
|
---|
| 119 | #
|
---|
| 120 | if( NOT BOOST_ROOT )
|
---|
| 121 | set( BOOST_ROOT ${casa_packages} )
|
---|
| 122 | endif()
|
---|
| 123 |
|
---|
| 124 |
|
---|
| 125 | #
|
---|
| 126 | # wcslib
|
---|
| 127 | #
|
---|
[1970] | 128 | set( WCSLIB_PATHS "${casaroot}/${arch};/usr/local;/usr" )
|
---|
[1968] | 129 |
|
---|
| 130 |
|
---|
| 131 | #
|
---|
[2210] | 132 | # CASA (only alma/ASDM)
|
---|
| 133 | #
|
---|
| 134 | find_path( LIBXML2_INCLUDE_DIR libxml/xmlversion.h
|
---|
| 135 | PATH_SUFFIXES libxml2 )
|
---|
| 136 | if( LIBXML2_INCLUDE_DIR MATCHES "NOTFOUND$" )
|
---|
| 137 | message( FATAL_ERROR "libxml/xmlversion.h could not be found. Please check!" )
|
---|
| 138 | endif()
|
---|
| 139 | message( STATUS "LIBXML2_INCLUDE_DIR = " ${LIBXML2_INCLUDE_DIR} )
|
---|
[2236] | 140 | find_path( LIBXML2_LIBRARY libxml2${CMAKE_SHARED_LIBRARY_SUFFIX}
|
---|
[2210] | 141 | PATHS /usr
|
---|
| 142 | PATH_SUFFIXES lib64 lib )
|
---|
| 143 | #find_path( LIBXML2_LIBRARY libxml2.so )
|
---|
| 144 | if ( LIBXML2_LIBRARY MATCHES "NOTFOUND$" )
|
---|
[2236] | 145 | message( FATAL_ERROR "libxml2${CMAKE_SHARED_LIBRARY_SUFFIX} could not be found. Please check!" )
|
---|
[2210] | 146 | endif()
|
---|
| 147 | message( STATUS "LIBXML2_LIBRARY = " ${LIBXML2_LIBRARY} )
|
---|
[2578] | 148 |
|
---|
| 149 | set( ASDM_INCLUDE_ROOT ${CASA_CODE_PATH} )
|
---|
| 150 | if ( EXISTS ${CASA_CODE_PATH}/include/alma )
|
---|
| 151 | set( ASDM_INCLUDE_ROOT ${CASA_CODE_PATH}/include )
|
---|
| 152 | endif()
|
---|
| 153 | #set( ASDM_INCLUDE_DIR_OLD ${ASDM_INCLUDE_ROOT}/alma/ASDM
|
---|
| 154 | # ${ASDM_INCLUDE_ROOT}/alma/Enumerations
|
---|
| 155 | # ${ASDM_INCLUDE_ROOT}/alma/ASDMBinaries
|
---|
| 156 | # ${ASDM_INCLUDE_ROOT}/alma/Enumtcl
|
---|
[2417] | 157 | # ${LIBXML2_INCLUDE_DIR} )
|
---|
| 158 | #set( ASDM_LIBRARY_OLD ${casaroot}/${arch}/lib/libalma${CMAKE_SHARED_LIBRARY_SUFFIX}
|
---|
| 159 | # ${LIBXML2_LIBRARY}/libxml2${CMAKE_SHARED_LIBRARY_SUFFIX} )
|
---|
[2578] | 160 | #set( ASDM_INCLUDE_DIR ${ASDM_INCLUDE_ROOT}/alma_v3/ASDM
|
---|
| 161 | # ${ASDM_INCLUDE_ROOT}/alma_v3/Enumerations
|
---|
| 162 | # ${ASDM_INCLUDE_ROOT}/alma_v3/ASDMBinaries
|
---|
| 163 | # ${ASDM_INCLUDE_ROOT}/alma_v3/Enumtcl
|
---|
[2417] | 164 | # ${LIBXML2_INCLUDE_DIR} )
|
---|
| 165 | #set( ASDM_LIBRARY ${casaroot}/${arch}/lib/libalma_v3${CMAKE_SHARED_LIBRARY_SUFFIX}
|
---|
| 166 | # ${LIBXML2_LIBRARY}/libxml2${CMAKE_SHARED_LIBRARY_SUFFIX} )
|
---|
[2578] | 167 | set( ASDM_INCLUDE_DIR ${ASDM_INCLUDE_ROOT}/alma/ASDM
|
---|
| 168 | ${ASDM_INCLUDE_ROOT}/alma/Enumerations
|
---|
| 169 | ${ASDM_INCLUDE_ROOT}/alma/ASDMBinaries
|
---|
| 170 | ${ASDM_INCLUDE_ROOT}/alma/Enumtcl
|
---|
[2210] | 171 | ${LIBXML2_INCLUDE_DIR} )
|
---|
[2558] | 172 | if ( NOT ALMA_LIB_PATH )
|
---|
| 173 | set( ASDM_LIBRARY ${casaroot}/${arch}/lib/libalma${CMAKE_SHARED_LIBRARY_SUFFIX}
|
---|
| 174 | ${LIBXML2_LIBRARY}/libxml2${CMAKE_SHARED_LIBRARY_SUFFIX} )
|
---|
| 175 | else( )
|
---|
| 176 | set( ASDM_LIBRARY ${ALMA_LIB_PATH}
|
---|
| 177 | ${LIBXML2_LIBRARY}/libxml2${CMAKE_SHARED_LIBRARY_SUFFIX} )
|
---|
| 178 | endif( )
|
---|
| 179 | message( STATUS "ASDM_LIBRARY = " ${ASDM_LIBRARY} )
|
---|
[2210] | 180 | add_definitions( -DWITHOUT_ACS )
|
---|
| 181 |
|
---|
| 182 | #
|
---|
[1968] | 183 | # subdirectories
|
---|
| 184 | # ASAP2TO3 asap2to3 apps
|
---|
| 185 | # PYRAPLIB libpyrap.so external/libpyrap
|
---|
| 186 | # ATNFLIB libatnf.so external-alma/atnf
|
---|
| 187 | # ASAPLIB _asap.so src
|
---|
| 188 | # python modules python
|
---|
| 189 | # shared files share
|
---|
| 190 | #
|
---|
| 191 | macro( asap_add_subdirectory )
|
---|
| 192 | add_subdirectory( apps )
|
---|
| 193 | add_subdirectory( external/libpyrap )
|
---|
| 194 | add_subdirectory( external-alma/atnf )
|
---|
| 195 | add_subdirectory( src )
|
---|
| 196 | add_subdirectory( python )
|
---|
| 197 | add_subdirectory( share )
|
---|
[2273] | 198 | add_subdirectory( external-alma/asdm2ASAP )
|
---|
[2417] | 199 | # add_subdirectory( external-alma/oldasdm2ASAP )
|
---|
[1968] | 200 | endmacro( asap_add_subdirectory )
|
---|
| 201 |
|
---|