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")
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 "")
if (NOT ZLIB_FOUND)
include(ZLIB/ZLIB.cmake)
@ -170,19 +157,14 @@ if (NOT "${ZLIB_PKG}" STREQUAL "")
add_dependencies(dep_openexr ${ZLIB_PKG})
endif ()
if (MSVC)
add_custom_target(deps ALL
DEPENDS
set(_dep_list
dep_boost
dep_boost_polygon
dep_tbb
dep_libcurl
dep_wxWidgets
dep_gtest
dep_cereal
dep_nlopt
# dep_qhull # Experimental
dep_openvdb
dep_OpenCSG
dep_CGAL
@ -191,29 +173,33 @@ if (MSVC)
${EXPAT_PKG}
)
else()
add_custom_target(deps ALL
DEPENDS
dep_boost
dep_boost_polygon
dep_tbb
dep_libcurl
dep_wxWidgets
dep_gtest
dep_cereal
dep_nlopt
dep_qhull
dep_openvdb
dep_OpenCSG
dep_CGAL
${PNG_PKG}
${ZLIB_PKG}
${EXPAT_PKG}
# dep_libigl # Not working, static build has different Eigen
if ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
# 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"
)
# Only override boost::Polygon Voronoi implementation with Vojtech's GMP hacks on 64bit platforms.
list(APPEND _dep_list "dep_boost_polygon")
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
# 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)
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}: ")
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}")
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")
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()
# Installation

View File

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

View File

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