diff --git a/Meta/Lagom/CMakeLists.txt b/Meta/Lagom/CMakeLists.txt index b858ac62db..09559b85f9 100644 --- a/Meta/Lagom/CMakeLists.txt +++ b/Meta/Lagom/CMakeLists.txt @@ -291,6 +291,13 @@ lagom_lib(TimeZone timezone ) target_compile_definitions(LibTimeZone PRIVATE ENABLE_TIME_ZONE_DATA=$) +# LibIDL +# This is used by the WrapperGenerator so needs to always be built. +file(GLOB LIBIDL_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibIDL/*.cpp") +lagom_lib(IDL idl + SOURCES ${LIBIDL_SOURCES} +) + # Manually install AK headers install( DIRECTORY "${SERENITY_PROJECT_ROOT}/AK" @@ -548,7 +555,7 @@ if (BUILD_LAGOM) lagom_lib(Web web SOURCES ${LIBWEB_SOURCES} ${LIBWEB_SUBDIR_SOURCES} ${LIBWEB_SUBSUBDIR_SOURCES} ${LIBWEB_SUBSUBSUBDIR_SOURCES} ${LIBWEB_GENERATED_SOURCES} - LIBS LibMarkdown LibGemini LibGfx LibGL LibJS LibTextCodec LibWasm LibXML + LIBS LibMarkdown LibGemini LibGfx LibGL LibIDL LibJS LibTextCodec LibWasm LibXML ) generate_js_wrappers(LibWeb) endif() diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/CMakeLists.txt b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/CMakeLists.txt index 5c97766e2d..2f06043b2f 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/CMakeLists.txt +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/CMakeLists.txt @@ -1,8 +1,7 @@ -set(SOURCES "") - -lagom_tool(WrapperGenerator SOURCES +set(SOURCES IDLGenerators.cpp - IDLParser.cpp - main.cpp) + main.cpp +) +lagom_tool(WrapperGenerator LIBS LibIDL) target_compile_options(WrapperGenerator PUBLIC -g) diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLGenerators.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLGenerators.cpp index 410c27c34d..5e5def3832 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLGenerators.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLGenerators.cpp @@ -7,10 +7,10 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include "IDLTypes.h" #include #include #include +#include Vector s_header_search_paths; diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/main.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/main.cpp index d97574a12a..08d54280c0 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/main.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/main.cpp @@ -7,12 +7,12 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include "IDLParser.h" -#include "IDLTypes.h" #include #include #include #include +#include +#include extern Vector s_header_search_paths; diff --git a/Userland/Libraries/CMakeLists.txt b/Userland/Libraries/CMakeLists.txt index cc6f311315..dde02378b1 100644 --- a/Userland/Libraries/CMakeLists.txt +++ b/Userland/Libraries/CMakeLists.txt @@ -26,6 +26,7 @@ add_subdirectory(LibGL) add_subdirectory(LibGPU) add_subdirectory(LibGUI) add_subdirectory(LibHTTP) +add_subdirectory(LibIDL) add_subdirectory(LibIMAP) add_subdirectory(LibImageDecoderClient) add_subdirectory(LibIPC) diff --git a/Userland/Libraries/LibIDL/CMakeLists.txt b/Userland/Libraries/LibIDL/CMakeLists.txt new file mode 100644 index 0000000000..6c36da7885 --- /dev/null +++ b/Userland/Libraries/LibIDL/CMakeLists.txt @@ -0,0 +1,6 @@ +set(SOURCES + IDLParser.cpp +) + +serenity_lib(LibIDL idl) +target_link_libraries(LibIDL LibCore) diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLParser.cpp b/Userland/Libraries/LibIDL/IDLParser.cpp similarity index 99% rename from Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLParser.cpp rename to Userland/Libraries/LibIDL/IDLParser.cpp index d8cad15a66..7b4d4ba919 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLParser.cpp +++ b/Userland/Libraries/LibIDL/IDLParser.cpp @@ -805,7 +805,7 @@ void Parser::parse_non_interface_entities(bool allow_interface, Interface& inter consume_whitespace(); } -void resolve_typedef(Interface& interface, NonnullRefPtr& type, HashMap* extended_attributes = {}) +static void resolve_typedef(Interface& interface, NonnullRefPtr& type, HashMap* extended_attributes = {}) { if (is(*type)) { auto parameterized_type = static_ptr_cast(type); @@ -826,7 +826,7 @@ void resolve_typedef(Interface& interface, NonnullRefPtr& type, HashMapvalue.extended_attributes) extended_attributes->set(attribute.key, attribute.value); } -void resolve_parameters_typedefs(Interface& interface, Vector& parameters) +static void resolve_parameters_typedefs(Interface& interface, Vector& parameters) { for (auto& parameter : parameters) resolve_typedef(interface, parameter.type, ¶meter.extended_attributes); diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLParser.h b/Userland/Libraries/LibIDL/IDLParser.h similarity index 98% rename from Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLParser.h rename to Userland/Libraries/LibIDL/IDLParser.h index a735537f82..9cf488513b 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLParser.h +++ b/Userland/Libraries/LibIDL/IDLParser.h @@ -9,9 +9,9 @@ #pragma once -#include "IDLTypes.h" #include #include +#include namespace IDL { diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLTypes.h b/Userland/Libraries/LibIDL/Types.h similarity index 100% rename from Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLTypes.h rename to Userland/Libraries/LibIDL/Types.h