1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 03:47:34 +00:00

LibWeb: Support generating IDL namespaces

These are similar to prototypes and constructors in that they will now
be lazily instantiated when they are first requested.
This commit is contained in:
Timothy Flynn 2023-03-15 10:02:04 -04:00 committed by Tim Flynn
parent 61ecdbca54
commit 020c2b59c4
5 changed files with 269 additions and 24 deletions

View file

@ -76,20 +76,33 @@ endfunction()
function (generate_js_bindings target)
set(LIBWEB_INPUT_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}")
function(libweb_js_bindings class)
cmake_parse_arguments(PARSE_ARGV 1 LIBWEB_BINDINGS "ITERABLE;GLOBAL" "" "")
cmake_parse_arguments(PARSE_ARGV 1 LIBWEB_BINDINGS "NAMESPACE;ITERABLE;GLOBAL" "" "")
get_filename_component(basename "${class}" NAME)
set(BINDINGS_SOURCES
"Bindings/${basename}Constructor.h"
"Bindings/${basename}Constructor.cpp"
"Bindings/${basename}Prototype.h"
"Bindings/${basename}Prototype.cpp"
)
set(BINDINGS_TYPES
constructor-header
constructor-implementation
prototype-header
prototype-implementation
)
# FIXME: Instead of requiring a manual declaration of namespace bindings, we should ask BindingsGenerator if it's a namespace
if (LIBWEB_BINDINGS_NAMESPACE)
set(BINDINGS_SOURCES
"Bindings/${basename}Namespace.h"
"Bindings/${basename}Namespace.cpp"
)
set(BINDINGS_TYPES
namespace-header
namespace-implementation
)
else()
set(BINDINGS_SOURCES
"Bindings/${basename}Constructor.h"
"Bindings/${basename}Constructor.cpp"
"Bindings/${basename}Prototype.h"
"Bindings/${basename}Prototype.cpp"
)
set(BINDINGS_TYPES
constructor-header
constructor-implementation
prototype-header
prototype-implementation
)
endif()
# FIXME: Instead of requiring a manual declaration of iterable bindings, we should ask BindingsGenerator if it's iterable
if(LIBWEB_BINDINGS_ITERABLE)