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

Gather resource dependencies by executing corrade-rc instead of a nasty CMake regex #131

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mosra
Copy link
Owner

@mosra mosra commented Apr 3, 2022

(Oh come on, what happened lately that my every attempt to implement anything results in stashing the unfinished work to a WIP branch because I hit a wall?!)

This will allow for much easier modifications to the resource file format, such as shorthand lists or directory globbing. Or to projects that use a custom buildsystem (such as #114) and thus would have to reimplement that nasty regex themselves to get proper dependency tracking in incremental builds.

But of course it would work only in projects using Corrade and not in Corrade itself! Because guess what, at the time I need to gather dependencies, I don't yet have the corrade-rc executable built. So I can't use it in execute_process(), but only later in add_custom_command(), which means it can't know the dependency tree until it actually starts building stuff. And that's quite shit. TODOs / alternatives:

  • There's a DEPFILE option in add_custom_command() which could solve this, but its syntax is far more than just a list of files, its support is sparse, and mostly just in newer CMakes. So a no-go.
  • Or I would need to keep the nasty regex in there for when using corrade_add_resource() right inside Corrade, and switch to the clean option only in dependent projects, but that doesn't fix the problem of having to maintain two different parsers for the same thing which I wanted to avoid in the first place. Wouldn't work when CMake subprojects are involved.
    • Or maybe restricting the use in Corrade itself to just something that doesn't make the CMake regex too nasty? Like, just the long version, no globs, ... Feels strange tho. Neither this would work when CMake subprojects are involved.
  • This also needs a changelog entry

And not by reimplementing the conf file parsing with CMake. This will
allow for much easier modifications to the resource file format, such as
shorthand lists or directory globbing.

TODO: but of course it would work only in projects using Corrade and not
  in Corrade itself! Because guess what, at the time I need to gather
  dependencies, I don't yet have the corrade-rc executable built. So I
  can't use it in execute_process(), but only later in
  add_custom_command(), which means it can't know the dependency tree
  until it actually starts building stuff and that's quite shit.
TODO: there's a DEPFILE option which could solve this, but its support
  is sparse and mostly just in newer CMakes. So a no-go.
TODO: or I would need to keep the nasty regex in there for when using
  corrade_add_resource() right inside Corrade, and switch to the clean
  option only in dependent projects, but that doesn't fix the problem of
  having to maintain two different parsers for the same thing.
TODO: this also needs a changelog entry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In progress
Development

Successfully merging this pull request may close these issues.

1 participant