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