-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
64 lines (54 loc) · 2.71 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
################################################################################
# SAMPLE
#
# created by Sebastian Reiter
#
# This script shows how easy it is to add a build script for your plugins.
# Simply specify the plugins name, the path (relative to ug's root path) and
# a list of your source files.
################################################################################
# SPDX-FileCopyrightText: Copyright (c) 2025: G-CSC, Goethe University Frankfurt
# SPDX-License-Identifier: LicenseRef-UG4-LGPL-3.0
# Name of your plugin, path to your plugin (relative to ug's root path) and sources.
set(pluginName Limex)
set(SOURCES limex_plugin.cpp
time_disc/time_extrapolation.cpp
time_disc/linear_implicit_timestep.cpp
)
################################################################################
# The code below doesn't have to be changed (usually)
################################################################################
cmake_minimum_required(VERSION 3.0)
project(UG_PLUGIN_${pluginName})
# include the definitions and dependencies for ug-plugins.
include(${UG_ROOT_CMAKE_PATH}/ug_plugin_includes.cmake)
################################################################################
# Classic binding (static or dynamic plugin).
################################################################################
if(NOT USE_PYBIND11)
if(buildEmbeddedPlugins)
# add the sources to ug4's sources
EXPORTSOURCES(${CMAKE_CURRENT_SOURCE_DIR} ${SOURCES})
else(buildEmbeddedPlugins)
# create a shared library from the sources and link it against ug4.
add_library(${pluginName} SHARED ${SOURCES})
target_link_libraries (${pluginName} ug4)
set_target_properties(${pluginName} PROPERTIES INSTALL_RPATH "$ORIGIN/../../lib/")
install(TARGETS ${pluginName} LIBRARY DESTINATION bin/plugins COMPONENT plugins)
endif(buildEmbeddedPlugins)
endif(NOT USE_PYBIND11)
################################################################################
# Python binding (static plugin, dynamic python interface).
################################################################################
if(USE_PYBIND11)
# Create a STATIC library for UG4 stuff from the sources
add_library(${pluginName} STATIC ${SOURCES})
SET(myPluginSources limex_pybind.cpp)
SET(myLibraries ug4 ${pluginName})
# First argument must match module name in PYBIND11_MODULE call
python_add_library(pylimex MODULE ${myPluginSources} ${SOURCES} WITH_SOABI)
#ug4pybind_add_module(pylimex ${myPluginSources} ${myLibraries})
target_link_libraries (pylimex PRIVATE ${pluginName} ug4_s)
set_target_properties(pylimex PROPERTIES INSTALL_RPATH "$ORIGIN/..:$ORIGIN/../../../lib")
install(TARGETS pylimex LIBRARY DESTINATION ug4py COMPONENT pymodules)
endif(USE_PYBIND11)