Skip to content

Commit

Permalink
fixin build.hancho
Browse files Browse the repository at this point in the history
  • Loading branch information
aappleby committed Jun 5, 2024
1 parent 42e33e2 commit 16b8602
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 29 deletions.
10 changes: 7 additions & 3 deletions build.hancho
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

import hancho

exports.config = hancho.Config(build_tag = "debug")
exports.config = hancho.Config(
build_tag = "debug",
includes = [".", "{repo_path}"],
)

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.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.tests = hancho.load("tests/tests.hancho", exports)
Expand Down
12 changes: 4 additions & 8 deletions examples/c_lexer/c_lexer.hancho
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,27 @@
rules = imports.rules
config = imports.config

config = config.extend(
includes = [".", "{repo_path}"],
)

c_lexer_lib = rules.cpp_lib(
config,
name = "c_lexer",
name = "c_lexer",
in_srcs = ["CLexer.cpp", "CToken.cpp"],
out_lib = "c_lexer.a",
**config,
)

rules.c_test(
config,
in_srcs = "c_lexer_test.cpp",
in_libs = c_lexer_lib,
out_bin = "c_lexer_test",
quiet = True,
**config,
)

rules.cpp_bin(
config,
name = "c_lexer_benchmark",
in_srcs = "c_lexer_benchmark.cpp",
in_libs = c_lexer_lib,
out_bin = "c_lexer_benchmark",
**config,
)

exports.lib = c_lexer_lib
12 changes: 7 additions & 5 deletions examples/c_parser/c_parser.hancho
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@ rules = imports.rules
config = imports.config
c_lexer = imports.c_lexer

c_parser_lib = rules.c_library(
config,
c_parser_lib = rules.cpp_lib(
name = "c_parser_lib",
in_srcs = ["CContext.cpp", "CNode.cpp", "CScope.cpp"],
out_lib = "c_parser.a",
**config,
)

rules.c_binary(
config,
rules.cpp_bin(
name = "c_parser_benchmark",
in_srcs = "c_parser_benchmark.cpp",
in_libs = [c_lexer.lib, c_parser_lib],
out_bin = "c_parser_benchmark",
libs = [c_lexer.lib, c_parser_lib],
**config,
)

# Broken?
Expand Down
31 changes: 18 additions & 13 deletions examples/json/json.hancho
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,43 @@
rules = imports.rules
config = imports.config

json_parser = rules.c_library(
config,
json_parser = rules.cpp_lib(
name = "json_parser",
in_srcs = ["json_matcher.cpp", "json_parser.cpp"],
out_lib = "json_parser.a",
**config,
)

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

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

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

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

Expand Down

0 comments on commit 16b8602

Please sign in to comment.