1

请允许我Conan.io在我们的环境中使用两个问题:

我们正在开发汽车嵌入式软件。通常,这包括 COTS 库的集成,最重要的是用于通信和操作系统,如 AUTOSAR。这些在源代码中提供。典型的 uC 是 Renesas RH850、RL78 或来自NXPCypressInfinion等的类似设备。我们使用gnumake(MinGW)、Jenkins 进行 CI,并拥有自己的 EclipseCDT 发行版作为标准化 IDE。

我的第一个问题:

那些第 3 方组件通常充满了条件编译以进行正确的编译时配置。使用这种方法,代码和生成的二进制文件在大小和运行时行为方面都得到了优化。

除了这些组件之外,我们当然还有用于不同目的的内部可重用组件。这里的编译时配置不像上面的例子那么繁重,但仍然存在。

一句话:我们有很多编译时配置——建立一个基于 JFrog / Conan 的环境有什么好的方法?留在每个项目的来源?

与柯南的外部参照:

有没有办法维护来自柯南的交叉引用信息?我正在寻找类似“项目 xxx 正在使用库 lll 版本 vvv”的内容。这样,我们将能够在检测到问题时自动识别库的其他“用户”。

非常感谢,斯特凡

4

1 回答 1

1

Conan recipes are based on python and thus are very flexible, being able to implement any conditional logic that you might need.

As an example, the libxslt recipe in ConanCenter contains something like:

def build(self):
    self._patch_sources()
    if self._is_msvc:
        self._build_windows()
    else:
        self._build_with_configure()

And following this example, the autotools build contains code like:

def _build_with_configure(self):
        env_build = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows)
        full_install_subfolder = tools.unix_path(self.package_folder)
        # fix rpath
        if self.settings.os == "Macos":
            tools.replace_in_file(os.path.join(self._full_source_subfolder, "configure"), r"-install_name \$rpath/", "-install_name ")
        configure_args = ['--with-python=no', '--prefix=%s' % full_install_subfolder]
        if self.options.shared:
            configure_args.extend(['--enable-shared', '--disable-static'])
        else:
            configure_args.extend(['--enable-static', '--disable-shared'])

So Conan is able to implement any compile time configuration. That doesn't mean that you need to build always from sources. The parametrization of the build is basically:

  • Settings: for "project wide" configuration, like the OS or the architecture. Settings values typically have the same value for all dependencies
  • Options: for package specific configuration, like a library being static or shared. Every package can have its own value, different to other packages.

You can implement the variability model for a package with settings and options, build the most used binaries. When a given variant is requested, Conan will error saying there is not precompiled binary for that configuration. Users can specify --build=missing to build those from sources.

于 2020-10-12T20:19:34.203 回答