aboutsummaryrefslogtreecommitdiffstats
path: root/3rdparty/pybind11/tools/setup_global.py.in
diff options
context:
space:
mode:
authorMiodrag Milanovic <mmicko@gmail.com>2021-01-02 10:15:39 +0100
committerMiodrag Milanovic <mmicko@gmail.com>2021-01-02 10:15:39 +0100
commite76cdab6dd77bad411e6ac9372ee527aff89ef17 (patch)
treee9868f05cf455336d75f33b1312d71034f8fb334 /3rdparty/pybind11/tools/setup_global.py.in
parentc6cdf30501dcb2da01361229dd66a05dad73a132 (diff)
downloadnextpnr-e76cdab6dd77bad411e6ac9372ee527aff89ef17.tar.gz
nextpnr-e76cdab6dd77bad411e6ac9372ee527aff89ef17.tar.bz2
nextpnr-e76cdab6dd77bad411e6ac9372ee527aff89ef17.zip
Update pybind11 to version 2.6.1
Diffstat (limited to '3rdparty/pybind11/tools/setup_global.py.in')
-rw-r--r--3rdparty/pybind11/tools/setup_global.py.in63
1 files changed, 63 insertions, 0 deletions
diff --git a/3rdparty/pybind11/tools/setup_global.py.in b/3rdparty/pybind11/tools/setup_global.py.in
new file mode 100644
index 00000000..4cf040b2
--- /dev/null
+++ b/3rdparty/pybind11/tools/setup_global.py.in
@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# Setup script for pybind11-global (in the sdist or in tools/setup_global.py in the repository)
+# This package is targeted for easy use from CMake.
+
+import contextlib
+import glob
+import os
+import re
+import shutil
+import subprocess
+import sys
+import tempfile
+
+# Setuptools has to be before distutils
+from setuptools import setup
+
+from distutils.command.install_headers import install_headers
+
+class InstallHeadersNested(install_headers):
+ def run(self):
+ headers = self.distribution.headers or []
+ for header in headers:
+ # Remove pybind11/include/
+ short_header = header.split("/", 2)[-1]
+
+ dst = os.path.join(self.install_dir, os.path.dirname(short_header))
+ self.mkpath(dst)
+ (out, _) = self.copy_file(header, dst)
+ self.outfiles.append(out)
+
+
+main_headers = glob.glob("pybind11/include/pybind11/*.h")
+detail_headers = glob.glob("pybind11/include/pybind11/detail/*.h")
+cmake_files = glob.glob("pybind11/share/cmake/pybind11/*.cmake")
+headers = main_headers + detail_headers
+
+cmdclass = {"install_headers": InstallHeadersNested}
+$extra_cmd
+
+# This will _not_ affect installing from wheels,
+# only building wheels or installing from SDist.
+# Primarily intended on Windows, where this is sometimes
+# customized (for example, conda-forge uses Library/)
+base = os.environ.get("PYBIND11_GLOBAL_PREFIX", "")
+
+# Must have a separator
+if base and not base.endswith("/"):
+ base += "/"
+
+setup(
+ name="pybind11_global",
+ version="$version",
+ packages=[],
+ headers=headers,
+ data_files=[
+ (base + "share/cmake/pybind11", cmake_files),
+ (base + "include/pybind11", main_headers),
+ (base + "include/pybind11/detail", detail_headers),
+ ],
+ cmdclass=cmdclass,
+)