I'm working on a project that installs the dependencies using brew.
We need pybind11 to build our python module.
When I ll
the available files I get:
@DOCKER:include ^_^$ ll pybind11/
total 548K
-rw-rw-r-- 1 builder docker 24K Nov 8 10:32 attr.h
-rw-rw-r-- 1 builder docker 7.0K Nov 8 10:32 buffer_info.h
-rw-rw-r-- 1 builder docker 64K Nov 8 10:32 cast.h
-rw-rw-r-- 1 builder docker 8.7K Nov 8 10:32 chrono.h
-rw-rw-r-- 1 builder docker 120 Nov 8 10:32 common.h
-rw-rw-r-- 1 builder docker 2.1K Nov 8 10:32 complex.h
drwxrwxr-x 2 builder docker 4.0K Nov 8 10:32 detail
-rw-rw-r-- 1 builder docker 31K Nov 8 10:32 eigen.h
-rw-rw-r-- 1 builder docker 12K Nov 8 10:32 embed.h
-rw-rw-r-- 1 builder docker 5.5K Nov 8 10:32 eval.h
-rw-rw-r-- 1 builder docker 4.7K Nov 8 10:32 functional.h
-rw-rw-r-- 1 builder docker 6.7K Nov 8 10:32 gil.h
-rw-rw-r-- 1 builder docker 8.7K Nov 8 10:32 iostream.h
-rw-rw-r-- 1 builder docker 77K Nov 8 10:32 numpy.h
-rw-rw-r-- 1 builder docker 9.6K Nov 8 10:32 operators.h
-rw-rw-r-- 1 builder docker 2.2K Nov 8 10:32 options.h
-rw-rw-r-- 1 builder docker 123K Nov 8 10:32 pybind11.h
-rw-rw-r-- 1 builder docker 80K Nov 8 10:32 pytypes.h
drwxrwxr-x 2 builder docker 4.0K Nov 8 10:32 stl
-rw-rw-r-- 1 builder docker 27K Nov 8 10:32 stl_bind.h
-rw-rw-r-- 1 builder docker 15K Nov 8 10:32 stl.h
Is this enough?
When I try to add pybind11 to my CMakeLists.txt:
include_directories("/cache/venv/include/pybind11")
#I tried this too: add_subdirectory("/cache/venv/include/pybind11" ".")
pybind11_add_module(pystuff binding.cpp)
I always get the same error:
CMake Error at src/applications/pycore/CMakeLists.txt:60 (pybind11_add_module):
Unknown CMake command "pybind11_add_module".
What am I missing?
I tried installing pybind11 using pip
but cmake still can't find the command.
(I'm using a docker image based on ubuntu 22)
I have a very simple code to test this:
#include <pybind11/pybind11.h>
namespace py = pybind11;
int return42(){ return 42;}
PYBIND11_MODULE(pystuff, m) {
m.def("return42", &return42, "A function that returns 42");
}
If I don't add the pybind11_add_module(pystuff binding.cpp)
line on cmake, the project compiles, however I guess pybind11 needs to add the module to actually work