Skip to content

Commit 0574204

Browse files
committed
build: pyudmaio through CMake for better editor/IDE support
To comfortably edit the C++ part of the binding w/o the lsp raising a red wall of errors, we need to include it in the compile_commands.json
1 parent 4e083db commit 0574204

3 files changed

Lines changed: 17 additions & 0 deletions

File tree

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "doxygen-awesome-css"]
22
path = doxygen-awesome-css
33
url = https://github.com/jothepro/doxygen-awesome-css.git
4+
[submodule "pyudmaio/pybind11"]
5+
path = pyudmaio/pybind11
6+
url = git@github.com:pybind/pybind11.git

CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,19 @@ if(BUILD_TESTING)
104104
endforeach()
105105
endif()
106106

107+
# The python binding is usually installed via setuptools;
108+
# we include the C++ part of it here only to populate the compile-command.json for editors/IDEs
109+
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/pyudmaio/pybind11/CMakeLists.txt")
110+
message("pybind11 submodule found, adding pyudmaio target")
111+
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/pyudmaio/pybind11")
112+
pybind11_add_module(pyudmaio EXCLUDE_FROM_ALL
113+
"${CMAKE_CURRENT_LIST_DIR}/pyudmaio/src/PythonBinding.cpp"
114+
"${CMAKE_CURRENT_LIST_DIR}/pyudmaio/src/DataHandlerPython.cpp"
115+
)
116+
else()
117+
message("skipping python binding, clone pybind11 submodule to include it")
118+
endif()
119+
107120
# Create debian package containing library
108121
set(CPACK_GENERATOR "DEB")
109122
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Patrick Huesmann <patrick.huesmann@desy.de>")

pyudmaio/pybind11

Submodule pybind11 added at e7c9b90

0 commit comments

Comments
 (0)