Update FlatBuffers codegen script for Nyma cores
uses latest (they switched from SemVer to dates, so 22.9.24 follows 2.0.8) works on real Linux, using Nix if installed
This commit is contained in:
parent
ddac50eb30
commit
cf0053fd3c
|
@ -1,3 +1,21 @@
|
|||
#!/bin/sh
|
||||
./flatc --cpp --gen-object-api NymaTypes.fbs
|
||||
./flatc --csharp --gen-object-api -o ../../ExternalProjects/FlatBuffers.GenOutput NymaTypes.fbs
|
||||
if ( uname -s | fgrep -i cygwin ); then
|
||||
flatc=./flatc
|
||||
else
|
||||
flatc="$(command -v flatc)"
|
||||
if [ -z "$flatc" ]; then
|
||||
if ! ( command -v nix >/dev/null ); then
|
||||
printf "You do not have flatc (the FlatBuffers schema compiler) installed.\nIf it's not available from your package manager, you will have to build from source:\n%s\n" "https://google.github.io/flatbuffers/flatbuffers_guide_building.html"
|
||||
exit 1
|
||||
fi
|
||||
printf "Grabbing flatc via Nix...\n"
|
||||
nix-shell --run "$0"
|
||||
exit $?
|
||||
fi
|
||||
fi
|
||||
"$flatc" --cpp --gen-object-api NymaTypes.fbs
|
||||
"$flatc" --csharp --gen-object-api -o ../../ExternalProjects/FlatBuffers.GenOutput NymaTypes.fbs
|
||||
if ! ( uname -s | fgrep -i cygwin ); then
|
||||
unix2dos NymaTypes_generated.h
|
||||
unix2dos ../../ExternalProjects/FlatBuffers.GenOutput/NymaTypes/*
|
||||
fi
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
{ pkgs ? import <nixpkgs> {} }:
|
||||
let
|
||||
versionAtLeast = exVer: acVer: builtins.compareVersions exVer acVer <= 0;
|
||||
flatbuffersPatched = pkgs.flatbuffers.overrideAttrs (oldAttrs: {
|
||||
version = "22.9.24";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "google";
|
||||
repo = "flatbuffers";
|
||||
rev = "76ddae006f6e5068d2f26f235dbd167bd826a698";
|
||||
sha256 = "1vycd1641id476qhmkrgdfiisxx7n2zn54p3r6nva6dm0bd58lc8";
|
||||
};
|
||||
patches = []; # single patch has since been merged upstream
|
||||
postPatch = ''
|
||||
# Fix default value of "test_data_path" to make tests work
|
||||
substituteInPlace tests/test.cpp --replace '"tests/";' '"../tests/";'
|
||||
'';
|
||||
});
|
||||
flatbuffersFinal = if versionAtLeast "22.9.24" pkgs.flatbuffers.version
|
||||
then pkgs.flatbuffers
|
||||
else assert versionAtLeast "2.0.0" pkgs.flatbuffers.version; flatbuffersPatched; # need base of >= Nixpkgs 21.11
|
||||
in pkgs.mkShell {
|
||||
packages = [ flatbuffersFinal ];
|
||||
}
|
Loading…
Reference in New Issue