Add more subcommands to the builder

This commit is contained in:
Sameer Rahmani 2020-07-10 20:41:46 +01:00
parent 51b9f4a307
commit 5668ef4d10
4 changed files with 115 additions and 65 deletions

View File

@ -26,6 +26,7 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
"${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
set(MemoryCheckCommand "valgrind")
# Let's nicely support folders in IDEs
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

107
builder Executable file
View File

@ -0,0 +1,107 @@
#! /bin/bash
command=$1
export CCC_CC=clang-10
export CCC_CXX=clang++-10
export CC=clang-10
export CXX=clang++-10
ROOT_DIR=`pwd`
BUILD_DIR=$ROOT_DIR/build
scanbuild=scan-build-10
function compile() {
pushd $BUILD_DIR
ninja
popd
}
function build() {
pushd $BUILD_DIR
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug $ROOT_DIR
#make -j 4
ninja
popd
}
function clean() {
rm -rf $BUILD_DIR
}
function run() {
pushd $BUILD_DIR
$BUILD_DIR/bin/serene "$@"
popd
}
function memcheck() {
pushd $BUILD_DIR
ctest -T memcheck
popd
}
function tests() {
pushd $BUILD_DIR
ctest
popd
}
case "$command" in
"deps")
sudo apt update
sudo apt install -y llvm-10 llvm-10-tools \
clang-10 clang-format-10 clang-tidy-10 \
clang-tools-10 valgrind cmake ninja-build
;;
"build")
clean
mkdir -p $BUILD_DIR
build
;;
"compile")
compile
;;
"run")
run "$@"
;;
"scan-build")
clean
mkdir -p $BUILD_DIR
pushd $BUILD_DIR
exec $scanbuild cmake $ROOT_DIR
exec $scanbuild scan-build make -j 4
popd
;;
"memcheck")
memcheck
;;
"memcheck")
tests
;;
"clean")
rm -rf $BUILD_DIR
;;
"full-build")
clean
mkdir -p $BUILD_DIR
build
tests
memcheck
;;
*)
echo "Commands: "
echo "full-build - Build and test Serene."
echo "build - Build Serene from scratch"
echo "compile - reCompiles the project using the already exist cmake configuration"
echo "run - Runs the serene executable"
echo "scan-build - Compiles serene with static analyzer"
echo "tests - Runs the test cases"
echo "memcheck - Runs the memcheck tool."
echo "clean - :D"
;;
esac

View File

@ -1,65 +0,0 @@
#! /bin/bash
command=$1
export CCC_CC=clang-10
export CCC_CXX=clang++-10
export CC=clang-10
export CXX=clang++-10
ROOT_DIR=`pwd`
BUILD_DIR=$ROOT_DIR/build
scanbuild=scan-build-10
function build() {
pushd $BUILD_DIR
cmake $ROOT_DIR
make -j 4
popd
}
function clean() {
rm -rf $BUILD_DIR
}
function run() {
pushd $BUILD_DIR
$BUILD_DIR/bin/serene "$@"
popd
}
case "$command" in
"fresh-build")
clean
mkdir -p $BUILD_DIR
build
;;
"build")
build
;;
"run")
run "$@"
;;
"scan-build")
clean
mkdir -p $BUILD_DIR
pushd $BUILD_DIR
exec $scanbuild cmake $ROOT_DIR
exec $scanbuild scan-build make -j 4
popd
;;
"clean")
rm -rf $BUILD_DIR
;;
*)
echo "Commands: "
echo "fresh-build - Build Serene from scratch"
echo "build - reCompiles the project using the already exist cmake configuration"
echo "run - Runs the serene executable"
echo "scan-build - Compiles serene with static analyzer"
echo "clean - :D"
;;
esac

View File

@ -1,3 +1,10 @@
* Requirements
- llvm-10
- valgrind
- cmake
- ninja
- clang
- clang-tidy
* Parser
First of all you need to read [[https://tomassetti.me/guide-parsing-algorithms-terminology/][All you need to know about Parser algorithms]].
Then here is the list or parsers that we have considered