source: branches/casa-release-4_3/cmake/withcasa.cmake@ 3093

Last change on this file since 3093 was 2982, 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: cmake with LIBXML2_ROOT_DIR specified

Put in Release Notes: No

Module(s): asap build

Description: committing changes to withcasa.cmake received from Darrell. Added hints of path to libxml2. CMake searches libxml include files for ${LIBXML2_ROOT_DIR}/include and library for ${LIBXML2_ROOT_DIR}.


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/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()
54elseif( 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()
70endif()
71message( 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#
79IF(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 )
87ELSE()
88 set( casaroot ${CMAKE_INSTALL_PREFIX}/.. CACHE PATH "casa architecture directory" FORCE )
89ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
90
91message( STATUS "casaroot = " ${casaroot} )
92
93# modules
94IF ( 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()
100ENDIF()
101message( STATUS "CASA_CODE_PATH = " ${CASA_CODE_PATH} )
102set( CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CASA_CODE_PATH}/install" )
103message( STATUS "CMAKE_MODULE_PATH = " ${CMAKE_MODULE_PATH} )
104
105include( config )
106include( CASA )
107
108#
109# casacore
110#
111set( CASACORE_PATHS "${casaroot}/${arch};${casaroot};/usr/local;/usr" )
112
113SET(NO_SOVERSION FALSE CACHE BOOL "do not add version information to shared libraries")
114if( 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}" )
128else( )
129 message( STATUS "User disabled shared library versioning" )
130endif( )
131
132#
133# Boost
134#
135if( NOT BOOST_ROOT )
136 set( BOOST_ROOT ${casa_packages} )
137endif()
138
139
140#
141# wcslib
142#
143set( WCSLIB_PATHS "${casaroot}/${arch};/usr/local;/usr" )
144
145
146#
147# CASA (only alma/ASDM)
148#
149find_path( LIBXML2_INCLUDE_DIR libxml/xmlversion.h
150 HINTS ${LIBXML2_ROOT_DIR}/include
151 PATH_SUFFIXES libxml2 )
152if( LIBXML2_INCLUDE_DIR MATCHES "NOTFOUND$" )
153 message( FATAL_ERROR "libxml/xmlversion.h could not be found. Please check!" )
154endif()
155message( STATUS "LIBXML2_INCLUDE_DIR = " ${LIBXML2_INCLUDE_DIR} )
156find_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 )
161if ( LIBXML2_LIBRARY MATCHES "NOTFOUND$" )
162 message( FATAL_ERROR "libxml2${CMAKE_SHARED_LIBRARY_SUFFIX} could not be found. Please check!" )
163endif()
164message( STATUS "LIBXML2_LIBRARY = " ${LIBXML2_LIBRARY} )
165
166set( ASDM_INCLUDE_ROOT ${CASA_CODE_PATH} )
167if ( EXISTS ${CASA_CODE_PATH}/include/alma )
168 set( ASDM_INCLUDE_ROOT ${CASA_CODE_PATH}/include )
169endif()
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} )
184set( 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} )
189if ( NOT ALMA_LIB_PATH )
190 set( ASDM_LIBRARY ${casaroot}/${arch}/lib/libalma${CMAKE_SHARED_LIBRARY_SUFFIX}
191 ${LIBXML2_LIBRARY}/libxml2${CMAKE_SHARED_LIBRARY_SUFFIX} )
192else( )
193 set( ASDM_LIBRARY ${ALMA_LIB_PATH}
194 ${LIBXML2_LIBRARY}/libxml2${CMAKE_SHARED_LIBRARY_SUFFIX} )
195endif( )
196message( STATUS "ASDM_LIBRARY = " ${ASDM_LIBRARY} )
197add_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#
208macro( 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 )
217endmacro( asap_add_subdirectory )
218
Note: See TracBrowser for help on using the repository browser.