aboutsummaryrefslogtreecommitdiff
path: root/flatcc/scripts/initbuild.sh
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2023-07-16 02:03:33 +0200
committerToni Uhlig <matzeton@googlemail.com>2023-07-16 02:03:33 +0200
commitb31e4bc16d1df62b50c6f77a77041f9e7b6c906d (patch)
tree024c74c13d918aa6bde302aab6836fa33607613c /flatcc/scripts/initbuild.sh
parentba6815ef8fb8ae472412b5af2837a7caba2799c2 (diff)
parent5a40295c4cf0af5ea8da9ced04a4ce7d3621a080 (diff)
Merge commit '5a40295c4cf0af5ea8da9ced04a4ce7d3621a080' as 'flatcc'
Diffstat (limited to 'flatcc/scripts/initbuild.sh')
-rwxr-xr-xflatcc/scripts/initbuild.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/flatcc/scripts/initbuild.sh b/flatcc/scripts/initbuild.sh
new file mode 100755
index 0000000..2b18cd2
--- /dev/null
+++ b/flatcc/scripts/initbuild.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+# link a specific build.cfg.xxx to build.cfg to use that build
+# configuration, e.g. ln -sf build.cfg.make build.cfg
+#
+# call build/cleanall.sh before changing
+
+set -e
+
+HERE=`dirname $0`
+cd $HERE/..
+ROOT=`pwd`
+
+CFGFILE=${ROOT}/scripts/build.cfg
+
+if [ x"$1" != x ]; then
+ if [ -e ${CFGFILE}.$1 ]; then
+ ln -sf ${CFGFILE}.$1 $CFGFILE
+ else
+ echo "missing config file for build generator option: $1"
+ exit -1
+ fi
+ ${ROOT}/scripts/cleanall.sh
+fi
+
+if [ -e $CFGFILE ]; then
+ . $CFGFILE
+fi
+
+FLATCC_BUILD_GEN=${FLATCC_BUILD_GEN:-Ninja}
+
+echo "initializing build for CMake $FLATCC_BUILD_GEN"
+
+mkdir -p ${ROOT}/build/Debug
+mkdir -p ${ROOT}/build/Release
+rm -rf ${ROOT}/build/Debug/*
+rm -rf ${ROOT}/build/Release/*
+
+cd ${ROOT}/build/Debug && cmake -G "$FLATCC_BUILD_GEN" $FLATCC_BUILD_FLAGS ../.. -DCMAKE_BUILD_TYPE=Debug
+cd ${ROOT}/build/Release && cmake -G "$FLATCC_BUILD_GEN" $FLATCC_BUILD_FLAGS ../.. -DCMAKE_BUILD_TYPE=Release