Comments (5)
Proposing new detect_api.detect_xxx_compiler
apis in #16092
from conan.
Hi @jwillikers - thanks for this feature request.
Bear in mind that for compilers that are not the system default, the profile needs to indicate where this compiler is located, otherwise Conan assumes that other tools just run with the system defaults as well. This is addressed by defining the tools.build:compiler_executables
conf, or with [buildenv]
vars where appropriate.
At the moment the detect_default_compiler()
functionality is biased towards locating a default given platform priorities, or influenced by the CC
/CXX
environment variables - I suppose the functionality that is missing here is: if we are given a compiler executable, please fill in the rest for me.
Or alternatively, the ability to alter the priority of detect_api.detect_default_compiler()
- at the moment it can already be influenced by externally to the profile file (by defining the CC environment variable when invoking Conan - this is harder to guarantee for dev machines, but it's useful for Docker images for example). However here as well we would need to ensure the profile defines the conf or env vars when used.
Otherwise, for the first option, I think the profile could look something along the lines of:
[settings]
{% set c_compiler = '/path/to/clang' %}
{% set cxx_compiler = '/path/to/clang++' %}
{% set compiler, version = detect_api.detect_compiler_settings(cxx_compiler) %}
compiler = {{compiler}}
compiler.version = {{version}}
# (derive other settings)
[conf]
tools.build:compiler_executables={ 'c':{{c_compiler}},'cxx':{{cxx_compiler}} }
from conan.
After the merge of #16092 an example of a profile would be the following:
[settings]
{% set c_compiler = 'clang' %}
{% set cxx_compiler = 'clang++' %}
{% set compiler, version, _ = detect_api.detect_clang_compiler(c_compiler) %}
compiler = {{compiler}}
compiler.version = {{detect_api.default_compiler_version(compiler, version)}}
compiler.libcxx = {{detect_api.detect_libcxx(compiler, version)}}
compiler.cppstd = {{detect_api.detect_cppstd(compiler, version)}}
os=Linux
arch=armv8
[conf]
tools.build:compiler_executables={ 'c':{{c_compiler}},'cxx':{{cxx_compiler}} }
from conan.
After the merge of #16092 an example of a profile would be the following:
[settings] {% set c_compiler = 'clang' %} {% set cxx_compiler = 'clang++' %} {% set compiler, version, _ = detect_api.detect_clang_compiler(c_compiler) %} compiler = {{compiler}} compiler.version = {{detect_api.default_compiler_version(compiler, version)}} compiler.libcxx = {{detect_api.detect_libcxx(compiler, version)}} compiler.cppstd = {{detect_api.detect_cppstd(compiler, version)}} os=Linux arch=armv8 [conf] tools.build:compiler_executables={ 'c':{{c_compiler}},'cxx':{{cxx_compiler}} }
Thanks! That's exactly what I'm looking for!
from conan.
#16092 merged for next Conan 2.3
from conan.
Related Issues (20)
- [question] How to dynamically set channel attribute ? HOT 1
- [bug] Bad UX when trying to fetch deactivated Artifactory
- [feature] Use `pluggy` to take plugin-managemant to the next level HOT 2
- [question] does conan command line tool automatically discover conanfile(s) in subfolders ? HOT 2
- [question] Alternative for cmake_paths generator HOT 8
- [feature] conan graph explain should mention if a missing prebuilt binary exists for a different recipe revision HOT 5
- [bug] Conan cache restore on non-existing file HOT 1
- [feature] Add a mode similar to "recipe_revision_mode"("full_mode"), that doesn't include PREV HOT 6
- [bug] sqlite3.OperationalError: no such column HOT 5
- [bug] build order produces not buildable build arguments in specific override scenario HOT 11
- [question] Can VirtualRunEnv/VirtualBuildEnv scripts generation be suppressed for deployers? HOT 5
- [bug] subsystem.Popen() should be called with a clean env HOT 11
- [bug] Cannot force generated Find*.cmake modules to fail from the packaged CMake modules
- [bug] `[platform_requires]` does not work with `ConanFile.dependencies` HOT 2
- [question] Strange handling of options in Conan 1.x create lock HOT 2
- How to reference packages such as iostream , limits etc HOT 5
- [bug] dependency collision text report does not match graph HOT 1
- [question] How to use MinGW as build profile on Windows? HOT 2
- [question] Is merging lockfiles pre 2.0 possible? HOT 3
- [question] How to build node from source (autotools, make) HOT 5
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.