source: trunk/cmake/withcasa.cmake@ 3016

Last change on this file since 3016 was 3006, checked in by Kana Sugimoto, 10 years ago

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

What Interface Changed:

Test Programs:

Put in Release Notes: No

Module(s): cmake build scripts

Description: Applied a patch sent from Darrell on Sep. 12, 2014 to support building on the latest version of OSX.


File size: 7.8 KB
Line 
1###
2# CMakeLists.txt for build with casa
3###
4
5
6# environment dependent settings
7if( 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()
56elseif( 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()
72endif()
73message( 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#
81IF(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 )
89ELSE()
90 set( casaroot ${CMAKE_INSTALL_PREFIX}/.. CACHE PATH "casa architecture directory" FORCE )
91ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
92
93message( STATUS "casaroot = " ${casaroot} )
94
95# modules
96IF ( 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()
102ENDIF()
103message( STATUS "CASA_CODE_PATH = " ${CASA_CODE_PATH} )
104set( CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CASA_CODE_PATH}/install" )
105message( STATUS "CMAKE_MODULE_PATH = " ${CMAKE_MODULE_PATH} )
106
107include( config )
108include( CASA )
109
110#
111# casacore
112#
113set( CASACORE_PATHS "${casaroot}/${arch};${casaroot};/usr/local;/usr" )
114
115SET(NO_SOVERSION FALSE CACHE BOOL "do not add version information to shared libraries")
116if( 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}" )
130else( )
131 message( STATUS "User disabled shared library versioning" )
132endif( )
133
134#
135# Boost
136#
137if( NOT BOOST_ROOT )
138 set( BOOST_ROOT ${casa_packages} )
139endif()
140
141
142#
143# wcslib
144#
145set( WCSLIB_PATHS "${casaroot}/${arch};/usr/local;/usr" )
146
147
148#
149# CASA (only alma/ASDM)
150#
151find_path( LIBXML2_INCLUDE_DIR libxml/xmlversion.h
152 HINTS ${LIBXML2_ROOT_DIR}/include
153 PATH_SUFFIXES libxml2 )
154if( LIBXML2_INCLUDE_DIR MATCHES "NOTFOUND$" )
155 message( FATAL_ERROR "libxml/xmlversion.h could not be found. Please check!" )
156endif()
157message( STATUS "LIBXML2_INCLUDE_DIR = " ${LIBXML2_INCLUDE_DIR} )
158find_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 )
163if ( LIBXML2_LIBRARY MATCHES "NOTFOUND$" )
164 message( FATAL_ERROR "libxml2${CMAKE_SHARED_LIBRARY_SUFFIX} could not be found. Please check!" )
165endif()
166message( STATUS "LIBXML2_LIBRARY = " ${LIBXML2_LIBRARY} )
167
168set( ASDM_INCLUDE_ROOT ${CASA_CODE_PATH} )
169if ( EXISTS ${CASA_CODE_PATH}/include/alma )
170 set( ASDM_INCLUDE_ROOT ${CASA_CODE_PATH}/include )
171endif()
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} )
186set( 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} )
191if ( NOT ALMA_LIB_PATH )
192 set( ASDM_LIBRARY ${casaroot}/${arch}/lib/libalma${CMAKE_SHARED_LIBRARY_SUFFIX}
193 ${LIBXML2_LIBRARY}/libxml2${CMAKE_SHARED_LIBRARY_SUFFIX} )
194else( )
195 set( ASDM_LIBRARY ${ALMA_LIB_PATH}
196 ${LIBXML2_LIBRARY}/libxml2${CMAKE_SHARED_LIBRARY_SUFFIX} )
197endif( )
198message( STATUS "ASDM_LIBRARY = " ${ASDM_LIBRARY} )
199add_definitions( -DWITHOUT_ACS )
200
201#
202# subdirectories
203# ASAP2TO3 asap2to3 apps
204# PYRAPLIB libpyrap.so external/libpyrap
205# ATNFLIB libatnf.so external-alma/atnf
206# ASAPLIB _asap.so src
207# python modules python
208# shared files share
209#
210macro( asap_add_subdirectory )
211 add_subdirectory( apps )
212 add_subdirectory( external/libpyrap )
213 add_subdirectory( external-alma/atnf )
214 add_subdirectory( src )
215 add_subdirectory( python )
216 add_subdirectory( share )
217 add_subdirectory( external-alma/asdm2ASAP )
218# add_subdirectory( external-alma/oldasdm2ASAP )
219endmacro( asap_add_subdirectory )
220
Note: See TracBrowser for help on using the repository browser.