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/darwin12 ) |
---|
16 | set( archflag x86_64 ) |
---|
17 | elseif( EXISTS /opt/casa/darwin11 ) |
---|
18 | set( archflag x86_64 ) |
---|
19 | elseif( EXISTS /opt/casa/darwin10-64b ) |
---|
20 | set( archflag x86_64 ) |
---|
21 | elseif( EXISTS /opt/casa/core2-apple-darwin10 ) |
---|
22 | set( archflag i386 ) |
---|
23 | elseif( EXISTS /opt/casa/01 ) |
---|
24 | set( archflag x86_64 ) |
---|
25 | else() |
---|
26 | set( archflag x86_64 ) |
---|
27 | endif() |
---|
28 | endif() |
---|
29 | if( archflag STREQUAL x86_64 ) |
---|
30 | if( CMAKE_SYSTEM MATCHES ^Darwin-12 ) |
---|
31 | if ( EXISTS /opt/casa/01 ) |
---|
32 | set( casa_packages /opt/casa/01 ) |
---|
33 | else() |
---|
34 | set( casa_packages /opt/local ) |
---|
35 | endif() |
---|
36 | elseif( CMAKE_SYSTEM MATCHES ^Darwin-11 ) |
---|
37 | if ( EXISTS /opt/casa/01 ) |
---|
38 | set( casa_packages /opt/casa/01 ) |
---|
39 | else() |
---|
40 | set( casa_packages /opt/casa/darwin11 ) |
---|
41 | endif() |
---|
42 | else() |
---|
43 | set( casa_packages /opt/casa/darwin10-64b ) |
---|
44 | endif() |
---|
45 | else() |
---|
46 | set( casa_packages /opt/casa/core2-apple-darwin10 ) |
---|
47 | endif() |
---|
48 | elseif( CMAKE_SYSTEM MATCHES ^Darwin-9 ) |
---|
49 | if ( NOT arch ) |
---|
50 | set( arch darwin ) |
---|
51 | endif() |
---|
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 ) |
---|
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( ) |
---|
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 | |
---|
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} ) |
---|
86 | set( CMAKE_INSTALL_PREFIX ${casaroot}/${arch} CACHE PATH "casa architecture directory" FORCE ) |
---|
87 | ELSE() |
---|
88 | set( casaroot ${CMAKE_INSTALL_PREFIX}/.. CACHE PATH "casa architecture directory" FORCE ) |
---|
89 | ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) |
---|
90 | |
---|
91 | message( STATUS "casaroot = " ${casaroot} ) |
---|
92 | |
---|
93 | # modules |
---|
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() |
---|
100 | ENDIF() |
---|
101 | message( STATUS "CASA_CODE_PATH = " ${CASA_CODE_PATH} ) |
---|
102 | set( CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CASA_CODE_PATH}/install" ) |
---|
103 | message( STATUS "CMAKE_MODULE_PATH = " ${CMAKE_MODULE_PATH} ) |
---|
104 | |
---|
105 | include( config ) |
---|
106 | include( CASA ) |
---|
107 | |
---|
108 | # |
---|
109 | # casacore |
---|
110 | # |
---|
111 | set( CASACORE_PATHS "${casaroot}/${arch};${casaroot};/usr/local;/usr" ) |
---|
112 | |
---|
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}" ) |
---|
128 | else( ) |
---|
129 | message( STATUS "User disabled shared library versioning" ) |
---|
130 | endif( ) |
---|
131 | |
---|
132 | # |
---|
133 | # Boost |
---|
134 | # |
---|
135 | if( NOT BOOST_ROOT ) |
---|
136 | set( BOOST_ROOT ${casa_packages} ) |
---|
137 | endif() |
---|
138 | |
---|
139 | |
---|
140 | # |
---|
141 | # wcslib |
---|
142 | # |
---|
143 | set( WCSLIB_PATHS "${casaroot}/${arch};/usr/local;/usr" ) |
---|
144 | |
---|
145 | |
---|
146 | # |
---|
147 | # CASA (only alma/ASDM) |
---|
148 | # |
---|
149 | find_path( LIBXML2_INCLUDE_DIR libxml/xmlversion.h |
---|
150 | HINTS ${LIBXML2_ROOT_DIR}/include |
---|
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} ) |
---|
156 | find_path( LIBXML2_LIBRARY libxml2${CMAKE_SHARED_LIBRARY_SUFFIX} |
---|
157 | HINTS ${LIBXML2_ROOT_DIR} |
---|
158 | PATHS /usr |
---|
159 | PATH_SUFFIXES lib64 lib lib/x86_64-linux-gnu) |
---|
160 | #find_path( LIBXML2_LIBRARY libxml2.so ) |
---|
161 | if ( LIBXML2_LIBRARY MATCHES "NOTFOUND$" ) |
---|
162 | message( FATAL_ERROR "libxml2${CMAKE_SHARED_LIBRARY_SUFFIX} could not be found. Please check!" ) |
---|
163 | endif() |
---|
164 | message( STATUS "LIBXML2_LIBRARY = " ${LIBXML2_LIBRARY} ) |
---|
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 |
---|
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} ) |
---|
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 |
---|
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} ) |
---|
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 |
---|
188 | ${LIBXML2_INCLUDE_DIR} ) |
---|
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} ) |
---|
197 | add_definitions( -DWITHOUT_ACS ) |
---|
198 | |
---|
199 | # |
---|
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 ) |
---|
215 | add_subdirectory( external-alma/asdm2ASAP ) |
---|
216 | # add_subdirectory( external-alma/oldasdm2ASAP ) |
---|
217 | endmacro( asap_add_subdirectory ) |
---|
218 | |
---|