Skip to content

Commit

Permalink
build: pyudmaio through CMake for better editor/IDE support
Browse files Browse the repository at this point in the history
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
  • Loading branch information
patrislav1 committed Nov 29, 2024
1 parent 4e083db commit 0574204
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "doxygen-awesome-css"]
path = doxygen-awesome-css
url = https://github.com/jothepro/doxygen-awesome-css.git
[submodule "pyudmaio/pybind11"]
path = pyudmaio/pybind11
url = git@github.com:pybind/pybind11.git
13 changes: 13 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,19 @@ if(BUILD_TESTING)
endforeach()
endif()

# The python binding is usually installed via setuptools;
# we include the C++ part of it here only to populate the compile-command.json for editors/IDEs
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/pyudmaio/pybind11/CMakeLists.txt")
message("pybind11 submodule found, adding pyudmaio target")
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/pyudmaio/pybind11")
pybind11_add_module(pyudmaio EXCLUDE_FROM_ALL
"${CMAKE_CURRENT_LIST_DIR}/pyudmaio/src/PythonBinding.cpp"
"${CMAKE_CURRENT_LIST_DIR}/pyudmaio/src/DataHandlerPython.cpp"
)
else()
message("skipping python binding, clone pybind11 submodule to include it")
endif()

# Create debian package containing library
set(CPACK_GENERATOR "DEB")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Patrick Huesmann <patrick.huesmann@desy.de>")
Expand Down
1 change: 1 addition & 0 deletions pyudmaio/pybind11
Submodule pybind11 added at e7c9b9

0 comments on commit 0574204

Please sign in to comment.