Skip to content

Commit 06f204f

Browse files
committed
Ensure demo is built with the correct C++ standard
1 parent 020eb41 commit 06f204f

File tree

4 files changed

+15
-12
lines changed

4 files changed

+15
-12
lines changed

tests/demo-lib/include/demo/Foo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace demo{
55

66

77
class CppException : public std::runtime_error {
8-
//using std::runtime_error;
8+
using std::runtime_error::runtime_error;
99
};
1010

1111
struct Foo {

tests/install-demo-module.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ install_pybind11() {
5959
}
6060

6161
install_demo() {
62-
cmake -S "${TESTS_ROOT}/demo-lib" -B "${BUILD_ROOT}/demo"
62+
cmake \
63+
-S "${TESTS_ROOT}/demo-lib" \
64+
-B "${BUILD_ROOT}/demo" \
65+
-DCMAKE_CXX_STANDARD=17
6366
cmake --build "${BUILD_ROOT}/demo"
6467
cmake --install "${BUILD_ROOT}/demo" \
6568
--prefix "${INSTALL_PREFIX}"
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "modules.h"
22

3-
namespace mymodules {
3+
namespace {
44
struct Dummy {
55
int regular_method(int x) { return x + 1; }
66
static int static_method(int x) { return x + 1; }
@@ -9,8 +9,8 @@ struct Dummy {
99
} // namespace
1010

1111
void bind_methods_module(py::module&& m) {
12-
auto &&pyDummy = py::class_<mymodules::Dummy>(m, "Dummy");
12+
auto &&pyDummy = py::class_<Dummy>(m, "Dummy");
1313

14-
pyDummy.def_static("static_method", &mymodules::Dummy::static_method);
15-
pyDummy.def("regular_method", &mymodules::Dummy::regular_method);
14+
pyDummy.def_static("static_method", &Dummy::static_method);
15+
pyDummy.def("regular_method", &Dummy::regular_method);
1616
}

tests/py-demo/bindings/src/modules/values.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
#include <chrono>
66

7-
namespace myvalues {
7+
namespace {
88
class Dummy {};
99
class Foo {};
1010
} // namespace
1111

1212
void bind_values_module(py::module &&m) {
1313
{
1414
// python module as value
15-
auto &&pyDummy = py::class_<myvalues::Dummy>(m, "Dummy");
15+
auto &&pyDummy = py::class_<Dummy>(m, "Dummy");
1616

1717
pyDummy.def_property_readonly_static(
1818
"linalg", [](py::object &) { return py::module::import("numpy.linalg"); });
@@ -27,12 +27,12 @@ void bind_values_module(py::module &&m) {
2727
m.attr("list_with_none") = li;
2828
}
2929
{
30-
auto pyFoo = py::class_<myvalues::Foo>(m, "Foo");
31-
m.attr("foovar") = myvalues::Foo();
30+
auto pyFoo = py::class_<Foo>(m, "Foo");
31+
m.attr("foovar") = Foo();
3232

3333
py::list foolist;
34-
foolist.append(myvalues::Foo());
35-
foolist.append(myvalues::Foo());
34+
foolist.append(Foo());
35+
foolist.append(Foo());
3636

3737
m.attr("foolist") = foolist;
3838
m.attr("none") = py::none();

0 commit comments

Comments
 (0)