Fixed unit tests on Windows after introduction of GMP to

boost::polygon Voronoi diagram generator by Vojtech.

Fixed Perl bindings on Windows after some "improvement" of the Windows 10
SDK headers, which fail if included from a C++ code using the
extern "C"
clause. Namely, the Windows 10 SDK include for sockets introduces C++ macros
if a "compiled with C++" symbol is provided even if included through
exetrn "C".
This commit is contained in:
bubnikv 2020-06-27 08:44:13 +02:00
parent 53b6c93ceb
commit c10f6a622d
5 changed files with 58 additions and 58 deletions

66
deps/CMakeLists.txt vendored
View File

@ -129,19 +129,6 @@ else()
include("deps-linux.cmake") include("deps-linux.cmake")
endif() endif()
# Patch the boost::polygon library with a custom one.
ExternalProject_Add(dep_boost_polygon
EXCLUDE_FROM_ALL ON
GIT_REPOSITORY "https://github.com/prusa3d/polygon"
GIT_TAG prusaslicer_gmp
DEPENDS dep_boost
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CMAKE_CURRENT_BINARY_DIR}/dep_boost_polygon-prefix/src/dep_boost_polygon/include/boost/polygon"
"${DESTDIR}/usr/local/include/boost/polygon"
)
set(ZLIB_PKG "") set(ZLIB_PKG "")
if (NOT ZLIB_FOUND) if (NOT ZLIB_FOUND)
include(ZLIB/ZLIB.cmake) include(ZLIB/ZLIB.cmake)
@ -170,19 +157,14 @@ if (NOT "${ZLIB_PKG}" STREQUAL "")
add_dependencies(dep_openexr ${ZLIB_PKG}) add_dependencies(dep_openexr ${ZLIB_PKG})
endif () endif ()
if (MSVC) set(_dep_list
add_custom_target(deps ALL
DEPENDS
dep_boost dep_boost
dep_boost_polygon
dep_tbb dep_tbb
dep_libcurl dep_libcurl
dep_wxWidgets dep_wxWidgets
dep_gtest dep_gtest
dep_cereal dep_cereal
dep_nlopt dep_nlopt
# dep_qhull # Experimental
dep_openvdb dep_openvdb
dep_OpenCSG dep_OpenCSG
dep_CGAL dep_CGAL
@ -191,29 +173,33 @@ if (MSVC)
${EXPAT_PKG} ${EXPAT_PKG}
) )
else() if ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
# Patch the boost::polygon library with a custom one.
add_custom_target(deps ALL ExternalProject_Add(dep_boost_polygon
DEPENDS EXCLUDE_FROM_ALL ON
dep_boost GIT_REPOSITORY "https://github.com/prusa3d/polygon"
dep_boost_polygon GIT_TAG prusaslicer_gmp
dep_tbb DEPENDS dep_boost
dep_libcurl CONFIGURE_COMMAND ""
dep_wxWidgets BUILD_COMMAND ""
dep_gtest INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory
dep_cereal "${CMAKE_CURRENT_BINARY_DIR}/dep_boost_polygon-prefix/src/dep_boost_polygon/include/boost/polygon"
dep_nlopt "${DESTDIR}/usr/local/include/boost/polygon"
dep_qhull
dep_openvdb
dep_OpenCSG
dep_CGAL
${PNG_PKG}
${ZLIB_PKG}
${EXPAT_PKG}
# dep_libigl # Not working, static build has different Eigen
) )
# Only override boost::Polygon Voronoi implementation with Vojtech's GMP hacks on 64bit platforms.
list(APPEND _dep_list "dep_boost_polygon")
endif () endif ()
if (MSVC)
# Experimental
#list(APPEND _dep_list "dep_qhull")
else()
list(APPEND _dep_list "dep_qhull")
# Not working, static build has different Eigen
#list(APPEND _dep_list "dep_libigl")
endif()
add_custom_target(deps ALL DEPENDS ${_dep_list})
# Note: I'm not using any of the LOG_xxx options in ExternalProject_Add() commands # Note: I'm not using any of the LOG_xxx options in ExternalProject_Add() commands
# because they seem to generate bogus build files (possibly a bug in ExternalProject). # because they seem to generate bogus build files (possibly a bug in ExternalProject).

View File

@ -19,5 +19,9 @@ add_executable(${_TEST_NAME}_tests
target_link_libraries(${_TEST_NAME}_tests test_common libslic3r) target_link_libraries(${_TEST_NAME}_tests test_common libslic3r)
set_property(TARGET ${_TEST_NAME}_tests PROPERTY FOLDER "tests") set_property(TARGET ${_TEST_NAME}_tests PROPERTY FOLDER "tests")
if (WIN32)
prusaslicer_copy_dlls(${_TEST_NAME}_tests)
endif()
# catch_discover_tests(${_TEST_NAME}_tests TEST_PREFIX "${_TEST_NAME}: ") # catch_discover_tests(${_TEST_NAME}_tests TEST_PREFIX "${_TEST_NAME}: ")
add_test(${_TEST_NAME}_tests ${_TEST_NAME}_tests ${CATCH_EXTRA_ARGS}) add_test(${_TEST_NAME}_tests ${_TEST_NAME}_tests ${CATCH_EXTRA_ARGS})

View File

@ -185,6 +185,16 @@ if (MSVC)
string(REPLACE "/" "\\" PROPS_CMAKE_SOURCE_DIR "${CMAKE_SOURCE_DIR}") string(REPLACE "/" "\\" PROPS_CMAKE_SOURCE_DIR "${CMAKE_SOURCE_DIR}")
configure_file("../cmake/msvc/xs.wperl.props.in" "${CMAKE_BINARY_DIR}/xs.wperl.props" NEWLINE_STYLE CRLF) configure_file("../cmake/msvc/xs.wperl.props.in" "${CMAKE_BINARY_DIR}/xs.wperl.props" NEWLINE_STYLE CRLF)
set_target_properties(XS PROPERTIES VS_USER_PROPS "${CMAKE_BINARY_DIR}/xs.wperl.props") set_target_properties(XS PROPERTIES VS_USER_PROPS "${CMAKE_BINARY_DIR}/xs.wperl.props")
if ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
set(_bits 64)
elseif ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
set(_bits 32)
endif ()
add_custom_command(TARGET XS POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${TOP_LEVEL_PROJECT_DIR}/deps/GMP/gmp/lib/win${_bits}/libgmp-10.dll "${PERL_LOCAL_LIB_ARCH_DIR}/auto/Slic3r/XS/"
COMMENT "Installing gmp runtime into the local-lib directory ..."
VERBATIM)
endif() endif()
# Installation # Installation

View File

@ -5,7 +5,7 @@
// #include <libslic3r/GCodeSender.hpp> // #include <libslic3r/GCodeSender.hpp>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { /* extern "C" { */
#endif #endif
#include "EXTERN.h" #include "EXTERN.h"
#include "perl.h" #include "perl.h"
@ -14,7 +14,7 @@ extern "C" {
#undef do_open #undef do_open
#undef do_close #undef do_close
#ifdef __cplusplus #ifdef __cplusplus
} /* } */
#endif #endif
#ifdef _WIN32 #ifdef _WIN32

View File

@ -40,7 +40,7 @@
// #include <libslic3r.h> // #include <libslic3r.h>
#ifdef SLIC3RXS #ifdef SLIC3RXS
extern "C" { // extern "C" {
#include "EXTERN.h" #include "EXTERN.h"
#include "perl.h" #include "perl.h"
#include "XSUB.h" #include "XSUB.h"
@ -88,7 +88,7 @@ extern "C" {
#undef Zero #undef Zero
#undef Packet #undef Packet
#undef _ #undef _
} // }
#endif #endif
#include <ClipperUtils.hpp> #include <ClipperUtils.hpp>