Skip to content

Commit

Permalink
checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
aappleby committed Jun 5, 2024
1 parent 16b8602 commit f39ada7
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 19 deletions.
4 changes: 2 additions & 2 deletions build.hancho
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ exports.rules = hancho.load("symlinks/hancho/rules.hancho", exports)
exports.c_lexer = hancho.load("examples/c_lexer/c_lexer.hancho", exports)
exports.c_parser = hancho.load("examples/c_parser/c_parser.hancho", exports)
exports.json = hancho.load("examples/json/json.hancho", exports)
#exports.regex = hancho.load("examples/regex/regex.hancho", exports)
#exports.toml = hancho.load("examples/toml/toml.hancho", exports)
exports.regex = hancho.load("examples/regex/regex.hancho", exports)
exports.toml = hancho.load("examples/toml/toml.hancho", exports)
#exports.tests = hancho.load("tests/tests.hancho", exports)
#exports.tutorial = hancho.load("examples/tutorial/tutorial.hancho", exports)
#
Expand Down
5 changes: 4 additions & 1 deletion examples/c_lexer/c_lexer.hancho
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ c_lexer_lib = rules.cpp_lib(
)

rules.c_test(
name = "c_lexer_test",
in_srcs = "c_lexer_test.cpp",
in_libs = c_lexer_lib,
out_bin = "c_lexer_test",
out_bin = "{name}",
quiet = True,
**config,
#debug = True,
#trace = True
)

rules.cpp_bin(
Expand Down
26 changes: 15 additions & 11 deletions examples/regex/regex.hancho
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,37 @@
rules = imports.rules
config = imports.config

regex_parser = rules.c_library(
config,
regex_parser = rules.cpp_lib(
name = "regex_parser_lib",
in_srcs = "regex_parser.cpp",
out_lib = "regex_parser.a",
**config,
)

rules.c_binary(
config,
rules.cpp_bin(
name = "regex_demo",
in_srcs = "regex_demo.cpp",
in_libs = regex_parser,
out_bin = "regex_demo",
libs = regex_parser,
**config,
)

rules.c_binary(
config,
rules.cpp_bin(
name = "regex_benchmark",
in_srcs = "regex_benchmark.cpp",
out_bin = "regex_benchmark",
libs = regex_parser,
sys_libs = "-lboost_system -lboost_regex",
in_libs = regex_parser,
sys_libs = ["boost_system", "boost_regex"],
**config,
)

rules.c_test(
config,
name = "regex_test",
in_srcs = "regex_test.cpp",
out_bin = "regex_test",
libs = regex_parser,
quiet = True
quiet = True,
**config,
)

exports.lib = regex_parser
12 changes: 7 additions & 5 deletions examples/toml/toml.hancho
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@
rules = imports.rules
config = imports.config

toml_lib = rules.c_library(
config,
toml_lib = rules.cpp_lib(
name = "toml_parser",
in_srcs = "toml_parser.cpp",
out_lib = "toml_lib.a",
**config,
)

rules.c_test(
config,
name = "toml_test",
in_srcs = "toml_test.cpp",
in_libs = toml_lib,
out_bin = "toml_test",
libs = toml_lib,
quiet = True
quiet = True,
**config,
)

0 comments on commit f39ada7

Please sign in to comment.