Comments (5)
Just to check my understanding: I need to get package location (where include and lib are stored) so I can prepend CFLAGS and LDFLAGS when doing ./configure - so autotools can find it? Also, what I have to set --prefix to?
Well, we already have the AutotoolsDeps
generator, which is very close what you are trying to do, if I understand correctly. It is true that it doesn't work for Windows yet, but it does in Linux. Please check https://docs.conan.io/2/reference/tools/gnu/autotoolsdeps.html and try it, to see how it works.
You have the implementation here if you want to start from there: https://github.com/conan-io/conan/blob/develop2/conan/tools/gnu/autotoolsdeps.py
Also, what I have to set --prefix to?
The --prefix
is for the current installation of the current package, isn't it? Note that you can also use bare copy()
inside the package()
method, very often it is easier than implementing installation steps, depending on the project.
In the case of the Autotools
helper, it is using DESTDIR
for this purpose:
conan/conan/tools/gnu/autotools.py
Line 84 in 66ef385
from conan.
Hi @nikoladsp
Thanks for your question.
The responsibility of extracting the information from dependencies and generating the necessary files for the build systems to locate the dependencies is the one of generators()
and the generate()
method. You can experiment a bit with:
def generate(self):
deps = CMakeDeps(self) # or deps = MSBuildDeps(self), or deps = PkgConfigDeps(self)...
deps.generate()
And see how it works.
Then you need to do your own mapping from dependencies to your specific build system, you can access the dependencies via:
def generate(self):
for require, dep in self.dependencies.host.items():
dep.package_folder
dep.cpp_info.includedirs
dep.cpp_info.libdirs
...
Check https://docs.conan.io/2/reference/conanfile/methods/generate.html#conan-conanfile-model-dependencies for more information about dependencies and cpp_info
in https://docs.conan.io/2/reference/conanfile/methods/generate.html#dependencies-cpp-info-interface
Don't worry about the shared
one, the self.dependencies
will contain the information of the specific packages that have been resolved, if you specified shared
, it will be pointing to the shared binaries of the dependencies.
Then, when you know how to generate the files that you want, if you want to reuse it, the recommendation would be to put the code in a common python_requires
and reuse it from there in all recipes that you want.
About the "libwebp/1.4.0": {"shared": True},
definition of "shared=True" inside the recipes, please not that in general, it is more robust and easier to specify those things in profile
files instead. The reason is that there might be other recipes competing for having shared=False
, and the first one to specify it wins, so the only guarantee to have them as shared is to specify that in the profile files.
Please let me know if this helps.
from conan.
Many thanks for your answer - I will try it later today or tomorrow morning.
Just to check my understanding: I need to get package location (where include and lib are stored) so I can prepend CFLAGS and LDFLAGS when doing ./configure - so autotools can find it? Also, what I have to set --prefix
to?
Kindest regards
from conan.
I did play a bit with suggested readings and realized that maybe I should of ask: "Is it possible to build package with autotools but in such way it can be consumed by CMake"? Majority of packages I am using are available via Conan recipes - but there will be couple of exceptions to this rule. Shall I make custom generate() method based on say PkgConfigDeps or completely custom generator that will help other team members to consume packages from their CMake projects?
from conan.
I did play a bit with suggested readings and realized that maybe I should of ask: "Is it possible to build package with autotools but in such way it can be consumed by CMake"?
Absolutely. Conan packages are intended to be created with any build system and be consumed with any other build system. All packages in ConanCenter use different build systems, and there are already tons of packages using CMake consuming packages built with autotools, meson, etc.
Shall I make custom generate() method based on say PkgConfigDeps or completely custom generator that will help other team members to consume packages from their CMake projects?
The key here is the package_info()
and the cpp_info
abstractions. As long as it is filled correctly, the generators on the consumers side will be able to map that information to their respective build systems. PkgConfigDeps
generates .pc
files from the information in package_info()
of its depenencies, and CMakeDeps
generates .cmake
files from exactly the same information of the dependencies.
If using CMake, they might be able to use the built-in CMakeToolchain
and CMakeDeps
, as recommended in the documentation, they can achieve transparent integration (no need to modify their CMakeListst.xt
to add Conan-specific things, just using standard CMake)
from conan.
Related Issues (20)
- [bug] unable to install openssl/3.2.1 recipe with conan version: 2.0.17 HOT 4
- [question] How to Conan download binaries and find binaries HOT 5
- Cache Gets wrong package[bug] HOT 8
- How can I read CPPFLAGS HOT 17
- [question] Recommended way of calling conan from python program HOT 8
- [question] Problem deploying oneMKL prepackaged binaries in custom package HOT 21
- [bug] tools.build:compiler_executables won't work with Meson due to spaces in the compiler path HOT 5
- Cannot install qt 6.7.0 prebuilt binary on Windows HOT 5
- [question] How to use editable library with cmake's conan provider file HOT 2
- [bug] `qt` install broken since 2.3.0 HOT 2
- [question] How can I not export sources when creating a package and publishing it HOT 3
- [question] Compatibility Issues HOT 5
- Conan CLI: Add option to conan remove to just skip without error if package does not exist HOT 2
- [feature] expose CMakeToolchain conf to be able to set CMAKE_GENERATOR_INSTANCE HOT 1
- conan export-pkg command not passing --version to the recipe with Conan 2.2.3 HOT 10
- [question] Revision mismatch between OSes HOT 1
- [bug] detect_api.detect_clang_compiler provides the minor version of the compiler HOT 4
- SSLError: HTTPSConnectionPool HOT 2
- [question] "control" cmake include dir variable HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from conan.