source: trunk/cmake/withcasa.cmake@ 2974

Last change on this file since 2974 was 2971, checked in by KohjiNakamura, 10 years ago

native optimization

File size: 7.7 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 PATH_SUFFIXES libxml2 )
151if( LIBXML2_INCLUDE_DIR MATCHES "NOTFOUND$" )
152 message( FATAL_ERROR "libxml/xmlversion.h could not be found. Please check!" )
153endif()
154message( STATUS "LIBXML2_INCLUDE_DIR = " ${LIBXML2_INCLUDE_DIR} )
155find_path( LIBXML2_LIBRARY libxml2${CMAKE_SHARED_LIBRARY_SUFFIX}
156 PATHS /usr
157 PATH_SUFFIXES lib64 lib lib/x86_64-linux-gnu)
158#find_path( LIBXML2_LIBRARY libxml2.so )
159if ( LIBXML2_LIBRARY MATCHES "NOTFOUND$" )
160 message( FATAL_ERROR "libxml2${CMAKE_SHARED_LIBRARY_SUFFIX} could not be found. Please check!" )
161endif()
162message( STATUS "LIBXML2_LIBRARY = " ${LIBXML2_LIBRARY} )
163
164set( ASDM_INCLUDE_ROOT ${CASA_CODE_PATH} )
165if ( EXISTS ${CASA_CODE_PATH}/include/alma )
166 set( ASDM_INCLUDE_ROOT ${CASA_CODE_PATH}/include )
167endif()
168#set( ASDM_INCLUDE_DIR_OLD ${ASDM_INCLUDE_ROOT}/alma/ASDM
169# ${ASDM_INCLUDE_ROOT}/alma/Enumerations
170# ${ASDM_INCLUDE_ROOT}/alma/ASDMBinaries
171# ${ASDM_INCLUDE_ROOT}/alma/Enumtcl
172# ${LIBXML2_INCLUDE_DIR} )
173#set( ASDM_LIBRARY_OLD ${casaroot}/${arch}/lib/libalma${CMAKE_SHARED_LIBRARY_SUFFIX}
174# ${LIBXML2_LIBRARY}/libxml2${CMAKE_SHARED_LIBRARY_SUFFIX} )
175#set( ASDM_INCLUDE_DIR ${ASDM_INCLUDE_ROOT}/alma_v3/ASDM
176# ${ASDM_INCLUDE_ROOT}/alma_v3/Enumerations
177# ${ASDM_INCLUDE_ROOT}/alma_v3/ASDMBinaries
178# ${ASDM_INCLUDE_ROOT}/alma_v3/Enumtcl
179# ${LIBXML2_INCLUDE_DIR} )
180#set( ASDM_LIBRARY ${casaroot}/${arch}/lib/libalma_v3${CMAKE_SHARED_LIBRARY_SUFFIX}
181# ${LIBXML2_LIBRARY}/libxml2${CMAKE_SHARED_LIBRARY_SUFFIX} )
182set( ASDM_INCLUDE_DIR ${ASDM_INCLUDE_ROOT}/alma/ASDM
183 ${ASDM_INCLUDE_ROOT}/alma/Enumerations
184 ${ASDM_INCLUDE_ROOT}/alma/ASDMBinaries
185 ${ASDM_INCLUDE_ROOT}/alma/Enumtcl
186 ${LIBXML2_INCLUDE_DIR} )
187if ( NOT ALMA_LIB_PATH )
188 set( ASDM_LIBRARY ${casaroot}/${arch}/lib/libalma${CMAKE_SHARED_LIBRARY_SUFFIX}
189 ${LIBXML2_LIBRARY}/libxml2${CMAKE_SHARED_LIBRARY_SUFFIX} )
190else( )
191 set( ASDM_LIBRARY ${ALMA_LIB_PATH}
192 ${LIBXML2_LIBRARY}/libxml2${CMAKE_SHARED_LIBRARY_SUFFIX} )
193endif( )
194message( STATUS "ASDM_LIBRARY = " ${ASDM_LIBRARY} )
195add_definitions( -DWITHOUT_ACS )
196
197#
198# subdirectories
199# ASAP2TO3 asap2to3 apps
200# PYRAPLIB libpyrap.so external/libpyrap
201# ATNFLIB libatnf.so external-alma/atnf
202# ASAPLIB _asap.so src
203# python modules python
204# shared files share
205#
206macro( asap_add_subdirectory )
207 add_subdirectory( apps )
208 add_subdirectory( external/libpyrap )
209 add_subdirectory( external-alma/atnf )
210 add_subdirectory( src )
211 add_subdirectory( python )
212 add_subdirectory( share )
213 add_subdirectory( external-alma/asdm2ASAP )
214# add_subdirectory( external-alma/oldasdm2ASAP )
215endmacro( asap_add_subdirectory )
216
Note: See TracBrowser for help on using the repository browser.