summaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authorStephan Bergmann <stephan.bergmann@allotropia.de>2024-02-27 16:30:24 +0100
committerStephan Bergmann <stephan.bergmann@allotropia.de>2024-02-28 07:53:21 +0100
commitc7664f12a99b6e08eb334d63646c3d2a6aa75e18 (patch)
tree2b713342c8ea894b6984f7e875955818f66afd2f /static
parent4c20fb09d7fe6c2f4cdb672a6238c8ddb67aa437 (diff)
Init Embind-ings manually, once UNO is set up
Upcoming code that changes the Embind'ing of UNO sequences will require availability of the UNO type manager during that Embind init code, so only call that after UNO has been bootstrapped (rather than as part of the initialization of global static data, which is what EMSCRIPTEN_BINDINGS does). Change-Id: Iba19851ffb82c055dcab10a28a8c1fafa9d2a414 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164065 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
Diffstat (limited to 'static')
-rw-r--r--static/CustomTarget_unoembind.mk8
-rw-r--r--static/source/embindmaker/embindmaker.cxx30
2 files changed, 26 insertions, 12 deletions
diff --git a/static/CustomTarget_unoembind.mk b/static/CustomTarget_unoembind.mk
index 045e0fea511c..d1bc294e0b9f 100644
--- a/static/CustomTarget_unoembind.mk
+++ b/static/CustomTarget_unoembind.mk
@@ -15,14 +15,14 @@ $(eval $(call gb_CustomTarget_register_targets,static/unoembind, \
))
$(call gb_CustomTarget_get_workdir,static/unoembind)/bindings_uno.cxx \
+$(call gb_CustomTarget_get_workdir,static/unoembind)/bindings_uno.hxx \
$(call gb_CustomTarget_get_workdir,static/unoembind)/bindings_uno.js: \
$(call gb_Executable_get_target_for_build,embindmaker) $(call gb_UnoApi_get_target,udkapi) \
- $(call gb_UnoApi_get_target,offapi) \
- $(if $(ENABLE_DBGUTIL),$(call gb_UnoApiTarget_get_target,embindtest))
+ $(call gb_UnoApi_get_target,offapi)
$(call gb_Executable_get_command,embindmaker) uno \
$(call gb_CustomTarget_get_workdir,static/unoembind)/bindings_uno.cxx \
+ $(call gb_CustomTarget_get_workdir,static/unoembind)/bindings_uno.hxx \
$(call gb_CustomTarget_get_workdir,static/unoembind)/bindings_uno.js \
- +$(call gb_UnoApi_get_target,udkapi) +$(call gb_UnoApi_get_target,offapi) \
- +$(if $(ENABLE_DBGUTIL),$(call gb_UnoApiTarget_get_target,embindtest))
+ +$(call gb_UnoApi_get_target,udkapi) +$(call gb_UnoApi_get_target,offapi)
# vim: set noet sw=4 ts=4:
diff --git a/static/source/embindmaker/embindmaker.cxx b/static/source/embindmaker/embindmaker.cxx
index bff11e99b16d..335b7983503c 100644
--- a/static/source/embindmaker/embindmaker.cxx
+++ b/static/source/embindmaker/embindmaker.cxx
@@ -46,13 +46,13 @@ void badUsage()
{
std::cerr
<< "Usage:\n\n"
- " embindmaker <name> <cpp-output> <js-output> <registries>\n\n"
+ " embindmaker <name> <cpp-output> <hpp-output> <js-output> <registries>\n\n"
"where each <registry> is '+' (primary) or ':' (secondary), followed by: either a\n"
"new- or legacy-format .rdb file, a single .idl file, or a root directory of an\n"
".idl file tree. For all primary registries, Embind code is written to\n"
- "<cpp-output> and corresponding JavaScript scaffolding code is written to\n"
- "<js-output>. The <name> is used as part of some of the identifiers in those\n"
- "generated files.\n";
+ "<cpp-output>/<hpp-output> and corresponding JavaScript scaffolding code is\n"
+ "written to <js-output>. The <name> is used as part of some of the identifiers\n"
+ "in those generated files.\n";
std::exit(EXIT_FAILURE);
}
@@ -708,16 +708,17 @@ SAL_IMPLEMENT_MAIN()
try
{
auto const args = rtl_getAppCommandArgCount();
- if (args < 3)
+ if (args < 4)
{
badUsage();
}
OUString name;
rtl_getAppCommandArg(0, &name.pData);
auto const cppPathname = getPathnameArgument(1);
- auto const jsPathname = getPathnameArgument(2);
+ auto const hppPathname = getPathnameArgument(2);
+ auto const jsPathname = getPathnameArgument(3);
rtl::Reference<TypeManager> mgr(new TypeManager);
- for (sal_uInt32 i = 3; i != args; ++i)
+ for (sal_uInt32 i = 4; i != args; ++i)
{
auto const & [ uri, primary ] = parseRegistryArgument(i);
try
@@ -906,7 +907,7 @@ SAL_IMPLEMENT_MAIN()
<< "::get);\n";
dumpRegisterFunctionEpilog(cppOut, n);
}
- cppOut << "EMSCRIPTEN_BINDINGS(unoembind_" << name << ") {\n";
+ cppOut << "void init_unoembind_" << name << "() {\n";
for (unsigned long long i = 0; i != n; ++i)
{
cppOut << " register" << i << "();\n";
@@ -933,6 +934,19 @@ SAL_IMPLEMENT_MAIN()
std::cerr << "Failed to write \"" << cppPathname << "\"\n";
std::exit(EXIT_FAILURE);
}
+ std::ofstream hppOut(hppPathname, std::ios_base::out | std::ios_base::trunc);
+ if (!hppOut)
+ {
+ std::cerr << "Cannot open \"" << hppPathname << "\" for writing\n";
+ std::exit(EXIT_FAILURE);
+ }
+ hppOut << "void init_unoembind_" << name << "();\n";
+ hppOut.close();
+ if (!hppOut)
+ {
+ std::cerr << "Failed to write \"" << hppPathname << "\"\n";
+ std::exit(EXIT_FAILURE);
+ }
std::ofstream jsOut(jsPathname, std::ios_base::out | std::ios_base::trunc);
if (!jsOut)
{