Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify plugins are loadable in Windows installer builds and fix missing dependencies #946

Merged
merged 2 commits into from
Feb 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/build_installer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,22 @@ jobs:
echo "INSTALLER_NAME=${INSTALLER_NAME}" >> $GITHUB_OUTPUT
echo "INSTALLER_DIR=$(cygpath -m ${INSTALLER_DIR})" >> $GITHUB_OUTPUT

- name: Build verify_plugin_loads binary
run: |
g++ -DWINDOWS -o verify_plugin_loads .github/workflows/verify_plugin_loads.cpp libs/OpenFX/HostSupport/src/ofxhBinary.cpp libs/OpenFX/HostSupport/src/ofxhUtilities.cpp -I libs/OpenFX/HostSupport/include/ -I libs/OpenFX/include/

- name: Uninstall Natron dependencies
run: |
pacman -Rs --noconfirm mingw-w64-x86_64-natron-build-deps-qt5

- name: Verify plugin loading
run: |
INSTALLER_DIR=$(cygpath -u '${{ steps.build.outputs.INSTALLER_DIR }}')/${{ steps.build.outputs.INSTALLER_NAME }}
for x in $(find ${INSTALLER_DIR}/Plugins -name *.ofx); do
echo "Testing $(basename ${x}) ..."
PATH=${INSTALLER_DIR}/bin ./verify_plugin_loads.exe "${x}"
done

- name: Upload artifacts
uses: actions/upload-artifact@v4.3.1
with:
Expand Down Expand Up @@ -125,6 +141,22 @@ jobs:
echo "SYMBOLS_NAME=${SYMBOLS_NAME}" >> $GITHUB_OUTPUT
echo "SYMBOLS_DIR=$(cygpath -m ${SYMBOLS_DIR})" >> $GITHUB_OUTPUT

- name: Build verify_plugin_loads binary
run: |
g++ -DWINDOWS -o verify_plugin_loads .github/workflows/verify_plugin_loads.cpp libs/OpenFX/HostSupport/src/ofxhBinary.cpp libs/OpenFX/HostSupport/src/ofxhUtilities.cpp -I libs/OpenFX/HostSupport/include/ -I libs/OpenFX/include/

- name: Uninstall Natron dependencies
run: |
pacman -Rs --noconfirm mingw-w64-x86_64-natron-build-deps-qt5

- name: Verify plugin loading
run: |
INSTALLER_DIR=$(cygpath -u '${{ steps.build.outputs.INSTALLER_DIR }}')/${{ steps.build.outputs.INSTALLER_NAME }}
for x in $(find ${INSTALLER_DIR}/Plugins -name *.ofx); do
echo "Testing $(basename ${x}) ..."
PATH=${INSTALLER_DIR}/bin ./verify_plugin_loads.exe "${x}"
done

- name: Upload installer
uses: actions/upload-artifact@v4.3.1
with:
Expand Down
58 changes: 58 additions & 0 deletions .github/workflows/verify_plugin_loads.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@

#include "ofxhBinary.h"
#include "ofxhPluginCache.h"

int
main(int argc, const char* argv[])
{
if (argc < 2) {
std::cerr << "Usage: " << argv[0] << " <plugin>\n";
return 1;
}

const char* const binaryPath = argv[1];

// TODO: Change code to _dlHandle = dlopen(_binaryPath.c_str(), RTLD_NOW|RTLD_LOCAL);
OFX::Binary bin(binaryPath);

if (bin.isInvalid()) {
std::cerr << "error: '" << binaryPath << "' is invalid.\n";
return 1;
}

bin.load();

if (!bin.isLoaded()) {
std::cerr << "error: '" << binaryPath << "' failed to load.\n";
return 1;
}

auto* getNumberOfPlugins = (OFX::Host::OfxGetNumberOfPluginsFunc)bin.findSymbol("OfxGetNumberOfPlugins");
auto* getPluginFunc = (OFX::Host::OfxGetPluginFunc)bin.findSymbol("OfxGetPlugin");

if (getNumberOfPlugins == nullptr || getPluginFunc == nullptr) {
std::cerr << "error: '" << binaryPath << "' missing required symbols.\n";
return 1;
}

const int numPlugins = getNumberOfPlugins();

std::cout << "numPlugins: " << numPlugins << "\n";

if (numPlugins <= 0) {
std::cerr << "error: unexpected number of plugins.\n";
return 1;
}

for (int i = 0; i < numPlugins; ++i) {
auto* plugin = getPluginFunc(i);
if (plugin == nullptr) {
std::cerr << "Failed to get plugin " << i << "\n";
return 1;
}

std::cout << "plugin[" << i << "] : " << plugin->pluginIdentifier << " v" << plugin->pluginVersionMajor << "." << plugin->pluginVersionMinor << "\n";
}

return 0;
}
2 changes: 2 additions & 0 deletions tools/jenkins/genDllVersions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ catDll libdatrie-
catDll libsnappy
#catDll libpugixml
catDll libheif
catDll libkvazaar-
catDll libcryptopp
catDll rav1e
catDll libde265-
catDll libx265
Expand Down