-
Notifications
You must be signed in to change notification settings - Fork 343
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Verify plugins are loadable in Windows installer builds and fix missi…
…ng dependencies (#946) * Add logic to verify that OFX plugins load. * Add missing libheif dependencies.
- Loading branch information
Showing
3 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters