| 1 | ### | 
|---|
| 2 | # CMakeLists.txt for build with casa | 
|---|
| 3 | ### | 
|---|
| 4 |  | 
|---|
| 5 |  | 
|---|
| 6 | # environment dependent settings | 
|---|
| 7 | if( APPLE ) | 
|---|
| 8 | if( NOT arch ) | 
|---|
| 9 | set( arch darwin ) | 
|---|
| 10 | endif() | 
|---|
| 11 | if( CMAKE_SYSTEM MATCHES ^Darwin-10 ) | 
|---|
| 12 | if( NOT archflag ) | 
|---|
| 13 | if( EXISTS /opt/casa/darwin10-64b ) | 
|---|
| 14 | set( archflag x86_64 ) | 
|---|
| 15 | elseif( EXISTS /opt/casa/core2-apple-darwin10 ) | 
|---|
| 16 | set( archflag i386 ) | 
|---|
| 17 | else() | 
|---|
| 18 | set( archflag x86_64 ) | 
|---|
| 19 | endif() | 
|---|
| 20 | endif() | 
|---|
| 21 | if( archflag STREQUAL x86_64 ) | 
|---|
| 22 | set( casa_packages /opt/casa/darwin10-64b ) | 
|---|
| 23 | else() | 
|---|
| 24 | set( casa_packages /opt/casa/core2-apple-darwin10 ) | 
|---|
| 25 | endif() | 
|---|
| 26 | elseif( CMAKE_SYSTEM MATCHES ^Darwin-9 ) | 
|---|
| 27 | set( casa_packages /opt/casa/core2-apple-darwin8/3rd-party ) | 
|---|
| 28 | endif() | 
|---|
| 29 | elseif( CMAKE_SYSTEM_NAME STREQUAL Linux ) | 
|---|
| 30 | if( CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 ) | 
|---|
| 31 | set( casa_packages /usr/lib64/casapy ) | 
|---|
| 32 | if( NOT arch ) | 
|---|
| 33 | set( arch linux_64b ) | 
|---|
| 34 | endif() | 
|---|
| 35 | else() | 
|---|
| 36 | set( casa_packages /usr/lib/casapy ) | 
|---|
| 37 | if( NOT arch ) | 
|---|
| 38 | set( arch linux_gnu ) | 
|---|
| 39 | endif() | 
|---|
| 40 | endif() | 
|---|
| 41 | endif() | 
|---|
| 42 | message( STATUS "arch = " ${arch} ) | 
|---|
| 43 |  | 
|---|
| 44 | # install directory | 
|---|
| 45 | # | 
|---|
| 46 | # The layout of the source+install directory trees | 
|---|
| 47 | # is rather hard-coded in much source code. However, | 
|---|
| 48 | # with care CASA can be built and installed elsewhere... | 
|---|
| 49 | # | 
|---|
| 50 | IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) | 
|---|
| 51 | # the regular expression means '../' | 
|---|
| 52 | #  [^ ] Matches any character(s) not inside the brackets | 
|---|
| 53 | #  +    Matches preceding pattern one or more times | 
|---|
| 54 | #  ?    Matches preceding pattern zero or once only | 
|---|
| 55 | #  $    Mathces at end of a line | 
|---|
| 56 | string( REGEX REPLACE /[^/]+/?$ "" casaroot ${CMAKE_SOURCE_DIR} ) | 
|---|
| 57 | set( CMAKE_INSTALL_PREFIX ${casaroot}/${arch} CACHE PATH "casa architecture directory" FORCE ) | 
|---|
| 58 | ELSE() | 
|---|
| 59 | set( casaroot ${CMAKE_INSTALL_PREFIX}/.. CACHE PATH "casa architecture directory" FORCE ) | 
|---|
| 60 | ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) | 
|---|
| 61 |  | 
|---|
| 62 | message( STATUS "casaroot = " ${casaroot} ) | 
|---|
| 63 |  | 
|---|
| 64 | # modules | 
|---|
| 65 | IF ( NOT DEFINED CASA_CODE_PATH ) | 
|---|
| 66 | IF ( EXISTS ${casaroot}/code/install ) | 
|---|
| 67 | set( CASA_CODE_PATH ${casaroot}/code ) | 
|---|
| 68 | ELSE() | 
|---|
| 69 | set( CASA_CODE_PATH ${CMAKE_SOURCE_DIR}/../code ) | 
|---|
| 70 | ENDIF() | 
|---|
| 71 | ENDIF() | 
|---|
| 72 | message( STATUS "CASA_CODE_PATH = " ${CASA_CODE_PATH} ) | 
|---|
| 73 | set( CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CASA_CODE_PATH}/install" ) | 
|---|
| 74 | message( STATUS "CMAKE_MODULE_PATH = " ${CMAKE_MODULE_PATH} ) | 
|---|
| 75 |  | 
|---|
| 76 | include( config ) | 
|---|
| 77 | include( CASA ) | 
|---|
| 78 |  | 
|---|
| 79 | # | 
|---|
| 80 | # casacore | 
|---|
| 81 | # | 
|---|
| 82 | set( CASACORE_PATHS "${casaroot}/${arch};${casaroot};/usr/local;/usr" ) | 
|---|
| 83 |  | 
|---|
| 84 |  | 
|---|
| 85 | # | 
|---|
| 86 | # Boost | 
|---|
| 87 | # | 
|---|
| 88 | if( NOT BOOST_ROOT ) | 
|---|
| 89 | set( BOOST_ROOT ${casa_packages} ) | 
|---|
| 90 | endif() | 
|---|
| 91 |  | 
|---|
| 92 |  | 
|---|
| 93 | # | 
|---|
| 94 | # wcslib | 
|---|
| 95 | # | 
|---|
| 96 | set( WCSLIB_PATHS "${casaroot}/${arch};/usr/local;/usr" ) | 
|---|
| 97 |  | 
|---|
| 98 |  | 
|---|
| 99 | # | 
|---|
| 100 | # CASA (only alma/ASDM) | 
|---|
| 101 | # | 
|---|
| 102 | find_path( LIBXML2_INCLUDE_DIR libxml/xmlversion.h | 
|---|
| 103 | PATH_SUFFIXES libxml2 ) | 
|---|
| 104 | if( LIBXML2_INCLUDE_DIR MATCHES "NOTFOUND$" ) | 
|---|
| 105 | message( FATAL_ERROR "libxml/xmlversion.h could not be found. Please check!" ) | 
|---|
| 106 | endif() | 
|---|
| 107 | message( STATUS "LIBXML2_INCLUDE_DIR = " ${LIBXML2_INCLUDE_DIR} ) | 
|---|
| 108 | find_path( LIBXML2_LIBRARY libxml2${CMAKE_SHARED_LIBRARY_SUFFIX} | 
|---|
| 109 | PATHS /usr | 
|---|
| 110 | PATH_SUFFIXES lib64 lib ) | 
|---|
| 111 | #find_path( LIBXML2_LIBRARY libxml2.so ) | 
|---|
| 112 | if ( LIBXML2_LIBRARY MATCHES "NOTFOUND$" ) | 
|---|
| 113 | message( FATAL_ERROR "libxml2${CMAKE_SHARED_LIBRARY_SUFFIX} could not be found. Please check!" ) | 
|---|
| 114 | endif() | 
|---|
| 115 | message( STATUS "LIBXML2_LIBRARY = " ${LIBXML2_LIBRARY} ) | 
|---|
| 116 | set( ASDM_INCLUDE_DIR_OLD ${CASA_CODE_PATH}/alma/implement/ASDM | 
|---|
| 117 | ${CASA_CODE_PATH}/alma/implement/Enumerations | 
|---|
| 118 | ${CASA_CODE_PATH}/alma/implement/ASDMBinaries | 
|---|
| 119 | ${CASA_CODE_PATH}/alma/implement/Enumtcl | 
|---|
| 120 | ${LIBXML2_INCLUDE_DIR} ) | 
|---|
| 121 | set( ASDM_LIBRARY_OLD ${casaroot}/${arch}/lib/libalma${CMAKE_SHARED_LIBRARY_SUFFIX} | 
|---|
| 122 | ${LIBXML2_LIBRARY}/libxml2${CMAKE_SHARED_LIBRARY_SUFFIX} ) | 
|---|
| 123 | set( ASDM_INCLUDE_DIR ${CASA_CODE_PATH}/alma_v3/implement/ASDM | 
|---|
| 124 | ${CASA_CODE_PATH}/alma_v3/implement/Enumerations | 
|---|
| 125 | ${CASA_CODE_PATH}/alma_v3/implement/ASDMBinaries | 
|---|
| 126 | ${CASA_CODE_PATH}/alma_v3/implement/Enumtcl | 
|---|
| 127 | ${LIBXML2_INCLUDE_DIR} ) | 
|---|
| 128 | set( ASDM_LIBRARY ${casaroot}/${arch}/lib/libalma_v3${CMAKE_SHARED_LIBRARY_SUFFIX} | 
|---|
| 129 | ${LIBXML2_LIBRARY}/libxml2${CMAKE_SHARED_LIBRARY_SUFFIX} ) | 
|---|
| 130 | add_definitions( -DWITHOUT_ACS ) | 
|---|
| 131 |  | 
|---|
| 132 | # | 
|---|
| 133 | # subdirectories | 
|---|
| 134 | #  ASAP2TO3 asap2to3       apps | 
|---|
| 135 | #  PYRAPLIB libpyrap.so    external/libpyrap | 
|---|
| 136 | #  ATNFLIB  libatnf.so     external-alma/atnf | 
|---|
| 137 | #  ASAPLIB  _asap.so       src | 
|---|
| 138 | #  python modules          python | 
|---|
| 139 | #  shared files            share | 
|---|
| 140 | # | 
|---|
| 141 | macro( asap_add_subdirectory ) | 
|---|
| 142 | add_subdirectory( apps ) | 
|---|
| 143 | add_subdirectory( external/libpyrap ) | 
|---|
| 144 | add_subdirectory( external-alma/atnf ) | 
|---|
| 145 | add_subdirectory( src ) | 
|---|
| 146 | add_subdirectory( python ) | 
|---|
| 147 | add_subdirectory( share ) | 
|---|
| 148 | add_subdirectory( external-alma/asdm2ASAP ) | 
|---|
| 149 | add_subdirectory( external-alma/oldasdm2ASAP ) | 
|---|
| 150 | endmacro( asap_add_subdirectory ) | 
|---|
| 151 |  | 
|---|