Commit fddf79f1 authored by Isaak Lim's avatar Isaak Lim

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
parent 53371f63
......@@ -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
Boost Python was linked against the correct Python version.
The Python Bindings are automatically build with %OpenMesh. For more information
on how to build %OpenMesh see \ref compiling.
The Python Bindings are automatically built with %OpenMesh. The generated files are written to the
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)
# 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()
......@@ -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)
......
......@@ -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()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment