mirror of
https://github.com/bazel-contrib/rules_foreign_cc
synced 2024-12-04 08:02:31 +00:00
9a261f7993
* Add crosstool example; does not work with cmake rule yet the code is taken from Bazel test data (bazel_toolchain_test_data) * Make crosstool compilation of cmake_external + cc_binary work To build example, cd examples/cmake_crosstool bazel build //:libhello_test Changes: 1) Initially suggested in #124: put $EXT_BUILD_ROOT on path, so that relative paths can be resolved by CMake 2) Toolchain tools are references as relative paths, and they themselves refer to external repository with external/ prefix. This will not work with CMake, as CMake also perform compiler tests and the build is performed in some temp directory. We need to convert to absolute paths. I did a trick with checking of $EXT_BUILD_ROOT is defined and then using it as a prefix. 3) I had to change the visibility of the cc-compiler-k8 toolchain to public 4) For CMake crosstool file, CMAKE_C_COMPILER, CMAKE_CXX_COMPILER, CMAKE_AR need to be absolute, so in cases when they are relative and not under external directory, force paths conversion
22 lines
769 B
Python
22 lines
769 B
Python
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
|
|
|
http_archive(
|
|
name = "org_linaro_components_toolchain_gcc_5_3_1",
|
|
build_file = "@//:compilers/linaro_linux_gcc_5.3.1.BUILD",
|
|
strip_prefix = "gcc-linaro-5.3.1-2016.05-x86_64_arm-linux-gnueabihf",
|
|
url = "https://bazel-mirror.storage.googleapis.com/releases.linaro.org/components/toolchain/binaries/latest-5/arm-linux-gnueabihf/gcc-linaro-5.3.1-2016.05-x86_64_arm-linux-gnueabihf.tar.xz",
|
|
)
|
|
|
|
local_repository(
|
|
name = "rules_foreign_cc",
|
|
path = "../..",
|
|
)
|
|
|
|
load("@rules_foreign_cc//:workspace_definitions.bzl", "rules_foreign_cc_dependencies")
|
|
|
|
rules_foreign_cc_dependencies()
|
|
|
|
local_repository(
|
|
name = "cmake_hello_world_lib",
|
|
path = "../cmake_hello_world_lib/static",
|
|
) |