From 84d70b281b863e57cfacecbb9623faddc2ec05ce Mon Sep 17 00:00:00 2001 From: devZoGok Date: Sun, 30 Jul 2023 17:25:31 +0300 Subject: [PATCH] using Lua dep as a CMake project --- .gitmodules | 3 +++ CMakeLists.txt | 13 +++++-------- external/lua-cmake | 1 + 3 files changed, 9 insertions(+), 8 deletions(-) create mode 160000 external/lua-cmake diff --git a/.gitmodules b/.gitmodules index 6a3c5b3..f71aab3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "external/glfw"] path = external/glfw url = https://github.com/glfw/glfw +[submodule "external/lua-cmake"] + path = external/lua-cmake + url = https://github.com/lubgr/lua-cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index a1f8509..924d6c3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,22 +10,19 @@ set(core inputManager.cpp mapping.h stateManager.cpp luaManager.cpp) set(util util.cpp) set(GLFW_DIR vb01/external/glfw) -set(LUA_DIR external/lua) +set(LUA_DIR external/lua-cmake) include_directories(../${GLFW_DIR}/include/GLFW) set(LUA_LIB_DIR ${LUA_DIR}) -include_directories(${LUA_DIR}) -link_directories(${LUA_DIR}) +add_subdirectory(${LUA_DIR}) -add_library(gameBase STATIC ${states} ${core} ${util}) -set(GLFW_DIR ../vb01/external/glfw) set(LIB_NAME gameBase) +add_library(${LIB_NAME} STATIC ${states} ${core} ${util}) +set(GLFW_DIR ../vb01/external/glfw) set(GLFW_LIB_DIR ../vb01/build/external/glfw/src) target_include_directories(${LIB_NAME} PUBLIC ${GLFW_DIR}/include/GLFW) target_link_directories(${LIB_NAME} PUBLIC ${GLFW_LIB_DIR}) -target_link_libraries(${LIB_NAME} lua) -target_link_libraries(gameBase glfw) - +target_link_libraries(${LIB_NAME} glfw lua::lib) diff --git a/external/lua-cmake b/external/lua-cmake new file mode 160000 index 0000000..ca210c5 --- /dev/null +++ b/external/lua-cmake @@ -0,0 +1 @@ +Subproject commit ca210c56ae41ff13b20490cca8be5ead47b24196