-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
100 lines (84 loc) · 3.35 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# Copyright (C) 2010-2025 CEA, EDF
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
cmake_minimum_required(VERSION 3.8)
project(MEDReader)
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
option(MEDREADER_USE_MPI "Activate parallel reading for MEDREADER" OFF)
find_package(ParaView REQUIRED)
if(MEDREADER_USE_MPI)
add_definitions(-DMEDREADER_USE_MPI)
endif(MEDREADER_USE_MPI)
enable_testing()
include(GNUInstallDirs)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
set("_paraview_plugin_default_${CMAKE_PROJECT_NAME}" ON)
paraview_plugin_scan(
ENABLE_BY_DEFAULT YES
PLUGIN_FILES "${CMAKE_CURRENT_SOURCE_DIR}/plugin/paraview.plugin"
PROVIDES_PLUGINS plugins
REQUIRES_MODULES required_modules)
foreach (module IN LISTS required_modules)
if (NOT TARGET "${module}")
message("Missing required module: ${module}")
return ()
endif ()
endforeach ()
paraview_plugin_build(
RUNTIME_DESTINATION "${CMAKE_INSTALL_BINDIR}"
LIBRARY_DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY_SUBDIRECTORY "${PARAVIEW_PLUGIN_SUBDIR}"
PLUGINS ${plugins})
if(TARGET VTK::Python)
vtk_module_python_default_destination(python_destination)
vtk_module_wrap_python(
MODULES MEDReaderIO
WRAPPED_MODULES medr_wrapped_modules
TARGET MEDREADER::Python
INSTALL_EXPORT MEDReaderVTKPython
PYTHON_PACKAGE "MEDReaderVTK"
MODULE_DESTINATION "${python_destination}"
CMAKE_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/MEDReaderVTKPython"
LIBRARY_DESTINATION "${CMAKE_INSTALL_LIBDIR}"
INSTALL_HEADERS ON
BUILD_STATIC OFF)
# Generate __init__.py
set(python_modules)
foreach(module ${medr_wrapped_modules})
list(APPEND python_modules "'${module}'")
endforeach()
set(InitContent "__all__ = ['vtkMEDReader']")
file(GENERATE
OUTPUT "${CMAKE_BINARY_DIR}/${python_destination}/MEDReaderVTK/__init__.py"
CONTENT "${InitContent}")
install(
FILES "${CMAKE_BINARY_DIR}/${python_destination}/MEDReaderVTK/__init__.py"
DESTINATION "${python_destination}/MEDReaderVTK/")
# Install MEDReaderVTKPython
export(
EXPORT MEDReaderVTKPython
NAMESPACE MEDREADER::
FILE "${CMAKE_BINARY_DIR}/${python_destination}/MEDReaderVTKPython/MEDReaderVTKPython-targets.cmake")
install(
EXPORT MEDReaderVTKPython
NAMESPACE MEDREADER::
FILE MEDReaderVTKPython-targets.cmake
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/MEDReaderVTKPython")
endif()