source: trunk/cmake/withcasa.cmake@ 2924

Last change on this file since 2924 was 2898, 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: cmake -DNO_SOVERSION=TRUE ..

Put in Release Notes: No

Module(s): asap

Description: Committing cmake script sent from Darrell to support a new cmake option, NO_SOVERSION to disable shared library version.


File size: 7.3 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(NO_SOVERSION FALSE CACHE BOOL "do not add version information to shared libraries")
104if( NOT NO_SOVERSION )
105 set( epochdelta 1385403204 )
106 if ( EXISTS ${CMAKE_INSTALL_PREFIX}/${arch}/casa_sover.txt )
107 execute_process( COMMAND perl -e "while (<>) { chomp and print if (! m/^\#/ ) }" ${CMAKE_INSTALL_PREFIX}/${arch}/casa_sover.txt
108 OUTPUT_VARIABLE __asap_soversion )
109 elseif( EXISTS ${CMAKE_INSTALL_PREFIX}/casa_sover.txt )
110 execute_process( COMMAND perl -e "while (<>) { chomp and print if (! m/^#/ ) }" ${CMAKE_INSTALL_PREFIX}/casa_sover.txt
111 OUTPUT_VARIABLE __asap_soversion )
112 else( )
113 execute_process( COMMAND perl -e "$t=time( )-${epochdelta};$z=$t & 0xff; $y=($t>>8)&0xff; $x=($t>>16)&0xffff; print \"$x.$y.$z\""
114 OUTPUT_VARIABLE __asap_soversion )
115 endif( )
116 set(asap_soversion ${__asap_soversion} CACHE STRING "version for shared objects")
117 message( STATUS "Shared object version number ${asap_soversion}" )
118else( )
119 message( STATUS "User disabled shared library versioning" )
120endif( )
121
122#
123# Boost
124#
125if( NOT BOOST_ROOT )
126 set( BOOST_ROOT ${casa_packages} )
127endif()
128
129
130#
131# wcslib
132#
133set( WCSLIB_PATHS "${casaroot}/${arch};/usr/local;/usr" )
134
135
136#
137# CASA (only alma/ASDM)
138#
139find_path( LIBXML2_INCLUDE_DIR libxml/xmlversion.h
140 PATH_SUFFIXES libxml2 )
141if( LIBXML2_INCLUDE_DIR MATCHES "NOTFOUND$" )
142 message( FATAL_ERROR "libxml/xmlversion.h could not be found. Please check!" )
143endif()
144message( STATUS "LIBXML2_INCLUDE_DIR = " ${LIBXML2_INCLUDE_DIR} )
145find_path( LIBXML2_LIBRARY libxml2${CMAKE_SHARED_LIBRARY_SUFFIX}
146 PATHS /usr
147 PATH_SUFFIXES lib64 lib )
148#find_path( LIBXML2_LIBRARY libxml2.so )
149if ( LIBXML2_LIBRARY MATCHES "NOTFOUND$" )
150 message( FATAL_ERROR "libxml2${CMAKE_SHARED_LIBRARY_SUFFIX} could not be found. Please check!" )
151endif()
152message( STATUS "LIBXML2_LIBRARY = " ${LIBXML2_LIBRARY} )
153
154set( ASDM_INCLUDE_ROOT ${CASA_CODE_PATH} )
155if ( EXISTS ${CASA_CODE_PATH}/include/alma )
156 set( ASDM_INCLUDE_ROOT ${CASA_CODE_PATH}/include )
157endif()
158#set( ASDM_INCLUDE_DIR_OLD ${ASDM_INCLUDE_ROOT}/alma/ASDM
159# ${ASDM_INCLUDE_ROOT}/alma/Enumerations
160# ${ASDM_INCLUDE_ROOT}/alma/ASDMBinaries
161# ${ASDM_INCLUDE_ROOT}/alma/Enumtcl
162# ${LIBXML2_INCLUDE_DIR} )
163#set( ASDM_LIBRARY_OLD ${casaroot}/${arch}/lib/libalma${CMAKE_SHARED_LIBRARY_SUFFIX}
164# ${LIBXML2_LIBRARY}/libxml2${CMAKE_SHARED_LIBRARY_SUFFIX} )
165#set( ASDM_INCLUDE_DIR ${ASDM_INCLUDE_ROOT}/alma_v3/ASDM
166# ${ASDM_INCLUDE_ROOT}/alma_v3/Enumerations
167# ${ASDM_INCLUDE_ROOT}/alma_v3/ASDMBinaries
168# ${ASDM_INCLUDE_ROOT}/alma_v3/Enumtcl
169# ${LIBXML2_INCLUDE_DIR} )
170#set( ASDM_LIBRARY ${casaroot}/${arch}/lib/libalma_v3${CMAKE_SHARED_LIBRARY_SUFFIX}
171# ${LIBXML2_LIBRARY}/libxml2${CMAKE_SHARED_LIBRARY_SUFFIX} )
172set( ASDM_INCLUDE_DIR ${ASDM_INCLUDE_ROOT}/alma/ASDM
173 ${ASDM_INCLUDE_ROOT}/alma/Enumerations
174 ${ASDM_INCLUDE_ROOT}/alma/ASDMBinaries
175 ${ASDM_INCLUDE_ROOT}/alma/Enumtcl
176 ${LIBXML2_INCLUDE_DIR} )
177if ( NOT ALMA_LIB_PATH )
178 set( ASDM_LIBRARY ${casaroot}/${arch}/lib/libalma${CMAKE_SHARED_LIBRARY_SUFFIX}
179 ${LIBXML2_LIBRARY}/libxml2${CMAKE_SHARED_LIBRARY_SUFFIX} )
180else( )
181 set( ASDM_LIBRARY ${ALMA_LIB_PATH}
182 ${LIBXML2_LIBRARY}/libxml2${CMAKE_SHARED_LIBRARY_SUFFIX} )
183endif( )
184message( STATUS "ASDM_LIBRARY = " ${ASDM_LIBRARY} )
185add_definitions( -DWITHOUT_ACS )
186
187#
188# subdirectories
189# ASAP2TO3 asap2to3 apps
190# PYRAPLIB libpyrap.so external/libpyrap
191# ATNFLIB libatnf.so external-alma/atnf
192# ASAPLIB _asap.so src
193# python modules python
194# shared files share
195#
196macro( asap_add_subdirectory )
197 add_subdirectory( apps )
198 add_subdirectory( external/libpyrap )
199 add_subdirectory( external-alma/atnf )
200 add_subdirectory( src )
201 add_subdirectory( python )
202 add_subdirectory( share )
203 add_subdirectory( external-alma/asdm2ASAP )
204# add_subdirectory( external-alma/oldasdm2ASAP )
205endmacro( asap_add_subdirectory )
206
Note: See TracBrowser for help on using the repository browser.