当前位置: 首页 > 知识库问答 >
问题:

Bazel RULES_FOREIGN_CC-在构建时使用从源代码构建的cmake二进制文件

丌官晨
2023-03-14
rules_foreign_cc_dependencies(
    ["//:built_cmake_toolchain"],
    False,
)
toolchain(
    name = "built_cmake_toolchain",
    exec_compatible_with = [
        "@bazel_tools//platforms:osx",
        "@bazel_tools//platforms:x86_64",
    ],
    toolchain = "@rules_foreign_cc//tools/build_defs/native_tools:built_cmake",
    toolchain_type = "@rules_foreign_cc//tools/build_defs:cmake_toolchain",
)

谢了!

共有1个答案

田普松
2023-03-14

您可能还需要用于Linux平台的ninja工具。我在这个配置上很幸运:

工作空间

rules_foreign_cc_dependencies(
    native_tools_toolchains = [
        ":built_cmake_toolchain_linux",
        ":built_cmake_toolchain_osx",
        ":built_ninja_toolchain_linux",
        ":built_ninja_toolchain_osx",
    ],
    register_default_tools = False,
)

建造


toolchain(
    name = "built_cmake_toolchain_linux",
    exec_compatible_with = [
        "@bazel_tools//platforms:linux",
        "@bazel_tools//platforms:x86_64",
    ],
    toolchain = "@rules_foreign_cc//tools/build_defs/native_tools:built_cmake",
    toolchain_type = "@rules_foreign_cc//tools/build_defs:cmake_toolchain",
)

toolchain(
    name = "built_cmake_toolchain_osx",
    exec_compatible_with = [
        "@bazel_tools//platforms:osx",
        "@bazel_tools//platforms:x86_64",
    ],
    toolchain = "@rules_foreign_cc//tools/build_defs/native_tools:built_cmake",
    toolchain_type = "@rules_foreign_cc//tools/build_defs:cmake_toolchain",
)

toolchain(
    name = "built_ninja_toolchain_linux",
    exec_compatible_with = [
        "@bazel_tools//platforms:linux",
        "@bazel_tools//platforms:x86_64",
    ],
    toolchain = "@rules_foreign_cc//tools/build_defs/native_tools:built_ninja",
    toolchain_type = "@rules_foreign_cc//tools/build_defs:ninja_toolchain",
)

toolchain(
    name = "built_ninja_toolchain_osx",
    exec_compatible_with = [
        "@bazel_tools//platforms:osx",
        "@bazel_tools//platforms:x86_64",
    ],
    toolchain = "@rules_foreign_cc//tools/build_defs/native_tools:built_ninja",
    toolchain_type = "@rules_foreign_cc//tools/build_defs:ninja_toolchain",
)
 类似资料:
  • 问题内容: 我是cmake的新手,我只用它在我的ubuntu linux上安装opencv。这是我运行的命令: 然后它返回错误: 我当前的目录/ home / jinha / OCV / build / opencv确实包含CMakefiles.txt文件,所以这不是问题。我试图在命令中更改目录,但是它们都引发相同的错误。我看到了有关此问题的其他答案,因此,每次运行命令之前,我都会擦除CMakeF

  • 原文:Building from source 此处给出了从源代码构建NumPy的一般概述,以及单独给出的特定平台的详细说明。 先决条件 构建 NumPy 需要安装以下软件: Python 2.7.x、3.4.x 的版本或是最新版本。 在Debian和其衍生版本(Ubuntu)中需要:python,python-dev(或python3-dev)。 在Windows上:www.python.org

  • 我想尝试对java.lang中的java库进行更改,最终还可能对其他包进行更改。这意味着不使用,我希望至少能够分离出java.lang并编译它们。 如果使用rt.jar,则不可能在java.lang中编辑类的源代码,因为它们已经在rt.jar中找到了。 我在Mercurial中找到了repo:http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/tip/s

  • 我想从OkHttp库源代码构建一个jar文件,以便在我的android应用程序中使用快照版本。我不知道怎么做。 欢迎任何帮助。谢了。

  • 所以,我想创建一个新的BouncyCastle 1.47罐子,它不是OSGi罐子。我已经从他们的站点下载了源代码(JDK1.5-1.7的“JCE with provider and lightweight API”下的bcprov-jdk15on-147.tar.gz文件),但是当我提取它和源代码时,我看不到构建脚本。看看他们的维基,他们说这应该是一个使用ant的简单案例。 以前有人这样做过吗,能

  • 当我运行命令“npm install robotjs-g”时,它会给出这个错误。 RobotJS@0.5.1安装C:\users\ehsan\appdata\roaming\npm\node_modules\RobotJS预构建-安装节点-gyp重建 prebuild-install WARN install找不到预构建的二进制文件(target=8.11.3runtime=node arch=x