source: trunk/cmake/withcasa.cmake@ 2874

Last change on this file since 2874 was 2872, 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:

Put in Release Notes: No

Module(s): asap build with CASA

Description: introduced version numbering (common to casacore and CASA) to shared libraries of asap (_asap.so, libpyrap.so, libatnf.so, and libasap.so) when the package is build as a part of CASA.


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