From 9de6047097ad44e8c360b94bf5b05bca33fcf8ff Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Wed, 27 Nov 2019 16:26:50 +0100 Subject: [PATCH] dist/tools: add support for flatc compiler --- dist/tools/flatc/.gitignore | 2 ++ dist/tools/flatc/Makefile | 28 ++++++++++++++++++++++++++++ makefiles/tools/targets.inc.mk | 5 +++++ 3 files changed, 35 insertions(+) create mode 100644 dist/tools/flatc/.gitignore create mode 100644 dist/tools/flatc/Makefile diff --git a/dist/tools/flatc/.gitignore b/dist/tools/flatc/.gitignore new file mode 100644 index 0000000000..baed641328 --- /dev/null +++ b/dist/tools/flatc/.gitignore @@ -0,0 +1,2 @@ +flatc +bin diff --git a/dist/tools/flatc/Makefile b/dist/tools/flatc/Makefile new file mode 100644 index 0000000000..959b77a8a9 --- /dev/null +++ b/dist/tools/flatc/Makefile @@ -0,0 +1,28 @@ +PKG_NAME=flatc +PKG_URL=https://github.com/google/flatbuffers +PKG_VERSION=9e7e8cbe9f675123dd41b7c62868acad39188cae +PKG_LICENSE=Apache2.0 + +PKG_BUILDDIR=$(CURDIR)/bin + +# manually set some RIOT env vars, so this Makefile can be called stand-alone +RIOTBASE ?= $(CURDIR)/../../.. +RIOTTOOLS ?= $(CURDIR)/.. +GITCACHE ?= $(RIOTTOOLS)/git/git-cache + +CMAKE_OPTIONS = \ + -DCMAKE_BUILD_TYPE=Release \ + -DFLATBUFFERS_BUILD_TESTS=OFF \ + -DFLATBUFFERS_BUILD_FLATHASH=OFF \ + -DFLATBUFFERS_BUILD_FLATLIB=OFF \ + # + +include $(RIOTBASE)/pkg/pkg.mk + +all: + @cd "$(PKG_BUILDDIR)" && env -i PATH="$(PATH)" cmake -G "Unix Makefiles" $(CMAKE_OPTIONS) . + "$(MAKE)" -C "$(PKG_BUILDDIR)" + @mv "$(PKG_BUILDDIR)"/flatc $(CURDIR)/flatc + +distclean:: + @rm -f $(CURDIR)/flatc diff --git a/makefiles/tools/targets.inc.mk b/makefiles/tools/targets.inc.mk index ac364fee6e..b8ae92b5af 100644 --- a/makefiles/tools/targets.inc.mk +++ b/makefiles/tools/targets.inc.mk @@ -34,3 +34,8 @@ $(RIOTTOOLS)/setsid/setsid: $(RIOTTOOLS)/setsid/Makefile @echo "[INFO] setsid binary not found - building it from source now" @make -C $(RIOTTOOLS)/setsid @echo "[INFO] setsid binary successfully built!" + +$(RIOTTOOLS)/flatc/flatc: $(RIOTTOOLS)/flatc/Makefile + @echo "[INFO] flatc binary not found - building it from source now" + make -C $(RIOTTOOLS)/flatc + @echo "[INFO] flatc binary successfully built!"