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() ...@@ -126,6 +126,9 @@ else()
endif() endif()
message(STATUS "USING BOOST_LIBS: ${Boost_LIBRARIES}") message(STATUS "USING BOOST_LIBS: ${Boost_LIBRARIES}")
if (WIN32)
message(STATUS "USING PYTHON_LIBS: ${PYTHON_LIBRARIES}")
endif()
if (CMAKE_COMPILER_IS_GNUCXX) if (CMAKE_COMPILER_IS_GNUCXX)
# Just setting CMAKE_POSITION_INDEPENDENT_CODE should be enough to set # Just setting CMAKE_POSITION_INDEPENDENT_CODE should be enough to set
...@@ -150,6 +153,7 @@ macro(add_python_module module_name module_sources ) ...@@ -150,6 +153,7 @@ macro(add_python_module module_name module_sources )
TARGET_LINK_LIBRARIES(${module_name}_ ${Boost_LIBRARIES} dlib::dlib) TARGET_LINK_LIBRARIES(${module_name}_ ${Boost_LIBRARIES} dlib::dlib)
if(WIN32 AND NOT CYGWIN) if(WIN32 AND NOT CYGWIN)
TARGET_LINK_LIBRARIES(${module_name}_ ${PYTHON_LIBRARIES})
SET_TARGET_PROPERTIES( ${module_name}_ SET_TARGET_PROPERTIES( ${module_name}_
PROPERTIES PROPERTIES
PREFIX "" PREFIX ""
......
...@@ -18,7 +18,7 @@ void validate_numpy_array_type ( ...@@ -18,7 +18,7 @@ void validate_numpy_array_type (
) )
{ {
using namespace boost::python; 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') if (dlib::is_same_type<T,double>::value && ch != 'd')
throw dlib::error("Expected numpy.ndarray of float64"); throw dlib::error("Expected numpy.ndarray of float64");
......
...@@ -45,10 +45,10 @@ struct serialize_pickle : boost::python::pickle_suite ...@@ -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 // 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 // bytes objects. However, we keep the deserialization code that worked with str
// for backwards compatibility with previously pickled files. // 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]); str data = boost::python::extract<str>(state[0]);
std::string temp(extract<const char*>(data), len(data)); std::string temp(boost::python::extract<const char*>(data), len(data));
std::istringstream sin(temp); std::istringstream sin(temp);
deserialize(item, sin); 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