CMake: fix for MSVC, installing Python
authorCampbell Barton <ideasman42@gmail.com>
Mon, 1 Dec 2014 13:53:12 +0000 (14:53 +0100)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 1 Dec 2014 13:54:13 +0000 (14:54 +0100)
source/creator/CMakeLists.txt

index 71f0ef81ad858bccc6ba532a269b39f2c9eacae1..6903ab8fccc1846063eb2f2b140beb43e8ff5157 100644 (file)
@@ -628,24 +628,41 @@ elseif(WIN32)
                        install(DIRECTORY DESTINATION ${TARGETDIR_VER}/python)
                        install(DIRECTORY DESTINATION ${TARGETDIR_VER}/python/lib)
 
-                       if(\"\${CMAKE_INSTALL_CONFIG_NAME}\" STREQUAL \"Debug\")
-                               add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib
-                                       COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib"
-                                       COMMAND ${CMAKE_COMMAND} -E tar xzfv "${LIBDIR}/release/python${_PYTHON_VERSION_NO_DOTS}_d.tar.gz -C ${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib")
-                       else()
-                               add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib
-                                       COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib"
-                                       COMMAND ${CMAKE_COMMAND} -E tar xzfv "${LIBDIR}/release/python${_PYTHON_VERSION_NO_DOTS}.tar.gz -C ${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib")
-                       endif()
+                       # extract python
+                       install(
+                               CODE
+                               "
+                               if(\"\${CMAKE_INSTALL_CONFIG_NAME}\" MATCHES \"^([Dd][Ee][Bb][Uu][Gg])$\")
+                                       set(PYTHON_ZIP ${LIBDIR}/release/python${_PYTHON_VERSION_NO_DOTS}_d.tar.gz)
+                               else()
+                                       set(PYTHON_ZIP ${LIBDIR}/release/python${_PYTHON_VERSION_NO_DOTS}.tar.gz)
+                               endif()
+
+                               execute_process(
+                                       COMMAND ${CMAKE_COMMAND} -E
+                                               make_directory \"${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib\"
+                                       COMMAND ${CMAKE_COMMAND} -E
+                                               tar xzfv \"\${PYTHON_ZIP} -C ${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib\"
+                               )
+                               unset(PYTHON_ZIP)
+                               "
+                       )
+                       # install python
+                       install(
+                               DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib
+                               DESTINATION ${BLENDER_VERSION}/python
+                               PATTERN 'site-packages/*' EXCLUDE
+                       )
 
                        # release/site-packages
-                       install(DIRECTORY ${LIBDIR}/release/site-packages
-                                       DESTINATION ${BLENDER_VERSION}/python/lib
-                                       PATTERN ".svn" EXCLUDE
-                                       PATTERN "__pycache__" EXCLUDE           # * any cache *
-                                       PATTERN "*.pyc" EXCLUDE                 # * any cache *
-                                       PATTERN "*.pyo" EXCLUDE                 # * any cache *)
-                                       )
+                       install(
+                               DIRECTORY ${LIBDIR}/release/site-packages
+                               DESTINATION ${BLENDER_VERSION}/python/lib
+                               PATTERN ".svn" EXCLUDE
+                               PATTERN "__pycache__" EXCLUDE           # * any cache *
+                               PATTERN "*.pyc" EXCLUDE                 # * any cache *
+                               PATTERN "*.pyo" EXCLUDE                 # * any cache *)
+                       )
 
                        if(WITH_PYTHON_INSTALL_NUMPY)
                                add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib/site-packages/numpy
@@ -656,11 +673,6 @@ elseif(WIN32)
                                                DESTINATION ${BLENDER_VERSION}/python/lib/site-packages)
                        endif()
 
-
-                       install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${BLENDER_VERSION}/python/lib
-                                       DESTINATION ${BLENDER_VERSION}/python
-                                       PATTERN 'site-packages/*' EXCLUDE)
-
                endif()
 
                unset(_PYTHON_VERSION_NO_DOTS)