source: trunk/cmake/withcasa.cmake@ 3120

Last change on this file since 3120 was 3107, checked in by Kana Sugimoto, 8 years ago

New Development: Yes

JIRA Issue: Yes (CAS-9275)

Ready for Test: Yes

Interface Changes: No

What Interface Changed:

Test Programs: build cmake

Put in Release Notes: No

Module(s): asap

Description: Darrell's changes to support thirdparty at /opt/casa/02.


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