source: trunk/cmake/withcasa.cmake@ 2929

Last change on this file since 2929 was 2898, checked in by Kana Sugimoto, 10 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
RevLine 
[1968]1###
2# CMakeLists.txt for build with casa
3###
4
5
6# environment dependent settings
7if( APPLE )
[2400]8 if( CMAKE_SYSTEM MATCHES ^Darwin-10 OR
[2898]9 CMAKE_SYSTEM MATCHES ^Darwin-11 OR
10 CMAKE_SYSTEM MATCHES ^Darwin-12 )
[2399]11 if ( NOT arch )
12 set( arch darwin64 )
13 endif()
[1968]14 if( NOT archflag )
[2893]15 if( EXISTS /opt/casa/darwin12 )
[1968]16 set( archflag x86_64 )
[2893]17 elseif( EXISTS /opt/casa/darwin11 )
18 set( archflag x86_64 )
[2400]19 elseif( EXISTS /opt/casa/darwin10-64b )
20 set( archflag x86_64 )
[1968]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 )
[2893]28 if( CMAKE_SYSTEM MATCHES ^Darwin-12 )
29 set( casa_packages /opt/local )
30 elseif( CMAKE_SYSTEM MATCHES ^Darwin-11 )
[2400]31 set( casa_packages /opt/casa/darwin11 )
32 else()
33 set( casa_packages /opt/casa/darwin10-64b )
34 endif()
[1968]35 else()
36 set( casa_packages /opt/casa/core2-apple-darwin10 )
37 endif()
38 elseif( CMAKE_SYSTEM MATCHES ^Darwin-9 )
[2399]39 if ( NOT arch )
40 set( arch darwin )
41 endif()
[1968]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 )
[2847]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( )
[1968]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
[1991]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} )
[2092]76 set( CMAKE_INSTALL_PREFIX ${casaroot}/${arch} CACHE PATH "casa architecture directory" FORCE )
[1991]77ELSE()
[2092]78 set( casaroot ${CMAKE_INSTALL_PREFIX}/.. CACHE PATH "casa architecture directory" FORCE )
[1991]79ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
[1968]80
[1991]81message( STATUS "casaroot = " ${casaroot} )
[1968]82
[1991]83# modules
[2183]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()
[1991]90ENDIF()
[2183]91message( STATUS "CASA_CODE_PATH = " ${CASA_CODE_PATH} )
92set( CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CASA_CODE_PATH}/install" )
[2181]93message( STATUS "CMAKE_MODULE_PATH = " ${CMAKE_MODULE_PATH} )
[1991]94
95include( config )
96include( CASA )
97
[1968]98#
99# casacore
100#
[1976]101set( CASACORE_PATHS "${casaroot}/${arch};${casaroot};/usr/local;/usr" )
[1968]102
[2898]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}" )
[2872]118else( )
[2898]119 message( STATUS "User disabled shared library versioning" )
[2872]120endif( )
[1968]121
122#
123# Boost
124#
125if( NOT BOOST_ROOT )
126 set( BOOST_ROOT ${casa_packages} )
127endif()
128
129
130#
131# wcslib
132#
[1970]133set( WCSLIB_PATHS "${casaroot}/${arch};/usr/local;/usr" )
[1968]134
135
136#
[2210]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} )
[2236]145find_path( LIBXML2_LIBRARY libxml2${CMAKE_SHARED_LIBRARY_SUFFIX}
[2210]146 PATHS /usr
147 PATH_SUFFIXES lib64 lib )
148#find_path( LIBXML2_LIBRARY libxml2.so )
149if ( LIBXML2_LIBRARY MATCHES "NOTFOUND$" )
[2236]150 message( FATAL_ERROR "libxml2${CMAKE_SHARED_LIBRARY_SUFFIX} could not be found. Please check!" )
[2210]151endif()
152message( STATUS "LIBXML2_LIBRARY = " ${LIBXML2_LIBRARY} )
[2578]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
[2417]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} )
[2578]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
[2417]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} )
[2578]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
[2210]176 ${LIBXML2_INCLUDE_DIR} )
[2558]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} )
[2210]185add_definitions( -DWITHOUT_ACS )
186
187#
[1968]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 )
[2273]203 add_subdirectory( external-alma/asdm2ASAP )
[2417]204# add_subdirectory( external-alma/oldasdm2ASAP )
[1968]205endmacro( asap_add_subdirectory )
206
Note: See TracBrowser for help on using the repository browser.