diff --git a/.gitignore b/.gitignore index 1e7aad7..fc8463e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -**/*.pyc **/tags.* \ No newline at end of file diff --git a/Makefile b/Makefile index ca1b9f3..10d8081 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,124 @@ -.PHONY: run install +## +## Gem-graph OpenGL experiments +## +## Desc: Makefile +## +## Copyright (C) 2023 Arthur Menges +## Copyright (C) 2023 Adrien Bourmault +## +## This file is part of Gem-graph. +## +## This program is free software: you can redistribute it and/or modify +## it under the terms of the GNU Affero General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU Affero General Public License for more details. +## +## You should have received a copy of the GNU Affero General Public License +## along with this program. If not, see . +## -sources=gemgraph.py gemgraph/main.py gemgraph/window.py -uis=ui/gemgraph.ui +.PHONY: all clean install run build_system +.DELETE_ON_ERROR: $(BINDIR)/gem-graph-client +.DEFAULT_GOAL := all + +# +# Color codes +# +CL='\033[0;32m' +CL2='\033[1;36m' +CL3='\033[0m' +NC='\033[1;37m' + +# +# Variables & constants +# +NTHREADS= $(shell nproc) + +CC=gcc +WARNINGS= -Wall +DEBUG= -ggdb -fno-omit-frame-pointer -fdiagnostics-color=always +OPTIMIZE= -O2 +INCLUDE= $(shell pkg-config --cflags glib-2.0 libxml-2.0 gtk4) +LIBS= $(shell pkg-config --libs glib-2.0 libxml-2.0 gtk4) -lGL -lGLU -lm -lepoxy -lX11 -lGLEW + +BINDIR=bin +BUILDDIR=build +SRCDIR=src +vpath %.c $(SRCDIR) + +SOURCES= $(shell ls -r $(SRCDIR)) +BUILDBINS=$(patsubst %.c,$(BUILDDIR)/%.o,$(SOURCES)) +BUILDDEPS=$(patsubst %.c,$(BUILDDIR)/%.d,$(SOURCES)) + +-include /etc/os-release + +# +# Directories +# +$(BUILDDIR): + @mkdir -p $@ + @echo -e ${CL2}[$@] ${CL}folder generated.${CL3} + +$(BINDIR): + @mkdir -p $@ + @echo -e ${CL2}[$@] ${CL}folder generated.${CL3} + +# +# Dependencies +# +-include $(BUILDDEPS) + +$(BUILDDIR)/%.d: %.c | $(BUILDDIR) + @$(CC) -MM -MT $(@:%.d=%.o) -MF $@ $< + @echo -e ${CL2}[$@] ${CL}dependencies generated.${CL3} + +# +# Compilation +# +$(BINDIR)/gem-graph-client: $(BUILDBINS) | $(BINDIR) + @$(CC) -o $@ $(WARNINGS) $(DEBUG) $(OPTIMIZE) $^ $(INCLUDE) $(LIBS) + @echo -e ${CL2}[$@] ${CL}built.${CL3} +$(BUILDDIR)/%.o: %.c | $(BUILDDIR) + @$(CC) $(WARNINGS) $(DEBUG) $(OPTIMIZE) $(INCLUDE) -c $< -o $@ + @echo -e ${CL2}[$@] ${CL}compiled.${CL3} -install: ${sources} ${uis} - : -run: ${sources} ${uis} - ./gemgraph.py +# +# Virtual recipes +# +clean: + @rm -rf $(BINDIR) + @rm -rf $(BUILDDIR) + @echo -e ${CL2}[$@] ${CL}done.${CL3} + +install: + echo "Installing is not supported" + + +ifeq ($(ID), guix) +build_system: + @echo -e ${CL2}[$@] ${CL}building through containerized manifest...${CL3} + @guix shell --container -m ./manifest.scm -- make $(BINDIR)/gem-graph-client -j $(NTHREADS) + @echo -e ${CL2}[$@] ${CL}done.${CL3} +else +build_system: + @echo -e ${CL2}[$@] ${CL}building...${CL3} + @make $(BINDIR)/gem-graph-client -j $(NTHREADS) + @echo -e ${CL2}[$@] ${CL}done.${CL3} +endif + +run: build_system + @echo -e ${CL2}[$@] ${CL}executing...${CL3} + @$(BINDIR)/gem-graph-client + @echo -e ${CL2}[$@] ${CL}done.${CL3} + +all: build_system + @echo -e ${CL2}[$@] ${CL}done.${CL3} + diff --git a/gemgraph/__init__.py b/help/.gitkeep similarity index 100% rename from gemgraph/__init__.py rename to help/.gitkeep diff --git a/manifest.scm b/manifest.scm new file mode 100644 index 0000000..69a9efe --- /dev/null +++ b/manifest.scm @@ -0,0 +1,25 @@ +;; +;; Dépendances sous GNU Guix +;; + + +(specifications->manifest + (list + "bash" + "coreutils" + "gcc-toolchain" + "pkg-config" + "make" + "gtk" + "libxml2" + "glu" + "glew" + "glfw" + "libepoxy" + "pango@1.90.0" + "xorgproto" + "glib" + "mesa-headers" + "mesa" + ) +) \ No newline at end of file diff --git a/old_python_code/__init__.py b/old_python_code/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/old_python_code/__pycache__/__init__.cpython-310.pyc b/old_python_code/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000..49346e5 Binary files /dev/null and b/old_python_code/__pycache__/__init__.cpython-310.pyc differ diff --git a/old_python_code/__pycache__/__init__.cpython-39.pyc b/old_python_code/__pycache__/__init__.cpython-39.pyc new file mode 100644 index 0000000..3ef758d Binary files /dev/null and b/old_python_code/__pycache__/__init__.cpython-39.pyc differ diff --git a/old_python_code/__pycache__/main.cpython-310.pyc b/old_python_code/__pycache__/main.cpython-310.pyc new file mode 100644 index 0000000..b1bd1e2 Binary files /dev/null and b/old_python_code/__pycache__/main.cpython-310.pyc differ diff --git a/old_python_code/__pycache__/main.cpython-39.pyc b/old_python_code/__pycache__/main.cpython-39.pyc new file mode 100644 index 0000000..d8e78b1 Binary files /dev/null and b/old_python_code/__pycache__/main.cpython-39.pyc differ diff --git a/old_python_code/__pycache__/window.cpython-310.pyc b/old_python_code/__pycache__/window.cpython-310.pyc new file mode 100644 index 0000000..650c61e Binary files /dev/null and b/old_python_code/__pycache__/window.cpython-310.pyc differ diff --git a/old_python_code/__pycache__/window.cpython-39.pyc b/old_python_code/__pycache__/window.cpython-39.pyc new file mode 100644 index 0000000..e97dd49 Binary files /dev/null and b/old_python_code/__pycache__/window.cpython-39.pyc differ diff --git a/gemgraph.py b/old_python_code/gemgraph.py similarity index 100% rename from gemgraph.py rename to old_python_code/gemgraph.py diff --git a/gemgraph/main.py b/old_python_code/main.py similarity index 100% rename from gemgraph/main.py rename to old_python_code/main.py diff --git a/gemgraph/window.py b/old_python_code/window.py similarity index 100% rename from gemgraph/window.py rename to old_python_code/window.py