Skip to content

Commit

Permalink
let's just push this stuff to main
Browse files Browse the repository at this point in the history
  • Loading branch information
aappleby committed Oct 7, 2024
1 parent e713d3d commit dccd827
Show file tree
Hide file tree
Showing 6 changed files with 394 additions and 394 deletions.
4 changes: 2 additions & 2 deletions examples/examples.hancho
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import hancho

hancho.load("hello_world/hello_world.hancho")
hancho.load("hello_gtk/hello_gtk.hancho")
#hancho.load("subrepos/build.hancho")
hancho.load("subrepos/build.hancho")

# needs source_path fix
#hancho.load("dynamic_dependencies/filelist/build.hancho")
hancho.load("dynamic_dependencies/filelist/build.hancho")
6 changes: 2 additions & 4 deletions examples/hello_gtk/hello_gtk.hancho
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ rules = hancho.load("{repo_path}/rules.hancho")

main_o = rules.compile_cpp(
in_src = "main.c",
cpp_flags = [
"-fdiagnostics-color=always",
"-fpermissive",
flags = rules.compile_cpp.flags + [
"{run_cmd('pkg-config gtk+-3.0 --cflags-only-other')}",
"{run_cmd('pkg-config gtk+-3.0 --cflags-only-I')}",
],
Expand All @@ -15,7 +13,7 @@ main_o = rules.compile_cpp(
main = rules.link_cpp_bin(
name = "hello_gtk",
in_objs = main_o,
link_flags = [
flags = rules.link_cpp_bin.flags + [
"{run_cmd('pkg-config gtk+-3.0 --libs')}"
],
)
2 changes: 1 addition & 1 deletion examples/hello_gtk/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ int main(int argc, char **argv)
GtkApplication *app;
int status;

app = gtk_application_new(NULL, G_APPLICATION_FLAGS_NONE);
app = gtk_application_new(NULL, G_APPLICATION_DEFAULT_FLAGS);
g_signal_connect(app, "activate", G_CALLBACK(activate), NULL);
status = g_application_run(G_APPLICATION(app), argc, argv);
g_object_unref(app);
Expand Down
7 changes: 5 additions & 2 deletions hancho.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,8 @@ def expand_dec():
def stringify_variant(variant):
""" Converts any type into an expansion-compatible string. """
match variant:
case Expander():
return stringify_variant(variant.config)
case Task():
return stringify_variant(variant._out_files)
case list():
Expand Down Expand Up @@ -739,13 +741,14 @@ async def await_variant(variant):
variant = await variant

match variant:
case Exception():
case Exception() | asyncio.CancelledError():
raise variant
case Promise():
variant = await variant.get()
variant = await await_variant(variant)
case Task():
await variant.await_done()
variant = await variant.await_done()
variant = await await_variant(variant)
case Config() | dict():
for key, val in variant.items():
variant[key] = await await_variant(val)
Expand Down
8 changes: 4 additions & 4 deletions rules.hancho
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ default_toolchain = hancho.Config(
)

riscv64_toolchain = hancho.Config(
arch = "riscv64",
arch = "riscv64",
compiler = "riscv64-unknown-elf-g++",
linker = "riscv64-unknown-elf-g++",
)
Expand All @@ -93,7 +93,7 @@ riscv64_toolchain = hancho.Config(
# arch = "-march=rv32i -mabi=ilp32 -mstrict-align",
# cpp_std = "-std=gnu++2a",
# build_type = "-g -Os",
# link_flags = [
# flags = [
# "-nostdlib",
# "-nostartfiles",
# "-Wl,-T {linkerscript}",
Expand Down Expand Up @@ -156,8 +156,8 @@ link_cpp_bin = hancho.Command(
out_bin = "{name}",

toolchain = default_toolchain,
command = "{toolchain.linker} {linker_group} {link_flags} {joined_sys_libs} -o {rel(out_bin)}",
link_flags = [],
command = "{toolchain.linker} {linker_group} {flags} {joined_sys_libs} -o {rel(out_bin)}",
flags = [],
linker_group = [
"-Wl,--as-needed",
"-Wl,--no-undefined",
Expand Down
Loading

0 comments on commit dccd827

Please sign in to comment.