Commit f566b05a authored by Davis King's avatar Davis King

Fixed linker errors when building pyhton on windows. This fixes a bug that was…

Fixed linker errors when building pyhton on windows.  This fixes a bug that was introduced in a recent PR.

Also fixed compiler errors that occurred in visual studio.
parent 05c8391c
......@@ -126,6 +126,9 @@ else()
endif()
message(STATUS "USING BOOST_LIBS: ${Boost_LIBRARIES}")
if (WIN32)
message(STATUS "USING PYTHON_LIBS: ${PYTHON_LIBRARIES}")
endif()
if (CMAKE_COMPILER_IS_GNUCXX)
# Just setting CMAKE_POSITION_INDEPENDENT_CODE should be enough to set
......@@ -150,6 +153,7 @@ macro(add_python_module module_name module_sources )
TARGET_LINK_LIBRARIES(${module_name}_ ${Boost_LIBRARIES} dlib::dlib)
if(WIN32 AND NOT CYGWIN)
TARGET_LINK_LIBRARIES(${module_name}_ ${PYTHON_LIBRARIES})
SET_TARGET_PROPERTIES( ${module_name}_
PROPERTIES
PREFIX ""
......
......@@ -18,7 +18,7 @@ void validate_numpy_array_type (
)
{
using namespace boost::python;
const char ch = extract<char>(obj.attr("dtype").attr("char"));
const char ch = boost::python::extract<char>(obj.attr("dtype").attr("char"));
if (dlib::is_same_type<T,double>::value && ch != 'd')
throw dlib::error("Expected numpy.ndarray of float64");
......
......@@ -45,10 +45,10 @@ struct serialize_pickle : boost::python::pickle_suite
// UTF-8 encodings. So instead we access the python C interface directly and use
// bytes objects. However, we keep the deserialization code that worked with str
// for backwards compatibility with previously pickled files.
if (extract<str>(state[0]).check())
if (boost::python::extract<str>(state[0]).check())
{
str data = extract<str>(state[0]);
std::string temp(extract<const char*>(data), len(data));
str data = boost::python::extract<str>(state[0]);
std::string temp(boost::python::extract<const char*>(data), len(data));
std::istringstream sin(temp);
deserialize(item, sin);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment