1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-29 05:07:45 +00:00

Lagom+CMake: Propagate dependencies for generated custom targets

We have logic for serenity_generated_sources which works well for source
files that are specified in GENERATED_SOURCES prior to calling
serenity_lib or serenity_bin. However, code generated with
invoke_generator, and the LibWeb generators do not always follow the
pattern of the IDL and GML files.

For the LibWeb generators, we can just add_dependencies to LibWeb at the
time we declare the generate_Foo custom target. However for LibLocale,
LibTimeZone, and LibUnicode, we don't have the name of the target
available, so export the name in a variable to set into
GENERATED_SOURCES.

To make this work for Lagom, we need to make sure that lagom_lib and
serenity_bin in Lagom/CMakeLists.txt call serenity_generated_sources on
the target.

This enables the Xcode generator on macOS hosts, at least for Lagom.
This commit is contained in:
Andrew Kaster 2022-10-16 23:49:52 -06:00 committed by Linus Groh
parent 8160b53228
commit b8e51425e9
6 changed files with 22 additions and 10 deletions

View file

@ -224,6 +224,7 @@ function(lagom_lib target_name fs_name)
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN "*.h"
)
serenity_generated_sources(${target_name})
endfunction()
function(lagom_test source)
@ -254,6 +255,7 @@ function(serenity_bin name)
INCLUDES #
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
serenity_generated_sources(${name})
endfunction()
function(serenity_lib name fs_name)
@ -372,9 +374,11 @@ if (BUILD_LAGOM)
list(APPEND LIBWEBVIEW_GENERATED_SOURCES WebContent/WebContentClientEndpoint.h)
list(APPEND LIBWEBVIEW_GENERATED_SOURCES WebContent/WebContentServerEndpoint.h)
set(GENERATED_SOURCES ${LIBWEBVIEW_GENERATED_SOURCES})
lagom_lib(LibWebView webview
SOURCES ${LIBWEBVIEW_SOURCES} ${LIBWEBVIEW_GENERATED_SOURCES}
LIBS LibGUI LibWeb)
unset(GENERATED_SOURCES)
endif()
# FIXME: Excluding arm64 is a temporary hack to circumvent a build problem