Skip to content

Commit

Permalink
CI: Install plugins into artifact
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
garyo committed Dec 29, 2023
1 parent c0b3c55 commit b9ded56
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 12 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -196,16 +197,17 @@ 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
- 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
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
26 changes: 19 additions & 7 deletions cmake/OpenFX.cmake
Original file line number Diff line number Diff line change
@@ -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()

Expand Down Expand Up @@ -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()

Expand Down
7 changes: 4 additions & 3 deletions scripts/build-cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit b9ded56

Please sign in to comment.