Skip to content

Commit

Permalink
Pybind11 v2.13.6 (#65)
Browse files Browse the repository at this point in the history
* Delete pybind11 V2.2.0

* Add pybind11 V2.13.6

* Fix CMakeList.txt

* Update minimum CMake version in setup.py
  • Loading branch information
DavidDiazGuerra authored Sep 24, 2024
1 parent f32633b commit c09c866
Show file tree
Hide file tree
Showing 293 changed files with 43,790 additions and 16,268 deletions.
12 changes: 7 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# https://stackoverflow.com/questions/51907755/building-a-pybind11-module-with-cpp-and-cuda-sources-using-cmake

cmake_minimum_required(VERSION 3.12)
cmake_minimum_required(VERSION 3.23)

project(gpuRIR LANGUAGES CXX CUDA)
find_package(CUDA)

# Select several CUDA architectures
include(FindCUDA)
cuda_select_nvcc_arch_flags(CUDA_ARCH_FLAGS Common) # Change Common by Auto for autodetect
string(REPLACE ";" " " CUDA_ARCH_FLAGS "${CUDA_ARCH_FLAGS}")
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} ${CUDA_ARCH_FLAGS}")
#include(FindCUDA)
#cuda_select_nvcc_arch_flags(CUDA_ARCH_FLAGS Common) # Change Common by Auto for autodetect
#string(REPLACE ";" " " CUDA_ARCH_FLAGS "${CUDA_ARCH_FLAGS}")
#set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} ${CUDA_ARCH_FLAGS}")

set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -D_FORCE_INLINES")
# set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo")
Expand All @@ -18,6 +18,8 @@ add_library(gpuRIRcu STATIC
src/gpuRIR_cuda.cu
)

set_property(TARGET gpuRIRcu PROPERTY CUDA_ARCHITECTURES all-major)

set_target_properties(gpuRIRcu PROPERTIES
POSITION_INDEPENDENT_CODE ON
CUDA_VISIBILITY_PRESET "hidden"
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def run(self):

if platform.system() == "Windows":
cmake_version = LooseVersion(re.search(r'version\s*([\d.]+)', out.decode()).group(1))
if cmake_version < '3.1.0':
raise RuntimeError("CMake >= 3.1.0 is required on Windows")
if cmake_version < '3.23.0':
raise RuntimeError("CMake >= 3.23.0 is required on Windows")

for ext in self.extensions:
self.build_extension(ext)
Expand Down
55 changes: 12 additions & 43 deletions third_party/pybind11/.appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,66 +1,35 @@
version: 1.0.{build}
image:
- Visual Studio 2017
- Visual Studio 2015
test: off
skip_branch_with_pr: true
build:
parallel: true
platform:
- x64
- x86
environment:
matrix:
- PYTHON: 36
CPP: 14
- PYTHON: 38
CONFIG: Debug
- PYTHON: 27
CPP: 14
CONFIG: Debug
- CONDA: 36
CPP: latest
CONFIG: Release
matrix:
exclude:
- image: Visual Studio 2015
platform: x86
- image: Visual Studio 2015
CPP: latest
- image: Visual Studio 2017
CPP: latest
platform: x86
install:
- ps: |
if ($env:PLATFORM -eq "x64") { $env:CMAKE_ARCH = "x64" }
if ($env:APPVEYOR_JOB_NAME -like "*Visual Studio 2017*") {
$env:CMAKE_GENERATOR = "Visual Studio 15 2017"
$env:CMAKE_INCLUDE_PATH = "C:\Libraries\boost_1_64_0"
} else {
$env:CMAKE_GENERATOR = "Visual Studio 14 2015"
}
if ($env:PYTHON) {
if ($env:PLATFORM -eq "x64") { $env:PYTHON = "$env:PYTHON-x64" }
$env:PATH = "C:\Python$env:PYTHON\;C:\Python$env:PYTHON\Scripts\;$env:PATH"
pip install --disable-pip-version-check --user --upgrade pip wheel
pip install pytest numpy
} elseif ($env:CONDA) {
if ($env:CONDA -eq "27") { $env:CONDA = "" }
if ($env:PLATFORM -eq "x64") { $env:CONDA = "$env:CONDA-x64" }
$env:PATH = "C:\Miniconda$env:CONDA\;C:\Miniconda$env:CONDA\Scripts\;$env:PATH"
$env:PYTHONHOME = "C:\Miniconda$env:CONDA"
conda install -y -q pytest numpy scipy
}
$env:CMAKE_GENERATOR = "Visual Studio 15 2017"
if ($env:PLATFORM -eq "x64") { $env:PYTHON = "$env:PYTHON-x64" }
$env:PATH = "C:\Python$env:PYTHON\;C:\Python$env:PYTHON\Scripts\;$env:PATH"
python -W ignore -m pip install --upgrade pip wheel
python -W ignore -m pip install pytest numpy --no-warn-script-location pytest-timeout
- ps: |
Start-FileDownload 'http://bitbucket.org/eigen/eigen/get/3.3.3.zip'
7z x 3.3.3.zip -y > $null
$env:CMAKE_INCLUDE_PATH = "eigen-eigen-67e894c6cd8f;$env:CMAKE_INCLUDE_PATH"
Start-FileDownload 'https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.zip'
7z x eigen-3.3.7.zip -y > $null
$env:CMAKE_INCLUDE_PATH = "eigen-3.3.7;$env:CMAKE_INCLUDE_PATH"
build_script:
- cmake -G "%CMAKE_GENERATOR%" -A "%CMAKE_ARCH%"
-DPYBIND11_CPP_STANDARD=/std:c++%CPP%
-DCMAKE_CXX_STANDARD=14
-DPYBIND11_WERROR=ON
-DDOWNLOAD_CATCH=ON
-DCMAKE_SUPPRESS_REGENERATION=1
.
- set MSBuildLogger="C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
- cmake --build . --config %CONFIG% --target pytest -- /m /v:m /logger:%MSBuildLogger%
- cmake --build . --config %CONFIG% --target cpptest -- /m /v:m /logger:%MSBuildLogger%
- if "%CPP%"=="latest" (cmake --build . --config %CONFIG% --target test_cmake_build -- /m /v:m /logger:%MSBuildLogger%)
on_failure: if exist "tests\test_cmake_build" type tests\test_cmake_build\*.log*
38 changes: 38 additions & 0 deletions third_party/pybind11/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
# See all possible options and defaults with:
# clang-format --style=llvm --dump-config
BasedOnStyle: LLVM
AccessModifierOffset: -4
AllowShortLambdasOnASingleLine: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: All
BreakConstructorInitializers: BeforeColon
ColumnLimit: 99
CommentPragmas: 'NOLINT:.*|^ IWYU pragma:'
IncludeBlocks: Regroup
IndentCaseLabels: true
IndentPPDirectives: AfterHash
IndentWidth: 4
Language: Cpp
SpaceAfterCStyleCast: true
Standard: Cpp11
StatementMacros: ['PyObject_HEAD']
TabWidth: 4
IncludeCategories:
- Regex: '<pybind11/.*'
Priority: -1
- Regex: 'pybind11.h"$'
Priority: 1
- Regex: '^".*/?detail/'
Priority: 1
SortPriority: 2
- Regex: '^"'
Priority: 1
SortPriority: 3
- Regex: '<[[:alnum:]._]+>'
Priority: 4
- Regex: '.*'
Priority: 5
...
79 changes: 79 additions & 0 deletions third_party/pybind11/.clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
FormatStyle: file

Checks: |
*bugprone*,
*performance*,
clang-analyzer-optin.cplusplus.VirtualCall,
clang-analyzer-optin.performance.Padding,
cppcoreguidelines-init-variables,
cppcoreguidelines-prefer-member-initializer,
cppcoreguidelines-pro-type-static-cast-downcast,
cppcoreguidelines-slicing,
google-explicit-constructor,
llvm-namespace-comment,
misc-definitions-in-headers,
misc-misplaced-const,
misc-non-copyable-objects,
misc-static-assert,
misc-throw-by-value-catch-by-reference,
misc-uniqueptr-reset-release,
misc-unused-parameters,
modernize-avoid-bind,
modernize-loop-convert,
modernize-make-shared,
modernize-redundant-void-arg,
modernize-replace-auto-ptr,
modernize-replace-disallow-copy-and-assign-macro,
modernize-replace-random-shuffle,
modernize-shrink-to-fit,
modernize-use-auto,
modernize-use-bool-literals,
modernize-use-default-member-init,
modernize-use-emplace,
modernize-use-equals-default,
modernize-use-equals-delete,
modernize-use-noexcept,
modernize-use-nullptr,
modernize-use-override,
modernize-use-using,
readability-avoid-const-params-in-decls,
readability-braces-around-statements,
readability-const-return-type,
readability-container-size-empty,
readability-delete-null-pointer,
readability-else-after-return,
readability-implicit-bool-conversion,
readability-inconsistent-declaration-parameter-name,
readability-make-member-function-const,
readability-misplaced-array-index,
readability-non-const-parameter,
readability-qualified-auto,
readability-redundant-function-ptr-dereference,
readability-redundant-smartptr-get,
readability-redundant-string-cstr,
readability-simplify-subscript-expr,
readability-static-accessed-through-instance,
readability-static-definition-in-anonymous-namespace,
readability-string-compare,
readability-suspicious-call-argument,
readability-uniqueptr-delete-release,
-bugprone-chained-comparison,
-bugprone-easily-swappable-parameters,
-bugprone-exception-escape,
-bugprone-reserved-identifier,
-bugprone-unused-raii,
-performance-enum-size,
CheckOptions:
- key: modernize-use-equals-default.IgnoreMacros
value: false
- key: performance-for-range-copy.WarnOnAllAutoCopies
value: true
- key: performance-inefficient-string-concatenation.StrictMode
value: true
- key: performance-unnecessary-value-param.AllowedTypes
value: 'exception_ptr$;'
- key: readability-implicit-bool-conversion.AllowPointerConditions
value: true

HeaderFilterRegex: 'pybind11/.*h'
73 changes: 73 additions & 0 deletions third_party/pybind11/.cmake-format.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
parse:
additional_commands:
pybind11_add_module:
flags:
- THIN_LTO
- MODULE
- SHARED
- NO_EXTRAS
- EXCLUDE_FROM_ALL
- SYSTEM

format:
line_width: 99
tab_size: 2

# If an argument group contains more than this many sub-groups
# (parg or kwarg groups) then force it to a vertical layout.
max_subgroups_hwrap: 2

# If a positional argument group contains more than this many
# arguments, then force it to a vertical layout.
max_pargs_hwrap: 6

# If a cmdline positional group consumes more than this many
# lines without nesting, then invalidate the layout (and nest)
max_rows_cmdline: 2
separate_ctrl_name_with_space: false
separate_fn_name_with_space: false
dangle_parens: false

# If the trailing parenthesis must be 'dangled' on its on
# 'line, then align it to this reference: `prefix`: the start'
# 'of the statement, `prefix-indent`: the start of the'
# 'statement, plus one indentation level, `child`: align to'
# the column of the arguments
dangle_align: prefix
# If the statement spelling length (including space and
# parenthesis) is smaller than this amount, then force reject
# nested layouts.
min_prefix_chars: 4

# If the statement spelling length (including space and
# parenthesis) is larger than the tab width by more than this
# amount, then force reject un-nested layouts.
max_prefix_chars: 10

# If a candidate layout is wrapped horizontally but it exceeds
# this many lines, then reject the layout.
max_lines_hwrap: 2

line_ending: unix

# Format command names consistently as 'lower' or 'upper' case
command_case: canonical

# Format keywords consistently as 'lower' or 'upper' case
# unchanged is valid too
keyword_case: 'upper'

# A list of command names which should always be wrapped
always_wrap: []

# If true, the argument lists which are known to be sortable
# will be sorted lexicographically
enable_sort: true

# If true, the parsers may infer whether or not an argument
# list is sortable (without annotation).
autosort: false

# Causes a few issues - can be solved later, possibly.
markup:
enable_markup: false
24 changes: 24 additions & 0 deletions third_party/pybind11/.codespell-ignore-lines
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
template <op_id id, op_type ot, typename L = undefined_t, typename R = undefined_t>
template <typename ThisT>
auto &this_ = static_cast<ThisT &>(*this);
if (load_impl<ThisT>(temp, false)) {
ssize_t nd = 0;
auto trivial = broadcast(buffers, nd, shape);
auto ndim = (size_t) nd;
int nd;
ssize_t ndim() const { return detail::array_proxy(m_ptr)->nd; }
using op = op_impl<id, ot, Base, L_type, R_type>;
template <op_id id, op_type ot, typename L, typename R>
template <detail::op_id id, detail::op_type ot, typename L, typename R, typename... Extra>
class_ &def(const detail::op_<id, ot, L, R> &op, const Extra &...extra) {
class_ &def_cast(const detail::op_<id, ot, L, R> &op, const Extra &...extra) {
@pytest.mark.parametrize("access", ["ro", "rw", "static_ro", "static_rw"])
struct IntStruct {
explicit IntStruct(int v) : value(v){};
~IntStruct() { value = -value; }
IntStruct(const IntStruct &) = default;
IntStruct &operator=(const IntStruct &) = default;
py::class_<IntStruct>(m, "IntStruct").def(py::init([](const int i) { return IntStruct(i); }));
py::implicitly_convertible<int, IntStruct>();
m.def("test", [](int expected, const IntStruct &in) {
[](int expected, const IntStruct &in) {
1 change: 1 addition & 0 deletions third_party/pybind11/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docs/*.svg binary
9 changes: 9 additions & 0 deletions third_party/pybind11/.github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*.cmake @henryiii
CMakeLists.txt @henryiii
*.yml @henryiii
*.yaml @henryiii
/tools/ @henryiii
/pybind11/ @henryiii
noxfile.py @henryiii
.clang-format @henryiii
.clang-tidy @henryiii
Loading

0 comments on commit c09c866

Please sign in to comment.