Skip to content

Commit

Permalink
Merging 'master' into 'wrap'
Browse files Browse the repository at this point in the history
  • Loading branch information
varunagrawal committed Jun 28, 2024
2 parents 2af2c96 + 5a97336 commit 3d40ceb
Show file tree
Hide file tree
Showing 175 changed files with 4,562 additions and 1,310 deletions.
4 changes: 2 additions & 2 deletions wrap/DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The python wrapper supports keyword arguments for functions/methods. Hence, the
- Only one Method/Constructor per line, though methods/constructors can extend across multiple lines.

- Methods can return
- Eigen types: `Matrix`, `Vector`.
- Eigen types: `gtsam::Matrix`, `gtsam::Vector`.
- C/C++ basic types: `string`, `bool`, `size_t`, `int`, `double`, `char`, `unsigned char`.
- `void`
- Any class with which be copied with `std::make_shared()`.
Expand All @@ -34,7 +34,7 @@ The python wrapper supports keyword arguments for functions/methods. Hence, the
- Overloads are supported, but arguments of different types *have* to have different names.

- Arguments to functions can be any of
- Eigen types: `Matrix`, `Vector`.
- Eigen types: `gtsam::Matrix`, `gtsam::Vector`.
- Eigen types and classes as an optionally const reference.
- C/C++ basic types: `string`, `bool`, `size_t`, `size_t`, `double`, `char`, `unsigned char`.
- Any class with which be copied with `std::make_shared()` (except Eigen).
Expand Down
18 changes: 4 additions & 14 deletions wrap/gtwrap/interface_parser/type.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ def __init__(self,
else:
self.instantiations = []

if self.name in ["Matrix", "Vector"] and not self.namespaces:
self.namespaces = ["gtsam"]

@staticmethod
def from_parse_result(parse_result: Union[str, list]):
"""Unpack the parsed result to get the Typename instance."""
Expand Down Expand Up @@ -220,25 +217,21 @@ def to_cpp(self) -> str:
Generate the C++ code for wrapping.
Treat all pointers as "const shared_ptr<T>&"
Treat Matrix and Vector as "const Matrix&" and "const Vector&" resp.
"""

if self.is_shared_ptr:
typename = "std::shared_ptr<{typename}>".format(
typename=self.typename.to_cpp())
elif self.is_ptr:
typename = "{typename}*".format(typename=self.typename.to_cpp())
elif self.is_ref or self.typename.name in ["Matrix", "Vector"]:
elif self.is_ref:
typename = typename = "{typename}&".format(
typename=self.typename.to_cpp())
else:
typename = self.typename.to_cpp()

return ("{const}{typename}".format(
const="const " if
(self.is_const
or self.typename.name in ["Matrix", "Vector"]) else "",
typename=typename))
const="const " if self.is_const else "", typename=typename))

def get_typename(self):
"""Convenience method to get the typename of this type."""
Expand Down Expand Up @@ -305,13 +298,10 @@ def to_cpp(self):
typename = f"std::shared_ptr<{typename}>"
elif self.is_ptr:
typename = "{typename}*".format(typename=typename)
elif self.is_ref or self.typename.name in ["Matrix", "Vector"]:
elif self.is_ref:
typename = typename = "{typename}&".format(typename=typename)
else:
pass

return ("{const}{typename}".format(
const="const " if
(self.is_const
or self.typename.name in ["Matrix", "Vector"]) else "",
typename=typename))
const="const " if self.is_const else "", typename=typename))
2 changes: 1 addition & 1 deletion wrap/pybind11/.appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ platform:
- x86
environment:
matrix:
- PYTHON: 36
- PYTHON: 38
CONFIG: Debug
install:
- ps: |
Expand Down
2 changes: 1 addition & 1 deletion wrap/pybind11/.github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ The valid options are:
* Use `-G` and the name of a generator to use something different. `cmake
--help` lists the generators available.
- On Unix, setting `CMAKE_GENERATER=Ninja` in your environment will give
you automatic mulithreading on all your CMake projects!
you automatic multithreading on all your CMake projects!
* Open the `CMakeLists.txt` with QtCreator to generate for that IDE.
* You can use `-DCMAKE_EXPORT_COMPILE_COMMANDS=ON` to generate the `.json` file
that some tools expect.
Expand Down
10 changes: 9 additions & 1 deletion wrap/pybind11/.github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,12 @@ updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
interval: "weekly"
groups:
actions:
patterns:
- "*"
ignore:
- dependency-name: actions/checkout
versions:
- "<5"
15 changes: 10 additions & 5 deletions wrap/pybind11/.github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
docs:
- any:
- 'docs/**/*.rst'
- '!docs/changelog.rst'
- '!docs/upgrade.rst'
all:
- changed-files:
- all-globs-to-all-files:
- '!docs/changelog.rst'
- '!docs/upgrade.rst'
- base-branch: "^(?!dependabot).*"
- base-branch: "^(?!pre-commit-ci).*"

ci:
- '.github/workflows/*.yml'
- changed-files:
- any-glob-to-any-file:
- '.github/workflows/*.yml'
9 changes: 7 additions & 2 deletions wrap/pybind11/.github/labeler_merged.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Add 'needs changelog` label to any change to code files as long as the `CHANGELOG` hasn't changed
# Skip dependabot and pre-commit-ci PRs
needs changelog:
- all:
- '!docs/changelog.rst'
- all:
- changed-files:
- all-globs-to-all-files: "!docs/changelog.rst"
- base-branch: "^(?!dependabot).*"
- base-branch: "^(?!pre-commit-ci).*"
Loading

0 comments on commit 3d40ceb

Please sign in to comment.