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:
Isaak Lim
2015-03-09 16:39:11 +00:00
parent 53371f63e1
commit fddf79f1a3
4 changed files with 42 additions and 18 deletions

View File

@@ -12,27 +12,26 @@ ENDIF()
IF(OPENMESH_BUILD_PYTHON_BINDINGS)
# Look for the python libs
MESSAGE(STATUS "Looking for Python")
MESSAGE(STATUS "Looking for PythonLibs")
FIND_PACKAGE(PythonLibs ${OPENMESH_PYTHON_VERSION} QUIET)
IF(PYTHONLIBS_FOUND)
MESSAGE(STATUS "Looking for Python -- found")
MESSAGE(STATUS "Looking for PythonLibs -- found")
# Determine the name of the python component
STRING(REGEX MATCH "^[0-9]+\\.[0-9]+" PYTHON_VERSION ${PYTHONLIBS_VERSION_STRING})
STRING(REGEX REPLACE "\\." "" PYTHON_VERSION ${PYTHON_VERSION})
SET(BOOST_PYTHON_COMPONENT "python-py${PYTHON_VERSION}")
STRING(REGEX MATCH "^[0-9]+\\.[0-9]+" PYTHON_VERSION_MAJOR_MINOR ${PYTHONLIBS_VERSION_STRING})
STRING(REGEX REPLACE "\\." "" PYTHON_VERSION_MAJOR_MINOR ${PYTHON_VERSION_MAJOR_MINOR})
STRING(REGEX MATCH "^[0-9]" PYTHON_VERSION_MAJOR ${PYTHON_VERSION_MAJOR_MINOR})
MESSAGE(STATUS "Looking for Boost Python")
# Look for version specific python component
FIND_PACKAGE(Boost QUIET COMPONENTS ${BOOST_PYTHON_COMPONENT})
# Look for any other python component
IF(NOT Boost_FOUND)
FIND_PACKAGE(Boost QUIET COMPONENTS python)
ENDIF()
SET(BOOST_PYTHON_COMPONENT_NAMES "python-py${PYTHON_VERSION_MAJOR_MINOR}" "python${PYTHON_VERSION_MAJOR}" "python")
FOREACH(NAME ${BOOST_PYTHON_COMPONENT_NAMES})
IF(NOT Boost_FOUND)
FIND_PACKAGE(Boost QUIET COMPONENTS ${NAME})
ENDIF()
ENDFOREACH()
IF(Boost_FOUND)
MESSAGE(STATUS "Looking for Boost Python -- found")
@@ -111,6 +110,9 @@ IF(OPENMESH_BUILD_PYTHON_BINDINGS)
IF(APPLE)
SET_TARGET_PROPERTIES(openmesh PROPERTIES SUFFIX ".so")
IF (NOT (CMAKE_MAJOR_VERSION LESS 3))
SET_TARGET_PROPERTIES(openmesh PROPERTIES MACOSX_RPATH TRUE)
ENDIF()
ENDIF()
IF(WIN32)
@@ -191,6 +193,6 @@ IF(OPENMESH_BUILD_PYTHON_BINDINGS)
MESSAGE("Boost Python not found! Skipping Python Bindings.")
ENDIF()
ELSE()
MESSAGE("Python not found! Skipping Python Bindings.")
MESSAGE("PythonLibs not found! Skipping Python Bindings.")
ENDIF()
ENDIF()

View File

@@ -19,6 +19,9 @@ SET_TARGET_PROPERTIES(
IF(APPLE)
SET_TARGET_PROPERTIES(example PROPERTIES SUFFIX ".so")
IF (NOT (CMAKE_MAJOR_VERSION LESS 3))
SET_TARGET_PROPERTIES(example PROPERTIES MACOSX_RPATH TRUE)
ENDIF()
ENDIF()
IF(WIN32)

View File

@@ -216,11 +216,12 @@ class AddFace(unittest.TestCase):
self.mesh.add_face(self.vhandle[0], self.vhandle[5], self.vhandle[6])
# 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
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):
self.mesh = openmesh.PolyMesh()