updates to the sapphire.sh script

This commit is contained in:
apio 2022-07-19 15:11:24 +02:00
parent 434405afb4
commit af0fb223be
8 changed files with 41 additions and 27 deletions

View File

@ -70,4 +70,6 @@ target_link_libraries(sapphirec ${llvm_libs})
install(TARGETS sapphirec)
include_directories(src src/tclap-1.2.5/include)
include(cmake/clang-dev-tools.cmake)

View File

View File

@ -6,14 +6,4 @@ add_custom_target(
-style=file
-i
${ALL_SOURCE_FILES}
)
add_custom_target(
clang-tidy
COMMAND /usr/bin/clang-tidy
${ALL_SOURCE_FILES}
-config=''
--
-std=c++20
-I${INCLUDE_DIRECTORIES}
)

24
sapphire.sh Executable file
View File

@ -0,0 +1,24 @@
cd $(dirname $0)
usage()
{
echo "Sapphire utility script"
echo "-----------------------"
echo "sapphire.sh build <config>: build the project"
echo "sapphire.sh generate <generator>: regenerate build files"
echo "sapphire.sh format: run clang-format on source files"
echo "sapphire.sh clean: clean build files"
echo "sapphire.sh install <path>: install the project"
echo "sapphire.sh new-ast-node <name>: create a new AST node"
}
case $1 in
"build") tools/build.sh "$2";;
"generate") tools/generate.sh "$2";;
"format") tools/format.sh;;
"clean") rm -rf build;;
"install") tools/install.sh "$2";;
"new-ast-node") tools/generateASTNode.sh $2;;
"help") usage;;
*) echo "Invalid action, run './sapphire.sh help' for a list of available options.";;
esac

View File

@ -1,8 +1 @@
if [ ! -d build ]
then
mkdir build
fi
cmake -S . -B build -G ${1:-Ninja}
cmake --build build
cmake --build build --config $1

6
tools/generate.sh Executable file
View File

@ -0,0 +1,6 @@
if [ ! -d build ]
then
mkdir build
fi
cmake -S . -B build -G "${1:-Ninja}"

8
tools/install.sh Executable file
View File

@ -0,0 +1,8 @@
cd build
if [ "$1" == "" ]
then
cmake --install .
else
cmake --install . --prefix $1
fi

View File

@ -1,9 +0,0 @@
if [ ! -d build ]
then
mkdir build
cmake -S . -B build
fi
cd build
cmake --build . --target clang-tidy