From e08bae1f040a17d7bd8191b8f1427f63fd058936 Mon Sep 17 00:00:00 2001
From: Joseph Walton-Rivers <joseph@walton-rivers.uk>
Date: Sat, 19 Mar 2022 10:49:27 +0000
Subject: [PATCH] don't expose logging library as part of public API

---
 fggl/CMakeLists.txt                 | 4 ++--
 fggl/gfx/ogl/CMakeLists.txt         | 2 +-
 include/fggl/data/storage.hpp       | 4 +---
 include/fggl/ecs3/module/module.h   | 3 +--
 include/fggl/ecs3/prototype/world.h | 6 +++---
 include/fggl/ecs3/types.hpp         | 3 +--
 include/fggl/gfx/ogl/compat.hpp     | 2 +-
 7 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/fggl/CMakeLists.txt b/fggl/CMakeLists.txt
index 2fde6fd..dc23900 100644
--- a/fggl/CMakeLists.txt
+++ b/fggl/CMakeLists.txt
@@ -24,11 +24,11 @@ target_sources(${PROJECT_NAME}
 
 # spdlog for cleaner logging
 find_package(spdlog REQUIRED)
-target_link_libraries(${PROJECT_NAME} spdlog::spdlog)
+target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt spdlog::spdlog)
 
 # Graphics backend
 add_subdirectory(gfx)
-target_link_libraries(${PROJECT_NAME} glfw)
+target_link_libraries(${PROJECT_NAME} PUBLIC glfw)
 
 # Debug backend
 add_subdirectory(debug)
diff --git a/fggl/gfx/ogl/CMakeLists.txt b/fggl/gfx/ogl/CMakeLists.txt
index d746aeb..d351a1b 100644
--- a/fggl/gfx/ogl/CMakeLists.txt
+++ b/fggl/gfx/ogl/CMakeLists.txt
@@ -10,7 +10,7 @@ target_sources(fggl
 # OpenGL Backend
 find_package( OpenGL REQUIRED )
 include_directories( ${OPENGL_INCLUDE_DIR} )
-target_link_libraries(fggl OpenGL::OpenGL GLEW)
+target_link_libraries(fggl PUBLIC OpenGL::OpenGL GLEW)
 
 # GLEW
 find_package( GLEW REQUIRED )
diff --git a/include/fggl/data/storage.hpp b/include/fggl/data/storage.hpp
index c1cea22..98ab993 100644
--- a/include/fggl/data/storage.hpp
+++ b/include/fggl/data/storage.hpp
@@ -5,8 +5,6 @@
 #include <string>
 #include <filesystem>
 
-#include <spdlog/spdlog.h>
-
 namespace fggl::data {
 
 	template<typename T>
@@ -23,7 +21,7 @@ namespace fggl::data {
 			bool load(StorageType pool, const std::string& name, T* out) {
 				auto path = resolvePath(pool, name);
 				if ( !std::filesystem::exists(path) ) {
-                    spdlog::warn("Path {} does not exist!", path.c_str());
+                    //spdlog::warn("Path {} does not exist!", path.c_str());
 					return false;
 				}
 				return fggl_deserialize<T>(path, out);
diff --git a/include/fggl/ecs3/module/module.h b/include/fggl/ecs3/module/module.h
index f07828b..255cea9 100644
--- a/include/fggl/ecs3/module/module.h
+++ b/include/fggl/ecs3/module/module.h
@@ -8,7 +8,6 @@
 #include <string>
 #include <map>
 #include <memory>
-#include <spdlog/spdlog.h>
 
 #include <fggl/ecs3/types.hpp>
 
@@ -34,7 +33,7 @@ namespace fggl::ecs3 {
                 m_modules[ptr->name()] = ptr;
 
                 ptr->onLoad(*this, m_types);
-                spdlog::info("loaded ECS module: {}", ptr->name());
+                //spdlog::info("loaded ECS module: {}", ptr->name());
                 return ptr;
             }
 
diff --git a/include/fggl/ecs3/prototype/world.h b/include/fggl/ecs3/prototype/world.h
index 8a4266d..1ffcaec 100644
--- a/include/fggl/ecs3/prototype/world.h
+++ b/include/fggl/ecs3/prototype/world.h
@@ -22,7 +22,7 @@ namespace fggl::ecs3::prototype {
 
             explicit Entity(entity_t id) : m_id(id), m_abstract(false) {};
             Entity(const Entity& entity) : m_id(entity.m_id), m_components(entity.m_components) {
-                spdlog::info("entity created fro copy: {}", m_id);
+                //spdlog::info("entity created fro copy: {}", m_id);
             }
             ~Entity() = default;
 
@@ -163,7 +163,7 @@ namespace fggl::ecs3::prototype {
 
             template<typename C>
             C* add(entity_t entity_id) {
-                spdlog::info("component '{}' added to '{}'", C::name, entity_id);
+                //spdlog::info("component '{}' added to '{}'", C::name, entity_id);
                 auto& entity = m_entities.at(entity_id);
                 auto comp = entity.template add<C>();
 
@@ -182,7 +182,7 @@ namespace fggl::ecs3::prototype {
 
             template<typename C>
             C* set(entity_t entity_id, const C* ptr) {
-                spdlog::info("component '{}' set on '{}'", C::name, entity_id);
+                //spdlog::info("component '{}' set on '{}'", C::name, entity_id);
                 auto& entity = m_entities.at(entity_id);
                 auto comp = entity.set<C>(ptr);
 
diff --git a/include/fggl/ecs3/types.hpp b/include/fggl/ecs3/types.hpp
index 50e5465..4cce5ac 100644
--- a/include/fggl/ecs3/types.hpp
+++ b/include/fggl/ecs3/types.hpp
@@ -12,7 +12,6 @@
 #include <algorithm>
 #include <map>
 #include <unordered_map>
-#include <spdlog/spdlog.h>
 
 namespace fggl::ecs3 {
 
@@ -203,7 +202,7 @@ namespace fggl::ecs3 {
                         callback(world, entity);
                     }
                 } catch ( std::out_of_range& e) {
-                    spdlog::debug("no callbacks for {}", m_types[type]->name());
+                    //spdlog::debug("no callbacks for {}", m_types[type]->name());
                 }
             }
 
diff --git a/include/fggl/gfx/ogl/compat.hpp b/include/fggl/gfx/ogl/compat.hpp
index 0fd4100..19741fa 100644
--- a/include/fggl/gfx/ogl/compat.hpp
+++ b/include/fggl/gfx/ogl/compat.hpp
@@ -107,7 +107,7 @@ namespace fggl::gfx {
 	// fake module/callbacks - our ECS doesn't have module/callback support yet.
 	// 
 	void onStaticMeshAdded(ecs3::World& ecs, ecs::entity_t entity, OglModule& mod) {
-        spdlog::info("[CALLBACK] static mesh added, renderable?");
+        //spdlog::info("[CALLBACK] static mesh added, renderable?");
         /*
 		auto meshData = ecs.get<gfx::StaticMesh>(entity);
 		auto pipeline = mod->cache.get(meshData->pipeline);
-- 
GitLab