source: trunk/cmake/withcasa.cmake@ 3138

Last change on this file since 3138 was 3107, checked in by Kana Sugimoto, 8 years ago

New Development: Yes

JIRA Issue: Yes (CAS-9275)

Ready for Test: Yes

Interface Changes: No

What Interface Changed:

Test Programs: build cmake

Put in Release Notes: No

Module(s): asap

Description: Darrell's changes to support thirdparty at /opt/casa/02.


File size: 8.5 KB
RevLine 
[1968]1###
2# CMakeLists.txt for build with casa
3###
4
5
6# environment dependent settings
7if( APPLE )
[3040]8 if ( CMAKE_SYSTEM MATCHES ^Darwin-1[0-4] )
9 message( STATUS "This is OS X" )
10 if ( CMAKE_SYSTEM MATCHES ^Darwin-1[34] )
11 set( arch darwin )
12 endif()
[2399]13 if ( NOT arch )
14 set( arch darwin64 )
15 endif()
[1968]16 if( NOT archflag )
[3006]17 if( EXISTS /opt/casa/01 )
[1968]18 set( archflag x86_64 )
[3006]19 elseif( EXISTS /opt/casa/darwin12 )
20 set( archflag x86_64 )
[2893]21 elseif( EXISTS /opt/casa/darwin11 )
22 set( archflag x86_64 )
[2400]23 elseif( EXISTS /opt/casa/darwin10-64b )
24 set( archflag x86_64 )
[1968]25 elseif( EXISTS /opt/casa/core2-apple-darwin10 )
26 set( archflag i386 )
[2931]27 elseif( EXISTS /opt/casa/01 )
28 set( archflag x86_64 )
[1968]29 else()
30 set( archflag x86_64 )
31 endif()
32 endif()
33 if( archflag STREQUAL x86_64 )
[3040]34 if( CMAKE_SYSTEM MATCHES ^Darwin-1[2-4] )
[2967]35 if ( EXISTS /opt/casa/01 )
36 set( casa_packages /opt/casa/01 )
37 else()
38 set( casa_packages /opt/local )
39 endif()
[2893]40 elseif( CMAKE_SYSTEM MATCHES ^Darwin-11 )
[2931]41 if ( EXISTS /opt/casa/01 )
42 set( casa_packages /opt/casa/01 )
43 else()
44 set( casa_packages /opt/casa/darwin11 )
45 endif()
[2400]46 else()
47 set( casa_packages /opt/casa/darwin10-64b )
48 endif()
[1968]49 else()
50 set( casa_packages /opt/casa/core2-apple-darwin10 )
51 endif()
52 elseif( CMAKE_SYSTEM MATCHES ^Darwin-9 )
[2399]53 if ( NOT arch )
54 set( arch darwin )
55 endif()
[1968]56 set( casa_packages /opt/casa/core2-apple-darwin8/3rd-party )
57 endif()
58elseif( CMAKE_SYSTEM_NAME STREQUAL Linux )
59 if( CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 )
[3107]60 if ( EXISTS /usr/lib64/casa/02 )
61 set( casa_packages /opt/casa/02 )
62 elseif ( EXISTS /usr/lib64/casa/01 )
[2847]63 set( casa_packages /usr/lib64/casa/01 )
64 else( )
65 set( casa_packages /usr/lib64/casapy )
66 endif( )
[1968]67 if( NOT arch )
68 set( arch linux_64b )
69 endif()
70 else()
71 set( casa_packages /usr/lib/casapy )
72 if( NOT arch )
73 set( arch linux_gnu )
74 endif()
75 endif()
76endif()
77message( STATUS "arch = " ${arch} )
[3040]78message( STATUS "casa_packages = " ${casa_packages} )
[1968]79
[1991]80# install directory
81#
82# The layout of the source+install directory trees
83# is rather hard-coded in much source code. However,
84# with care CASA can be built and installed elsewhere...
85#
86IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
87 # the regular expression means '../'
88 # [^ ] Matches any character(s) not inside the brackets
89 # + Matches preceding pattern one or more times
90 # ? Matches preceding pattern zero or once only
91 # $ Mathces at end of a line
92 string( REGEX REPLACE /[^/]+/?$ "" casaroot ${CMAKE_SOURCE_DIR} )
[2092]93 set( CMAKE_INSTALL_PREFIX ${casaroot}/${arch} CACHE PATH "casa architecture directory" FORCE )
[1991]94ELSE()
[2092]95 set( casaroot ${CMAKE_INSTALL_PREFIX}/.. CACHE PATH "casa architecture directory" FORCE )
[1991]96ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
[1968]97
[1991]98message( STATUS "casaroot = " ${casaroot} )
[1968]99
[1991]100# modules
[2183]101IF ( NOT DEFINED CASA_CODE_PATH )
102 IF ( EXISTS ${casaroot}/code/install )
103 set( CASA_CODE_PATH ${casaroot}/code )
104 ELSE()
105 set( CASA_CODE_PATH ${CMAKE_SOURCE_DIR}/../code )
106 ENDIF()
[1991]107ENDIF()
[2183]108message( STATUS "CASA_CODE_PATH = " ${CASA_CODE_PATH} )
109set( CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CASA_CODE_PATH}/install" )
[2181]110message( STATUS "CMAKE_MODULE_PATH = " ${CMAKE_MODULE_PATH} )
[1991]111
112include( config )
113include( CASA )
114
[1968]115#
116# casacore
117#
[1976]118set( CASACORE_PATHS "${casaroot}/${arch};${casaroot};/usr/local;/usr" )
[1968]119
[2898]120SET(NO_SOVERSION FALSE CACHE BOOL "do not add version information to shared libraries")
121if( NOT NO_SOVERSION )
122 set( epochdelta 1385403204 )
123 if ( EXISTS ${CMAKE_INSTALL_PREFIX}/${arch}/casa_sover.txt )
124 execute_process( COMMAND perl -e "while (<>) { chomp and print if (! m/^\#/ ) }" ${CMAKE_INSTALL_PREFIX}/${arch}/casa_sover.txt
125 OUTPUT_VARIABLE __asap_soversion )
126 elseif( EXISTS ${CMAKE_INSTALL_PREFIX}/casa_sover.txt )
127 execute_process( COMMAND perl -e "while (<>) { chomp and print if (! m/^#/ ) }" ${CMAKE_INSTALL_PREFIX}/casa_sover.txt
128 OUTPUT_VARIABLE __asap_soversion )
129 else( )
130 execute_process( COMMAND perl -e "$t=time( )-${epochdelta};$z=$t & 0xff; $y=($t>>8)&0xff; $x=($t>>16)&0xffff; print \"$x.$y.$z\""
131 OUTPUT_VARIABLE __asap_soversion )
132 endif( )
133 set(asap_soversion ${__asap_soversion} CACHE STRING "version for shared objects")
134 message( STATUS "Shared object version number ${asap_soversion}" )
[2872]135else( )
[2898]136 message( STATUS "User disabled shared library versioning" )
[2872]137endif( )
[1968]138
139#
140# Boost
141#
142if( NOT BOOST_ROOT )
143 set( BOOST_ROOT ${casa_packages} )
144endif()
145
146
147#
148# wcslib
149#
[1970]150set( WCSLIB_PATHS "${casaroot}/${arch};/usr/local;/usr" )
[1968]151
152
153#
[2210]154# CASA (only alma/ASDM)
155#
[3055]156#find_path( LIBXML2_INCLUDE_DIR libxml/xmlversion.h
157# HINTS ${LIBXML2_ROOT_DIR}/include
158# PATH_SUFFIXES libxml2 )
159#if( LIBXML2_INCLUDE_DIR MATCHES "NOTFOUND$" )
160# message( FATAL_ERROR "libxml/xmlversion.h could not be found. Please check!" )
161#endif()
162#message( STATUS "LIBXML2_INCLUDE_DIR = " ${LIBXML2_INCLUDE_DIR} )
163#find_path( LIBXML2_LIBRARY libxml2${CMAKE_SHARED_LIBRARY_SUFFIX}
164# HINTS ${LIBXML2_ROOT_DIR}
165# PATHS /usr
166# PATH_SUFFIXES lib64 lib lib/x86_64-linux-gnu)
[2210]167#find_path( LIBXML2_LIBRARY libxml2.so )
[3055]168#if ( LIBXML2_LIBRARY MATCHES "NOTFOUND$" )
169# message( FATAL_ERROR "libxml2${CMAKE_SHARED_LIBRARY_SUFFIX} could not be found. Please check!" )
170#endif()
171#message( STATUS "LIBXML2_LIBRARY = " ${LIBXML2_LIBRARY} )
[2578]172
[3055]173#set( ASDM_INCLUDE_ROOT ${CASA_CODE_PATH} )
174#if ( EXISTS ${CASA_CODE_PATH}/include/alma )
175# set( ASDM_INCLUDE_ROOT ${CASA_CODE_PATH}/include )
176#endif()
[2578]177#set( ASDM_INCLUDE_DIR_OLD ${ASDM_INCLUDE_ROOT}/alma/ASDM
178# ${ASDM_INCLUDE_ROOT}/alma/Enumerations
179# ${ASDM_INCLUDE_ROOT}/alma/ASDMBinaries
180# ${ASDM_INCLUDE_ROOT}/alma/Enumtcl
[2417]181# ${LIBXML2_INCLUDE_DIR} )
182#set( ASDM_LIBRARY_OLD ${casaroot}/${arch}/lib/libalma${CMAKE_SHARED_LIBRARY_SUFFIX}
183# ${LIBXML2_LIBRARY}/libxml2${CMAKE_SHARED_LIBRARY_SUFFIX} )
[2578]184#set( ASDM_INCLUDE_DIR ${ASDM_INCLUDE_ROOT}/alma_v3/ASDM
185# ${ASDM_INCLUDE_ROOT}/alma_v3/Enumerations
186# ${ASDM_INCLUDE_ROOT}/alma_v3/ASDMBinaries
187# ${ASDM_INCLUDE_ROOT}/alma_v3/Enumtcl
[2417]188# ${LIBXML2_INCLUDE_DIR} )
189#set( ASDM_LIBRARY ${casaroot}/${arch}/lib/libalma_v3${CMAKE_SHARED_LIBRARY_SUFFIX}
190# ${LIBXML2_LIBRARY}/libxml2${CMAKE_SHARED_LIBRARY_SUFFIX} )
[3055]191#set( ASDM_INCLUDE_DIR ${ASDM_INCLUDE_ROOT}/alma/ASDM
192# ${ASDM_INCLUDE_ROOT}/alma/Enumerations
193# ${ASDM_INCLUDE_ROOT}/alma/ASDMBinaries
194# ${ASDM_INCLUDE_ROOT}/alma/Enumtcl
195# ${LIBXML2_INCLUDE_DIR} )
196#if ( NOT ALMA_LIB_PATH )
197# set( ASDM_LIBRARY ${casaroot}/${arch}/lib/libalma${CMAKE_SHARED_LIBRARY_SUFFIX}
198# ${LIBXML2_LIBRARY}/libxml2${CMAKE_SHARED_LIBRARY_SUFFIX} )
199#else( )
200# set( ASDM_LIBRARY ${ALMA_LIB_PATH}
201# ${LIBXML2_LIBRARY}/libxml2${CMAKE_SHARED_LIBRARY_SUFFIX} )
202#endif( )
203#message( STATUS "ASDM_LIBRARY = " ${ASDM_LIBRARY} )
204#add_definitions( -DWITHOUT_ACS )
[2210]205
[3055]206#set( COMPONENTS_INCLUDE_ROOT ${CASA_CODE_PATH} )
207#if ( EXISTS ${CASA_CODE_PATH}/include/components )
208# set( COMPONENTS_INCLUDE_ROOT ${CASA_CODE_PATH}/include )
209#endif()
210#set( COMPONENTS_INCLUDE_DIR ${COMPONENTS_INCLUDE_ROOT}/components/SpectralComponents )
211#if ( NOT COMPONENTS_LIB_PATH )
212# set( COMPONENTS_LIBRARY ${casaroot}/${arch}/lib/libcomponents${CMAKE_SHARED_LIBRARY_SUFFIX} )
213#else( )
214# set( COMPONENTS_LIBRARY ${COMPONENTS_LIB_PATH} )
215#endif( )
[3028]216
[2210]217#
[1968]218# subdirectories
219# ASAP2TO3 asap2to3 apps
220# PYRAPLIB libpyrap.so external/libpyrap
221# ATNFLIB libatnf.so external-alma/atnf
222# ASAPLIB _asap.so src
223# python modules python
224# shared files share
225#
226macro( asap_add_subdirectory )
227 add_subdirectory( apps )
[3035]228# add_subdirectory( external/libpyrap )
[1968]229 add_subdirectory( external-alma/atnf )
230 add_subdirectory( src )
231 add_subdirectory( python )
232 add_subdirectory( share )
[3055]233# add_subdirectory( external-alma/asdm2ASAP )
[2417]234# add_subdirectory( external-alma/oldasdm2ASAP )
[1968]235endmacro( asap_add_subdirectory )
236
Note: See TracBrowser for help on using the repository browser.