Skip to content

Commit c9aca87

Browse files
committed
Linux build fixed
1 parent 6539d87 commit c9aca87

File tree

6 files changed

+14
-13
lines changed

6 files changed

+14
-13
lines changed

benchmark/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,10 @@ set(XTENSOR_PYTHON_BENCHMARK
6161
)
6262

6363
set(XTENSOR_PYTHON_BENCHMARK_TARGET benchmark_xtensor_python)
64-
add_library(${XTENSOR_PYTHON_BENCHMARK_TARGET} EXCLUDE_FROM_ALL
64+
add_library(${XTENSOR_PYTHON_BENCHMARK_TARGET} MODULE EXCLUDE_FROM_ALL
6565
${XTENSOR_PYTHON_BENCHMARK} ${XTENSOR_PYTHON_HEADERS})
6666

67+
set_target_properties(${XTENSOR_PYTHON_BENCHMARK_TARGET} PROPERTIES PREFIX "")
6768
set_target_properties(${XTENSOR_PYTHON_BENCHMARK_TARGET} PROPERTIES SUFFIX "${PYTHON_MODULE_EXTENSION}")
6869

6970
if(APPLE)

benchmark/benchmark_pyarray.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from xtensor_python_benchmark import sum_array
1+
from benchmark_xtensor_python import sum_array
22
import numpy as np
33

44
u = np.ones(1000000, dtype=float)

benchmark/benchmark_pybind_array.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from xtensor_python_benchmark import pybind_sum_array
1+
from benchmark_xtensor_python import pybind_sum_array
22
import numpy as np
33

44
u = np.ones(1000000, dtype=float)

benchmark/benchmark_pytensor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from xtensor_python_benchmark import sum_tensor
1+
from benchmark_xtensor_python import sum_tensor
22
import numpy as np
33

44
u = np.ones(1000000, dtype=float)

benchmark/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111

1212
namespace py = pybind11;
1313

14-
PYBIND11_PLUGIN(xtensor_python_benchmark)
14+
PYBIND11_PLUGIN(benchmark_xtensor_python)
1515
{
1616
if(_import_array() < 0)
1717
{
1818
PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import");
1919
return nullptr;
2020
}
2121

22-
py::module m("xtensor_python_benchmark", "Benchmark module for xtensor python bindings");
22+
py::module m("benchmark_xtensor_python", "Benchmark module for xtensor python bindings");
2323

2424
m.def("sum_array", [](xt::pyarray<double> const& x) {
2525
double sum = 0;

include/xtensor-python/pytensor.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ namespace xt
8989

9090
pytensor() = default;
9191

92-
pytensor(pybind11::handle h, borrowed_t);
93-
pytensor(pybind11::handle h, stolen_t);
92+
pytensor(pybind11::handle h, pybind11::object::borrowed_t);
93+
pytensor(pybind11::handle h, pybind11::object::stolen_t);
9494
pytensor(const pybind11::object &o);
9595

9696
pytensor(const shape_type& shape, const strides_type& strides);
@@ -137,22 +137,22 @@ namespace xt
137137
***************************/
138138

139139
template <class T, std::size_t N>
140-
inline pytensor<T, N>::pytensor(pybind11::handle h, borrowed_t)
141-
: base_type(h, borrowed)
140+
inline pytensor<T, N>::pytensor(pybind11::handle h, pybind11::object::borrowed_t)
141+
: base_type(h, pybind11::object::borrowed)
142142
{
143143
init_from_python();
144144
}
145145

146146
template <class T, std::size_t N>
147-
inline pytensor<T, N>::pytensor(pybind11::handle h, stolen_t)
148-
: base_type(h, stolen)
147+
inline pytensor<T, N>::pytensor(pybind11::handle h, pybind11::object::stolen_t)
148+
: base_type(h, pybind11::object::stolen)
149149
{
150150
init_from_python();
151151
}
152152

153153
template <class T, std::size_t N>
154154
inline pytensor<T, N>::pytensor(const pybind11::object& o)
155-
: base_type(base_type::raw_array_t(o.ptr()), stolen)
155+
: base_type(base_type::raw_array_t(o.ptr()), pybind11::object::stolen)
156156
{
157157
if(!this->m_ptr)
158158
throw pybind11::error_already_set();

0 commit comments

Comments
 (0)