1 | ###
|
---|
2 | # CMakeLists.txt for build with casa
|
---|
3 | ###
|
---|
4 |
|
---|
5 |
|
---|
6 | # environment dependent settings
|
---|
7 | if( APPLE )
|
---|
8 | if( CMAKE_SYSTEM MATCHES ^Darwin-10 OR
|
---|
9 | CMAKE_SYSTEM MATCHES ^Darwin-11 OR
|
---|
10 | CMAKE_SYSTEM MATCHES ^Darwin-12 )
|
---|
11 | if ( NOT arch )
|
---|
12 | set( arch darwin64 )
|
---|
13 | endif()
|
---|
14 | if( NOT archflag )
|
---|
15 | if( EXISTS /opt/casa/01 )
|
---|
16 | set( archflag x86_64 )
|
---|
17 | elseif( EXISTS /opt/casa/darwin12 )
|
---|
18 | set( archflag x86_64 )
|
---|
19 | elseif( EXISTS /opt/casa/darwin11 )
|
---|
20 | set( archflag x86_64 )
|
---|
21 | elseif( EXISTS /opt/casa/darwin10-64b )
|
---|
22 | set( archflag x86_64 )
|
---|
23 | elseif( EXISTS /opt/casa/core2-apple-darwin10 )
|
---|
24 | set( archflag i386 )
|
---|
25 | elseif( EXISTS /opt/casa/01 )
|
---|
26 | set( archflag x86_64 )
|
---|
27 | else()
|
---|
28 | set( archflag x86_64 )
|
---|
29 | endif()
|
---|
30 | endif()
|
---|
31 | if( archflag STREQUAL x86_64 )
|
---|
32 | if( CMAKE_SYSTEM MATCHES ^Darwin-12 )
|
---|
33 | if ( EXISTS /opt/casa/01 )
|
---|
34 | set( casa_packages /opt/casa/01 )
|
---|
35 | else()
|
---|
36 | set( casa_packages /opt/local )
|
---|
37 | endif()
|
---|
38 | elseif( CMAKE_SYSTEM MATCHES ^Darwin-11 )
|
---|
39 | if ( EXISTS /opt/casa/01 )
|
---|
40 | set( casa_packages /opt/casa/01 )
|
---|
41 | else()
|
---|
42 | set( casa_packages /opt/casa/darwin11 )
|
---|
43 | endif()
|
---|
44 | else()
|
---|
45 | set( casa_packages /opt/casa/darwin10-64b )
|
---|
46 | endif()
|
---|
47 | else()
|
---|
48 | set( casa_packages /opt/casa/core2-apple-darwin10 )
|
---|
49 | endif()
|
---|
50 | elseif( CMAKE_SYSTEM MATCHES ^Darwin-9 )
|
---|
51 | if ( NOT arch )
|
---|
52 | set( arch darwin )
|
---|
53 | endif()
|
---|
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 )
|
---|
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( )
|
---|
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 |
|
---|
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} )
|
---|
88 | set( CMAKE_INSTALL_PREFIX ${casaroot}/${arch} CACHE PATH "casa architecture directory" FORCE )
|
---|
89 | ELSE()
|
---|
90 | set( casaroot ${CMAKE_INSTALL_PREFIX}/.. CACHE PATH "casa architecture directory" FORCE )
|
---|
91 | ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
---|
92 |
|
---|
93 | message( STATUS "casaroot = " ${casaroot} )
|
---|
94 |
|
---|
95 | # modules
|
---|
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()
|
---|
102 | ENDIF()
|
---|
103 | message( STATUS "CASA_CODE_PATH = " ${CASA_CODE_PATH} )
|
---|
104 | set( CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CASA_CODE_PATH}/install" )
|
---|
105 | message( STATUS "CMAKE_MODULE_PATH = " ${CMAKE_MODULE_PATH} )
|
---|
106 |
|
---|
107 | include( config )
|
---|
108 | include( CASA )
|
---|
109 |
|
---|
110 | #
|
---|
111 | # casacore
|
---|
112 | #
|
---|
113 | set( CASACORE_PATHS "${casaroot}/${arch};${casaroot};/usr/local;/usr" )
|
---|
114 |
|
---|
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}" )
|
---|
130 | else( )
|
---|
131 | message( STATUS "User disabled shared library versioning" )
|
---|
132 | endif( )
|
---|
133 |
|
---|
134 | #
|
---|
135 | # Boost
|
---|
136 | #
|
---|
137 | if( NOT BOOST_ROOT )
|
---|
138 | set( BOOST_ROOT ${casa_packages} )
|
---|
139 | endif()
|
---|
140 |
|
---|
141 |
|
---|
142 | #
|
---|
143 | # wcslib
|
---|
144 | #
|
---|
145 | set( WCSLIB_PATHS "${casaroot}/${arch};/usr/local;/usr" )
|
---|
146 |
|
---|
147 |
|
---|
148 | #
|
---|
149 | # CASA (only alma/ASDM)
|
---|
150 | #
|
---|
151 | find_path( LIBXML2_INCLUDE_DIR libxml/xmlversion.h
|
---|
152 | HINTS ${LIBXML2_ROOT_DIR}/include
|
---|
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} )
|
---|
158 | find_path( LIBXML2_LIBRARY libxml2${CMAKE_SHARED_LIBRARY_SUFFIX}
|
---|
159 | HINTS ${LIBXML2_ROOT_DIR}
|
---|
160 | PATHS /usr
|
---|
161 | PATH_SUFFIXES lib64 lib lib/x86_64-linux-gnu)
|
---|
162 | #find_path( LIBXML2_LIBRARY libxml2.so )
|
---|
163 | if ( LIBXML2_LIBRARY MATCHES "NOTFOUND$" )
|
---|
164 | message( FATAL_ERROR "libxml2${CMAKE_SHARED_LIBRARY_SUFFIX} could not be found. Please check!" )
|
---|
165 | endif()
|
---|
166 | message( STATUS "LIBXML2_LIBRARY = " ${LIBXML2_LIBRARY} )
|
---|
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
|
---|
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} )
|
---|
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
|
---|
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} )
|
---|
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
|
---|
190 | ${LIBXML2_INCLUDE_DIR} )
|
---|
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} )
|
---|
199 | add_definitions( -DWITHOUT_ACS )
|
---|
200 |
|
---|
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 |
|
---|
212 | #
|
---|
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 )
|
---|
223 | # add_subdirectory( external/libpyrap )
|
---|
224 | add_subdirectory( external-alma/atnf )
|
---|
225 | add_subdirectory( src )
|
---|
226 | add_subdirectory( python )
|
---|
227 | add_subdirectory( share )
|
---|
228 | add_subdirectory( external-alma/asdm2ASAP )
|
---|
229 | # add_subdirectory( external-alma/oldasdm2ASAP )
|
---|
230 | endmacro( asap_add_subdirectory )
|
---|
231 |
|
---|