source: trunk/cmake/withcasa.cmake@ 3007

Last change on this file since 3007 was 3006, checked in by Kana Sugimoto, 10 years ago

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

What Interface Changed:

Test Programs:

Put in Release Notes: No

Module(s): cmake build scripts

Description: Applied a patch sent from Darrell on Sep. 12, 2014 to support building on the latest version of OSX.


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