From 19685c27623c9ba9ff1008a95b0b722e9c770952 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 24 Dec 2023 00:18:12 +0100 Subject: [PATCH] Added support for building the module as a shared library. --- SCsub | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/SCsub b/SCsub index edce52c..32cee66 100644 --- a/SCsub +++ b/SCsub @@ -121,5 +121,15 @@ if module_env.pmlpp_build_tests and module_env.pmlpp_build_old_classes: "test/mlpp_tests_old.cpp", ] -module_env.add_source_files(env.modules_sources, sources) +if ARGUMENTS.get('pmlpp_shared', 'no') == 'yes': + # Shared lib compilation + module_env.Append(CCFLAGS=['-fPIC']) + module_env['LIBS'] = [] + shared_lib = module_env.SharedLibrary(target='#bin/pmlpp', source=sources) + shared_lib_shim = shared_lib[0].name.rsplit('.', 1)[0] + env.Append(LIBS=[shared_lib_shim]) + env.Append(LIBPATH=['#bin']) +else: + # Static compilation + module_env.add_source_files(env.modules_sources, sources)