source: trunk/CMakeLists.txt@ 1954

Last change on this file since 1954 was 1954, checked in by Takeshi Nakazato, 14 years ago

New Development: Yes

JIRA Issue: Yes CAS-2668

Ready for Test: Yes

Interface Changes: 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...

Preliminary version of CMakeLists.txt files.

*NOTE*
Part of library search is hard-coded, so this is not a
complete cross-platform system.


File size: 6.3 KB
Line 
1###
2# CMakeLists.txt for ASAP module
3###
4
5# minimum requirement for cmake version
6cmake_minimum_required( VERSION 2.8 )
7
8# project name is ASAP
9project( ASAP )
10
11# install directory
12# set casaroot
13# the regular expression means '../'
14# [^ ] Matches any character(s) not inside the brackets
15# + Matches preceding pattern one or more times
16# ? Matches preceding pattern zero or once only
17# $ Mathces at end of a line
18string( REGEX REPLACE /[^/]+/?$ "" casaroot ${CMAKE_SOURCE_DIR} )
19message( STATUS "casaroot = " ${casaroot} )
20
21# flags
22set( DEFAULT_CXX_FLAGS
23 "-pipe -Wall -Wextra -Wno-non-template-friend -Wcast-align -Wno-comment" )
24find_package( OpenMP )
25if( OPENMP_FOUND )
26 set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" )
27endif()
28
29# environment dependent settings
30if( APPLE )
31 set( SO dylib )
32 if( NOT arch )
33 set( arch darwin )
34 endif()
35 if( CMAKE_SYSTEM MATHCES ^Darwin-10 )
36 if( NOT archflag )
37 if( EXISTS /opt/casa/darwin10-64b )
38 set( archflag x86_64 )
39 elseif( EXISTS /opt/casa/core2-apple-darwin10 )
40 set( archflag i386 )
41 else()
42 set( archflag x86_64 )
43 endif()
44 endif()
45 if( archflag STREQUAL x86_64 )
46 add_definitions( -DAIPS_64B )
47 set( casa_packages /opt/casa/darwin10-64b )
48 else()
49 set( casa_packages /opt/casa/core2-apple-darwin10 )
50 endif()
51 execute_process( COMMAND ${CMAKE_CXX_COMPILER} --version
52 COMMAND head -1
53 COMMAND perl -pe "s|.*?(\\d+\\.\\d+)\\.\\d+$|$1|"
54 OUTPUT_VARIABLE _cxx_version
55 OUTPUT_STRIP_TRAILING_WHITESPACE )
56 if( NOT _cxx_version STREQUAL "4.4" )
57 set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} -arch ${archflag}" )
58 endif()
59 elseif( CMAKE_SYSTEM MATCHES ^Darwin-9 )
60 set( casa_packages /opt/casa/core2-apple-darwin8/3rd-party )
61 endif()
62elseif( CMAKE_SYSTEM_NAME STREQUAL Linux )
63 set( SO so )
64 add_definitions( -DAIPS_LINUX )
65 if( CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 )
66 set( casa_packages /usr/lib64/casapy )
67 if( NOT arch )
68 set( arch linux_64b )
69 endif()
70 add_definitions( -DAIPS_64B )
71 set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} -Wno-deprecated" )
72 else()
73 set( casa_packages /usr/lib/casapy )
74 if( NOT arch )
75 set( arch linux_gnu )
76 endif()
77 set( DEFAULT_CXX_FLAGS "${DEFAULT_CXX_FLAGS} -Wno-deprecated -Woverloaded-virtual" )
78 endif()
79endif()
80message( STATUS "arch = " ${arch} )
81
82# set root directory for installation
83set( CMAKE_INSTALL_PREFIX ${casaroot}/${arch} )
84message( STATUS "CMAKE_INSTALL_PREFIX = " ${CMAKE_INSTALL_PREFIX} )
85
86# set flags for cpp compiler
87set( CMAKE_CXX_FLAGS ${DEFAULT_CXX_FLAGS} )
88
89#
90# casacore
91#
92set( CASACORE_INCLUDE_DIR ${casaroot}/${arch}/include/casacore )
93
94set( CASACORE_LIBS casa
95 components
96 coordinates
97 fits
98 images
99 lattices
100 measures
101 mirlib
102 ms
103 msfits
104 scimath
105 scimath_f
106 tables )
107set( _casacore_libs "" )
108foreach( _a ${CASACORE_LIBS} )
109 set( _libname libcasa_${_a}.${SO} )
110 unset( _casacore_lib CACHE )
111 find_library( _casacore_lib ${_libname}
112 PATHS ${CMAKE_INSTALL_PREFIX} PATH_SUFFIXES lib )
113 if( NOT _casacore_lib-NOTFOUND )
114 list( APPEND _casacore_libs casa_${_a} )
115 endif()
116endforeach()
117set( CASACORE_LIBRARIES ${_casacore_libs} )
118message( STATUS "CASACORE_LIBRARIES = " ${CASACORE_LIBRARIES} )
119
120#
121# Python
122#
123# tentative
124set( PYVERSION 2.6 )
125if (NOT PYTHON_ROOT )
126 set( PYTHON_ROOT ${casa_packages} )
127endif()
128find_package( PythonLibs REQUIRED python${PYVERSION} )
129
130if( NOT PYTHONLIBS_FOUND )
131 message( FATAL_ERROR "Python could not be found. Please check!" )
132endif()
133message( STATUS "PYTHON_INCLUDE_PATH = " ${PYTHON_INCLUDE_PATH} )
134message( STATUS "PYTHON_LIBRARIES = " ${PYTHON_LIBRARIES} )
135
136set( PYTHON_INCLUDE_DIR ${PYTHON_INCLUDE_PATH} )
137find_path( NUMPY_INC_DIR numpy/npy_interrupt.h
138 PATHS ${casa_packages}/lib/python${PYVERSION}/site-packages/numpy/core/include )
139message( STATUS "NUMPY_INC_DIR = " ${NUMPY_INC_DIR} )
140if( NOT NUMPY_INC_DIR STREQUAL NUMPY_INC_DIR-NOTFOUND )
141 list( APPEND PYTHON_INCLUDE_DIR ${NUMPY_INC_DIR} )
142endif()
143message( STATUS "PYTHON_INCLUDE_DIR = " ${PYTHON_INCLUDE_DIR} )
144
145#
146# Boost
147#
148if( NOT BOOST_ROOT )
149 set( BOOST_ROOT ${casa_packages} )
150endif()
151
152set( boost_components regex program_options filesystem )
153find_package( Boost REQUIRED ${boost_components} )
154
155if( NOT Boost_FOUND )
156 message( FATAL_ERROR "Boost could not be found. Please check!" )
157endif()
158
159# For boost >= 1.35, we need to link also to boost-system
160if( Boost_VERSION GREATER 103499 )
161
162 # Force redetection by resetting these variables
163 if( NOT Boost_SYSTEM_FOUND )
164 message( STATUS "Boost version (${Boost_VERSION}) is 1.35.0 or newer" )
165 unset( Boost_FOUND )
166 unset( Boost_INCLUDE_DIR CACHE )
167 endif()
168 set( boost_components regex program_options filesystem system )
169 find_package( Boost REQUIRED ${boost_components} )
170
171 if( NOT Boost_FOUND )
172 message( FATAL_ERROR "Boost-system could not be found. Please check!" )
173 endif()
174endif()
175
176if( NOT Boost_VERSION GREATER 103199 AND NOT CASA_IGNORE_VERSION )
177 message( FATAL_ERROR "Boost version (${Boost_VERSION}) is too old! Must be 103200 (1.32.0) or newer. Please check!" )
178endif()
179
180
181
182# include path
183message( STATUS "Boost_INCLUDE_DIR = " ${Boost_INCLUDE_DIR} )
184include_directories( ${CASACORE_INCLUDE_DIR}
185 ${Boost_INCLUDE_DIR}
186 ${PYTHON_INCLUDE_DIR} )
187
188# link path
189set( CASACORE_LIBRARY_DIR ${casaroot}/${arch}/lib )
190link_directories( ${CASACORE_LIBRARY_DIR} )
191
192
193# install directory
194set( EXEC_INSTALL_DIR bin )
195set( LIB_INSTALL_DIR lib )
196set( PYTHON_INSTALL_DIR python/${PYVERSION}/asap )
197set( SHARED_INSTALL_DIR share/asap )
198
199# subdirectories
200# asap2to3 apps
201# libpyrap.so external/libpyrap
202# libatnf.so external-alma/atnf
203# _asap.so src
204# python modules python
205add_subdirectory( apps )
206add_subdirectory( external/libpyrap )
207add_subdirectory( external-alma/atnf )
208add_subdirectory( src )
209add_subdirectory( python )
210add_subdirectory( share )
211
212
Note: See TracBrowser for help on using the repository browser.