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.
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user