Skip to content
Permalink
Browse files
Add CMake option for custom Python framework on Mac
  • Loading branch information
dakcarto committed Dec 22, 2012
1 parent 991666c commit d56b1c885f668127c72a9bafaf7ad85c89e1e7ad
Showing with 19 additions and 2 deletions.
  1. +4 −0 CMakeLists.txt
  2. +15 −2 cmake/FindPythonLibrary.cmake
@@ -82,6 +82,10 @@ IF (WITH_BINDINGS)
SET (WITH_PY_COMPILE FALSE CACHE BOOL "Determines whether Python modules in staged or installed locations are byte-compiled")
# concatenate QScintilla2 API files
SET (WITH_QSCIAPI TRUE CACHE BOOL "Determines whether the QScintilla2 API files will be updated and concatenated")
# path to custom Python framework on Mac
IF (APPLE)
SET (PYTHON_CUSTOM_FRAMEWORK "" CACHE PATH "Path to custom Python.framework on Mac. (should not have to specify other Python options)")
ENDIF (APPLE)
ENDIF (WITH_BINDINGS)

#BUILD WITH QtMobility by default on android only. Other platform can force it
@@ -31,6 +31,19 @@ if(EXISTS PYTHON_LIBRARY)
set(PYTHONLIBRARY_FOUND TRUE)
else(EXISTS PYTHON_LIBRARY)

set(_custom_python_fw FALSE)
if(APPLE AND PYTHON_CUSTOM_FRAMEWORK)
if("${PYTHON_CUSTOM_FRAMEWORK}" MATCHES "Python\\.framework")
STRING(REGEX REPLACE "(.*Python\\.framework).*$" "\\1" _python_fw "${PYTHON_CUSTOM_FRAMEWORK}")
set(PYTHON_EXECUTABLE "${_python_fw}/Versions/Current/bin/python")
set(PYTHON_INCLUDE_PATH "${_python_fw}/Versions/Current/Headers")
set(PYTHON_LIBRARY "${_python_fw}/Versions/Current/Python")
if(EXISTS "${PYTHON_EXECUTABLE}" AND EXISTS "${PYTHON_INCLUDE_PATH}" AND EXISTS "${PYTHON_LIBRARY}")
set(_custom_python_fw TRUE)
endif()
endif("${PYTHON_CUSTOM_FRAMEWORK}" MATCHES "Python\\.framework")
endif(APPLE AND PYTHON_CUSTOM_FRAMEWORK)

FIND_PACKAGE(PythonInterp)

if(PYTHONINTERP_FOUND)
@@ -60,7 +73,7 @@ else(EXISTS PYTHON_LIBRARY)
endif(python_config)

# adapted from cmake's builtin FindPythonLibs
if(APPLE)
if(APPLE AND NOT _custom_python_fw)
CMAKE_FIND_FRAMEWORKS(Python)
set(PYTHON_FRAMEWORK_INCLUDES)
if(Python_FRAMEWORKS)
@@ -75,7 +88,7 @@ else(EXISTS PYTHON_LIBRARY)
endif(NOT PYTHON_LIBRARY)
set(PYTHONLIBRARY_FOUND TRUE)
endif(Python_FRAMEWORKS)
endif(APPLE)
endif(APPLE AND NOT _custom_python_fw)
endif(PYTHONINTERP_FOUND)

if(PYTHONLIBRARY_FOUND)

0 comments on commit d56b1c8

Please sign in to comment.