Alexander Dielen:
- updated the tutorial with further information on how to build the python bindings - updated the cmake file so that cmake finds boost python installations with the names python2 and python3 - fixed a cmake warning on os x (Policy CMP0042: MACOSX_RPATH) - fixed a bug in the unit test test_add_face.py git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@1237 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
@@ -25,8 +25,26 @@ The Python Bindings depend on the following libraries:
|
|||||||
\note Make sure that your Boost Python and Python versions match, i.e. that
|
\note Make sure that your Boost Python and Python versions match, i.e. that
|
||||||
Boost Python was linked against the correct Python version.
|
Boost Python was linked against the correct Python version.
|
||||||
|
|
||||||
The Python Bindings are automatically build with %OpenMesh. For more information
|
The Python Bindings are automatically built with %OpenMesh. The generated files are written to the
|
||||||
on how to build %OpenMesh see \ref compiling.
|
Build/python subdirectory of the build tree. For more information on how to build %OpenMesh see
|
||||||
|
\ref compiling.
|
||||||
|
|
||||||
|
If CMake does not find your Python installation (or finds the wrong one) you can
|
||||||
|
explicitly specify an installation by setting the following variables:
|
||||||
|
|
||||||
|
\verbatim
|
||||||
|
PYTHON_LIBRARY - Path to the python library
|
||||||
|
PYTHON_INCLUDE_DIR - Path to where Python.h is found
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
Similarly, if CMake does not find your Boost Python installation, set the
|
||||||
|
following variables:
|
||||||
|
|
||||||
|
\verbatim
|
||||||
|
BOOST_ROOT - Preferred installation prefix
|
||||||
|
BOOST_INCLUDEDIR - Preferred include directory e.g. <prefix>/include
|
||||||
|
BOOST_LIBRARYDIR - Preferred library directory e.g. <prefix>/lib
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,27 +12,26 @@ ENDIF()
|
|||||||
|
|
||||||
IF(OPENMESH_BUILD_PYTHON_BINDINGS)
|
IF(OPENMESH_BUILD_PYTHON_BINDINGS)
|
||||||
# Look for the python libs
|
# Look for the python libs
|
||||||
MESSAGE(STATUS "Looking for Python")
|
MESSAGE(STATUS "Looking for PythonLibs")
|
||||||
FIND_PACKAGE(PythonLibs ${OPENMESH_PYTHON_VERSION} QUIET)
|
FIND_PACKAGE(PythonLibs ${OPENMESH_PYTHON_VERSION} QUIET)
|
||||||
|
|
||||||
IF(PYTHONLIBS_FOUND)
|
IF(PYTHONLIBS_FOUND)
|
||||||
MESSAGE(STATUS "Looking for Python -- found")
|
MESSAGE(STATUS "Looking for PythonLibs -- found")
|
||||||
|
|
||||||
# Determine the name of the python component
|
# Determine the name of the python component
|
||||||
STRING(REGEX MATCH "^[0-9]+\\.[0-9]+" PYTHON_VERSION ${PYTHONLIBS_VERSION_STRING})
|
STRING(REGEX MATCH "^[0-9]+\\.[0-9]+" PYTHON_VERSION_MAJOR_MINOR ${PYTHONLIBS_VERSION_STRING})
|
||||||
STRING(REGEX REPLACE "\\." "" PYTHON_VERSION ${PYTHON_VERSION})
|
STRING(REGEX REPLACE "\\." "" PYTHON_VERSION_MAJOR_MINOR ${PYTHON_VERSION_MAJOR_MINOR})
|
||||||
|
STRING(REGEX MATCH "^[0-9]" PYTHON_VERSION_MAJOR ${PYTHON_VERSION_MAJOR_MINOR})
|
||||||
SET(BOOST_PYTHON_COMPONENT "python-py${PYTHON_VERSION}")
|
|
||||||
|
|
||||||
MESSAGE(STATUS "Looking for Boost Python")
|
MESSAGE(STATUS "Looking for Boost Python")
|
||||||
|
|
||||||
# Look for version specific python component
|
SET(BOOST_PYTHON_COMPONENT_NAMES "python-py${PYTHON_VERSION_MAJOR_MINOR}" "python${PYTHON_VERSION_MAJOR}" "python")
|
||||||
FIND_PACKAGE(Boost QUIET COMPONENTS ${BOOST_PYTHON_COMPONENT})
|
|
||||||
|
FOREACH(NAME ${BOOST_PYTHON_COMPONENT_NAMES})
|
||||||
# Look for any other python component
|
IF(NOT Boost_FOUND)
|
||||||
IF(NOT Boost_FOUND)
|
FIND_PACKAGE(Boost QUIET COMPONENTS ${NAME})
|
||||||
FIND_PACKAGE(Boost QUIET COMPONENTS python)
|
ENDIF()
|
||||||
ENDIF()
|
ENDFOREACH()
|
||||||
|
|
||||||
IF(Boost_FOUND)
|
IF(Boost_FOUND)
|
||||||
MESSAGE(STATUS "Looking for Boost Python -- found")
|
MESSAGE(STATUS "Looking for Boost Python -- found")
|
||||||
@@ -111,6 +110,9 @@ IF(OPENMESH_BUILD_PYTHON_BINDINGS)
|
|||||||
|
|
||||||
IF(APPLE)
|
IF(APPLE)
|
||||||
SET_TARGET_PROPERTIES(openmesh PROPERTIES SUFFIX ".so")
|
SET_TARGET_PROPERTIES(openmesh PROPERTIES SUFFIX ".so")
|
||||||
|
IF (NOT (CMAKE_MAJOR_VERSION LESS 3))
|
||||||
|
SET_TARGET_PROPERTIES(openmesh PROPERTIES MACOSX_RPATH TRUE)
|
||||||
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
@@ -191,6 +193,6 @@ IF(OPENMESH_BUILD_PYTHON_BINDINGS)
|
|||||||
MESSAGE("Boost Python not found! Skipping Python Bindings.")
|
MESSAGE("Boost Python not found! Skipping Python Bindings.")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ELSE()
|
ELSE()
|
||||||
MESSAGE("Python not found! Skipping Python Bindings.")
|
MESSAGE("PythonLibs not found! Skipping Python Bindings.")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ SET_TARGET_PROPERTIES(
|
|||||||
|
|
||||||
IF(APPLE)
|
IF(APPLE)
|
||||||
SET_TARGET_PROPERTIES(example PROPERTIES SUFFIX ".so")
|
SET_TARGET_PROPERTIES(example PROPERTIES SUFFIX ".so")
|
||||||
|
IF (NOT (CMAKE_MAJOR_VERSION LESS 3))
|
||||||
|
SET_TARGET_PROPERTIES(example PROPERTIES MACOSX_RPATH TRUE)
|
||||||
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
|
|||||||
@@ -216,11 +216,12 @@ class AddFace(unittest.TestCase):
|
|||||||
self.mesh.add_face(self.vhandle[0], self.vhandle[5], self.vhandle[6])
|
self.mesh.add_face(self.vhandle[0], self.vhandle[5], self.vhandle[6])
|
||||||
|
|
||||||
# non-manifold!
|
# non-manifold!
|
||||||
self.mesh.add_face(self.vhandle[3], self.vhandle[0], self.vhandle[4])
|
invalid_fh = self.mesh.add_face(self.vhandle[3], self.vhandle[0], self.vhandle[4])
|
||||||
|
|
||||||
# Check setup
|
# Check setup
|
||||||
self.assertEqual(self.mesh.n_vertices(), 7)
|
self.assertEqual(self.mesh.n_vertices(), 7)
|
||||||
self.assertEqual(self.mesh.n_faces(), 4)
|
self.assertEqual(self.mesh.n_faces(), 3)
|
||||||
|
self.assertEqual(invalid_fh, openmesh.TriMesh.InvalidFaceHandle)
|
||||||
|
|
||||||
def test_add_quad_to_polymesh(self):
|
def test_add_quad_to_polymesh(self):
|
||||||
self.mesh = openmesh.PolyMesh()
|
self.mesh = openmesh.PolyMesh()
|
||||||
|
|||||||
Reference in New Issue
Block a user