Initial commit I guess

This commit is contained in:
John Doty 2025-01-11 10:08:07 -08:00
commit 9a070a5f8f
7 changed files with 91 additions and 0 deletions

27
.buckconfig Normal file
View file

@ -0,0 +1,27 @@
[cells]
root = .
prelude = prelude
toolchains = toolchains
none = none
[cell_aliases]
config = prelude
ovr_config = prelude
fbcode = none
fbsource = none
fbcode_macros = none
buck = none
# Uses a copy of the prelude bundled with the buck2 binary. You can alternatively delete this
# section and vendor a copy of the prelude to the `prelude` directory of your project.
[external_cells]
prelude = bundled
[parser]
target_platform_detector_spec = target:root//...->prelude//platforms:default
[build]
execution_platforms = prelude//platforms:default
[project]
ignore = .git

0
.buckroot Normal file
View file

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/buck-out

13
BUCK Normal file
View file

@ -0,0 +1,13 @@
# A list of available rules and their signatures can be found here: https://buck2.build/docs/prelude/globals/
genrule(
name = "hello_world",
out = "out.txt",
cmd = "echo BUILT BY BUCK2> $OUT",
)
cxx_binary(
name = "main",
srcs = ["main.cpp"],
link_style = "static",
)

5
main.cpp Normal file
View file

@ -0,0 +1,5 @@
#include <stdio.h>
int main() {
printf("Hello from a C++ Buck2 program!\n");
}

20
toolchains/BUCK Normal file
View file

@ -0,0 +1,20 @@
load("@prelude//toolchains:cxx.bzl", "system_cxx_toolchain")
load("@prelude//toolchains:python.bzl", "system_python_bootstrap_toolchain")
# Ugh.
system_cxx_toolchain(
name = "cxx",
visibility = ["PUBLIC"],
compiler = "gcc",
compiler_type = "gcc",
cxx_compiler = "g++",
rc_compiler = None,
cvtres_compiler = None,
linker = "g++",
)
system_python_bootstrap_toolchain(
name = "python_bootstrap",
visibility = ["PUBLIC"],
)

25
toolchains/tools.bzl Normal file
View file

@ -0,0 +1,25 @@
load("@prelude//cxx:cxx_toolchain_types.bzl", "LinkerType")
load("@prelude//toolchains:cxx.bzl", "CxxToolsInfo")
def _path_gcc_tools_impl(_ctx) -> list[Provider]:
return [
DefaultInfo(),
CxxToolsInfo(
compiler = "gcc",
compiler_type = "gcc",
cxx_compiler = "g++",
asm_compiler = "gcc",
asm_compiler_type = "gcc",
rc_compiler = None,
cvtres_compiler = None,
archiver = "ar",
archiver_type = "gnu",
linker = "g++",
linker_type = LinkerType("gnu"),
),
]
path_gcc_tools = rule(
impl = _path_gcc_tools_impl,
attrs = {},
)