~chaffra/+junk/trilinos

« back to all changes in this revision

Viewing changes to packages/PyTrilinos/src/CMakeLists.txt

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Prud'homme, Christophe Prud'homme, Johannes Ring
  • Date: 2009-12-13 12:53:22 UTC
  • mfrom: (5.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20091213125322-in0nrdjc55deqsw9
Tags: 10.0.3.dfsg-1
[Christophe Prud'homme]
* New upstream release

[Johannes Ring]
* debian/patches/libname.patch: Add prefix 'libtrilinos_' to all
  libraries. 
* debian/patches/soname.patch: Add soversion to libraries.
* debian/watch: Update download URL.
* debian/control:
  - Remove python-numeric from Build-Depends (virtual package).
  - Remove automake and autotools from Build-Depends and add cmake to
    reflect switch to CMake.
  - Add python-support to Build-Depends.
* debian/rules: 
  - Cleanup and updates for switch to CMake.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# @HEADER
 
2
# ************************************************************************
 
3
#
 
4
#                PyTrilinos: Python Interface to Trilinos
 
5
#                   Copyright (2009) Sandia Corporation
 
6
#
 
7
# Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
 
8
# license for use of this work by or on behalf of the U.S. Government.
 
9
#
 
10
# This library is free software; you can redistribute it and/or modify
 
11
# it under the terms of the GNU Lesser General Public License as
 
12
# published by the Free Software Foundation; either version 2.1 of the
 
13
# License, or (at your option) any later version.
 
14
#
 
15
# This library is distributed in the hope that it will be useful, but
 
16
# WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
18
# Lesser General Public License for more details.
 
19
#
 
20
# You should have received a copy of the GNU Lesser General Public
 
21
# License along with this library; if not, write to the Free Software
 
22
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 
23
# USA
 
24
# Questions? Contact Bill Spotz (wfspotz@sandia.gov)
 
25
#
 
26
# ************************************************************************
 
27
# @HEADER
 
28
 
 
29
INCLUDE(PackageLibraryMacros)
 
30
 
 
31
#
 
32
# Package-specific configuration options
 
33
IF(Trilinos_ENABLE_Epetra)
 
34
  SET(HAVE_EPETRA ON)
 
35
ENDIF(Trilinos_ENABLE_Epetra)
 
36
 
 
37
IF(Trilinos_ENABLE_Teuchos)
 
38
  SET(HAVE_TEUCHOS ON)
 
39
ENDIF(Trilinos_ENABLE_Teuchos)
 
40
 
 
41
IF(NOX_ENABLE_Epetra)
 
42
  SET(HAVE_NOX_EPETRA ON)
 
43
ENDIF(NOX_ENABLE_Epetra)
 
44
 
 
45
IF(TPL_ENABLE_MPI)
 
46
  SET(HAVE_MPI ON)
 
47
ENDIF(TPL_ENABLE_MPI)
 
48
 
 
49
PACKAGE_CONFIGURE_FILE(${PACKAGE_NAME}_config.h)
 
50
 
 
51
#
 
52
# On Mac OS X Gnu compilers, add dynamic lookup for undefined symbols
 
53
# to the pytrilinos library and PyTrilinos extension modules
 
54
SET(EXTRA_LINK_ARGS "")
 
55
IF(APPLE)
 
56
  IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
 
57
    APPEND_SET(EXTRA_LINK_ARGS "-undefined dynamic_lookup")
 
58
  ENDIF()
 
59
ENDIF(APPLE)
 
60
 
 
61
#
 
62
# Add the current binary and source directories, the python include
 
63
# path, and the NumPy include path to the include directories
 
64
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
 
65
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
 
66
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
 
67
INCLUDE_DIRECTORIES(${NumPy_INCLUDE_DIR})
 
68
 
 
69
#
 
70
# Copy the pyfragments.swg file to the build directory
 
71
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/pyfragments.swg.in
 
72
  ${CMAKE_CURRENT_BINARY_DIR}/pyfragments.swg)
 
73
 
 
74
#
 
75
# Initialize the headers and sources
 
76
SET(HEADERS "")
 
77
SET(SOURCES "")
 
78
SET(HEADERS ${HEADERS}
 
79
  ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}_config.h
 
80
  )
 
81
 
 
82
#
 
83
# Core PyTrilinos headers and sources
 
84
APPEND_SET(HEADERS
 
85
  NumPyImporter.h
 
86
  PythonException.h
 
87
  FILEstream.h
 
88
  numpy_include.h
 
89
  )
 
90
 
 
91
APPEND_SET(SOURCES
 
92
  NumPyImporter.cpp
 
93
  PythonException.cpp
 
94
  FILEstream.cpp
 
95
  )
 
96
 
 
97
#
 
98
# PyTrilinos + Teuchos headers and sources
 
99
IF(PyTrilinos_ENABLE_Teuchos)
 
100
 
 
101
  APPEND_SET(HEADERS
 
102
    Teuchos_PythonParameter.h
 
103
    )
 
104
 
 
105
  APPEND_SET(SOURCES
 
106
    Teuchos_PythonParameter.cpp
 
107
    )
 
108
 
 
109
ENDIF(PyTrilinos_ENABLE_Teuchos)
 
110
 
 
111
#
 
112
# PyTrilinos + Epetra headers and sources
 
113
IF(PyTrilinos_ENABLE_Epetra)
 
114
 
 
115
  APPEND_SET(HEADERS
 
116
    Epetra_NumPyFEVector.h
 
117
    Epetra_NumPyIntSerialDenseMatrix.h
 
118
    Epetra_NumPyIntSerialDenseVector.h
 
119
    Epetra_NumPyIntVector.h
 
120
    Epetra_NumPyMultiVector.h
 
121
    Epetra_NumPySerialDenseMatrix.h
 
122
    Epetra_NumPySerialDenseVector.h
 
123
    Epetra_NumPyVector.h
 
124
    )
 
125
 
 
126
  APPEND_SET(SOURCES
 
127
    Epetra_NumPyFEVector.cpp
 
128
    Epetra_NumPyIntSerialDenseMatrix.cpp
 
129
    Epetra_NumPyIntSerialDenseVector.cpp
 
130
    Epetra_NumPyIntVector.cpp
 
131
    Epetra_NumPyMultiVector.cpp
 
132
    Epetra_NumPySerialDenseMatrix.cpp
 
133
    Epetra_NumPySerialDenseVector.cpp
 
134
    Epetra_NumPyVector.cpp
 
135
    )
 
136
 
 
137
ENDIF(PyTrilinos_ENABLE_Epetra)
 
138
 
 
139
#
 
140
# PyTrilinos + EpetraExt headers and sources
 
141
IF(PyTrilinos_ENABLE_EpetraExt)
 
142
 
 
143
  APPEND_SET(HEADERS
 
144
    EpetraExt_PyUtil.h
 
145
    )
 
146
 
 
147
  APPEND_SET(SOURCES
 
148
    EpetraExt_PyUtil.cpp
 
149
    )
 
150
 
 
151
ENDIF(PyTrilinos_ENABLE_EpetraExt)
 
152
 
 
153
#
 
154
# PyTrilinos + ML headers and sources
 
155
IF(PyTrilinos_ENABLE_ML)
 
156
 
 
157
  APPEND_SET(HEADERS
 
158
    MLAPI_PyMatrix.h
 
159
    )
 
160
 
 
161
ENDIF(PyTrilinos_ENABLE_ML)
 
162
 
 
163
#
 
164
# Define the target for the swig runtime header
 
165
SET(SWIG_RUNTIME swigpyrun.h)
 
166
ADD_CUSTOM_COMMAND(
 
167
  OUTPUT ${SWIG_RUNTIME}
 
168
  COMMAND ${SWIG_EXECUTABLE} -python -external-runtime
 
169
  )
 
170
 
 
171
#
 
172
# Define the targets for the PyTrilinos library
 
173
PACKAGE_ADD_LIBRARY(
 
174
  pytrilinos
 
175
  HEADERS ${HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/${SWIG_RUNTIME}
 
176
  SOURCES ${SOURCES}
 
177
  )
 
178
 
 
179
SET_TARGET_PROPERTIES(pytrilinos
 
180
  PROPERTIES LINK_FLAGS "${EXTRA_LINK_ARGS}"
 
181
  )
 
182
 
 
183
#
 
184
# Define the PyTrilinos swig setup
 
185
SET(CMAKE_SWIG_FLAGS "")
 
186
GET_FILENAME_COMPONENT(PYTRILINOS_DOXDIR
 
187
  ${CMAKE_CURRENT_SOURCE_DIR}/../doc/Doxygen ABSOLUTE
 
188
  )
 
189
APPEND_SET(CMAKE_SWIG_FLAGS -I${PYTRILINOS_DOXDIR})
 
190
 
 
191
#
 
192
# Loop over the PyTrilinos-enabled Trilinos modules and define the
 
193
# swig-generated PyTrilinos extension modules
 
194
FOREACH(MODULE ${PyTrilinos_MODULES})
 
195
  # Alternate versions of the module name
 
196
  STRING(TOUPPER ${MODULE} MODULE_UPPER)
 
197
  STRING(REPLACE "." "_" MODULE_NODOT ${MODULE})
 
198
  SET_SOURCE_FILES_PROPERTIES(${MODULE}.i PROPERTIES
 
199
    CPLUSPLUS ON
 
200
    )
 
201
  # Determine the swig module output directory, name and unique target name
 
202
  SWIG_MODULE_GET_OUTDIR_AND_MODULE(${MODULE}.i MODULE_OUTDIR MODULE_NAME)
 
203
  IF(TARGET ${MODULE_NAME})
 
204
    SET(PyTrilinos_TARGET_NAME ${MODULE_NODOT})
 
205
  ELSE(TARGET ${MODULE_NAME})
 
206
    SET(PyTrilinos_TARGET_NAME ${MODULE_NAME})
 
207
  ENDIF(TARGET ${MODULE_NAME})
 
208
  # Add the SWIG module
 
209
  SWIG_ADD_MODULE(${PyTrilinos_TARGET_NAME} python "${MODULE_OUTDIR}"
 
210
    "${MODULE_NAME}" ${MODULE}.i)
 
211
  SWIG_LINK_LIBRARIES(${PyTrilinos_TARGET_NAME} pytrilinos)
 
212
  # Choosing the Trilinos libraries to link against requires a little bit
 
213
  # of logic
 
214
  IF("${MODULE_OUTDIR}" MATCHES "PyTrilinos/NOX/Epetra")
 
215
    SET(TRILINOS_LIBS ${NOXEPETRA_LIBRARIES})
 
216
  ELSEIF("${MODULE_OUTDIR}" MATCHES "PyTrilinos/NOX")
 
217
    SET(TRILINOS_LIBS ${NOX_LIBRARIES})
 
218
  ELSEIF("${MODULE_OUTDIR}" MATCHES "PyTrilinos/LOCA")
 
219
    SET(TRILINOS_LIBS ${LOCA_LIBRARIES})
 
220
  ELSE("${MODULE_OUTDIR}")
 
221
    SET(TRILINOS_LIBS ${${MODULE_UPPER}_LIBRARIES})
 
222
  ENDIF("${MODULE_OUTDIR}" MATCHES "PyTrilinos/NOX/Epetra")
 
223
  SWIG_LINK_LIBRARIES(${PyTrilinos_TARGET_NAME} ${TRILINOS_LIBS})
 
224
  SET_TARGET_PROPERTIES(${PyTrilinos_TARGET_NAME} PROPERTIES
 
225
    LINK_FLAGS "${EXTRA_LINK_ARGS}"
 
226
    )
 
227
ENDFOREACH(MODULE ${PyTrilinos_MODULES})
 
228
 
 
229
#
 
230
# Add the PyTrilinos subdirectory, which is top-level package
 
231
# directory
 
232
ADD_SUBDIRECTORY(PyTrilinos)