add a clangd and qtcreator make targets

Add a clangd make target:
$ make clangd
This installs a .clangd file with configuration (includes/macros/compiler flags)
for the clandg language server.

Add a qtcreator make target:
$ make qtcreator
This installs a .qtcreator directory with QTCreator IDE project files.
In the QTCreator you can open a project by selecting the .qtcreator/ezc.creator
file.

You can use 'make qtcreator' again to refresh .qtcreator/ezc.files,
the rest of the project files will not be modified.
This commit is contained in:
2024-09-22 11:33:04 +02:00
parent 0de5623182
commit da8c33b14c
12 changed files with 296 additions and 9 deletions

30
.templates/install_clangd.sh Executable file
View File

@@ -0,0 +1,30 @@
#!/bin/sh
CURRENT_DIR=$(pwd)
GLOBAL_WORKING_DIR=$(realpath ${CURRENT_DIR}/../..)
# ----------
# make sure the current directory is correct
if [ ! -d ${CURRENT_DIR}/.templates ] ; then
echo "this script should be called by make: make clangd (one level up)"
exit 1
fi
# change / to \/ in paths
CURRENT_DIR_FOR_SED=$(echo ${CURRENT_DIR} | sed 's/\//\\\//g')
GLOBAL_WORKING_DIR_FOR_SED=$(echo ${GLOBAL_WORKING_DIR} | sed 's/\//\\\//g')
if [ -f "${CURRENT_DIR}/.templates/.clangd" ] ; then
if [ ! -f "${CURRENT_DIR}/.clangd" ] ; then
cat "${CURRENT_DIR}/.templates/.clangd" | \
sed -e "s/%%%CURRENT_DIR%%%/${CURRENT_DIR_FOR_SED}/g" \
-e "s/%%%GLOBAL_WORKING_DIR%%%/${GLOBAL_WORKING_DIR_FOR_SED}/g" > \
${CURRENT_DIR}/.clangd
echo "added a ${CURRENT_DIR}/.clangd file"
fi
fi