From 795a38c60dc57f03ee68fa4ffdc0b9fb00031b3f Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Tue, 24 Aug 2010 00:28:21 +0200 Subject: [PATCH] plugin starter kit --- tools/plugin-starter-kit/README | 1 + tools/plugin-starter-kit/SConstruct | 5 +++++ tools/plugin-starter-kit/myutil.cpp | 19 +++++++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 tools/plugin-starter-kit/README create mode 100644 tools/plugin-starter-kit/SConstruct create mode 100644 tools/plugin-starter-kit/myutil.cpp diff --git a/tools/plugin-starter-kit/README b/tools/plugin-starter-kit/README new file mode 100644 index 00000000..a513417b --- /dev/null +++ b/tools/plugin-starter-kit/README @@ -0,0 +1 @@ +This is a tiny example on how Mitsuba plugins can be developed outside of the main codebase. diff --git a/tools/plugin-starter-kit/SConstruct b/tools/plugin-starter-kit/SConstruct new file mode 100644 index 00000000..1d44fe19 --- /dev/null +++ b/tools/plugin-starter-kit/SConstruct @@ -0,0 +1,5 @@ +import os + +env = Environment(ENV = os.environ, tools=['default']) +env['SHLIBPREFIX'] = '' +env.SharedLibrary('plugins/myutil', ['myutil.cpp']) diff --git a/tools/plugin-starter-kit/myutil.cpp b/tools/plugin-starter-kit/myutil.cpp new file mode 100644 index 00000000..9a835187 --- /dev/null +++ b/tools/plugin-starter-kit/myutil.cpp @@ -0,0 +1,19 @@ +#include + +MTS_NAMESPACE_BEGIN + +class MyUtility : public Utility { +public: + MyUtility(UtilityServices *us) : Utility(us) { } + + int run(int argc, char **argv) { + cout << "Hello world!" << endl; + return 0; + } + + MTS_DECLARE_CLASS() +}; + +MTS_IMPLEMENT_CLASS(MyUtility, false, Utility) +MTS_EXPORT_UTILITY(MyUtility, "Example utility") +MTS_NAMESPACE_END