premake-core icon indicating copy to clipboard operation
premake-core copied to clipboard

Discuss about "Usage API"

Open alex-rass-88 opened this issue 10 months ago • 5 comments

After several experiments with the new API, I noticed that 'uses' are not inherited another 'uses'.

We have app, libA, libB, libC. libA uses libC, libB uses libC. app uses libA and libB. We have link error, because libC not found.

I have no problem adding another 'uses "libC"' to the app. But it may seem counterintuitive to some. In CMake, link inheritance is recursive. In premake-usage project, 'uses' are recursive.

Otherwise, the new Usage API is very good, as it seems to me.

If anyone has any suggestions, then let's discuss.

alex-rass-88 avatar Mar 04 '25 15:03 alex-rass-88

Would you be able to produce a minimum sample? By default, yes, uses are not recursive. This is intentional. However, specifying a uses in usage "PUBLIC" will ensure that it is propagated to any consumers. I'm also working on writing up a larger piece of documentation at the moment, but effectively, what you are trying to do can be done with:

project "A"
  usage "INTERFACE"
    links "A"

project "B"
  usage "PUBLIC"
    uses { "A" }
  usage "INTERFACE"
    links { "B" }

project "C"
  uses { "B" }

nickclark2016 avatar Mar 04 '25 15:03 nickclark2016

I understood. I used 'uses' outside of the 'usage' block. That's why it wasn't linked. It would be necessary to reflect this point in the documentation. Thanks for the reply.

alex-rass-88 avatar Mar 04 '25 17:03 alex-rass-88

See #2438. It is an open PR that will address adding documentation.

nickclark2016 avatar Mar 05 '25 03:03 nickclark2016

I updated my project, which used premake-usage, and it works fine. According to my measurements, the solution generation time has been reduced by about 15-20% compared to premake-usage.

alex-rass-88 avatar Mar 06 '25 07:03 alex-rass-88

Glad to hear a reduction in generation time. This is a pretty naive implementation that I have here, so hopefully we can continue improving performance over time with it.

nickclark2016 avatar Mar 14 '25 00:03 nickclark2016