diff --git a/.gitmodules b/.gitmodules index 2eeafd5..c69794b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,21 +1,21 @@ [submodule "inferno/vendor/glfw"] - path = inferno/vendor/glfw + path = vendor/glfw url = https://github.com/glfw/glfw [submodule "inferno/vendor/glm"] - path = inferno/vendor/glm + path = vendor/glm url = https://github.com/g-truc/glm [submodule "inferno/vendor/json"] - path = inferno/vendor/json + path = vendor/json url = https://github.com/nlohmann/json [submodule "inferno/vendor/entt"] - path = inferno/vendor/entt + path = vendor/entt url = https://github.com/skypjack/entt [submodule "inferno/vendor/lua/lua"] - path = inferno/vendor/lua/lua + path = vendor/lua/lua url = https://github.com/lua/lua [submodule "inferno/vendor/sol2"] - path = inferno/vendor/sol2 + path = vendor/sol2 url = https://github.com/ThePhD/sol2 [submodule "inferno/vendor/stb/stb"] - path = inferno/vendor/stb/stb + path = vendor/stb/stb url = https://github.com/nothings/stb diff --git a/CMakeLists.txt b/CMakeLists.txt index 159544c..d94fcf8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,6 +54,12 @@ endif() set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +# ------------------------------------------ +# Engine dependencies target + +# Add engine target to project +add_subdirectory("${CMAKE_SOURCE_DIR}/vendor") + # ------------------------------------------ # Engine target diff --git a/inferno/CMakeLists.txt b/inferno/CMakeLists.txt index 8a16ac0..973d2df 100644 --- a/inferno/CMakeLists.txt +++ b/inferno/CMakeLists.txt @@ -1,32 +1,17 @@ -# GLFW options -set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE) -set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE) -set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) - -# Add GLFW target to project -add_subdirectory(vendor/glfw) - -# Define engine source files -file(GLOB_RECURSE GLAD "vendor/glad/*.c") -file(GLOB LUA "vendor/lua/lua/*.c") -list(REMOVE_ITEM LUA "${CMAKE_CURRENT_SOURCE_DIR}/vendor/lua/lua/onelua.c") # Do not compile single file variant -list(REMOVE_ITEM LUA "${CMAKE_CURRENT_SOURCE_DIR}/vendor/lua/lua/ltests.c") # Do not compile internal debugging -list(REMOVE_ITEM LUA "${CMAKE_CURRENT_SOURCE_DIR}/vendor/lua/lua/lua.c") # Do not compile interpreter file(GLOB_RECURSE ENGINE_SOURCES "src/*.cpp") -set(ENGINE_SOURCES ${GLAD} ${LUA} ${ENGINE_SOURCES}) add_library(${ENGINE} ${ENGINE_SOURCES}) target_include_directories(${ENGINE} PRIVATE "src" - "vendor/entt/src" - "vendor/glad/include" - "vendor/glfw/include" - "vendor/glm" - "vendor/json/include" - "vendor/lua" - "vendor/sol2/include" - "vendor/stb") -target_link_libraries(${ENGINE} glfw) + "${CMAKE_SOURCE_DIR}/vendor/entt/src" + "${CMAKE_SOURCE_DIR}/vendor/glad/include" + "${CMAKE_SOURCE_DIR}/vendor/glfw/include" + "${CMAKE_SOURCE_DIR}/vendor/glm" + "${CMAKE_SOURCE_DIR}/vendor/json/include" + "${CMAKE_SOURCE_DIR}/vendor/lua" + "${CMAKE_SOURCE_DIR}/vendor/sol2/include" + "${CMAKE_SOURCE_DIR}/vendor/stb") +target_link_libraries(${ENGINE} ${ENGINE}-dependencies) # ------------------------------------------ diff --git a/vendor/CMakeLists.txt b/vendor/CMakeLists.txt new file mode 100644 index 0000000..9ec0057 --- /dev/null +++ b/vendor/CMakeLists.txt @@ -0,0 +1,21 @@ +# GLFW options +set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE) +set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE) +set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) + +# Add GLFW target to project +add_subdirectory(glfw) + +# Define engine source files +file(GLOB_RECURSE GLAD "glad/*.c") +file(GLOB LUA "lua/lua/*.c") +list(REMOVE_ITEM LUA "${CMAKE_CURRENT_SOURCE_DIR}/lua/lua/onelua.c") # Do not compile single file variant +list(REMOVE_ITEM LUA "${CMAKE_CURRENT_SOURCE_DIR}/lua/lua/ltests.c") # Do not compile internal debugging +list(REMOVE_ITEM LUA "${CMAKE_CURRENT_SOURCE_DIR}/lua/lua/lua.c") # Do not compile interpreter +set(ENGINE_SOURCES ${GLAD} ${LUA}) + +add_library(${ENGINE}-dependencies ${ENGINE_SOURCES}) +target_include_directories(${ENGINE}-dependencies PRIVATE + "glad/include" + "lua") +target_link_libraries(${ENGINE}-dependencies glfw) diff --git a/inferno/vendor/entt b/vendor/entt similarity index 100% rename from inferno/vendor/entt rename to vendor/entt diff --git a/inferno/vendor/glad/include/KHR/khrplatform.h b/vendor/glad/include/KHR/khrplatform.h similarity index 100% rename from inferno/vendor/glad/include/KHR/khrplatform.h rename to vendor/glad/include/KHR/khrplatform.h diff --git a/inferno/vendor/glad/include/glad/glad.h b/vendor/glad/include/glad/glad.h similarity index 100% rename from inferno/vendor/glad/include/glad/glad.h rename to vendor/glad/include/glad/glad.h diff --git a/inferno/vendor/glad/src/glad.c b/vendor/glad/src/glad.c similarity index 100% rename from inferno/vendor/glad/src/glad.c rename to vendor/glad/src/glad.c diff --git a/inferno/vendor/glfw b/vendor/glfw similarity index 100% rename from inferno/vendor/glfw rename to vendor/glfw diff --git a/inferno/vendor/glm b/vendor/glm similarity index 100% rename from inferno/vendor/glm rename to vendor/glm diff --git a/inferno/vendor/json b/vendor/json similarity index 100% rename from inferno/vendor/json rename to vendor/json diff --git a/inferno/vendor/lua/lua b/vendor/lua/lua similarity index 100% rename from inferno/vendor/lua/lua rename to vendor/lua/lua diff --git a/inferno/vendor/sol2 b/vendor/sol2 similarity index 100% rename from inferno/vendor/sol2 rename to vendor/sol2 diff --git a/inferno/vendor/stb/stb b/vendor/stb/stb similarity index 100% rename from inferno/vendor/stb/stb rename to vendor/stb/stb