Fixed linker errors with numpy in windows.

This commit is contained in:
Axel1092 2021-06-03 21:43:49 +02:00 committed by bernat
parent 74380cdc23
commit 14a3e3dd89
3 changed files with 1 additions and 9 deletions

View File

@ -131,7 +131,7 @@ def get_libcarla_extensions():
# https://docs.microsoft.com/es-es/cpp/porting/modifying-winver-and-win32-winnt
extra_compile_args = [
'/experimental:external', '/external:I', 'dependencies/include/system',
'/DBOOST_ALL_NO_LIB', '/DBOOST_PYTHON_STATIC_LIB',
'/DBOOST_ALL_NO_LIB', '/DBOOST_PYTHON_STATIC_LIB', '/DBOOST_NUMPY_STATIC_LIB',
'/DBOOST_ERROR_CODE_HEADER_ONLY', '/D_WIN32_WINNT=0x0600', '/DHAVE_SNPRINTF',
'/DLIBCARLA_WITH_PYTHON_SUPPORT', '-DLIBCARLA_IMAGE_WITH_PNG_SUPPORT=true', '/MD']
else:

View File

@ -210,7 +210,6 @@ static void ConvertImage(T &self, EColorConverter cc) {
throw std::invalid_argument("invalid color converter!");
}
}
#ifndef _WIN32
// method to convert optical flow images to rgb
static boost::python::numpy::ndarray ColorCodedFlow (
carla::sensor::data::OpticalFlowImage& image) {
@ -317,7 +316,6 @@ static boost::python::numpy::ndarray ColorCodedFlow (
bn::dtype type = bn::dtype::get_builtin<uint8_t>();
return bn::from_data(&result[0], type, shape, stride, bp::object()).copy();
}
#endif
template <typename T>
static std::string SaveImageToDisk(T &self, std::string path, EColorConverter cc) {
@ -397,9 +395,7 @@ void export_sensor_data() {
.add_property("height", &csd::OpticalFlowImage::GetHeight)
.add_property("fov", &csd::OpticalFlowImage::GetFOVAngle)
.add_property("raw_data", &GetRawDataAsBuffer<csd::OpticalFlowImage>)
#ifndef _WIN32
.def("get_color_coded_flow", &ColorCodedFlow)
#endif
.def("__len__", &csd::OpticalFlowImage::size)
.def("__iter__", iterator<csd::OpticalFlowImage>())
.def("__getitem__", +[](const csd::OpticalFlowImage &self, size_t pos) -> csd::OpticalFlowPixel {

View File

@ -209,9 +209,7 @@ static auto MakeCallback(boost::python::object callback) {
}
};
}
#ifndef _WIN32
#include <boost/python/numpy.hpp>
#endif
#include "Geom.cpp"
#include "Actor.cpp"
@ -239,9 +237,7 @@ BOOST_PYTHON_MODULE(libcarla) {
#if PY_MAJOR_VERSION < 3 || PY_MINOR_VERSION < 7
PyEval_InitThreads();
#endif
#ifndef _WIN32
boost::python::numpy::initialize();
#endif
scope().attr("__path__") = "libcarla";
export_geom();
export_control();