source: trunk/cmake/withcasa.cmake @ 3040

Last change on this file since 3040 was 3040, checked in by Takeshi Nakazato, 9 years ago

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: Yes/No?

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No?

Module(s): Module Names change impacts.

Description: Describe your changes here...

Support build on OS X 10.9 and 10.10.


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