CMake: add delayed_install macro to specify files to be installed from modules
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 7 Nov 2011 15:53:40 +0000 (15:53 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 7 Nov 2011 15:53:40 +0000 (15:53 +0000)
other than source/creator.

build_files/cmake/macros.cmake
source/creator/CMakeLists.txt

index ba1cdd9013bb54788a4c24b42c56289ba5458cdd..c9a04f87148280fd97d9360c0d0a05f3b6d1a1c5 100644 (file)
@@ -630,3 +630,38 @@ macro(blender_project_hack_post)
        endif()
 
 endmacro()
+
+# pair of macros to allow libraries to be specify files to install, but to
+# only install them at the end so the directories don't get cleared with
+# the files in them. used by cycles to install addon.
+macro(delayed_install
+       base
+       files
+       destination)
+
+       foreach(f ${files})
+               set_property(GLOBAL APPEND PROPERTY DELAYED_INSTALL_FILES ${base}/${f})
+               set_property(GLOBAL APPEND PROPERTY DELAYED_INSTALL_DESTINATIONS ${destination})
+       endforeach()
+endmacro()
+
+# note this is a function instead of a macro so that ${BUILD_TYPE} in targetdir
+# does not get expanded in calling but is preserved
+function(delayed_do_install
+       targetdir)
+
+       get_property(files GLOBAL PROPERTY DELAYED_INSTALL_FILES)
+       get_property(destinations GLOBAL PROPERTY DELAYED_INSTALL_DESTINATIONS)
+
+       if(files)
+               list(LENGTH files n)
+               math(EXPR n "${n}-1")
+
+               foreach(i RANGE ${n})
+                       list(GET files ${i} f)
+                       list(GET destinations ${i} d)
+                       install(FILES ${f} DESTINATION ${targetdir}/${d})
+               endforeach()
+       endif()
+endfunction()
+
index a633a139995d63dc2409fb62f0d385073db5253d..b0e5427500bda3d199f346412c0bdbd26d73c8b9 100644 (file)
@@ -575,6 +575,14 @@ elseif(WIN32)
                DESTINATION ${TARGETDIR}
        )       
 
+       if(WITH_OPENIMAGEIO)
+               install(
+                       FILES
+                               ${LIBDIR}/openimageio/bin/OpenImageIO.dll
+                       DESTINATION ${TARGETDIR}
+               )
+       endif()
+
 elseif(APPLE)
        set(SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blender.app)
        set(SOURCEINFO ${SOURCEDIR}/Contents/Info.plist)
@@ -720,6 +728,9 @@ elseif(APPLE)
        endif()
 endif()
 
+# install more files specified elsewhere
+delayed_do_install(${TARGETDIR_VER})
+
 unset(BLENDER_TEXT_FILES)