summaryrefslogtreecommitdiff
path: root/solenv
diff options
context:
space:
mode:
authorSarper Akdemir <sarper.akdemir.extern@allotropia.de>2023-08-07 14:41:32 +0300
committerSarper Akdemir <sarper.akdemir.extern@allotropia.de>2023-09-18 19:59:57 +0200
commit841f898574affb526a516224d7c3db9b137ea62b (patch)
treeb26718c1a063f47b2a75eb939b4fd0d55f90f79f /solenv
parent971425f9b7613183a565e9b4ec5792b3f67bb133 (diff)
JavaScript uno bindings for WASM with Embind - first cut
A rough implementation of uno bindings for LOWA using embind. Adds new parameter '-W' to cppumaker to generate _embind.cxx files alongside .hdl & .hpp. For usage examples see static/README.wasm.md Change-Id: Iee5d05e37bfba8e101c08212b15c05f7f2fa6c33 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156273 Tested-by: Jenkins Reviewed-by: Sarper Akdemir <sarper.akdemir.extern@allotropia.de>
Diffstat (limited to 'solenv')
-rw-r--r--solenv/gbuild/UnoApi.mk17
-rw-r--r--solenv/gbuild/UnoApiTarget.mk18
-rw-r--r--solenv/gbuild/platform/unxgcc.mk14
3 files changed, 46 insertions, 3 deletions
diff --git a/solenv/gbuild/UnoApi.mk b/solenv/gbuild/UnoApi.mk
index f396642901fe..9ed314703f33 100644
--- a/solenv/gbuild/UnoApi.mk
+++ b/solenv/gbuild/UnoApi.mk
@@ -36,6 +36,8 @@ define gb_UnoApi_add_idlfiles
$(call gb_UnoApiTarget_add_idlfiles,$(1),$(2),$(3))
$(call gb_UnoApiHeadersTarget_add_headerfiles,$(1),$(2),$(addsuffix .hpp,$(3)))
$(call gb_UnoApiHeadersTarget_add_headerfiles,$(1),$(2),$(addsuffix .hdl,$(3)))
+$(if $(filter EMSCRIPTEN, $(OS)),\
+ $(call gb_UnoApiHeadersTarget_add_embind,$(1),$(2),$(addsuffix _embind,$(3))))
endef
@@ -69,4 +71,19 @@ $(call gb_UnoApiTarget_set_reference_rdbfile,$(1),$(2))
endef
+ifeq ($(OS),EMSCRIPTEN)
+$(eval $(call gb_StaticLibrary_StaticLibrary,unoembind))
+$(eval $(call gb_StaticLibrary_set_include,unoembind,\
+ $$(INCLUDE) \
+))
+$(eval $(call gb_StaticLibrary_use_api,unoembind,\
+ offapi \
+ udkapi \
+))
+$(eval $(call gb_StaticLibrary_add_exception_objects,unoembind,\
+ static/source/unoembindhelpers/PrimaryBindings\
+))
+
+endif
+
# vim: set noet sw=4 ts=4:
diff --git a/solenv/gbuild/UnoApiTarget.mk b/solenv/gbuild/UnoApiTarget.mk
index 67e8bccca906..7c52ecc81f1e 100644
--- a/solenv/gbuild/UnoApiTarget.mk
+++ b/solenv/gbuild/UnoApiTarget.mk
@@ -151,7 +151,8 @@ $(call gb_UnoApiHeadersTarget_get_real_comprehensive_target,%) : \
$(gb_UnoApiHeadersTarget_CPPUMAKERDEPS)
$(call gb_Output_announce,$*,$(true),HPC,3)
$(call gb_Trace_StartRange,$*,HPC)
- $(call gb_UnoApiHeadersTarget__command,$@,$*,$(call gb_UnoApiHeadersTarget_get_comprehensive_dir,$*),-C)
+ $(call gb_UnoApiHeadersTarget__command,$@,$*,$(call gb_UnoApiHeadersTarget_get_comprehensive_dir,$*), \
+ -C $(if $(filter EMSCRIPTEN, $(OS)), -W))
$(call gb_Trace_EndRange,$*,HPC)
$(call gb_UnoApiHeadersTarget_get_real_target,%) : \
@@ -231,6 +232,21 @@ define gb_UnoApiHeadersTarget_add_headerfiles
$(foreach hdr,$(3),$(call gb_UnoApiHeadersTarget_add_headerfile,$(1),$(2)/$(hdr)))
endef
+# call gb_UnoApiEmbindTarget_add_embind,unoapi,directory,headerfilenames
+define gb_UnoApiHeadersTarget_add_embind
+$(if $(filter offapi udkapi, $(1)),\
+ $(foreach hdr,$(3),$(eval $(call gb_UnoApiEmbindTarget__add_embind,$(1),$(2),$(hdr)))))
+endef
+
+# CaptionEscapeDirection contains "auto" as a variable name.. so exclude that
+define gb_UnoApiEmbindTarget__add_embind
+$(if $(filter-out CaptionEscapeDirection_embind, $(3)),\
+$(eval $(call gb_StaticLibrary_add_generated_exception_objects,unoembind,\
+ UnoApiHeadersTarget/$(1)/comprehensive/$(2)/$(3) \
+)))
+
+endef
+
define gb_UnoApiHeadersTarget__use_api_for_target
$(call gb_UnoApiHeadersTarget_get_$(3),$(1)) : $(call gb_UnoApiTarget_get_target,$(2))
$(call gb_UnoApiHeadersTarget_get_$(3),$(1)) : UNOAPI_DEPS += -X$(call gb_UnoApiTarget_get_target,$(2))
diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk
index bfb860a41fc2..29adbf9dc42f 100644
--- a/solenv/gbuild/platform/unxgcc.mk
+++ b/solenv/gbuild/platform/unxgcc.mk
@@ -191,8 +191,18 @@ endef
define gb_LinkTarget__command_staticlink
$(call gb_Helper_abbreviate_dirs,\
rm -f $(1) && \
- $(if $(filter EMSCRIPTEN,$(OS)),unset PYTHONWARNINGS ;) \
+ $(if $(filter EMSCRIPTEN,$(OS)),unset PYTHONWARNINGS ; \
+ RESPONSEFILE=$(call gb_var2file,$(shell $(gb_MKTEMP)), \
+ $(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
+ $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
+ $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \
+ $(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_target,$(object))) \
+ $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
+ $(foreach object,$(GENNASMOBJECTS),$(call gb_GenNasmObject_get_target,$(object))) \
+ $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),$(shell cat $(extraobjectlist)))) && ) \
$(gb_AR) $(gb_LTOPLUGINFLAGS) -rsu $(1) \
+ $(if $(filter EMSCRIPTEN, $(OS)), \
+ @$${RESPONSEFILE} $(if $(findstring s,$(MAKEFLAGS)),2> /dev/null); rm $${RESPONSEFILE},\
$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
$(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \
@@ -200,7 +210,7 @@ $(call gb_Helper_abbreviate_dirs,\
$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
$(foreach object,$(GENNASMOBJECTS),$(call gb_GenNasmObject_get_target,$(object))) \
$(foreach extraobjectlist,$(EXTRAOBJECTLISTS),@$(extraobjectlist)) \
- $(if $(findstring s,$(MAKEFLAGS)),2> /dev/null))
+ $(if $(findstring s,$(MAKEFLAGS)),2> /dev/null)))
endef
define gb_LinkTarget__command