source: trunk/cmake/withcasa.cmake@ 2972

Last change on this file since 2972 was 2971, checked in by KohjiNakamura, 10 years ago

native optimization

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