Allow exporting Lua symbols
Which optionally enables loading Lua shared modules from within even static TPT. Not that anyone actually needs this. This currently can't work on Windows because DLLs there import symbols by [module name, symbol name] rather than just symbol name. One could in theory export Lua symbols from TPT (I don't know the exact MSVC hack this would require, .def files?) and place a lua51.dll next to the executable that just re-exports them, see https://learn.microsoft.com/en-us/cpp/build/reference/exports?view=msvc-170 , but I've yet to try this.
This commit is contained in:
parent
bfdfebc1d5
commit
c1c1daa9e5
16
meson.build
16
meson.build
@ -376,6 +376,22 @@ if host_platform == 'emscripten'
|
||||
'-o', app_exe + '.js', # so we get a .wasm, and a .js
|
||||
]
|
||||
endif
|
||||
if get_option('export_lua_symbols')
|
||||
if is_static and lua_variant != 'none' and not project_export_dynamic
|
||||
if host_platform == 'windows'
|
||||
error('Lua symbols are currently impossible to export correctly on Windows')
|
||||
elif c_compiler.has_link_argument('-Wl,--export-dynamic-symbol')
|
||||
project_link_args += [
|
||||
'-Wl,--export-dynamic-symbol=lua_*',
|
||||
'-Wl,--export-dynamic-symbol=luaL_*',
|
||||
'-Wl,--export-dynamic-symbol=luaopen_*',
|
||||
]
|
||||
else
|
||||
warning('your linker does not support -Wl,--export-dynamic-symbol so Meson will be instructed to export all symbols in order to enable loading Lua shared modules, which may blow up the size of the resulting binary')
|
||||
project_export_dynamic = true
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
if get_option('build_powder')
|
||||
powder_deps += project_deps + [
|
||||
|
@ -305,3 +305,9 @@ option(
|
||||
value: true,
|
||||
description: 'Ask Windows nicely for UTF-8 as the codepage'
|
||||
)
|
||||
option(
|
||||
'export_lua_symbols',
|
||||
type: 'boolean',
|
||||
value: false,
|
||||
description: 'Export Lua symbols to enable loading of Lua shared modules'
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user