mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
Merge.
This commit is contained in:
4
.github/workflows/ccpp.yml
vendored
4
.github/workflows/ccpp.yml
vendored
@@ -20,7 +20,7 @@ jobs:
|
||||
path: 'fluxengine-testdata'
|
||||
- name: apt
|
||||
run: |
|
||||
sudo apt install libudev-dev libsqlite3-dev protobuf-compiler libwxgtk3.0-gtk3-dev libfmt-dev libprotobuf-dev wx-common libqtbase5-dev
|
||||
sudo apt install libudev-dev libsqlite3-dev protobuf-compiler libwxgtk3.0-gtk3-dev libfmt-dev libprotobuf-dev wx-common
|
||||
- name: make
|
||||
run: CXXFLAGS="-Wp,-D_GLIBCXX_ASSERTIONS" make -j`nproc` -C fluxengine
|
||||
|
||||
@@ -70,7 +70,7 @@ jobs:
|
||||
mingw-w64-i686-sqlite3
|
||||
mingw-w64-i686-wxWidgets
|
||||
mingw-w64-i686-zlib
|
||||
mingw-w64-i686-imagemagick
|
||||
mingw-w64-i686-png2ico
|
||||
mingw-w64-i686-qt5-static
|
||||
vim
|
||||
zip
|
||||
|
||||
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -34,7 +34,7 @@ jobs:
|
||||
mingw-w64-i686-sqlite3
|
||||
mingw-w64-i686-wxWidgets
|
||||
mingw-w64-i686-zlib
|
||||
mingw-w64-i686-imagemagick
|
||||
mingw-w64-i686-png2ico
|
||||
mingw-w64-i686-qt5-static
|
||||
vim
|
||||
zip
|
||||
|
||||
194
build.lua
194
build.lua
@@ -1,194 +0,0 @@
|
||||
vars.cflags = { "$(CFLAGS)" }
|
||||
vars.cxxflags = { "$(CXXFLAGS)" }
|
||||
vars.ldflags = { "-pthread" }
|
||||
|
||||
include "build/protobuf.lua"
|
||||
include "build/dependency.lua"
|
||||
include "build/tests.lua"
|
||||
|
||||
dependency {
|
||||
name = "fmt_dep",
|
||||
pkg_config = "fmt",
|
||||
}
|
||||
|
||||
dependency {
|
||||
name = "stb_dep",
|
||||
pkg_config = "stb",
|
||||
fallback = "dep/stb+stb"
|
||||
}
|
||||
|
||||
dependency {
|
||||
name = "protobuf_dep",
|
||||
pkg_config = "protobuf"
|
||||
}
|
||||
|
||||
dependency {
|
||||
name = "zlib_dep",
|
||||
pkg_config = "zlib"
|
||||
}
|
||||
|
||||
proto_cc_library {
|
||||
name = "config_lib",
|
||||
srcs = {
|
||||
"./lib/common.proto",
|
||||
"./lib/config.proto",
|
||||
"./lib/decoders/decoders.proto",
|
||||
"./lib/drive.proto",
|
||||
"./lib/encoders/encoders.proto",
|
||||
"./lib/fl2.proto",
|
||||
"./lib/fluxsink/fluxsink.proto",
|
||||
"./lib/fluxsource/fluxsource.proto",
|
||||
"./lib/imagereader/imagereader.proto",
|
||||
"./lib/imagewriter/imagewriter.proto",
|
||||
"./lib/mapper.proto",
|
||||
"./lib/usb/usb.proto",
|
||||
"./arch/aeslanier/aeslanier.proto",
|
||||
"./arch/agat/agat.proto",
|
||||
"./arch/amiga/amiga.proto",
|
||||
"./arch/apple2/apple2.proto",
|
||||
"./arch/brother/brother.proto",
|
||||
"./arch/c64/c64.proto",
|
||||
"./arch/f85/f85.proto",
|
||||
"./arch/fb100/fb100.proto",
|
||||
"./arch/ibm/ibm.proto",
|
||||
"./arch/macintosh/macintosh.proto",
|
||||
"./arch/micropolis/micropolis.proto",
|
||||
"./arch/mx/mx.proto",
|
||||
"./arch/northstar/northstar.proto",
|
||||
"./arch/rolandd20/rolandd20.proto",
|
||||
"./arch/tids990/tids990.proto",
|
||||
"./arch/victor9k/victor9k.proto",
|
||||
"./arch/zilogmcz/zilogmcz.proto",
|
||||
}
|
||||
}
|
||||
|
||||
clibrary {
|
||||
name = "protocol_lib",
|
||||
hdrs = { "./protocol.h" }
|
||||
}
|
||||
|
||||
clibrary {
|
||||
name = "libfluxengine",
|
||||
srcs = {
|
||||
"./arch/aeslanier/decoder.cc",
|
||||
"./arch/agat/agat.cc",
|
||||
"./arch/agat/decoder.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/rolandd20.cc",
|
||||
"./arch/tids990/decoder.cc",
|
||||
"./arch/tids990/encoder.cc",
|
||||
"./arch/victor9k/decoder.cc",
|
||||
"./arch/victor9k/encoder.cc",
|
||||
"./arch/zilogmcz/decoder.cc",
|
||||
"./lib/bitmap.cc",
|
||||
"./lib/bytes.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/flags.cc",
|
||||
"./lib/fluxmap.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/cwffluxsource.cc",
|
||||
"./lib/fluxsource/erasefluxsource.cc",
|
||||
"./lib/fluxsource/fl2fluxsource.cc",
|
||||
"./lib/fluxsource/fluxsource.cc",
|
||||
"./lib/fluxsource/hardwarefluxsource.cc",
|
||||
"./lib/fluxsource/kryoflux.cc",
|
||||
"./lib/fluxsource/kryofluxfluxsource.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/imgimagewriter.cc",
|
||||
"./lib/imagewriter/ldbsimagewriter.cc",
|
||||
"./lib/imagewriter/nsiimagewriter.cc",
|
||||
"./lib/imagewriter/rawimagewriter.cc",
|
||||
"./lib/imginputoutpututils.cc",
|
||||
"./lib/ldbs.cc",
|
||||
"./lib/logger.cc",
|
||||
"./lib/mapper.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",
|
||||
"protocol.h",
|
||||
},
|
||||
deps = {
|
||||
"+config_lib",
|
||||
"+protocol_lib",
|
||||
"+fmt_dep",
|
||||
"+protobuf_dep",
|
||||
"+zlib_dep",
|
||||
"dep/libusbp+libusbp",
|
||||
},
|
||||
dep_cflags = { "-Ilib", "-Iarch", "-I." },
|
||||
vars = {
|
||||
["+cflags"] = { "-Ilib", "-Iarch", "-I." }
|
||||
}
|
||||
}
|
||||
|
||||
installable {
|
||||
name = "all",
|
||||
map = {
|
||||
["fluxengine"] = "src+fluxengine",
|
||||
["fluxengine-gui"] = "src/gui+fluxengine",
|
||||
["brother120tool"] = "tools+brother120tool",
|
||||
["brother240tool"] = "tools+brother240tool",
|
||||
["upgrade-flux-file"] = "tools+upgrade-flux-file",
|
||||
}
|
||||
}
|
||||
|
||||
include "tests/build.lua"
|
||||
|
||||
251
build/build.lua
251
build/build.lua
@@ -1,251 +0,0 @@
|
||||
local OBJDIR = "$(OBJDIR)"
|
||||
|
||||
local function objdir(e)
|
||||
return concatpath(OBJDIR, e.cwd, e.name)
|
||||
end
|
||||
|
||||
definerule("normalrule",
|
||||
{
|
||||
ins = { type="targets" },
|
||||
deps = { type="targets", default={} },
|
||||
outs = { type="targets", default={} },
|
||||
outleaves = { type="strings" },
|
||||
label = { type="string", optional=true },
|
||||
objdir = { type="string", optional=true },
|
||||
commands = { type="strings" },
|
||||
},
|
||||
function (e)
|
||||
local dir = e.objdir or objdir(e)
|
||||
local realouts = {}
|
||||
for _, v in pairs(e.outleaves) do
|
||||
realouts[#realouts+1] = concatpath(dir, v)
|
||||
end
|
||||
|
||||
local vars = inherit(e.vars, {
|
||||
dir = dir
|
||||
})
|
||||
|
||||
local result = simplerule {
|
||||
name = e.name,
|
||||
ins = e.ins,
|
||||
deps = e.deps,
|
||||
outs = concat(realouts, filenamesof(e.outs)),
|
||||
label = e.label,
|
||||
commands = e.commands,
|
||||
vars = vars,
|
||||
}
|
||||
result.dir = dir
|
||||
return result
|
||||
end
|
||||
)
|
||||
|
||||
local function is_clike(f)
|
||||
return f:find("%.c$") or f:find("%.cc$") or f:find("%.cpp$")
|
||||
end
|
||||
|
||||
definerule("cfile",
|
||||
{
|
||||
srcs = { type="targets" },
|
||||
deps = { type="targets", default={} }
|
||||
},
|
||||
function (e)
|
||||
local cflags = e.vars.cflags
|
||||
local cxxflags = e.vars.cxxflags
|
||||
for _, target in ipairs(targetsof(e.deps)) do
|
||||
if target.is.clibrary then
|
||||
cflags = concat(cflags, target.dep_cflags)
|
||||
cxxflags = concat(cxxflags, target.dep_cxxflags)
|
||||
end
|
||||
end
|
||||
|
||||
local src = filter(filenamesof(e.srcs), is_clike)
|
||||
local cmd
|
||||
local cxx = false
|
||||
if src[1]:find("%.c$") then
|
||||
cmd = "$(CC) -c -o %{outs[1]} %{ins[1]} %{hdrpaths} %{cflags}"
|
||||
else
|
||||
cmd = "$(CXX) -c -o %{outs[1]} %{ins[1]} %{hdrpaths} %{cflags} %{cxxflags}"
|
||||
cxx = true
|
||||
end
|
||||
|
||||
local outleaf = basename(e.name)..".o"
|
||||
local rule = normalrule {
|
||||
name = e.name,
|
||||
cwd = e.cwd,
|
||||
ins = e.srcs,
|
||||
deps = e.deps,
|
||||
outleaves = {outleaf},
|
||||
label = e.label,
|
||||
commands = cmd,
|
||||
vars = {
|
||||
hdrpaths = {},
|
||||
cflags = cflags,
|
||||
cxxflags = cxxflags,
|
||||
}
|
||||
}
|
||||
|
||||
rule.is.cxxfile = cxx
|
||||
return rule
|
||||
end
|
||||
)
|
||||
|
||||
local function do_cfiles(e)
|
||||
local outs = {}
|
||||
local srcs = filenamesof(e.srcs)
|
||||
for _, f in ipairs(sorted(filter(srcs, is_clike))) do
|
||||
local ofile
|
||||
if f:find(OBJDIR, 1, true) == 1 then
|
||||
ofile = e.name.."/"..f:sub(#OBJDIR+1)..".o"
|
||||
else
|
||||
ofile = e.name.."/"..f..".o"
|
||||
end
|
||||
outs[#outs+1] = cfile {
|
||||
name = ofile,
|
||||
srcs = { f },
|
||||
deps = e.deps
|
||||
}
|
||||
end
|
||||
return outs
|
||||
end
|
||||
|
||||
definerule("clibrary",
|
||||
{
|
||||
srcs = { type="targets", default={} },
|
||||
deps = { type="targets", default={} },
|
||||
hdrs = { type="targets", default={} },
|
||||
dep_cflags = { type="strings", default={} },
|
||||
dep_cxxflags = { type="strings", default={} },
|
||||
dep_ldflags = { type="strings", default={} },
|
||||
dep_libs = { type="strings", default={} },
|
||||
},
|
||||
function (e)
|
||||
local ins = do_cfiles(e)
|
||||
local cxx = false
|
||||
for _, f in ipairs(ins) do
|
||||
if f.is.cxxfile then
|
||||
cxx = true
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
local mkdirs = {}
|
||||
local copies = {}
|
||||
local outs = {}
|
||||
local function copy_file(src, dest)
|
||||
mkdirs[#mkdirs+1] = "mkdir -p %{dir}/"..dirname(dest)
|
||||
copies[#copies+1] = "cp "..src.." %{dir}/"..dest
|
||||
outs[#outs+1] = objdir(e).."/"..dest
|
||||
end
|
||||
|
||||
local deps = {}
|
||||
for k, v in pairs(e.hdrs) do
|
||||
deps[#deps+1] = v
|
||||
if type(k) == "number" then
|
||||
v = filenamesof(v)
|
||||
for _, v in ipairs(v) do
|
||||
if not startswith(e.cwd, v) then
|
||||
error(string.format("filename '%s' is not local to '%s' --- "..
|
||||
"you'll have to specify the output filename manually", v, e.cwd))
|
||||
end
|
||||
copy_file(v, v:gsub("^"..e.cwd, ""))
|
||||
end
|
||||
else
|
||||
v = filenamesof(v)
|
||||
if #v ~= 1 then
|
||||
error("each mapped hdrs item can only cope with a single file")
|
||||
end
|
||||
copy_file(v[1], k)
|
||||
end
|
||||
end
|
||||
|
||||
ins = sorted(filenamesof(ins))
|
||||
local has_ar = (#ins ~= 0)
|
||||
local lib = normalrule {
|
||||
name = e.name,
|
||||
cwd = e.cwd,
|
||||
ins = sorted(filenamesof(ins)),
|
||||
deps = deps,
|
||||
outs = outs,
|
||||
outleaves = { e.name..".a" },
|
||||
label = e.label,
|
||||
commands = {
|
||||
sorted(mkdirs),
|
||||
sorted(copies),
|
||||
has_ar and "rm -f %{outs[1]} && $(AR) cqs %{outs[1]} %{ins}" or {},
|
||||
}
|
||||
}
|
||||
|
||||
lib.dep_cflags = concat(e.dep_cflags, "-I"..lib.dir)
|
||||
lib.dep_cxxflags = e.dep_cxxflags
|
||||
lib.dep_ldflags = e.dep_ldflags
|
||||
lib.dep_libs = concat(e.dep_libs, has_ar and matching(filenamesof(lib), "%.a$") or {})
|
||||
lib.dep_cxx = cxx
|
||||
|
||||
for _, d in pairs(targetsof(e.deps)) do
|
||||
lib.dep_cflags = concat(lib.dep_cflags, d.dep_cflags)
|
||||
lib.dep_cxxflags = concat(lib.dep_cxxflags, d.dep_cxxflags)
|
||||
lib.dep_ldflags = concat(lib.dep_ldflags, d.dep_ldflags)
|
||||
lib.dep_libs = concat(lib.dep_libs, d.dep_libs)
|
||||
lib.dep_cxx = lib.dep_cxx or d.dep_cxx
|
||||
end
|
||||
|
||||
return lib
|
||||
end
|
||||
)
|
||||
|
||||
definerule("cprogram",
|
||||
{
|
||||
srcs = { type="targets", default={} },
|
||||
deps = { type="targets", default={} },
|
||||
},
|
||||
function (e)
|
||||
local deps = e.deps
|
||||
local ins = {}
|
||||
local cxx = false
|
||||
|
||||
if (#e.srcs > 0) then
|
||||
local objs = do_cfiles(e)
|
||||
for _, obj in pairs(objs) do
|
||||
if obj.is.cxxfile then
|
||||
cxx = true
|
||||
end
|
||||
ins[#ins+1] = obj
|
||||
end
|
||||
end
|
||||
|
||||
local libs = {}
|
||||
local cflags = {}
|
||||
local cxxflags = {}
|
||||
local ldflags = {}
|
||||
for _, lib in pairs(e.deps) do
|
||||
cflags = concat(cflags, lib.dep_cflags)
|
||||
cxxflags = concat(cxxflags, lib.dep_cxxflags)
|
||||
ldflags = concat(ldflags, lib.dep_ldflags)
|
||||
libs = concat(libs, lib.dep_libs)
|
||||
cxx = cxx or lib.dep_cxx
|
||||
end
|
||||
|
||||
local command
|
||||
if cxx then
|
||||
command = "$(CXX) $(LDFLAGS) %{ldflags} -o %{outs[1]} %{ins} %{libs} %{libs}"
|
||||
else
|
||||
command = "$(CC) $(LDFLAGS) %{ldflags} -o %{outs[1]} %{ins} %{libs} %{libs}"
|
||||
end
|
||||
|
||||
return normalrule {
|
||||
name = e.name,
|
||||
cwd = e.cwd,
|
||||
deps = deps,
|
||||
ins = ins,
|
||||
outleaves = { e.name },
|
||||
commands = { command },
|
||||
vars = {
|
||||
cflags = cflags,
|
||||
cxxflags = cxxflags,
|
||||
ldflags = ldflags,
|
||||
libs = libs,
|
||||
}
|
||||
}
|
||||
end
|
||||
)
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
definerule("test",
|
||||
{
|
||||
srcs = { type="targets", default={} },
|
||||
},
|
||||
function (e)
|
||||
if vars.TESTS == "yes" then
|
||||
normalrule {
|
||||
name = e.name,
|
||||
ins = e.srcs,
|
||||
outleaves = { "log.txt" },
|
||||
commands = {
|
||||
"%{ins} > %{outs}",
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
@@ -38,7 +38,7 @@ normalrule(
|
||||
ins=["./icon.png"],
|
||||
outs=["fluxengine.ico"],
|
||||
commands=[
|
||||
"convert {ins[0]} -resize 64x46 -define icon:auto-resize=64,48,32,16 {outs[0]}"
|
||||
"png2ico {outs[0]} {ins[0]}"
|
||||
],
|
||||
label="MAKEICON",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user