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
Add Toolchain Class for GnuMake #7430
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking very good, keep going. I am fine if the first iteration is basically this, it doesn't need to go much further to be included.
Did some minor changes in #7435 that will affect this PR, please update when it is merged. |
…dard make variables
…d unit test and added cases
@memsharded I've added proper handling to a bunch of important flags. Please review the diff of the latest commit if you can to get a feel for it. Let me know if you see any glaring issue. |
Just found issues, this is not ready yet. |
… build exe,shared,static binaries. Refactor test structure to be more like generator test.
Recent test issues resolved. Taking out of draft status for CI to run. |
For future reference, this toolchain features a Make function called These Make functions automatically appends |
Added PR for docs: conan-io/docs#1808 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good, but I would try to have the generated toolchain files simpler. Users when reading those should be very easy and clear what the toolchain is doing, without really needing to mentally evaluate and understand a lot of conditionals that will evaluate always to the same thing.
What do you think @solvingj?
@@ -1 +1,2 @@ | |||
|
|||
from .make import MakeToolchain |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this import necessary? We don't use this in the codebase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seemed it was necessary at the time. I will try to remove and see if it still works.
CONAN_TC_DEFINES += NDEBUG | ||
endif | ||
|
||
ifeq ($(CONAN_TC_SET_LIBCXX),True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is better to simplify this, by adding the condition in the template:
- Do not need to define a
CONAN_TC_SET_LIBCXX
var. - Use
set_libcxx
as a template condition to render or not certain parts of the template. - The idea is that if not setting libcxx, then absolutely nothing will appear in the toolchain file, and it will be simpler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed earlier I copied most of the patterns from the CMake toolchain for this first iteration.
endif | ||
else ifeq ($(CONAN_TC_COMPILER),sun-cc) | ||
ifeq ($(CONAN_TC_LIBCXX),libCstd) | ||
CONAN_TC_CXXFLAGS += -library=Cstd++ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something similar to the mapping from the CONAN_TC_LIBCXX to the final flag to be passed. It is likely that this is already somewhere in python. So maybe the final toolchain file could be something like just a single line defining the -library=xxx
value, but without conditions at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same answer as above. Copied patterns from Cmake. Indeed, if we can release this first iteration, we can refactor the common code out together as one concerted initiative.
The idea is that this will be definitely possible, but controlled by the recipe toolchain, not at the build system level. Recipe toolchain defines if the vars are automatically injected or not, if certain behaviors (fpic, libcxx) are used or not, etc. My feeling is that it is easier to control behavior, to introduce opt-ins/outs and fixes at the python toolchain() level than in the build system .mak files. It is also more transparent, e.g. if the |
Per @memsharded discussion on slack, we have a lot of feedback on the pattern of requiring a call to a macro in the build system to activate something in the files conan generated for the build system. The feedback is strong that transparency is most desirable, and calling the function explicitly is unacceptable in many cases. I understand and recognize that feedback. So, I think the ability to make things transparent should always be a top priority. However, I think there should always be a reasonable way to opt-out of the full transparency, so I think the macros should always be available as an option. @memsharded suggestion to add a toolchain option which sets the default activation status in the generated file makes sense to me, and I agree that in most OSS recipes, this would probably be |
As discussed, even if there are some things to change and improve, lets merge and release this as a first iteration, and start gathering feedback to keep this new experimental feature moving forward. |
Changelog: Feature: Add an experimental toolchain for gnu make.
Docs: conan-io/docs#1808
Progresses #7280.
develop
branch, documenting this one.Note: By default this PR will skip the slower tests and will use a limited set of python versions. Check here how to increase the testing level by writing some tags in the current PR body text.