-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: gcc toolchain Signed-off-by: Thulio Ferraz Assis <[email protected]> * fix: generated header * fix: set -lstdc++ by default Many libraries under Bazel rely on this behaviour by default. Signed-off-by: Thulio Ferraz Assis <[email protected]> * fix: set -I and -isystem flags Signed-off-by: Thulio Ferraz Assis <[email protected]> * feat: switch to use bootlin pre-compiled tools Signed-off-by: Thulio Ferraz Assis <[email protected]> * feat: explicit search dirs Signed-off-by: Thulio Ferraz Assis <[email protected]> * refactor: reduce hops and expose more attrs Signed-off-by: Thulio Ferraz Assis <[email protected]> * fix: use header substitution Signed-off-by: Thulio Ferraz Assis <[email protected]>
- Loading branch information
Showing
12 changed files
with
805 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
build --extra_toolchains=@gcc_toolchain//:toolchain --incompatible_enable_cc_toolchain_resolution | ||
|
||
test --sandbox_default_allow_network=false | ||
test --test_output=errors | ||
|
||
build:debug --verbose_failures --sandbox_debug --toolchain_resolution_debug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
bazel-* |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
workspace(name = "bazel_gcc_toolchain") | ||
|
||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
|
||
http_archive( | ||
name = "bazel_skylib", | ||
urls = [ | ||
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.2.1/bazel-skylib-1.2.1.tar.gz", | ||
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.2.1/bazel-skylib-1.2.1.tar.gz", | ||
], | ||
sha256 = "f7be3474d42aae265405a592bb7da8e171919d74c16f082a5457840f06054728", | ||
) | ||
|
||
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") | ||
|
||
bazel_skylib_workspace() | ||
|
||
http_archive( | ||
name = "rules_cc", | ||
urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.1/rules_cc-0.0.1.tar.gz"], | ||
sha256 = "4dccbfd22c0def164c8f47458bd50e0c7148f3d92002cdb459c2a96a68498241", | ||
) | ||
|
||
load("//toolchain:defs.bzl", "gcc_register_toolchain") | ||
|
||
gcc_register_toolchain( | ||
name = "gcc_toolchain", | ||
url = "https://toolchains.bootlin.com/downloads/releases/toolchains/x86-64/tarballs/x86-64--glibc--stable-2021.11-5.tar.bz2", | ||
sha256 = "6fe812add925493ea0841365f1fb7ca17fd9224bab61a731063f7f12f3a621b0", | ||
strip_prefix = "x86-64--glibc--stable-2021.11-5", | ||
target_arch = "x86_64", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
cc_binary( | ||
name = "hello_world_c", | ||
srcs = ["main.c"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include <stdio.h> | ||
|
||
int main() | ||
{ | ||
printf("Hello World!\n"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
cc_binary( | ||
name = "hello_world_cpp", | ||
srcs = ["main.cpp"], | ||
linkopts = ["-lstdc++"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include <iostream> | ||
|
||
int main() | ||
{ | ||
std::cout << "Hello World!" << std::endl; | ||
return 0; | ||
} |
Empty file.
Oops, something went wrong.