diff --git a/.gitignore b/.gitignore index 24f945c..1930293 100644 --- a/.gitignore +++ b/.gitignore @@ -3,15 +3,9 @@ .settings/ *.o *.so -winixd/winix -winixcli/src/winix -winixcli/m -.clangd -.qtc_clangd/ -winix.cflags -winix.config -winix.creator -winix.creator.user -winix.cxxflags -winix.files -winix.includes +/winixd/winix +/winixcli/src/winix +/winixcli/m +/.clangd +/.qtcreator/ +/.qtc_clangd/ diff --git a/.templates/.clangd b/.templates/.clangd new file mode 100644 index 0000000..b01e4f3 --- /dev/null +++ b/.templates/.clangd @@ -0,0 +1,2 @@ +CompileFlags: + Add: [-pthread, -std=c++20, -I%%%CURRENT_DIR%%%/winixd, -I%%%GLOBAL_WORKING_DIR%%%/pikotools/src, -I%%%GLOBAL_WORKING_DIR%%%/ezc/src, -I%%%GLOBAL_WORKING_DIR%%%/morm/src, -I%%%GLOBAL_WORKING_DIR%%%/tito/src, -I/usr/include, -I/usr/local/include, -I/usr/local/include/postgresql, -DPT_HAS_MORM_LIBRARY, -DEZC_HAS_MORM_LIBRARY, -DMORM_HAS_EZC_LIBRARY] diff --git a/.templates/.qtcreator/winix.cflags b/.templates/.qtcreator/winix.cflags new file mode 100644 index 0000000..594bcef --- /dev/null +++ b/.templates/.qtcreator/winix.cflags @@ -0,0 +1 @@ +-std=c20 diff --git a/.templates/.qtcreator/winix.config b/.templates/.qtcreator/winix.config new file mode 100644 index 0000000..78c338b --- /dev/null +++ b/.templates/.qtcreator/winix.config @@ -0,0 +1,4 @@ +#define PT_HAS_MORM_LIBRARY 1 +#define EZC_HAS_MORM_LIBRARY 1 +#define MORM_HAS_EZC_LIBRARY 1 + diff --git a/.templates/.qtcreator/winix.creator b/.templates/.qtcreator/winix.creator new file mode 100644 index 0000000..e94cbbd --- /dev/null +++ b/.templates/.qtcreator/winix.creator @@ -0,0 +1 @@ +[General] diff --git a/.templates/.qtcreator/winix.creator.user b/.templates/.qtcreator/winix.creator.user new file mode 100644 index 0000000..cdf567a --- /dev/null +++ b/.templates/.qtcreator/winix.creator.user @@ -0,0 +1,184 @@ + + + + + + EnvironmentId + {5ab9881c-fa5d-4482-9095-89b8f4d69c9e} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + 0 + false + true + false + 0 + true + true + 0 + 8 + true + false + 2 + true + true + true + *.md, *.MD, Makefile + false + true + true + + + + ProjectExplorer.Project.PluginSettings + + + true + false + true + true + true + true + + false + + + 0 + true + + true + true + Builtin.DefaultTidyAndClazy + 3 + true + + + + true + + + + + ProjectExplorer.Project.Target.0 + + Desktop + Desktop + Desktop + {d8d7580a-b779-40c7-980c-a52adf87b0ab} + 0 + 0 + 0 + + %%%CURRENT_DIR%%% + + + + all + + /usr/local/bin/gmake + true + GenericProjectManager.GenericMakeStep + + 1 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + + clean + + /usr/local/bin/gmake + true + GenericProjectManager.GenericMakeStep + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Default + GenericProjectManager.GenericBuildConfiguration + + 1 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + + false + ProjectExplorer.DefaultDeployConfiguration + + 1 + + true + true + 0 + true + + 2 + + false + -e cpu-cycles --call-graph dwarf,4096 -F 250 + + ProjectExplorer.CustomExecutableRunConfiguration + + false + true + true + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/.templates/.qtcreator/winix.cxxflags b/.templates/.qtcreator/winix.cxxflags new file mode 100644 index 0000000..e23b2ae --- /dev/null +++ b/.templates/.qtcreator/winix.cxxflags @@ -0,0 +1 @@ +-std=c++20 diff --git a/.templates/.qtcreator/winix.files b/.templates/.qtcreator/winix.files new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/.templates/.qtcreator/winix.files @@ -0,0 +1 @@ + diff --git a/.templates/.qtcreator/winix.includes b/.templates/.qtcreator/winix.includes new file mode 100644 index 0000000..e69de29 diff --git a/.templates/install_clangd.sh b/.templates/install_clangd.sh new file mode 100755 index 0000000..7287ac7 --- /dev/null +++ b/.templates/install_clangd.sh @@ -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 + + diff --git a/.templates/install_qtcreator.sh b/.templates/install_qtcreator.sh new file mode 100755 index 0000000..efd9a96 --- /dev/null +++ b/.templates/install_qtcreator.sh @@ -0,0 +1,71 @@ +#!/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}/winixd + + if [ $? -eq 0 ] ; then + find ../winixd -type f \( -iname "*.cpp" -o -iname "*.h" \) | sort > ${projectfiles} + echo "file ${projectfiles} has been updated" + fi + + cd ${CURRENT_DIR}/winixcli + + if [ $? -eq 0 ] ; then + find ../winixcli -type f \( -iname "*.cpp" -o -iname "*.h" \) | sort >> ${projectfiles} + fi + + done + +fi + + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c5db469 --- /dev/null +++ b/Makefile @@ -0,0 +1,62 @@ + + +export CXX +export CXXFLAGS +export LDFLAGS + + +all: winixd winixcli + + +winixd: FORCE + $(MAKE) -C winixd + + +winixcli: FORCE + $(MAKE) -C winixcli + + +clean: FORCE + $(MAKE) -C winixd clean + $(MAKE) -C winixcli clean + + +cleanall: FORCE + $(MAKE) -C winixd cleanall + $(MAKE) -C winixcli clean + + +depend: FORCE + $(MAKE) -C winixd depend + $(MAKE) -C winixcli depend + + +install: FORCE + $(MAKE) -C winixd install + #$(MAKE) -C winixcli depend + + +clangd: FORCE + @.templates/install_clangd.sh + + +clangdall: clangd + @$(MAKE) -C ../pikotools clangd + @$(MAKE) -C ../morm clangd + @$(MAKE) -C ../ezc clangd + @$(MAKE) -C ../tito clangd + + +qtcreator: clangd + @.templates/install_qtcreator.sh + + +qtcreatorall: qtcreator + @$(MAKE) -C ../pikotools qtcreator + @$(MAKE) -C ../morm qtcreator + @$(MAKE) -C ../ezc qtcreator + @$(MAKE) -C ../tito qtcreator + + +FORCE: + diff --git a/winixcli/src/Makefile b/winixcli/src/Makefile index 6d4ac61..1207bc5 100644 --- a/winixcli/src/Makefile +++ b/winixcli/src/Makefile @@ -66,24 +66,26 @@ $(progname): $(objfiles) pikotools morm ezc pikotools: $(MAKE) -C ../../../pikotools + morm: $(MAKE) -C ../../../morm/src + ezc: $(MAKE) -C ../../../ezc/src -clean: +clean: FORCE rm -f $(objfiles) rm -f $(progname) - $(MAKE) -C ../../../pikotools clean - $(MAKE) -C ../../../morm/src clean - $(MAKE) -C ../../../ezc/src clean depend: makedepend -Y. -I../../../pikotools/src -I../../../morm/src -I../../../ezc/src -I../../../tito/src $(WINIX_NEEDED_MACROS) -f- $(sourcefiles) > Makefile.dep +FORCE: + + -include Makefile.dep diff --git a/winixd/Makefile b/winixd/Makefile index 871d7b3..3fa4a40 100644 --- a/winixd/Makefile +++ b/winixd/Makefile @@ -102,7 +102,7 @@ plugins: FORCE FORCE: -clean: +clean: FORCE rm -f $(objfiles) rm -f winix.so rm -f winix @@ -115,15 +115,15 @@ clean: @cd plugins/export ; $(MAKE) -e clean @cd plugins/mailregister ; $(MAKE) -e clean @cd plugins/seo ; $(MAKE) -e clean + + +cleanall: clean @cd ../../pikotools ; $(MAKE) -e clean @cd ../../morm ; $(MAKE) -e clean @cd ../../ezc ; $(MAKE) -e clean @cd ../../tito ; $(MAKE) -e clean - - - depend: makedepend -Y. -I../../pikotools/src -I../../morm/src -I../../ezc/src -I../../tito/src $(WINIX_NEEDED_MACROS) -f- $(sourcefiles) > Makefile.dep @cd plugins/stats ; $(MAKE) -e depend