diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2017-05-25 03:34:39 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2017-05-25 03:34:39 +0300 |
commit | bbce6ce249f8964e9dbf2e1f13cadad15126f9b9 (patch) | |
tree | 17aa6641ec63cbf4d7d7665837c8b69518e3f474 /source | |
parent | a033a7bef9be0ab69edbccbcf49f8af3816fe1eb (diff) |
Fix macOS python cmake install to work when switching lib directories.
It's a bit ugly but I couldn't find a better way to keep fast installs and
correct handling of switching between master and blender2.8 with different
lib directories.
Diffstat (limited to 'source')
-rw-r--r-- | source/creator/CMakeLists.txt | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 504d0de9145..6d0cbb365b4 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -997,21 +997,26 @@ elseif(APPLE) # python if(WITH_PYTHON AND NOT WITH_PYTHON_MODULE AND NOT WITH_PYTHON_FRAMEWORK) - # the python zip is first extract as part of the build process, + # the python zip is first extracted as part of the build process, # and then later installed as part of make install. this is much # quicker, and means we can easily exclude files on copy - # Not needed for PYTHON_MODULE or WEB_PLUGIN due uses Pyhon framework + # Not needed for PYTHON_MODULE or WEB_PLUGIN due uses Pyhon framework + # use a hash of the .zip path to handle switching between different + # lib directories without needing a clean build + string(SHA1 PYTHON_ZIP_HASH ${LIBDIR}/release/${PYTHON_ZIP}) + set(PYTHON_EXTRACT_DIR ${CMAKE_CURRENT_BINARY_DIR}/${PYTHON_ZIP_HASH}/python) + add_custom_target( extractpyzip - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/python) + DEPENDS ${PYTHON_EXTRACT_DIR}) set(PYTHON_ZIP "python_${CMAKE_OSX_ARCHITECTURES}.zip") add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/python - COMMAND ${CMAKE_COMMAND} -E remove_directory "${CMAKE_CURRENT_BINARY_DIR}/python/" - COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/python/" - COMMAND ${CMAKE_COMMAND} -E chdir "${CMAKE_CURRENT_BINARY_DIR}/python/" + OUTPUT ${PYTHON_EXTRACT_DIR} + COMMAND ${CMAKE_COMMAND} -E remove_directory "${PYTHON_EXTRACT_DIR}/" + COMMAND ${CMAKE_COMMAND} -E make_directory "${PYTHON_EXTRACT_DIR}/" + COMMAND ${CMAKE_COMMAND} -E chdir "${PYTHON_EXTRACT_DIR}/" ${CMAKE_COMMAND} -E tar xzfv "${LIBDIR}/release/${PYTHON_ZIP}" DEPENDS ${LIBDIR}/release/${PYTHON_ZIP}) @@ -1019,13 +1024,13 @@ elseif(APPLE) # copy extracted python files install_dir( - ${CMAKE_CURRENT_BINARY_DIR}/python + ${PYTHON_EXTRACT_DIR} \${TARGETDIR_VER} ) # copy site-packages files install_dir( ${LIBDIR}/release/site-packages - ${CMAKE_CURRENT_BINARY_DIR}/python/lib/python${PYTHON_VERSION} + \${TARGETDIR_VER}/python/lib/python${PYTHON_VERSION} ) install(DIRECTORY ${LIBDIR}/python/bin |