Skip to content
Open
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: 23 additions & 9 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -766,18 +766,29 @@ def _compile_java_plugins_in_folder(env, folder):
)


_LANGUAGE_SOURCE_BY_OPTION = {
"without-python": "Py.cxx",
"without-perl": "Perl.cxx",
"without-r": "R.cxx",
}


def build_language_objects(env):
"""Build language support objects and return the language file list."""
languages = Glob("src/languages/*.cxx")
"""Build language support objects, skipping any disabled languages."""
disabled = {
src for opt, src in _LANGUAGE_SOURCE_BY_OPTION.items() if GetOption(opt)
}
languages = [
node for node in Glob("src/languages/*.cxx")
if os.path.basename(node.get_path()) not in disabled
]

for language in languages:
output = language.get_path().replace("src", "obj").replace(".cxx", ".os")
_build_language_object(env, language, output)

return languages

env.Program("PluGen/plugen", Glob("src/PluGen/*.cxx"), CPPPATH=[Dir("src")])

def _build_language_object(env, language, output):
"""Build a single language object file."""
is_perl = "Perl" in output
Expand All @@ -787,11 +798,14 @@ def _build_language_object(env, language, output):


def build_main_executable(env, languages):
"""Build the main PluMA executable."""
program_libs = [
"pthread", "m", "dl", "crypt", "c",
f"python{python_version}", "util", "perl", "R", "RInside",
]
"""Build the main PluMA executable, linking only enabled language runtimes."""
program_libs = ["pthread", "m", "dl", "crypt", "c"]
if not GetOption("without-python"):
program_libs.extend([f"python{python_version}", "util"])
if not GetOption("without-perl"):
program_libs.append("perl")
if not GetOption("without-r"):
program_libs.extend(["R", "RInside"])

env.Append(LIBPATH=[LibPath("")])
env.Program(
Expand Down
14 changes: 14 additions & 0 deletions src/PluginManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,18 @@
#include <fstream>

#include "languages/Compiled.h"
#ifdef HAVE_PYTHON
#include "languages/Py.h"
#endif
#ifdef HAVE_R
#include "languages/R.h"
#endif
#ifdef HAVE_PERL
#include "languages/Perl.h"
#endif
#ifdef HAVE_JAVA
#include "languages/Java.h"
#endif
#ifdef HAVE_RUST
#include "languages/Rust.h"
#endif
Expand Down Expand Up @@ -122,9 +130,15 @@ class PluginManager {
#else
supported.push_back(new Compiled("C", "so", pluginpath, "lib"));
#endif
#ifdef HAVE_PYTHON
supported.push_back(new Py("Python", "py", pluginpath));
#endif
#ifdef HAVE_R
supported.push_back(new MiAMi::R("R", "R", pluginpath, argc, argv));
#endif
#ifdef HAVE_PERL
supported.push_back(new Perl("Perl", "pl", pluginpath));
#endif
#ifdef HAVE_JAVA
supported.push_back(new Java("Java", "class", pluginpath));
#endif
Expand Down