Browse Source

meson project, gaming-core as submodule, logger from gaming-core, logger
tests

Kajetan Johannes Hammerle 3 years ago
parent
commit
e7af3ee0bc
5 changed files with 44 additions and 12 deletions
  1. 3 0
      .gitmodules
  2. 24 1
      Main.cpp
  3. 0 11
      Makefile
  4. 1 0
      gaming-core
  5. 16 0
      meson.build

+ 3 - 0
.gitmodules

@@ -0,0 +1,3 @@
+[submodule "gaming-core"]
+	path = gaming-core
+	url = git@git.hammerle.me:kjhammerle/gaming-core.git

+ 24 - 1
Main.cpp

@@ -1,8 +1,11 @@
-#include "Vector.h"
 #include <iostream>
 #include <memory>
 #include <vector>
 
+#include "Vector.h"
+#include "gaming-core/utils/ArrayList.h"
+#include "gaming-core/utils/Logger.h"
+
 // All implementations in this class use ints insteads of size_t because size_t
 // is interely slow compared to ints. C++20 also adds new methods to call for
 // signed container sizes. Several online resources also suggest to use unsigned
@@ -164,6 +167,21 @@ void test() {
     }
 }
 
+void logTest(Logger::Level level) {
+    std::cout << "--------------------------\n";
+    Logger::level = level;
+
+    ArrayList<int, 5> list;
+    list.add(1);
+    list.add(2);
+    list.add(3);
+
+    Logger::debug(StringBuffer<50>("Bla Bla ").append(list));
+    Logger::info(StringBuffer<50>("Bla Bla ").append(list));
+    Logger::warn(StringBuffer<50>("Bla Bla ").append(list));
+    Logger::error(StringBuffer<50>("Bla Bla ").append(list));
+}
+
 int main() {
     test<Vector<A>>();
     test();
@@ -174,4 +192,9 @@ int main() {
 
     Vector<std::unique_ptr<A>> test2;
     test2.resize(5);
+
+    logTest(Logger::DEBUG);
+    logTest(Logger::INFO);
+    logTest(Logger::WARNING);
+    logTest(Logger::ERROR);
 }

+ 0 - 11
Makefile

@@ -1,11 +0,0 @@
-all: Main.cpp
-	clang++ -std=c++14 -o vector Main.cpp -Wall -Wextra -Werror -pedantic
-
-run: gcc
-	./vector
-
-gcc: Main.cpp
-	g++ -std=c++14 -o vector Main.cpp -Wall -Wextra -Werror -pedantic
-
-clean:
-	rm -f vector

+ 1 - 0
gaming-core

@@ -0,0 +1 @@
+Subproject commit 3d86c46953a4877baca1810547b4f88d0700bb93

+ 16 - 0
meson.build

@@ -0,0 +1,16 @@
+project('gaming', 'cpp')
+
+arguments = ['-Wall', '-Wextra', '-pedantic', '-Werror', '-DLOG_LEVEL=3']
+engineSources = ['gaming-core/utils/Logger.cpp']
+sources = ['Main.cpp']
+
+engine = library('engine', 
+    sources: engineSources,
+    include_directories : include_directories('gaming-core'),
+    cpp_args: arguments)
+
+executable('game', 
+    sources: sources,
+    include_directories : include_directories('gaming-core'),
+    cpp_args: arguments,
+    link_with : engine)