Git Product home page Git Product logo

Comments (5)

memsharded avatar memsharded commented on June 14, 2024 1

Proposing new detect_api.detect_xxx_compiler apis in #16092

from conan.

jcar87 avatar jcar87 commented on June 14, 2024

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.

ErniGH avatar ErniGH commented on June 14, 2024

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.

jwillikers avatar jwillikers commented on June 14, 2024

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.

memsharded avatar memsharded commented on June 14, 2024

#16092 merged for next Conan 2.3

from conan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.