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