windows specific fix for finding and testing the boost python configuration

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@1219 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
Isaak Lim
2015-02-09 10:20:39 +00:00
parent af7d0ad162
commit 81a7ee7341

View File

@@ -26,14 +26,21 @@ IF(OPENMESH_BUILD_PYTHON_BINDINGS)
MESSAGE(STATUS "Looking for Boost Python") MESSAGE(STATUS "Looking for Boost Python")
# Look for python component # Look for version specific python component
FIND_PACKAGE(Boost QUIET COMPONENTS ${BOOST_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()
IF(Boost_FOUND) IF(Boost_FOUND)
MESSAGE(STATUS "Looking for Boost Python -- found") MESSAGE(STATUS "Looking for Boost Python -- found")
MESSAGE(STATUS "Checking the Boost Python configuration") MESSAGE(STATUS "Checking the Boost Python configuration")
SET(CMAKE_TRY_COMPILE_CONFIGURATION "Release")
TRY_COMPILE( TRY_COMPILE(
COMPILE_WORKS COMPILE_WORKS
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
@@ -47,14 +54,21 @@ IF(OPENMESH_BUILD_PYTHON_BINDINGS)
IF(COMPILE_WORKS) IF(COMPILE_WORKS)
# Look for the python interpreter to check if the example works # Look for the python interpreter to check if the example works
# strip version string of any characters (e.g. # '+') than 0-9 and . # strip version string of any characters (e.g. # '+') than 0-9 and .
STRING(REGEX REPLACE "[^ 0-9 | \\.]" "" PYTHONLIBS_VERSION_STRING_STRIPPED ${PYTHONLIBS_VERSION_STRING}) STRING(REGEX REPLACE "[^ 0-9 | \\.]" "" PYTHONLIBS_VERSION_STRING_STRIPPED ${PYTHONLIBS_VERSION_STRING})
FIND_PACKAGE(PythonInterp ${PYTHONLIBS_VERSION_STRING_STRIPPED} QUIET) FIND_PACKAGE(PythonInterp ${PYTHONLIBS_VERSION_STRING_STRIPPED} QUIET)
IF(PYTHONINTERP_FOUND) IF(PYTHONINTERP_FOUND)
IF(MSVC)
SET(PYTHON_WORKING_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_TRY_COMPILE_CONFIGURATION}")
ELSE()
SET(PYTHON_WORKING_DIR "${CMAKE_CURRENT_BINARY_DIR}")
ENDIF()
EXECUTE_PROCESS( EXECUTE_PROCESS(
COMMAND ${PYTHON_EXECUTABLE} -c "from example import *; greet(); planet = World()" COMMAND ${PYTHON_EXECUTABLE} -c "from example import *; greet(); planet = World()"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${PYTHON_WORKING_DIR}
RESULT_VARIABLE PYTHON_WORKS RESULT_VARIABLE PYTHON_WORKS
OUTPUT_QUIET OUTPUT_QUIET
ERROR_QUIET ERROR_QUIET
@@ -66,12 +80,13 @@ IF(OPENMESH_BUILD_PYTHON_BINDINGS)
MESSAGE(STATUS "Checking the Boost Python configuration -- done") MESSAGE(STATUS "Checking the Boost Python configuration -- done")
IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND ${Boost_VERSION} VERSION_LESS 105600) IF(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" AND ${Boost_VERSION} VERSION_LESS 105600)
MESSAGE("There are known issues with Clang and Boost Python 1.55 and below.") MESSAGE("There are known issues with Clang and Boost Python 1.55 and below.")
MESSAGE("Please consider updating Boost Python.") MESSAGE("Please consider updating Boost Python.")
ENDIF() ENDIF()
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Build/python/) SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Build/python/)
FILE(MAKE_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
FILE(GLOB SOURCES *.cc *hh) FILE(GLOB SOURCES *.cc *hh)
ADD_LIBRARY(openmesh SHARED ${SOURCES}) ADD_LIBRARY(openmesh SHARED ${SOURCES})