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