source: trunk/cmake/withcasa.cmake@ 2896

Last change on this file since 2896 was 2893, checked in by Kana Sugimoto, 11 years ago

New Development: Yes

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

What Interface Changed:

Test Programs: make on OSX 10.8

Put in Release Notes: No

Module(s): asap with casa

Description: Updated CMake file for OSX 10.8.


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