diff --git a/README.md b/README.md index b54d6f9..3da5df9 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Requirements ------------ You first need to install the `Boost `_ libraries. -You can compile your own local version or simply do on Linux: +You can compile your own local version. This is a must for Windows/MSCV. On Linux you can simply install it via: ``` $ sudo apt-get install libboost-dev @@ -38,6 +38,7 @@ $ python3 -m venv --copies my_venv $ source my_venv/bin/activate ``` +#### Linux/MacOS You should then compile and install the ``psbody-mesh`` package using the Makefile. If you are using the system-wide ``Boost`` libraries: @@ -51,6 +52,13 @@ or the libraries locally installed: $ BOOST_ROOT=/path/to/boost/libraries make all ``` +#### Windows + +The makefile will not work on Windows with MSVC. Not tested with neither CygWin nor MinGw. Execute the following instead: +``` +python setup.py install boost-location= +``` + Testing ------- diff --git a/mesh/CMakeLists.txt b/mesh/CMakeLists.txt index e8db071..0a49ad4 100644 --- a/mesh/CMakeLists.txt +++ b/mesh/CMakeLists.txt @@ -80,6 +80,20 @@ target_compile_definitions(spatialsearch PRIVATE ${DEFINES_MESH_EXTENSIONS_WITH_CGAL_WITHOUT_LINK}) + +# visibility +python_add_library(TARGET visibility SOURCES + src/py_visibility.cpp + src/visibility.cpp + ) +target_include_directories(visibility PRIVATE + ${libcgalroot}/include + ${NUMPY_INCLUDE_PATH} + ${Boost_INCLUDE_DIRS}) +set_property(TARGET visibility PROPERTY FOLDER "GeometryExt/") +target_compile_definitions(visibility PRIVATE + ${DEFINES_MESH_EXTENSIONS_WITH_CGAL_WITHOUT_LINK}) + # serialization extensions @@ -97,3 +111,4 @@ target_include_directories(loadobj PRIVATE ${NUMPY_INCLUDE_PATH} ${Boost_INCLUDE_DIRS}) set_property(TARGET loadobj PROPERTY FOLDER "SerializationExt/") + diff --git a/mesh/cmake/thirdparty.cmake b/mesh/cmake/thirdparty.cmake index e5ae1ed..fda2dfd 100644 --- a/mesh/cmake/thirdparty.cmake +++ b/mesh/cmake/thirdparty.cmake @@ -26,7 +26,7 @@ find_package(PythonInterp REQUIRED) # numpy execute_process( - COMMAND ${PYTHON_EXECUTABLE} -c "import numpy; print numpy.get_include()" + COMMAND ${PYTHON_EXECUTABLE} -c "import numpy; print(numpy.get_include())" OUTPUT_VARIABLE NUMPY_INCLUDE_PATH ERROR_VARIABLE NUMPY_ERROR OUTPUT_STRIP_TRAILING_WHITESPACE diff --git a/mesh/src/visibility.cpp b/mesh/src/visibility.cpp index 052a0b4..ef279d3 100644 --- a/mesh/src/visibility.cpp +++ b/mesh/src/visibility.cpp @@ -44,6 +44,13 @@ typedef AABB_triangle_traits::Point_and_primitive_id Point_and_Primitive_id; typedef CGAL::AABB_tree Tree; typedef Tree::Object_and_primitive_id Object_and_Primitive_id; +// if we are on MSCV, we need to instantiate the extern variable ORIGIN otherwise there will be a linking error +#ifdef _MSC_VER +namespace CGAL { + const CGAL::Origin ORIGIN; +}; +#endif + #include "visibility.h" struct VisibilityTask{ diff --git a/setup.py b/setup.py index bd37400..708ba71 100644 --- a/setup.py +++ b/setup.py @@ -61,6 +61,9 @@ def run(self): CGAL_dir_deflate = os.path.abspath(self.build_temp) + if os.name == 'nt': # if on windows, MSVC compiler will look for the Release folder + CGAL_dir_deflate = os.path.join(CGAL_dir_deflate, 'Release') + log.info('[CGAL] deflating cgal from "%s" to "%s"', CGAL_archive, CGAL_dir_deflate) if not os.path.exists(os.path.join(CGAL_dir_deflate, 'CGAL-4.7')): import tarfile