conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
8.29k stars 982 forks source link

[feature] provide a more advanced autotools_layout() to the level of cmake for autotools package supporting out-of-tree build #17315

Open hpe-ykoehler opened 1 week ago

hpe-ykoehler commented 1 week ago

What is your suggestion?

autotools package support building outside of the source tree folder using the approach

cd $build ../configure && make && ...

for those autotools package supporting this mode a autotools_layout() function should exists with the same function as cmake_layout as to set the build_folder directly in the recipe of via a settings set in the conan profile.

Have you read the CONTRIBUTING guide?

memsharded commented 1 week ago

Thanks for the suggestion @hpe-ykoehler

In order to consider this feature, it would be necessary to have some evidence of autotools projects supporting this flow. Up to my knowledge the vast majority of projects will work building only in-source. Then, the best way to proceed is to define a very simple example, like using conan new autotools_lib, and first write manually a layout() method that implements the necessary layout, and then it can be taken from there and abstract that layout() method into its own helper if necessary.

Could you please provide:

Thanks for your feedback.

hpe-ykoehler commented 1 week ago

The out-of-source build feature (also referred to as parallel build trees) of autotools/automake is not new.

You can find many articles about it on Google. And you can pull recent autotools based package to try it in a shell directly.

As with anything, some package may not use this function and may write build system file that make it incompatible, similar things can also be done in CMake (but it is a little harder to achieve thanks to the higher level language used).

memsharded commented 2 days ago

I have been checking this. Autotools helpers already have the basic_layout() that locates the "build" folder outside of the source folder. This layout will create a build-release or build-debug folders for the build by default, and can also be instructed to create a different one with --output-folder=myfolder. You can cd to that folder and issue the commands for the build.

The cmake_layout() has a build_folder argument because its logic is way more complex than the one for basic_layout(). For an autotools project, users can directly do:

def layout(self):
     self.folders.build = "myfolder"