From b9ded563b9cfb0e419456fa782a125d22d5da43f Mon Sep 17 00:00:00 2001 From: Gary Oberbrunner Date: Fri, 29 Dec 2023 11:57:38 -0500 Subject: [PATCH] CI: Install plugins into artifact Also add install step to build-cmake.sh. You can override the install dir via `-DPLUGIN_INSTALLDIR=/any/absolute/path`. Signed-off-by: Gary Oberbrunner --- .github/workflows/build.yml | 6 ++++-- CMakeLists.txt | 1 + cmake/OpenFX.cmake | 26 +++++++++++++++++++------- scripts/build-cmake.sh | 7 ++++--- 4 files changed, 28 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 139f484b..93d3b577 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -186,6 +186,7 @@ jobs: if [[ ${{ matrix.has_cmake_presets }} = true ]]; then # Sets up to build in e.g. build/Release cmake --preset $CONAN_PRESET -DBUILD_EXAMPLE_PLUGINS=TRUE \ + -DPLUGIN_INSTALLDIR=$(pwd)/$BUILD_DIR/Install \ -DOFX_SUPPORTS_OPENGLRENDER=TRUE \ -DOFX_SUPPORTS_CUDARENDER=$CUDA . else @@ -196,6 +197,7 @@ jobs: -DCMAKE_POLICY_DEFAULT_CMP0091=NEW \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_EXAMPLE_PLUGINS=TRUE \ + -DPLUGIN_INSTALLDIR=$(pwd)/$BUILD_DIR/Install \ -DOFX_SUPPORTS_OPENGLRENDER=TRUE \ -DOFX_SUPPORTS_CUDARENDER=$CUDA fi @@ -203,9 +205,9 @@ jobs: - name: Build with cmake run: | if [[ ${{ matrix.ostype }} = windows ]]; then - cmake --build $BUILD_DIR --config Release --parallel + cmake --build $BUILD_DIR --target install --config Release --parallel else - cmake --build $BUILD_DIR --parallel + cmake --build $BUILD_DIR --target install --parallel fi - name: Copy includes into build folder for installation diff --git a/CMakeLists.txt b/CMakeLists.txt index ffc7adce..b3a91cd9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,7 @@ option(OFX_SUPPORTS_OPENGLRENDER "Build with support for GPU rendering (OpenGL/C option(BUILD_EXAMPLE_PLUGINS "Build example plugins" OFF) option(OFX_SUPPORTS_OPENCLRENDER "Build examples with support for OpenCL GPU rendering" OFF) option(OFX_SUPPORTS_CUDARENDER "Build examples with support for CUDA GPU rendering" OFF) +option(PLUGIN_INSTALLDIR "Location to install plugins (default depends on OS)" "") if(APPLE) set(OFX_SUPPORTS_CUDARENDER OFF) diff --git a/cmake/OpenFX.cmake b/cmake/OpenFX.cmake index f31fb83b..275018a7 100644 --- a/cmake/OpenFX.cmake +++ b/cmake/OpenFX.cmake @@ -1,14 +1,22 @@ +if(NOT PLUGIN_INSTALLDIR) + if(APPLE) + set(PLUGIN_INSTALLDIR "/Library/OFX/Plugins") + elseif(WIN32) + set(PLUGIN_INSTALLDIR "C:/Program Files/Common Files/OFX/Plugins") + elseif(UNIX) + set(PLUGIN_INSTALLDIR "/usr/OFX/Plugins") + else() + set(PLUGIN_INSTALLDIR "/unknown-os") + endif() +endif() + if(APPLE) - set(PLUGINDIR "/Library/OFX/Plugins") set(ARCHDIR "MacOS") elseif(WIN32) - set(PLUGINDIR "C:/Program Files/Common Files/OFX/Plugins") set(ARCHDIR "Win64") elseif(UNIX) - set(PLUGINDIR "/usr/OFX/Plugins") set(ARCHDIR "Linux-x86-64") else() - set(PLUGINDIR "/unknown-os") set(ARCHDIR "unknown-arch") endif() @@ -53,16 +61,20 @@ function(add_ofx_plugin TARGET) endif() # To install plugins: cmake --install Build - install(TARGETS ${TARGET} DESTINATION "${PLUGINDIR}/${TARGET}.ofx.bundle/Contents/${ARCHDIR}") + install(TARGETS ${TARGET} + RUNTIME DESTINATION "${PLUGIN_INSTALLDIR}/${TARGET}.ofx.bundle/Contents/${ARCHDIR}" + LIBRARY DESTINATION "${PLUGIN_INSTALLDIR}/${TARGET}.ofx.bundle/Contents/${ARCHDIR}" + BUNDLE DESTINATION "${PLUGIN_INSTALLDIR}/${TARGET}.ofx.bundle/Contents/${ARCHDIR}" +) # Use info.plist in DIR or else current dir file(REAL_PATH ${DIR}/Info.plist INFO_PLIST) if(EXISTS ${INFO_PLIST}) - install(FILES ${INFO_PLIST} DESTINATION "${PLUGINDIR}/${TARGET}.ofx.bundle/Contents") + install(FILES ${INFO_PLIST} DESTINATION "${PLUGIN_INSTALLDIR}/${TARGET}.ofx.bundle/Contents") else() file(REAL_PATH ./Info.plist INFO_PLIST) if(EXISTS ${INFO_PLIST}) - install(FILES ${INFO_PLIST} DESTINATION "${PLUGINDIR}/${TARGET}.ofx.bundle/Contents") + install(FILES ${INFO_PLIST} DESTINATION "${PLUGIN_INSTALLDIR}/${TARGET}.ofx.bundle/Contents") endif() endif() diff --git a/scripts/build-cmake.sh b/scripts/build-cmake.sh index eb22b8e3..f7b23872 100755 --- a/scripts/build-cmake.sh +++ b/scripts/build-cmake.sh @@ -52,13 +52,14 @@ echo === Running cmake # Generate the build files cmake --preset ${PRESET_NAME} -DBUILD_EXAMPLE_PLUGINS=TRUE "$@" -echo === Building plugins and support libs -cmake --build ${CMAKE_BUILD_DIR} --config $BUILDTYPE $VERBOSE +echo === Building and installing plugins and support libs +cmake --build ${CMAKE_BUILD_DIR} --target install --config $BUILDTYPE --parallel $VERBOSE set +x echo "=== Build complete." echo " Sample Plugins are in ${CMAKE_BUILD_DIR}/Examples/*/${BUILDTYPE}" +echo " and installed in the OFX plugin dir for your platform (or where specified by PLUGIN_INSTALLDIR)." echo " Plugin support lib and examples are in ${CMAKE_BUILD_DIR}/Support/{Library,Plugins}" echo " Host lib is in ${CMAKE_BUILD_DIR}/HostSupport/${BUILDTYPE}" -echo "=== To install the sample plugins to your OFX plugins folder, become root and then do:" +echo "=== To (re)install the sample plugins to your OFX plugins folder, become root and then do:" echo " cmake --install ${CMAKE_BUILD_DIR} --config $BUILDTYPE"