From b9303dea47a1d6a695a77f09ff4d7220b1c6e77f Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Mon, 23 Jan 2023 18:44:16 +0100 Subject: [PATCH] WIP: begin transition to C lang --- .gitignore | 1 - Makefile | 126 +++++++++++++++++- gemgraph/__init__.py => help/.gitkeep | 0 manifest.scm | 25 ++++ old_python_code/__init__.py | 0 .../__pycache__/__init__.cpython-310.pyc | Bin 0 -> 159 bytes .../__pycache__/__init__.cpython-39.pyc | Bin 0 -> 157 bytes .../__pycache__/main.cpython-310.pyc | Bin 0 -> 5442 bytes .../__pycache__/main.cpython-39.pyc | Bin 0 -> 5542 bytes .../__pycache__/window.cpython-310.pyc | Bin 0 -> 2604 bytes .../__pycache__/window.cpython-39.pyc | Bin 0 -> 2593 bytes gemgraph.py => old_python_code/gemgraph.py | 0 {gemgraph => old_python_code}/main.py | 0 {gemgraph => old_python_code}/window.py | 0 14 files changed, 144 insertions(+), 8 deletions(-) rename gemgraph/__init__.py => help/.gitkeep (100%) create mode 100644 manifest.scm create mode 100644 old_python_code/__init__.py create mode 100644 old_python_code/__pycache__/__init__.cpython-310.pyc create mode 100644 old_python_code/__pycache__/__init__.cpython-39.pyc create mode 100644 old_python_code/__pycache__/main.cpython-310.pyc create mode 100644 old_python_code/__pycache__/main.cpython-39.pyc create mode 100644 old_python_code/__pycache__/window.cpython-310.pyc create mode 100644 old_python_code/__pycache__/window.cpython-39.pyc rename gemgraph.py => old_python_code/gemgraph.py (100%) rename {gemgraph => old_python_code}/main.py (100%) rename {gemgraph => old_python_code}/window.py (100%) 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 0000000000000000000000000000000000000000..49346e58a923b97d999d9572730854e53ea70884 GIT binary patch literal 159 zcmd1j<>g`kf|zGplR)%i5P=LBfgA@QE@lA|DGb33nv8xc8Hzx{2;!HMenx(7s(xN- zeuaKOQGQlxNwL0rYOZd2QDQ-cemab$o1BxGnpXl6fXKwhXXa&=#K-FuRNmsS$<0qG P%}KQbnO)2TBv=>##8D;k literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..3ef758d5d138d29377fc9552fb070c8151a86ed1 GIT binary patch literal 157 zcmYe~<>g`kf|zGplR)%i5P=LBfgA@QE@lA|DGb33nv8xc8Hzx{2;!HMenx(7s(xN- zeuaKOQGQlxNwL0rYOZd2QDQ-cemab$o1BxGnpXl6fXKwhXXa&=#K-FuRNmsS$<0qG N%}KQbnf)1v831xmCSCvl literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..b1bd1e26dc2161834eef7eea32ebc982cbbfdc6e GIT binary patch literal 5442 zcmcIo%aa>N8K0L%qvt;Sg7}fK6FXL%XbpsyF$Tr44OJ;Yl?|!VWooSM)y_uJ$UU>( z?9{p_%BFJ4g$oCuYL^qfaN@*Yz#)|*hrV*kg$p+d%KW~b8EGU-As3{YZ@RyJ%=hl^ z>#)(NYWRu2UhG$1(X_u)r}(qb`5~T205FZ|L#>y-^`6f4BZC>tJT`PqwJlbnHs;ww zb7b|bQK?rN**zP$GINIIk<)WVm0kt?O0UYQz1lsE)mZ(R#_HVOtv@w;4c1`IXIihx z^!r+C?Q?ur>q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_mp<~&9Nn?imX}#1lFTVM z_v)c6@wm#IVs9ZRWl zR2@tmQ--3am*~6;iYyMmP)K4U76h`~&l_w^)E*_xQSrMPourUa;6~S>tB)FfileGq6SMYHxLs;B_I&4&? zr4AcC)B<$6IH@O8zC<~yI77=dHc#lEkV`)+(WFGG2y;H3sPitVMCGJNat$Q81`ZQ& MIAEFUztC>}2jgU-qyPW_ literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..650c61e4f86fa813daddfb34de95da20f896ea18 GIT binary patch literal 2604 zcmZuz&2A$_5T0Lq?ATss6M1)$77afVSX$d*kvO0QZOB3df`CXQkT0#tblVwcX4-W3 zY!WM+vSLrm6L3f*F8dmsc!s`m;uR1Fs(NhakG7_!yQaIk>-(yz&6~}-1x@_EEoM(#>QMKUy=_sC`Y$Z%gU&m1&+MTOx(cm= zt_r%!nLDh|VAtx_{sv1{*U|2_I@InaJ({(OWH4sgSVYrM$_s1QrVZMJ_bP4CJMg~y((|cpoq7nZ9E5Qi zNof??%c3No-7O>&y#t=Ho;=C+d78wt4&`x?v0U{SP1L1+O`b@_vYsgNOXZu#Jw6&G zG3!kQldvdK3BUZ_^>i)clo8xw-bJfAFj_FBS55Eg>ex28mcoIT2M>gVB|9LLb!JU$ zYA4pI{k#3EZ9_1C=g!V+q|%qglnEUWlH`dZ1XP}6=}1=&k0LRauWel;#Na@PK%@UW z9pK>xIpfEJ?*yMPB?kav&jbNRL)q)aX#)N&!((t{0PasuL=((B!t>!_JNE3}bq@NA z!`yPrh51{!@M93C*2FruFRY*KQ*iIl6>Xz|kh%aT^U8eW;0XHexp!fK^Da2=%|0=# zhR}B5{GmEvp-d>-k3=}-GC@*8#X~-2dB_C>0+);~*9b&Bc?5E&>+3p(2AM`Vqq;F> ziYzSXhP*mjGxPQfrFc%}yXmUp<8jJp*AXo+s)NO119mCy;)hl_aj|d!I*Apa?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k@>lV7|502%Q+Ikjvs&=cHOdxQNgBRCV1Hz3(XcQlr6Q| zyJf~56k6vQo9`CXbv_;^f_E+1fJIAhFMI>aM}7YrG{hD5SS$Q|WOy(G?<+0iY}{Qg7q|w!z(wE~ z^e{n&-R2y9vu3b`ct49(e2@qh9mWY~qasNpdJCzJ`|isytN7hNokDi)eE;p<-WS_X zKQEhRWwTKEHoFQXV`jfN%CmBPl}0p|?o{Se6*TZOLsu4LI{5ibA~(zyOdZEMIyCD( zhU2Lk2;ywfEjshBZr;B(;Tn}#Rt=SRK&hxi5-~AenRGDeZVjO}yE@j1=sIOv=b_Rp zeWl7%Q6w z*8<35Ws9+&iZGdfsWS!@70eyR#u}KKPcc-M-o8kuNvHw(9b{R)1$#>@bn*rYL_xlb z;wFmQD6r_rO%(5-cppUBp4YWVBne|HL}B5Sn06A8#rf(35T51Oj@6{gpKVd|`?pqa z*8c-_1kXXLzjb{Q4kFz^<1&D@9mhy9Oc>)TvH z_4Yr@3z>#RqGxMgi7@l`V(7*NVzHA$C6C94+W+IV|LEbPNB-CGffPQ>+R4+j$kgmk zIGw`fSlw``tA|q`VIcRm|K4Eoea^!8MW^vdcO|rh-Bo)Wbp_=2Df7 zXt8O~0hn^O%s5jJ!lc~53ZPAn!{x(9xm-kWZ5m22t&nW^#jyAi9<>gF&=&RJS4oe~ zHdjblUQ5HSBYhYw@1Z~}Di9~kkYxEG mh+t#;61eJLh>5ETuK(Gl^d3W{fjs&Y1I(0?b-PJ72mb+Ry`1v^ literal 0 HcmV?d00001 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