mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-26 07:34:11 +00:00
7f8f688ef3
pybind11's CMake module uses the Python sysconfig module to find the Python site-packages and include directories. sysconfig returns the wrong values (from build Python) when cross-compiling, so this patch adds a setup hook to pass flags to CMake to override the sysconfig results. Note that the setup hook references build Python, and therefore adds build Python to pybind11's runtime closure. This is not a problem because pybind11 is a header only library and should never end up as part of another package's runtime closure.
13 lines
386 B
Bash
13 lines
386 B
Bash
# Tell the pybind11 CMake module where to find host platform Python. This is
|
|
# required when cross-compiling.
|
|
pybind11CMakeFlags () {
|
|
cmakeFlagsArray+=(
|
|
'-DPYBIND11_PYTHONLIBS_OVERWRITE=OFF'
|
|
'-DPYTHON_EXECUTABLE=@pythonInterpreter@'
|
|
'-DPYTHON_INCLUDE_DIR=@pythonIncludeDir@'
|
|
'-DPYTHON_SITE_PACKAGES=@pythonSitePackages@'
|
|
)
|
|
}
|
|
|
|
preConfigureHooks+=(pybind11CMakeFlags)
|