summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkdx <kikoodx@paranoici.org>2023-07-13 01:43:35 +0200
committerkdx <kikoodx@paranoici.org>2023-07-13 01:43:35 +0200
commit015247af10e5f70d636559d7a2fa2adc113c2057 (patch)
tree1f391d900e42d3d52a635bafbf23b82614b27250
parentcdfa78a8bc48b4170bc161564b27fa23b352db21 (diff)
downloadfld-015247af10e5f70d636559d7a2fa2adc113c2057.tar.gz
modules are cringe
-rw-r--r--Makefile16
-rw-r--r--_head.cpp2
-rw-r--r--compile_flags.txt1
-rwxr-xr-xcreate_FLD.cpp.sh2
-rw-r--r--demo.cpp5
5 files changed, 10 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index 8a3a8e9..c3907f1 100644
--- a/Makefile
+++ b/Makefile
@@ -1,23 +1,17 @@
-CFLAGS = -O3 -std=c++20 -Wall -Wextra
+CFLAGS = -O3 -std=c++20 -Wall -Wextra -iquotesrc
LIBS = -lSDL2
-SRC = FLD.pcm demo.cpp
+SRC = FLD.cpp demo.cpp
all: demo
FLD.cpp:
./create_FLD.cpp.sh
-FLD.pcm: FLD.cpp
- clang++ $(CFLAGS) -c -o $@ -Xclang -emit-module-interface $<
-
-demo: demo.o FLD.pcm
- clang++ $(CFLAGS) -o $@ demo.o FLD.pcm $(LIBS)
-
-demo.o: demo.cpp FLD.pcm
- clang++ $(CFLAGS) -fprebuilt-module-path=. -c -o $@ demo.cpp
+demo: $(SRC)
+ clang++ $(CFLAGS) -o $@ $(SRC) $(LIBS)
clean:
- rm -rf FLD.cpp FLD.pcm TZR.h demo demo.o build_FLD.cpp
+ rm -rf FLD.cpp demo build_FLD.cpp
re:
@$(MAKE) --no-print-directory clean
diff --git a/_head.cpp b/_head.cpp
index 94fa132..2620985 100644
--- a/_head.cpp
+++ b/_head.cpp
@@ -1,4 +1,2 @@
/* Licensing information can be found at the end of the file. */
-module;
-
diff --git a/compile_flags.txt b/compile_flags.txt
index 85c506c..a33c7b6 100644
--- a/compile_flags.txt
+++ b/compile_flags.txt
@@ -2,3 +2,4 @@
-Wextra
-std=c++20
-fprebuilt-module-path=.
+-iquotesrc
diff --git a/create_FLD.cpp.sh b/create_FLD.cpp.sh
index 69b9d63..e6bce11 100755
--- a/create_FLD.cpp.sh
+++ b/create_FLD.cpp.sh
@@ -8,13 +8,11 @@ for FILE in src/FLD.hpp src/*.cpp; do
printf '/* %s */\n' "$FILE" >>"$BUILDDIR/sources"
grep -v '^#include' "$FILE" \
| grep -v "^#pragma" \
- | sed 's/^class FLD/export class FLD/' \
>>"$BUILDDIR/sources"
done
cp _head.cpp "$BUILDDIR/out"
sort -u "$BUILDDIR/includes" >>"$BUILDDIR/out"
-printf '\nexport module FLD;\n' >>"$BUILDDIR/out"
cat "$BUILDDIR/sources" >>"$BUILDDIR/out"
printf '\n' >>"$BUILDDIR/out"
cat _tail.cpp >>"$BUILDDIR/out"
diff --git a/demo.cpp b/demo.cpp
index 0d6f15b..b763316 100644
--- a/demo.cpp
+++ b/demo.cpp
@@ -1,4 +1,6 @@
-import FLD;
+#include <iostream>
+#include <format>
+#include "FLD.hpp"
static int
main_loop(FLD& fld, [[maybe_unused]] void *udata)
@@ -7,6 +9,7 @@ main_loop(FLD& fld, [[maybe_unused]] void *udata)
return 1;
fld.drawSetColor(0, 0, 0);
+
fld.drawClear();
fld.drawSetColor(1, 1, 1);
fld.drawRectangle({ 16, 32, 64, 32 });