From 07aa416975255cb1855dede153735eb7c04110a0 Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 22 Oct 2023 22:57:54 +0200 Subject: [PATCH] Make the tests work. --- Makefile | 1 + arch/build.py | 66 ------------- build.py | 204 +++++++++++++++++++++++++++++++++++++++- build/utils.py | 11 +++ dep/adflib/build.py | 7 +- dep/snowhouse/build.py | 49 ++++++++++ lib/bitmap.cc | 4 +- lib/build.py | 135 -------------------------- lib/vfs/amigaffs.cc | 2 +- src/build.py | 3 +- src/formats/build.py | 2 +- src/gui/build.py | 3 +- tests/agg.cc | 6 +- tests/amiga.cc | 4 +- tests/bitaccumulator.cc | 2 +- tests/build.py | 89 +++++++++++++++++- tests/bytes.cc | 2 +- tests/compression.cc | 2 +- tests/cpmfs.cc | 2 +- tests/csvreader.cc | 2 +- tests/flags.cc | 4 +- tests/fluxmapreader.cc | 6 +- tests/fluxpattern.cc | 6 +- tests/flx.cc | 2 +- tests/fmmfm.cc | 4 +- tests/greaseweazle.cc | 4 +- tests/kryoflux.cc | 6 +- tests/ldbs.cc | 4 +- tests/options.cc | 4 +- tests/proto.cc | 4 +- tests/utils.cc | 4 +- tests/vfs.cc | 2 +- tools/build.py | 27 ++++++ 33 files changed, 424 insertions(+), 249 deletions(-) create mode 100644 dep/snowhouse/build.py create mode 100644 tools/build.py diff --git a/Makefile b/Makefile index 6e324e1c..2affa6a7 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ CC = gcc CXX = g++ +CFLAGS = -g -Os OBJ = .obj diff --git a/arch/build.py b/arch/build.py index 6ef55eed..6fbd27e0 100644 --- a/arch/build.py +++ b/arch/build.py @@ -24,69 +24,3 @@ proto( "./zilogmcz/zilogmcz.proto", ], ) - -clibrary( - name="arch", - srcs=[ - "./aeslanier/decoder.cc", - "./agat/agat.cc", - "./agat/decoder.cc", - "./agat/encoder.cc", - "./amiga/amiga.cc", - "./amiga/decoder.cc", - "./amiga/encoder.cc", - "./apple2/decoder.cc", - "./apple2/encoder.cc", - "./brother/decoder.cc", - "./brother/encoder.cc", - "./c64/c64.cc", - "./c64/decoder.cc", - "./c64/encoder.cc", - "./f85/decoder.cc", - "./fb100/decoder.cc", - "./ibm/decoder.cc", - "./ibm/encoder.cc", - "./macintosh/decoder.cc", - "./macintosh/encoder.cc", - "./micropolis/decoder.cc", - "./micropolis/encoder.cc", - "./mx/decoder.cc", - "./northstar/decoder.cc", - "./northstar/encoder.cc", - "./rolandd20/decoder.cc", - "./smaky6/decoder.cc", - "./tids990/decoder.cc", - "./tids990/encoder.cc", - "./victor9k/decoder.cc", - "./victor9k/encoder.cc", - "./zilogmcz/decoder.cc", - ], - hdrs={ - "arch/ibm/ibm.h": "./ibm/ibm.h", - "arch/apple2/data_gcr.h": "./apple2/data_gcr.h", - "arch/apple2/apple2.h": "./apple2/apple2.h", - "arch/smaky6/smaky6.h": "./smaky6/smaky6.h", - "arch/tids990/tids990.h": "./tids990/tids990.h", - "arch/zilogmcz/zilogmcz.h": "./zilogmcz/zilogmcz.h", - "arch/amiga/amiga.h": "./amiga/amiga.h", - "arch/f85/data_gcr.h": "./f85/data_gcr.h", - "arch/f85/f85.h": "./f85/f85.h", - "arch/mx/mx.h": "./mx/mx.h", - "arch/aeslanier/aeslanier.h": "./aeslanier/aeslanier.h", - "arch/northstar/northstar.h": "./northstar/northstar.h", - "arch/brother/data_gcr.h": "./brother/data_gcr.h", - "arch/brother/brother.h": "./brother/brother.h", - "arch/brother/header_gcr.h": "./brother/header_gcr.h", - "arch/macintosh/data_gcr.h": "./macintosh/data_gcr.h", - "arch/macintosh/macintosh.h": "./macintosh/macintosh.h", - "arch/agat/agat.h": "./agat/agat.h", - "arch/fb100/fb100.h": "./fb100/fb100.h", - "arch/victor9k/data_gcr.h": "./victor9k/data_gcr.h", - "arch/victor9k/victor9k.h": "./victor9k/victor9k.h", - "arch/rolandd20/rolandd20.h": "./rolandd20/rolandd20.h", - "arch/micropolis/micropolis.h": "./micropolis/micropolis.h", - "arch/c64/data_gcr.h": "./c64/data_gcr.h", - "arch/c64/c64.h": "./c64/c64.h", - }, - deps=["lib", "lib+config_proto_lib", "+protocol"], -) diff --git a/build.py b/build.py index de2dde30..f6a80510 100644 --- a/build.py +++ b/build.py @@ -13,6 +13,208 @@ clibrary(name="protocol", hdrs={"protocol.h": "./protocol.h"}) proto(name="fl2_proto", srcs=["lib/fl2.proto"]) protocc(name="fl2_proto_lib", srcs=["+fl2_proto"]) +clibrary( + name="lib", + srcs=[ + "./lib/bitmap.cc", + "./lib/bytes.cc", + "./lib/config.cc", + "./lib/crc.cc", + "./lib/csvreader.cc", + "./lib/decoders/decoders.cc", + "./lib/decoders/fluxdecoder.cc", + "./lib/decoders/fluxmapreader.cc", + "./lib/decoders/fmmfm.cc", + "./lib/encoders/encoders.cc", + "./lib/fl2.cc", + "./lib/flags.cc", + "./lib/fluxmap.cc", + "./lib/fluxsink/a2rfluxsink.cc", + "./lib/fluxsink/aufluxsink.cc", + "./lib/fluxsink/fl2fluxsink.cc", + "./lib/fluxsink/fluxsink.cc", + "./lib/fluxsink/hardwarefluxsink.cc", + "./lib/fluxsink/scpfluxsink.cc", + "./lib/fluxsink/vcdfluxsink.cc", + "./lib/fluxsource/a2rfluxsource.cc", + "./lib/fluxsource/cwffluxsource.cc", + "./lib/fluxsource/erasefluxsource.cc", + "./lib/fluxsource/fl2fluxsource.cc", + "./lib/fluxsource/fluxsource.cc", + "./lib/fluxsource/flx.cc", + "./lib/fluxsource/flxfluxsource.cc", + "./lib/fluxsource/hardwarefluxsource.cc", + "./lib/fluxsource/kryoflux.cc", + "./lib/fluxsource/kryofluxfluxsource.cc", + "./lib/fluxsource/memoryfluxsource.cc", + "./lib/fluxsource/scpfluxsource.cc", + "./lib/fluxsource/testpatternfluxsource.cc", + "./lib/globals.cc", + "./lib/hexdump.cc", + "./lib/image.cc", + "./lib/imagereader/d64imagereader.cc", + "./lib/imagereader/d88imagereader.cc", + "./lib/imagereader/dimimagereader.cc", + "./lib/imagereader/diskcopyimagereader.cc", + "./lib/imagereader/fdiimagereader.cc", + "./lib/imagereader/imagereader.cc", + "./lib/imagereader/imdimagereader.cc", + "./lib/imagereader/imgimagereader.cc", + "./lib/imagereader/jv3imagereader.cc", + "./lib/imagereader/nfdimagereader.cc", + "./lib/imagereader/nsiimagereader.cc", + "./lib/imagereader/td0imagereader.cc", + "./lib/imagewriter/d64imagewriter.cc", + "./lib/imagewriter/d88imagewriter.cc", + "./lib/imagewriter/diskcopyimagewriter.cc", + "./lib/imagewriter/imagewriter.cc", + "./lib/imagewriter/imdimagewriter.cc", + "./lib/imagewriter/imgimagewriter.cc", + "./lib/imagewriter/ldbsimagewriter.cc", + "./lib/imagewriter/nsiimagewriter.cc", + "./lib/imagewriter/rawimagewriter.cc", + "./lib/layout.cc", + "./lib/ldbs.cc", + "./lib/logger.cc", + "./lib/proto.cc", + "./lib/readerwriter.cc", + "./lib/sector.cc", + "./lib/usb/fluxengineusb.cc", + "./lib/usb/greaseweazle.cc", + "./lib/usb/greaseweazleusb.cc", + "./lib/usb/serial.cc", + "./lib/usb/usb.cc", + "./lib/usb/usbfinder.cc", + "./lib/utils.cc", + "./lib/vfs/acorndfs.cc", + "./lib/vfs/amigaffs.cc", + "./lib/vfs/appledos.cc", + "./lib/vfs/applesingle.cc", + "./lib/vfs/brother120fs.cc", + "./lib/vfs/cbmfs.cc", + "./lib/vfs/cpmfs.cc", + "./lib/vfs/fatfs.cc", + "./lib/vfs/fluxsectorinterface.cc", + "./lib/vfs/imagesectorinterface.cc", + "./lib/vfs/lif.cc", + "./lib/vfs/machfs.cc", + "./lib/vfs/microdos.cc", + "./lib/vfs/philefs.cc", + "./lib/vfs/prodos.cc", + "./lib/vfs/roland.cc", + "./lib/vfs/smaky6fs.cc", + "./lib/vfs/vfs.cc", + "./lib/vfs/zdos.cc", + "./arch/aeslanier/decoder.cc", + "./arch/agat/agat.cc", + "./arch/agat/decoder.cc", + "./arch/agat/encoder.cc", + "./arch/amiga/amiga.cc", + "./arch/amiga/decoder.cc", + "./arch/amiga/encoder.cc", + "./arch/apple2/decoder.cc", + "./arch/apple2/encoder.cc", + "./arch/brother/decoder.cc", + "./arch/brother/encoder.cc", + "./arch/c64/c64.cc", + "./arch/c64/decoder.cc", + "./arch/c64/encoder.cc", + "./arch/f85/decoder.cc", + "./arch/fb100/decoder.cc", + "./arch/ibm/decoder.cc", + "./arch/ibm/encoder.cc", + "./arch/macintosh/decoder.cc", + "./arch/macintosh/encoder.cc", + "./arch/micropolis/decoder.cc", + "./arch/micropolis/encoder.cc", + "./arch/mx/decoder.cc", + "./arch/northstar/decoder.cc", + "./arch/northstar/encoder.cc", + "./arch/rolandd20/decoder.cc", + "./arch/smaky6/decoder.cc", + "./arch/tids990/decoder.cc", + "./arch/tids990/encoder.cc", + "./arch/victor9k/decoder.cc", + "./arch/victor9k/encoder.cc", + "./arch/zilogmcz/decoder.cc", + ], + hdrs={ + "arch/ibm/ibm.h": "./arch/ibm/ibm.h", + "arch/apple2/data_gcr.h": "./arch/apple2/data_gcr.h", + "arch/apple2/apple2.h": "./arch/apple2/apple2.h", + "arch/smaky6/smaky6.h": "./arch/smaky6/smaky6.h", + "arch/tids990/tids990.h": "./arch/tids990/tids990.h", + "arch/zilogmcz/zilogmcz.h": "./arch/zilogmcz/zilogmcz.h", + "arch/amiga/amiga.h": "./arch/amiga/amiga.h", + "arch/f85/data_gcr.h": "./arch/f85/data_gcr.h", + "arch/f85/f85.h": "./arch/f85/f85.h", + "arch/mx/mx.h": "./arch/mx/mx.h", + "arch/aeslanier/aeslanier.h": "./arch/aeslanier/aeslanier.h", + "arch/northstar/northstar.h": "./arch/northstar/northstar.h", + "arch/brother/data_gcr.h": "./arch/brother/data_gcr.h", + "arch/brother/brother.h": "./arch/brother/brother.h", + "arch/brother/header_gcr.h": "./arch/brother/header_gcr.h", + "arch/macintosh/data_gcr.h": "./arch/macintosh/data_gcr.h", + "arch/macintosh/macintosh.h": "./arch/macintosh/macintosh.h", + "arch/agat/agat.h": "./arch/agat/agat.h", + "arch/fb100/fb100.h": "./arch/fb100/fb100.h", + "arch/victor9k/data_gcr.h": "./arch/victor9k/data_gcr.h", + "arch/victor9k/victor9k.h": "./arch/victor9k/victor9k.h", + "arch/rolandd20/rolandd20.h": "./arch/rolandd20/rolandd20.h", + "arch/micropolis/micropolis.h": "./arch/micropolis/micropolis.h", + "arch/c64/data_gcr.h": "./arch/c64/data_gcr.h", + "arch/c64/c64.h": "./arch/c64/c64.h", + "lib/a2r.h": "./lib/a2r.h", + "lib/bitmap.h": "./lib/bitmap.h", + "lib/bytes.h": "./lib/bytes.h", + "lib/config.h": "./lib/config.h", + "lib/crc.h": "./lib/crc.h", + "lib/csvreader.h": "./lib/csvreader.h", + "lib/decoders/decoders.h": "./lib/decoders/decoders.h", + "lib/decoders/fluxdecoder.h": "./lib/decoders/fluxdecoder.h", + "lib/decoders/fluxmapreader.h": "./lib/decoders/fluxmapreader.h", + "lib/decoders/rawbits.h": "./lib/decoders/rawbits.h", + "lib/encoders/encoders.h": "./lib/encoders/encoders.h", + "lib/scp.h": "./lib/scp.h", + "lib/fl2.h": "./lib/fl2.h", + "lib/flags.h": "./lib/flags.h", + "lib/flux.h": "./lib/flux.h", + "lib/fluxmap.h": "./lib/fluxmap.h", + "lib/fluxsink/fluxsink.h": "./lib/fluxsink/fluxsink.h", + "lib/fluxsource/fluxsource.h": "lib/fluxsource/fluxsource.h", + "lib/fluxsource/flx.h": "lib/fluxsource/flx.h", + "lib/fluxsource/kryoflux.h": "lib/fluxsource/kryoflux.h", + "lib/globals.h": "./lib/globals.h", + "lib/image.h": "./lib/image.h", + "lib/imagereader/imagereader.h": "./lib/imagereader/imagereader.h", + "lib/imagewriter/imagewriter.h": "./lib/imagewriter/imagewriter.h", + "lib/layout.h": "./lib/layout.h", + "lib/ldbs.h": "./lib/ldbs.h", + "lib/logger.h": "./lib/logger.h", + "lib/proto.h": "./lib/proto.h", + "lib/readerwriter.h": "./lib/readerwriter.h", + "lib/sector.h": "./lib/sector.h", + "lib/usb/greaseweazle.h": "./lib/usb/greaseweazle.h", + "lib/usb/usb.h": "./lib/usb/usb.h", + "lib/usb/usbfinder.h": "./lib/usb/usbfinder.h", + "lib/utils.h": "./lib/utils.h", + "lib/vfs/applesingle.h": "./lib/vfs/applesingle.h", + "lib/vfs/sectorinterface.h": "./lib/vfs/sectorinterface.h", + "lib/vfs/vfs.h": "./lib/vfs/vfs.h", + }, + deps=[ + "+fl2_proto_lib", + "+protocol", + "lib+config_proto_lib", + "dep/adflib", + "dep/agg", + "dep/fatfs", + "dep/hfsutils", + "dep/libusbp", + "dep/stb", + ], +) + export( name="all", items={ @@ -22,5 +224,5 @@ export( "brother240tool": "tools+brother240tool", "upgrade-flux-file": "tools+upgrade-flux-file", }, - deps=["+protocol"], + deps=["tests"], ) diff --git a/build/utils.py b/build/utils.py index 05283194..5f8a50ec 100644 --- a/build/utils.py +++ b/build/utils.py @@ -11,3 +11,14 @@ def objectify(self, name, src: Target, symbol): commands=["xxd -i -n " + symbol + " {ins} > {outs}"], label="OBJECTIFY", ) + + +@Rule +def test(self, name, command: Target): + normalrule( + replaces=self, + ins=[command], + outs=["sentinel"], + commands=["{ins[0]}", "touch {outs}"], + label="TEST", + ) diff --git a/dep/adflib/build.py b/dep/adflib/build.py index d938d379..9b93510e 100644 --- a/dep/adflib/build.py +++ b/dep/adflib/build.py @@ -37,10 +37,11 @@ clibrary( ], cflags=["-Idep/adflib", "-Idep/adflib/src"], hdrs={ - "adflib.h": "./src/adflib.h", - "adf_defs.h": "./src/adf_defs.h", - "adf_str.h": "./src/adf_str.h", "adf_blk.h": "./src/adf_blk.h", + "adf_defs.h": "./src/adf_defs.h", "adf_err.h": "./src/adf_err.h", + "adf_nativ.h": "./adf_nativ.h", + "adf_str.h": "./src/adf_str.h", + "adflib.h": "./src/adflib.h", }, ) diff --git a/dep/snowhouse/build.py b/dep/snowhouse/build.py new file mode 100644 index 00000000..87ddd6ec --- /dev/null +++ b/dep/snowhouse/build.py @@ -0,0 +1,49 @@ +from build.c import clibrary + +clibrary( + name="snowhouse", + hdrs={ + "snowhouse/snowhouse.h": "./include/snowhouse/snowhouse.h", + "snowhouse/assert.h": "./include/snowhouse/assert.h", + "snowhouse/fluent/fluent.h": "./include/snowhouse/fluent/fluent.h", + "snowhouse/fluent/constraintadapter.h": "./include/snowhouse/fluent/constraintadapter.h", + "snowhouse/fluent/constraintlist.h": "./include/snowhouse/fluent/constraintlist.h", + "snowhouse/fluent/operators/andoperator.h": "./include/snowhouse/fluent/operators/andoperator.h", + "snowhouse/fluent/operators/invalidexpressionexception.h": "./include/snowhouse/fluent/operators/invalidexpressionexception.h", + "snowhouse/fluent/operators/collections/collectionoperator.h": "./include/snowhouse/fluent/operators/collections/collectionoperator.h", + "snowhouse/fluent/operators/collections/collectionconstraintevaluator.h": "./include/snowhouse/fluent/operators/collections/collectionconstraintevaluator.h", + "snowhouse/fluent/operators/collections/atleastoperator.h": "./include/snowhouse/fluent/operators/collections/atleastoperator.h", + "snowhouse/fluent/operators/collections/noneoperator.h": "./include/snowhouse/fluent/operators/collections/noneoperator.h", + "snowhouse/fluent/operators/collections/atmostoperator.h": "./include/snowhouse/fluent/operators/collections/atmostoperator.h", + "snowhouse/fluent/operators/collections/alloperator.h": "./include/snowhouse/fluent/operators/collections/alloperator.h", + "snowhouse/fluent/operators/collections/exactlyoperator.h": "./include/snowhouse/fluent/operators/collections/exactlyoperator.h", + "snowhouse/fluent/operators/notoperator.h": "./include/snowhouse/fluent/operators/notoperator.h", + "snowhouse/fluent/operators/constraintoperator.h": "./include/snowhouse/fluent/operators/constraintoperator.h", + "snowhouse/fluent/operators/oroperator.h": "./include/snowhouse/fluent/operators/oroperator.h", + "snowhouse/fluent/expressionbuilder.h": "./include/snowhouse/fluent/expressionbuilder.h", + "snowhouse/assertionexception.h": "./include/snowhouse/assertionexception.h", + "snowhouse/exceptions.h": "./include/snowhouse/exceptions.h", + "snowhouse/stringizers.h": "./include/snowhouse/stringizers.h", + "snowhouse/macros.h": "./include/snowhouse/macros.h", + "snowhouse/constraints/equalscontainerconstraint.h": "./include/snowhouse/constraints/equalscontainerconstraint.h", + "snowhouse/constraints/islessthanorequaltoconstraint.h": "./include/snowhouse/constraints/islessthanorequaltoconstraint.h", + "snowhouse/constraints/equalsconstraint.h": "./include/snowhouse/constraints/equalsconstraint.h", + "snowhouse/constraints/isgreaterthanconstraint.h": "./include/snowhouse/constraints/isgreaterthanconstraint.h", + "snowhouse/constraints/fulfillsconstraint.h": "./include/snowhouse/constraints/fulfillsconstraint.h", + "snowhouse/constraints/endswithconstraint.h": "./include/snowhouse/constraints/endswithconstraint.h", + "snowhouse/constraints/constraints.h": "./include/snowhouse/constraints/constraints.h", + "snowhouse/constraints/haslengthconstraint.h": "./include/snowhouse/constraints/haslengthconstraint.h", + "snowhouse/constraints/startswithconstraint.h": "./include/snowhouse/constraints/startswithconstraint.h", + "snowhouse/constraints/equalswithdeltaconstraint.h": "./include/snowhouse/constraints/equalswithdeltaconstraint.h", + "snowhouse/constraints/isgreaterthanorequaltoconstraint.h": "./include/snowhouse/constraints/isgreaterthanorequaltoconstraint.h", + "snowhouse/constraints/containsconstraint.h": "./include/snowhouse/constraints/containsconstraint.h", + "snowhouse/constraints/islessthanconstraint.h": "./include/snowhouse/constraints/islessthanconstraint.h", + "snowhouse/constraints/isemptyconstraint.h": "./include/snowhouse/constraints/isemptyconstraint.h", + "snowhouse/constraints/expressions/andexpression.h": "./include/snowhouse/constraints/expressions/andexpression.h", + "snowhouse/constraints/expressions/orexpression.h": "./include/snowhouse/constraints/expressions/orexpression.h", + "snowhouse/constraints/expressions/expression_fwd.h": "./include/snowhouse/constraints/expressions/expression_fwd.h", + "snowhouse/constraints/expressions/notexpression.h": "./include/snowhouse/constraints/expressions/notexpression.h", + "snowhouse/constraints/expressions/expression.h": "./include/snowhouse/constraints/expressions/expression.h", + "snowhouse/stringize.h": "./include/snowhouse/stringize.h", + }, +) diff --git a/lib/bitmap.cc b/lib/bitmap.cc index ac27ec33..4c4a9919 100644 --- a/lib/bitmap.cc +++ b/lib/bitmap.cc @@ -1,7 +1,7 @@ #include "lib/globals.h" #include "lib/flags.h" -#include "dep/agg/include/agg2d.h" -#include "dep/stb/stb_image_write.h" +#include "agg2d.h" +#include "stb_image_write.h" #include "lib/utils.h" #include "lib/bitmap.h" #include diff --git a/lib/build.py b/lib/build.py index e57e2faf..9f4ff979 100644 --- a/lib/build.py +++ b/lib/build.py @@ -1,141 +1,6 @@ from build.c import clibrary from build.protobuf import proto, protocc -clibrary( - name="lib", - cflags=["-I."], - srcs=[ - "./bitmap.cc", - "./bytes.cc", - "./config.cc", - "./crc.cc", - "./csvreader.cc", - "./decoders/decoders.cc", - "./decoders/fluxdecoder.cc", - "./decoders/fluxmapreader.cc", - "./decoders/fmmfm.cc", - "./encoders/encoders.cc", - "./fl2.cc", - "./flags.cc", - "./fluxmap.cc", - "./fluxsink/a2rfluxsink.cc", - "./fluxsink/aufluxsink.cc", - "./fluxsink/fl2fluxsink.cc", - "./fluxsink/fluxsink.cc", - "./fluxsink/hardwarefluxsink.cc", - "./fluxsink/scpfluxsink.cc", - "./fluxsink/vcdfluxsink.cc", - "./fluxsource/a2rfluxsource.cc", - "./fluxsource/cwffluxsource.cc", - "./fluxsource/erasefluxsource.cc", - "./fluxsource/fl2fluxsource.cc", - "./fluxsource/fluxsource.cc", - "./fluxsource/flx.cc", - "./fluxsource/flxfluxsource.cc", - "./fluxsource/hardwarefluxsource.cc", - "./fluxsource/kryoflux.cc", - "./fluxsource/kryofluxfluxsource.cc", - "./fluxsource/memoryfluxsource.cc", - "./fluxsource/scpfluxsource.cc", - "./fluxsource/testpatternfluxsource.cc", - "./globals.cc", - "./hexdump.cc", - "./image.cc", - "./imagereader/d64imagereader.cc", - "./imagereader/d88imagereader.cc", - "./imagereader/dimimagereader.cc", - "./imagereader/diskcopyimagereader.cc", - "./imagereader/fdiimagereader.cc", - "./imagereader/imagereader.cc", - "./imagereader/imdimagereader.cc", - "./imagereader/imgimagereader.cc", - "./imagereader/jv3imagereader.cc", - "./imagereader/nfdimagereader.cc", - "./imagereader/nsiimagereader.cc", - "./imagereader/td0imagereader.cc", - "./imagewriter/d64imagewriter.cc", - "./imagewriter/d88imagewriter.cc", - "./imagewriter/diskcopyimagewriter.cc", - "./imagewriter/imagewriter.cc", - "./imagewriter/imdimagewriter.cc", - "./imagewriter/imgimagewriter.cc", - "./imagewriter/ldbsimagewriter.cc", - "./imagewriter/nsiimagewriter.cc", - "./imagewriter/rawimagewriter.cc", - "./layout.cc", - "./ldbs.cc", - "./logger.cc", - "./proto.cc", - "./readerwriter.cc", - "./sector.cc", - "./usb/fluxengineusb.cc", - "./usb/greaseweazle.cc", - "./usb/greaseweazleusb.cc", - "./usb/serial.cc", - "./usb/usb.cc", - "./usb/usbfinder.cc", - "./utils.cc", - "./vfs/acorndfs.cc", - "./vfs/amigaffs.cc", - "./vfs/appledos.cc", - "./vfs/applesingle.cc", - "./vfs/brother120fs.cc", - "./vfs/cbmfs.cc", - "./vfs/cpmfs.cc", - "./vfs/fatfs.cc", - "./vfs/fluxsectorinterface.cc", - "./vfs/imagesectorinterface.cc", - "./vfs/lif.cc", - "./vfs/machfs.cc", - "./vfs/microdos.cc", - "./vfs/philefs.cc", - "./vfs/prodos.cc", - "./vfs/roland.cc", - "./vfs/smaky6fs.cc", - "./vfs/vfs.cc", - "./vfs/zdos.cc", - ], - hdrs={ - "lib/bitmap.h": "./bitmap.h", - "lib/bytes.h": "./bytes.h", - "lib/config.h": "./config.h", - "lib/crc.h": "./crc.h", - "lib/csvreader.h": "./csvreader.h", - "lib/decoders/decoders.h": "./decoders/decoders.h", - "lib/decoders/fluxdecoder.h": "./decoders/fluxdecoder.h", - "lib/decoders/fluxmapreader.h": "./decoders/fluxmapreader.h", - "lib/decoders/rawbits.h": "./decoders/rawbits.h", - "lib/encoders/encoders.h": "./encoders/encoders.h", - "lib/fl2.h": "./fl2.h", - "lib/flags.h": "./flags.h", - "lib/flux.h": "./flux.h", - "lib/fluxmap.h": "./fluxmap.h", - "lib/fluxsink/fluxsink.h": "./fluxsink/fluxsink.h", - "lib/fluxsource/fluxsource.h": "lib/fluxsource/fluxsource.h", - "lib/globals.h": "./globals.h", - "lib/image.h": "./image.h", - "lib/imagereader/imagereader.h": "./imagereader/imagereader.h", - "lib/imagewriter/imagewriter.h": "./imagewriter/imagewriter.h", - "lib/layout.h": "./layout.h", - "lib/logger.h": "./logger.h", - "lib/proto.h": "./proto.h", - "lib/readerwriter.h": "./readerwriter.h", - "lib/sector.h": "./sector.h", - "lib/usb/usb.h": "./usb/usb.h", - "lib/usb/usbfinder.h": "./usb/usbfinder.h", - "lib/utils.h": "./utils.h", - "lib/vfs/sectorinterface.h": "./vfs/sectorinterface.h", - "lib/vfs/vfs.h": "./vfs/vfs.h", - }, - deps=[ - "+fl2_proto_lib", - ".+config_proto_lib", - "dep/libusbp", - "dep/adflib", - "dep/fatfs", - "dep/hfsutils", - ], -) proto(name="common_proto", srcs=["./common.proto"]) diff --git a/lib/vfs/amigaffs.cc b/lib/vfs/amigaffs.cc index ef18f203..d2e22791 100644 --- a/lib/vfs/amigaffs.cc +++ b/lib/vfs/amigaffs.cc @@ -7,7 +7,7 @@ #include "adflib.h" #include "adf_blk.h" -#include "dep/adflib/adf_nativ.h" +#include "adf_nativ.h" #undef min #include diff --git a/src/build.py b/src/build.py index 58742bec..ae33ae74 100644 --- a/src/build.py +++ b/src/build.py @@ -34,14 +34,13 @@ cxxprogram( "+protobuf_lib", "+protocol", "+z_lib", - "arch", "dep/adflib", "dep/agg", "dep/fatfs", "dep/hfsutils", "dep/libusbp", "dep/stb", - "lib", + "+lib", "lib+config_proto_lib", "src/formats", ], diff --git a/src/formats/build.py b/src/formats/build.py index ea2937a8..d5a54d0b 100644 --- a/src/formats/build.py +++ b/src/formats/build.py @@ -61,4 +61,4 @@ encoded = [ for name in formats ] -clibrary(name="formats", srcs=[".+table_cc"] + encoded) +clibrary(name="formats", srcs=[".+table_cc"] + encoded, deps=["+lib"]) diff --git a/src/gui/build.py b/src/gui/build.py index 011b8942..ba58f1d7 100644 --- a/src/gui/build.py +++ b/src/gui/build.py @@ -40,13 +40,12 @@ cxxprogram( deps=[ "+fl2_proto_lib", "+protocol", - "arch", "dep/adflib", "dep/fatfs", "dep/hfsutils", "dep/libusbp", "extras+icons", - "lib", + "+lib", "lib+config_proto_lib", "src/formats", "src/gui/drivetypes", diff --git a/tests/agg.cc b/tests/agg.cc index f6afe2ac..442bf4a0 100644 --- a/tests/agg.cc +++ b/tests/agg.cc @@ -1,7 +1,7 @@ -#include "globals.h" +#include "lib/globals.h" #include "lib/bytes.h" -#include "dep/agg/include/agg2d.h" -#include "dep/stb/stb_image_write.h" +#include "agg2d.h" +#include "stb_image_write.h" #include static void test_agg(void) diff --git a/tests/amiga.cc b/tests/amiga.cc index 1e5ea32e..4fa0c88f 100644 --- a/tests/amiga.cc +++ b/tests/amiga.cc @@ -1,6 +1,6 @@ -#include "globals.h" +#include "lib/globals.h" #include "lib/bytes.h" -#include "decoders/decoders.h" +#include "lib/decoders/decoders.h" #include "arch/amiga/amiga.h" #include diff --git a/tests/bitaccumulator.cc b/tests/bitaccumulator.cc index 694bf0b6..0321155a 100644 --- a/tests/bitaccumulator.cc +++ b/tests/bitaccumulator.cc @@ -1,4 +1,4 @@ -#include "globals.h" +#include "lib/globals.h" #include "lib/bytes.h" #include diff --git a/tests/build.py b/tests/build.py index e39ebca7..8a704d04 100644 --- a/tests/build.py +++ b/tests/build.py @@ -1,5 +1,8 @@ -from build.c import clibrary +from build.ab import export +from build.c import cxxprogram from build.protobuf import proto, protocc +from build.utils import test +from scripts.build import protoencode proto( @@ -14,3 +17,87 @@ protocc( srcs=[".+test_proto"], deps=["lib+config_proto", "arch+arch_proto"], ) + +tests = [ + "agg", + "amiga", + "applesingle", + "bitaccumulator", + "bytes", + "compression", + "configs", + "cpmfs", + "csvreader", + "flags", + "fluxmapreader", + "fluxpattern", + "flx", + "fmmfm", + "greaseweazle", + "kryoflux", + "layout", + "ldbs", + "options", + "utils", + "vfs", +] + +export( + name="tests", + deps=[ + test( + name="proto_test", + command=cxxprogram( + name="proto_test_exe", + srcs=[ + "./proto.cc", + protoencode( + name="testproto_cc", + srcs=["./testproto.textpb"], + proto="TestProto", + symbol="testproto_pb", + ), + ], + deps=[ + "+fl2_proto_lib", + "+protocol", + ".+test_proto_lib", + "dep/adflib", + "dep/agg", + "dep/fatfs", + "dep/hfsutils", + "dep/libusbp", + "dep/snowhouse", + "dep/stb", + "+lib", + "lib+config_proto_lib", + "src/formats", + ], + ), + ), + ] + + [ + test( + name=f"{n}_test", + command=cxxprogram( + name=f"{n}_test_exe", + srcs=[f"./{n}.cc"], + deps=[ + "+fl2_proto_lib", + "+protocol", + "dep/adflib", + "dep/agg", + "dep/fatfs", + "dep/hfsutils", + "dep/libusbp", + "dep/snowhouse", + "dep/stb", + "+lib", + "lib+config_proto_lib", + "src/formats", + ], + ), + ) + for n in tests + ], +) diff --git a/tests/bytes.cc b/tests/bytes.cc index caf53f40..539e5b46 100644 --- a/tests/bytes.cc +++ b/tests/bytes.cc @@ -1,4 +1,4 @@ -#include "globals.h" +#include "lib/globals.h" #include "lib/bytes.h" #include "snowhouse/snowhouse.h" diff --git a/tests/compression.cc b/tests/compression.cc index 2d97123b..102788a3 100644 --- a/tests/compression.cc +++ b/tests/compression.cc @@ -1,4 +1,4 @@ -#include "globals.h" +#include "lib/globals.h" #include "lib/bytes.h" static void test_roundtrip() diff --git a/tests/cpmfs.cc b/tests/cpmfs.cc index dfe53dc9..84b9efb6 100644 --- a/tests/cpmfs.cc +++ b/tests/cpmfs.cc @@ -1,4 +1,4 @@ -#include "globals.h" +#include "lib/globals.h" #include "lib/vfs/vfs.h" #include "lib/vfs/sectorinterface.h" #include "lib/vfs/vfs.pb.h" diff --git a/tests/csvreader.cc b/tests/csvreader.cc index fb97033a..57bc365d 100644 --- a/tests/csvreader.cc +++ b/tests/csvreader.cc @@ -1,4 +1,4 @@ -#include "globals.h" +#include "lib/globals.h" #include "lib/csvreader.h" #include diff --git a/tests/flags.cc b/tests/flags.cc index 79e19735..89ed0989 100644 --- a/tests/flags.cc +++ b/tests/flags.cc @@ -1,5 +1,5 @@ -#include "globals.h" -#include "flags.h" +#include "lib/globals.h" +#include "lib/flags.h" #include static void testDefaultIntValue() diff --git a/tests/fluxmapreader.cc b/tests/fluxmapreader.cc index be090e7c..996ab85b 100644 --- a/tests/fluxmapreader.cc +++ b/tests/fluxmapreader.cc @@ -1,6 +1,6 @@ -#include "globals.h" -#include "fluxmap.h" -#include "decoders/fluxmapreader.h" +#include "lib/globals.h" +#include "lib/fluxmap.h" +#include "lib/decoders/fluxmapreader.h" #include "protocol.h" #include "fmt/format.h" #include "tests.h" diff --git a/tests/fluxpattern.cc b/tests/fluxpattern.cc index 013ede65..3dcdcb13 100644 --- a/tests/fluxpattern.cc +++ b/tests/fluxpattern.cc @@ -1,6 +1,6 @@ -#include "globals.h" -#include "fluxmap.h" -#include "decoders/fluxmapreader.h" +#include "lib/globals.h" +#include "lib/fluxmap.h" +#include "lib/decoders/fluxmapreader.h" #include typedef std::vector ivector; diff --git a/tests/flx.cc b/tests/flx.cc index 85b0f045..bc26e65d 100644 --- a/tests/flx.cc +++ b/tests/flx.cc @@ -1,7 +1,7 @@ #include #include #include -#include "globals.h" +#include "lib/globals.h" #include "lib/fluxmap.h" #include "lib/fluxsource/flx.h" diff --git a/tests/fmmfm.cc b/tests/fmmfm.cc index ed105e03..f5a4c29a 100644 --- a/tests/fmmfm.cc +++ b/tests/fmmfm.cc @@ -1,5 +1,5 @@ -#include "globals.h" -#include "decoders/decoders.h" +#include "lib/globals.h" +#include "lib/decoders/decoders.h" #include static void testDecode(void) diff --git a/tests/greaseweazle.cc b/tests/greaseweazle.cc index 9a57832d..8ddbc8dd 100644 --- a/tests/greaseweazle.cc +++ b/tests/greaseweazle.cc @@ -1,8 +1,8 @@ #include #include #include -#include "globals.h" -#include "fluxmap.h" +#include "lib/globals.h" +#include "lib/fluxmap.h" #include "lib/usb/greaseweazle.h" #define E28(val) \ diff --git a/tests/kryoflux.cc b/tests/kryoflux.cc index 8361a82d..175a5411 100644 --- a/tests/kryoflux.cc +++ b/tests/kryoflux.cc @@ -1,9 +1,9 @@ #include #include #include -#include "globals.h" -#include "fluxmap.h" -#include "fluxsource/kryoflux.h" +#include "lib/globals.h" +#include "lib/fluxmap.h" +#include "lib/fluxsource/kryoflux.h" static void test_convert(const Bytes& kryofluxbytes, const Bytes& fluxmapbytes) { diff --git a/tests/ldbs.cc b/tests/ldbs.cc index 3934e8fd..af97933b 100644 --- a/tests/ldbs.cc +++ b/tests/ldbs.cc @@ -1,9 +1,9 @@ #include #include #include -#include "globals.h" +#include "lib/globals.h" #include "lib/bytes.h" -#include "ldbs.h" +#include "lib/ldbs.h" static Bytes testdata{ // clang-format off diff --git a/tests/options.cc b/tests/options.cc index 75e91c19..12837966 100644 --- a/tests/options.cc +++ b/tests/options.cc @@ -1,8 +1,8 @@ -#include "globals.h" +#include "lib/globals.h" #include "lib/bytes.h" #include "tests/testproto.pb.h" #include "lib/config.pb.h" -#include "proto.h" +#include "lib/proto.h" #include "snowhouse/snowhouse.h" #include #include diff --git a/tests/proto.cc b/tests/proto.cc index a0f2d46b..1386f689 100644 --- a/tests/proto.cc +++ b/tests/proto.cc @@ -1,8 +1,8 @@ -#include "globals.h" +#include "lib/globals.h" #include "lib/bytes.h" #include "tests/testproto.pb.h" #include "lib/config.pb.h" -#include "proto.h" +#include "lib/proto.h" #include "snowhouse/snowhouse.h" #include #include diff --git a/tests/utils.cc b/tests/utils.cc index 5ff64b03..b98901de 100644 --- a/tests/utils.cc +++ b/tests/utils.cc @@ -1,5 +1,5 @@ -#include "globals.h" -#include "utils.h" +#include "lib/globals.h" +#include "lib/utils.h" #include "snowhouse/snowhouse.h" using namespace snowhouse; diff --git a/tests/vfs.cc b/tests/vfs.cc index 158c9524..523355ce 100644 --- a/tests/vfs.cc +++ b/tests/vfs.cc @@ -1,4 +1,4 @@ -#include "globals.h" +#include "lib/globals.h" #include "lib/vfs/vfs.h" #include "snowhouse/snowhouse.h" diff --git a/tools/build.py b/tools/build.py new file mode 100644 index 00000000..1faeee19 --- /dev/null +++ b/tools/build.py @@ -0,0 +1,27 @@ +from build.c import cxxprogram + +cxxprogram( + name="brother120tool", + srcs=["./brother120tool.cc"], + deps=["+lib", "lib+config_proto_lib"], +) + +cxxprogram( + name="brother240tool", + srcs=["./brother240tool.cc"], + deps=["+lib", "lib+config_proto_lib"], +) + +cxxprogram( + name="upgrade-flux-file", + srcs=["./upgrade-flux-file.cc"], + deps=[ + "+lib", + "src/formats", + "lib+config_proto_lib", + "+protocol", + "+fl2_proto_lib", + "+sqlite3_lib", + "dep/libusbp", + ], +)