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.
This commit is contained in:
Davis King 2017-08-21 21:27:12 -04:00
parent 05c8391cb2
commit f566b05a2e
3 changed files with 8 additions and 4 deletions

View File

@ -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 ""

View File

@ -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");

View File

@ -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);
}