From 2abf894ad38936ac40594acfe5ed3977e16b2bf2 Mon Sep 17 00:00:00 2001
From: Joseph Walton-Rivers <joseph@walton-rivers.uk>
Date: Fri, 28 Oct 2022 10:52:10 +0100
Subject: [PATCH] fix vendor integration for entt

---
 CMakeLists.txt                                |  6 ++----
 fggl/CMakeLists.txt                           |  2 ++
 integrations/entt/CMakeLists.txt              |  5 -----
 vendor/entt/CMakeLists.txt                    | 20 +++++++++++++++++++
 .../entt/include/fggl/vendor/entt.hpp         |  0
 5 files changed, 24 insertions(+), 9 deletions(-)
 delete mode 100644 integrations/entt/CMakeLists.txt
 create mode 100644 vendor/entt/CMakeLists.txt
 rename {integrations => vendor}/entt/include/fggl/vendor/entt.hpp (100%)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 396a756..2c45c07 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,8 +31,9 @@ project(fggl
 set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
 
 # vendor dependencies
+add_subdirectory( vendor/entt )
 add_subdirectory( vendor/imgui )
-add_subdirectory(vendor/glad)
+add_subdirectory( vendor/glad )
 
 # engine headers
 file(GLOB_RECURSE public_headers
@@ -44,9 +45,6 @@ add_subdirectory( fggl )
 target_compile_options( fggl PRIVATE -Wall -Wpedantic -Wextra -Wodr -fno-strict-aliasing -fno-strict-overflow )
 set_property(TARGET fggl PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
 
-# vendor dependencies
-add_subdirectory( integrations/entt )
-
 # Unit Tests
 if (FGGL_TESTS)
 	include(CTest)
diff --git a/fggl/CMakeLists.txt b/fggl/CMakeLists.txt
index d054dc3..e3385dd 100644
--- a/fggl/CMakeLists.txt
+++ b/fggl/CMakeLists.txt
@@ -5,6 +5,8 @@ file(GLOB_RECURSE HEADER_LIST CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/include/fgg
 # Should be shared linkage for legal reasons (LGPL)
 add_library(fggl ${HEADER_LIST})
 
+target_link_libraries(fggl PUBLIC entt)
+
 # we need to tell people using the library about our headers
 target_include_directories(fggl
         PUBLIC
diff --git a/integrations/entt/CMakeLists.txt b/integrations/entt/CMakeLists.txt
deleted file mode 100644
index ed4cc62..0000000
--- a/integrations/entt/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-target_include_directories( fggl
-        PUBLIC
-            $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>
-            $<INSTALL_INTERFACE:include>
-)
diff --git a/vendor/entt/CMakeLists.txt b/vendor/entt/CMakeLists.txt
new file mode 100644
index 0000000..dca92b0
--- /dev/null
+++ b/vendor/entt/CMakeLists.txt
@@ -0,0 +1,20 @@
+add_library( entt INTERFACE )
+
+target_include_directories( entt
+        INTERFACE
+            $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>
+            $<INSTALL_INTERFACE:include>
+)
+
+install(
+        FILES
+            include/fggl/vendor/entt.hpp
+        DESTINATION
+            ${CMAKE_INSTALL_INCLUDEDIR}/fggl/vendor/entt.hpp
+)
+
+install(TARGETS entt
+        EXPORT fgglTargets
+        DESTINATION
+            ${CMAKE_INSTALL_LIBDIR}/fggl/entt
+)
diff --git a/integrations/entt/include/fggl/vendor/entt.hpp b/vendor/entt/include/fggl/vendor/entt.hpp
similarity index 100%
rename from integrations/entt/include/fggl/vendor/entt.hpp
rename to vendor/entt/include/fggl/vendor/entt.hpp
-- 
GitLab