Skip to content

Commit

Permalink
fix examples
Browse files Browse the repository at this point in the history
  • Loading branch information
aappleby committed Mar 28, 2024
1 parent 207e0fb commit a486212
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion build.hancho
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
build_config.verbose = True

build_config.task([], [], desc = "Run all tests", command = "cd tests && rm -rf build && ./test.py > /dev/null")
build_config.task([], [], desc = "Run all tests", command = "cd tests && rm -rf build && ./run_tests.py > /dev/null")
build_config.task([], [], desc = "Build all tutorials", command = "cd tutorial && rm -rf build && ../hancho.py --quiet")
build_config.task([], [], desc = "Build hello_world", command = "cd examples/hello_world && rm -rf build && ../../hancho.py --quiet")
build_config.task([], [], desc = "Build gtk hello_world", command = "cd examples/meson && rm -rf build && ../../hancho.py --quiet")
12 changes: 6 additions & 6 deletions examples/hello_world/build.hancho
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# examples/hello_world/build.hancho

compile = build_config.rule(
desc = "Compile {files_in} -> {files_out}",
command = "g++ -MMD -c {files_in} -o {files_out}",
files_out = "{swap_ext(files_in, '.o')}",
depfile = "{swap_ext(files_out, '.d')}",
desc = "Compile {rel_source_files} -> {rel_build_files}",
command = "g++ -MMD -c {rel_source_files} -o {rel_build_files}",
build_files = "{swap_ext(rel_source_files, '.o')}",
build_deps = "{swap_ext(rel_source_files, '.d')}",
)

link = build_config.rule(
desc = "Link {files_in} -> {files_out}",
command = "g++ {files_in} -o {files_out}",
desc = "Link {rel_source_files} -> {rel_build_files}",
command = "g++ {rel_source_files} -o {rel_build_files}",
)

main_o = compile("main.cpp")
Expand Down
26 changes: 13 additions & 13 deletions examples/meson/build.hancho
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# examples/meson/build.hancho

from hancho import *

build_config.build_tag = "debug"

compile = build_config.rule(
desc = "Compiling {files_in} -> {files_out} ({build_tag})",
command = "gcc {includes} {gcc_opts} {defines} {warnings} -c {files_in} -o {files_out}",
desc = "Compiling {rel_source_files} -> {rel_build_files} ({build_tag})",
command = "gcc {includes} {gcc_opts} {defines} {warnings} -c {rel_source_files} -o {rel_build_files}",
includes = [
"-I."
],
Expand All @@ -20,20 +22,21 @@ compile = build_config.rule(
"-Wall",
"-Winvalid-pch"
],
files_out = "{swap_ext(files_in, '.o')}",
depfile = "{swap_ext(files_out, '.d')}",
build_files = "{swap_ext(source_files, '.o')}",
build_deps = "{swap_ext(source_files, '.d')}",
)

link = build_config.rule(
desc = "Linking {files_out}",
command = "gcc {files_in} -o {files_out} {link_opts}",
desc = "Linking {rel_source_files} -> {rel_build_files}",
command = "gcc {rel_source_files} -o {rel_build_files} {link_opts}",
link_opts = [
"-Wl,--as-needed",
"-Wl,--no-undefined",
"-Wl,--start-group",
"{libs}",
"-Wl,--end-group",
]
],
libs = []
)

main_o = compile(
Expand All @@ -48,9 +51,6 @@ main_o = compile(
],
)

#main = link(main_o, "demo",
# libs = [
# link.libs,
# "{run_cmd('pkg-config gtk+-3.0 --libs')}"
# ],
#)
main = link(main_o, "demo",
libs = ["{run_cmd('pkg-config gtk+-3.0 --libs')}"],
)

0 comments on commit a486212

Please sign in to comment.