Files
tito/.templates/install_qtcreator.sh
Tomasz Sowa ecf25a5e5e 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/tito.creator
file.

You can use 'make qtcreator' again to refresh .qtcreator/tito.files,
the rest of the project files will not be modified.
2024-09-22 11:37:59 +02:00

66 lines
1.5 KiB
Bash
Executable File

#!/bin/sh
CURRENT_DIR=$(pwd)
GLOBAL_WORKING_DIR=$(realpath ${CURRENT_DIR}/..)
QTCREATOR_DIR=${CURRENT_DIR}/.qtcreator
# ----------
# make sure the current directory is correct
if [ ! -d ${CURRENT_DIR}/.templates ] ; then
echo "this script should be called by make: make qtcreator (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')
was_qtcreator_dir=0
if [ -d "${QTCREATOR_DIR}" ] ; then
was_qtcreator_dir=1
else
mkdir -p "${QTCREATOR_DIR}"
fi
if [ -d "${QTCREATOR_DIR}" ] ; then
if [ -d ${CURRENT_DIR}/.templates/.qtcreator ] ; then
cd ${CURRENT_DIR}/.templates/.qtcreator
if [ $? -eq 0 ] ; then
for i in * ; do
if [ ! -f "${QTCREATOR_DIR}/$i" ] ; then
cat "$i" | \
sed -e "s/%%%CURRENT_DIR%%%/${CURRENT_DIR_FOR_SED}/g" \
-e "s/%%%GLOBAL_WORKING_DIR%%%/${GLOBAL_WORKING_DIR_FOR_SED}/g" > \
"${QTCREATOR_DIR}/$i"
fi
done
if [ $was_qtcreator_dir -eq 0 ] ; then
echo "QTCreator files generated to ${QTCREATOR_DIR} directory"
echo "select an 'open project...' option and find a ${QTCREATOR_DIR}/*.creator file"
fi
fi
fi
find ${QTCREATOR_DIR} -name "*.files" | while read projectfiles ; do
cd ${CURRENT_DIR}/src
if [ $? -eq 0 ] ; then
find ../src -type f \( -iname "*.cpp" -o -iname "*.h" \) | sort > ${projectfiles}
echo "file ${projectfiles} has been updated"
fi
done
fi