-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
33 lines (27 loc) · 1.07 KB
/
CMakeLists.txt
File metadata and controls
33 lines (27 loc) · 1.07 KB
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
# Python-binding CMakeLists.
#
# Author: Kevin Vu te Laar <vu.te@rwth-aachen.de>
# SPDX-FileCopyrightText: 2014-2025 Institute for Automation of Complex Power Systems, RWTH Aachen University
# SPDX-License-Identifier: Apache-2.0
set(PYBIND11_FINDPYTHON ON)
find_package(pybind11 CONFIG)
if(pybind11_FOUND)
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
execute_process(
COMMAND "${Python3_EXECUTABLE}" -c "import sysconfig; print(sysconfig.get_path('purelib'))"
OUTPUT_VARIABLE PYTHON_SITE_PACKAGES
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message(STATUS "Found Python version: ${Python_VERSION}")
message(STATUS "Python major version: ${Python_VERSION_MAJOR}")
message(STATUS "Python minor version: ${Python_VERSION_MINOR}")
pybind11_add_module(python_binding capi_python_binding.cpp)
target_link_libraries(python_binding PUBLIC villas)
install(
TARGETS python_binding
COMPONENT lib
LIBRARY DESTINATION ${PYTHON_SITE_PACKAGES}/villas/node/
)
else()
message(STATUS "pybind11 not found. Skipping Python wrapper build.")
endif()