Conan: premake generator output 'conanbuildinfo.lua' consider rename

Created on 13 Jan 2019  路  9Comments  路  Source: conan-io/conan

.lua is not an extension unique to premake, but instead a lua script file. I am currently working on a generator for another build system which uses .lua files, and the problem is obvious. I suggest conanbuildinfo.premake.lua. That's the convention I'll be using for the new generator.

  • [x] I've read the CONTRIBUTING guide.
  • [x] I've specified the Conan version, operating system version and any tool that can be relevant.
  • [x] I've explained the steps to reproduce the error or the motivation/use case of the question/suggestion.
low Build low whiteboard

Most helpful comment

I support 1 and 2.

3) Sadly, I would leave conan_cppflags, which is what we did in the gnu_make generator. The conclusion there was that the user will be the one to map CONAN_CPPFLAGS -> CXXFLAGS variable in their consuming makefile. I agreed that it was even more confusing to map the Conan variable cppflags to the build variable cxxflags implicitly. It's certainly debatable, but given the history, it was the decision that was made in that one.

There was some discussion about it here.
https://github.com/conan-io/docs/pull/955#issuecomment-442754327

All 9 comments

Make sense, but would be breaking, so assigning it for 2.0

Ok, well at the same time, might as well also consider the following.

The variable for preprocessor definitions has a rather unfortunate name:

https://github.com/conan-io/conan/blob/develop/conans/client/generators/premake.py#L37

conan_cppdefines{dep} = {{{deps.defines}}}\n
conan_cppflags{dep} = {{{deps.cppflags}}}\n

These two variables mean the following:

conan_cppdefines : "C Pre Processor Definitions"
conan_cppflags : "C Plus Plus Flags"

This variable "situation" is unspeakably bad for at least three reasons:

  1. No other generator names the variable cppdefines. The standard is simply defines.
  2. The conan variable it's being mapped from is deps.defines. So, someone actually mapped the standard variable defines to this unique variable name: cppdefines.
  3. The two variables happen to be directly adjacent to each other, as if to draw attention to their terribly inconsistent and confusing names.

It would be funny, if these names didn't matter much, but they do. When working on the gnu_make generator, I spent hours across many days being confused, misinterpreting, and then troubleshooting the inconsistent meanings of cpp and cxx between Conan and Make. It could affect others in the future.

Now, I think the premake generator was created and maintained by Conan team from day 1. So, all of this together makes me wonder why this variable was named so uniquely. I'm willing to believe there was some special reason cppdefines was used here instead of the normal defines. However, I hope it was just a historical oversight that hasn't been corrected yet.

I am aware of the unfortunate history of the naming of the variable cpp_info.cppflags, and that's something we'll all have to accept and live with long-term. But, the premake generator is relatively new (as far as being an official generator), so hopefully we can rename the variable from conan_cppdefines to simply conan_defines so this blemish doesn't have to stick around forever.

I think we could change this as the generator was released as experimental https://docs.conan.io/en/latest/reference/generators/premake.html

So we could tackle both problems even before 2.0 @memsharded

to summarize, I believe we should change:

  1. conanbuildinfo.lua -> conanbuildinfo.premake.lua
  2. conan_cppdefines -> conan_defines
  3. conan_cppflags -> conan_cxxflags
    as in GNU word, CPP usually stands for C PreProcessor instead of C++, and CPPFLAGS variable is used for C preprocessor flags instead of C++ compiler flags (which is CXXFLAGS). so, this may introduce lots of confusion for end users, let's use more obvious name.

I support 1 and 2.

3) Sadly, I would leave conan_cppflags, which is what we did in the gnu_make generator. The conclusion there was that the user will be the one to map CONAN_CPPFLAGS -> CXXFLAGS variable in their consuming makefile. I agreed that it was even more confusing to map the Conan variable cppflags to the build variable cxxflags implicitly. It's certainly debatable, but given the history, it was the decision that was made in that one.

There was some discussion about it here.
https://github.com/conan-io/docs/pull/955#issuecomment-442754327

@solvingj you meant leave conan_cppflags, right?

Yes, sorry, i have corrected my comment.

As a reference, other generators, most noticeable cmake does this conversion:

cppflags (conanfile) -> CONAN_CXX_FLAGS (conanbuildinfo.cmake)

So it might make sense to be consistent.

We have finally decided to change the mapping of cpp_info.cppflags, see #4336

Was this page helpful?
0 / 5 - 0 ratings

Related issues

niosHD picture niosHD  路  3Comments

uilianries picture uilianries  路  3Comments

mpdelbuono picture mpdelbuono  路  3Comments

Polibif picture Polibif  路  3Comments

tonka3000 picture tonka3000  路  3Comments