Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lagom+CMake: Properly propagate dependencies for generated custom targets #15659

Merged
merged 4 commits into from
Oct 17, 2022

Conversation

ADKaster
Copy link
Member

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 lagom_bin
call serenity_generated_sources(${target}).

This enables the Xcode generator on macOS hosts, at least for Lagom.

@BuggieBot
Copy link
Member

Hello!

One or more of the commit messages in this PR do not match the SerenityOS code submission policy, please check the lint_commits CI job for more details on which commits were flagged and why.
Please do not close this PR and open another, instead modify your commit message(s) with git commit --amend and force push those changes to update this PR.

This matches serenity_lib, and consolidates the logic to strip Lib from
the front of the library name for the Lagom export name into one place
at the top of lagom_lib.
@ADKaster ADKaster force-pushed the xcode-friendly-generated-code branch from 06e1422 to 9bc3f96 Compare October 17, 2022 06:06
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 allows a developer who only wants to look at Lagom to have their
IDE find source files and headers properly.
Copy link
Member

@linusg linusg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks legit

@linusg linusg merged commit 5e2fe7e into SerenityOS:master Oct 17, 2022
@linusg linusg removed the 👀 pr-needs-review PR needs review from a maintainer or community member label Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants