Cycles: svn merge -r39457:39669 https://svn.blender.org/svnroot/bf-blender/trunk...
[blender-staging.git] / build_files / cmake / macros.cmake
index 58938c8b0b02d57b30aa3b5b78a959a60e666b69..437ad92631fcec0b9e87abc68ee3d47396981b50 100644 (file)
@@ -166,6 +166,12 @@ macro(SETUP_LIBDIRS)
        if(WITH_IMAGE_TIFF)
                link_directories(${TIFF_LIBPATH})
        endif()
+       if(WITH_BOOST)
+               link_directories(${BOOST_LIBPATH})
+       endif()
+       if(WITH_OPENIMAGEIO)
+               link_directories(${OPENIMAGEIO_LIBPATH})
+       endif()
        if(WITH_IMAGE_OPENJPEG AND UNIX AND NOT APPLE)
                link_directories(${OPENJPEG_LIBPATH})
        endif()
@@ -272,6 +278,12 @@ macro(setup_liblinks
        if(WITH_IMAGE_TIFF)
                target_link_libraries(${target} ${TIFF_LIBRARY})
        endif()
+       if(WITH_BOOST)
+               target_link_libraries(${target} ${BOOST_LIBRARIES})
+       endif()
+       if(WITH_OPENIMAGEIO)
+               target_link_libraries(${target} ${OPENIMAGEIO_LIBRARY})
+       endif()
        if(WITH_IMAGE_OPENEXR)
                if(WIN32 AND NOT UNIX)
                        file_list_suffix(OPENEXR_LIBRARIES_DEBUG "${OPENEXR_LIBRARIES}" "_d")
@@ -571,3 +583,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()
+