source: trunk/cmake/withcasa.cmake@ 2958

Last change on this file since 2958 was 2931, checked in by Kana Sugimoto, 11 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): asap build

Description: Committing changes to CMake scripts received from Darrell. This contains changes to enable building ASAP with llvm-gfortran. The changes do NOT affect build of stand-alone ASAP.


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