CMake: Move vendor directory to the project root

This commit is contained in:
Riyyi
2022-09-16 19:16:53 +02:00
parent 90bfd30f7f
commit 4468b1ffb9
14 changed files with 43 additions and 31 deletions
+7 -7
View File
@@ -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
+6
View File
@@ -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
+9 -24
View File
@@ -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)
# ------------------------------------------
+21
View File
@@ -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)
View File
View File
View File
View File
View File
View File
View File