Skip to content

Commit

Permalink
decoders protos now built separately.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgiven committed Oct 8, 2024
1 parent 665ceb9 commit d091479
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export BUILDTYPE
BUILDTYPE ?= host
export BUILDTYPE

ifeq ($(BUILDTYPE),windows)
MINGW = i686-w64-mingw32-
Expand Down
26 changes: 20 additions & 6 deletions build/c.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class Toolchain:
cxxfile = ["$(CXX) -c -o {outs[0]} {ins[0]} $(CFLAGS) {cflags}"]
clibrary = ["$(AR) cqs {outs[0]} {ins}"]
cxxlibrary = ["$(AR) cqs {outs[0]} {ins}"]
clibraryt = ["$(AR) cqsT {outs[0]} {ins}"]
cxxlibraryt = ["$(AR) cqsT {outs[0]} {ins}"]
cprogram = ["$(CC) -o {outs[0]} {ins} {ldflags} $(LDFLAGS)"]
cxxprogram = ["$(CXX) -o {outs[0]} {ins} {ldflags} $(LDFLAGS)"]

Expand All @@ -27,6 +29,8 @@ class HostToolchain:
cxxfile = ["$(HOSTCXX) -c -o {outs[0]} {ins[0]} $(HOSTCFLAGS) {cflags}"]
clibrary = ["$(HOSTAR) cqs {outs[0]} {ins}"]
cxxlibrary = ["$(HOSTAR) cqs {outs[0]} {ins}"]
clibraryt = ["$(HOSTAR) cqs {outs[0]} {ins}"]
cxxlibraryt = ["$(HOSTAR) cqs {outs[0]} {ins}"]
cprogram = ["$(HOSTCC) -o {outs[0]} {ins} {ldflags} $(HOSTLDFLAGS)"]
cxxprogram = ["$(HOSTCXX) -o {outs[0]} {ins} {ldflags} $(HOSTLDFLAGS)"]

Expand All @@ -44,7 +48,7 @@ def cfileimpl(self, name, srcs, deps, suffix, commands, label, kind, cflags):
t = simplerule(
replaces=self,
ins=srcs,
deps=hdr_deps,
deps=sorted(hdr_deps),
outs=[outleaf],
label=label,
commands=commands,
Expand Down Expand Up @@ -312,7 +316,7 @@ def programimpl(
label,
filerule,
kind,
libkind,
libaggrule,
):
cfiles = findsources(
self.localname, srcs, deps, cflags, toolchain, filerule, self.cwd
Expand All @@ -326,11 +330,21 @@ def programimpl(
targets=lib_deps, name="caller_ldflags", initial=ldflags
)

if len(libs) > 1:
libs = [
simplerule(
name=f"{self.localname}_libs",
ins=libs,
outs=[f"={self.localname}.a"],
commands=libaggrule,
label="LIBT",
)
]

simplerule(
replaces=self,
ins=cfiles + libs + libs,
ins=cfiles + libs,
outs=[f"={self.localname}$(EXT)"],
deps=lib_deps,
label=toolchain.label + label,
commands=commands,
args={
Expand Down Expand Up @@ -367,7 +381,7 @@ def cprogram(
label,
cfile,
"cprogram",
"clibrary",
toolchain.clibraryt,
)


Expand Down Expand Up @@ -397,5 +411,5 @@ def cxxprogram(
label,
cxxfile,
"cxxprogram",
"cxxlibrary",
toolchain.cxxlibraryt,
)
3 changes: 2 additions & 1 deletion lib/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
name="config_proto",
srcs=[
"./config.proto",
"./decoders/decoders.proto",
"./imagereader/imagereader.proto",
"./imagewriter/imagewriter.proto",
],
Expand All @@ -44,6 +43,7 @@
"lib/vfs+proto",
"lib/usb+proto",
"lib/encoders+proto",
"lib/decoders+proto",
],
)

Expand All @@ -56,6 +56,7 @@
"lib/vfs+proto_lib",
"lib/usb+proto_lib",
"lib/encoders+proto_lib",
"lib/decoders+proto_lib",
"lib+drive_proto_lib",
],
)
12 changes: 12 additions & 0 deletions lib/decoders/build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from build.protobuf import proto, protocc

proto(
name="proto",
srcs=["./decoders.proto"],
deps=["lib+common_proto", "arch+proto", "lib/fluxsink+proto"],
)
protocc(
name="proto_lib",
srcs=[".+proto"],
deps=["lib+common_proto_lib", "arch+proto_lib", "lib/fluxsink+proto_lib"],
)
1 change: 1 addition & 0 deletions tests/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
"dep/libusbp",
"dep/snowhouse",
"dep/stb",
"arch+proto_lib",
"lib+config_proto_lib",
"src/formats",
]
Expand Down

0 comments on commit d091479

Please sign in to comment.