diff --git a/CMakeLists.txt b/CMakeLists.txt index e4c91c57..0b8f2c2d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -161,14 +161,6 @@ foreach (dir ${INCLUDED_DIRECTORIES}) include_directories(${PROJECT_SOURCE_DIR}/${dir}) endforeach() -# Link dGame to LUA -if(__include_lua__) - find_package(Lua REQUIRED) - - include_directories(/usr/include ${LUA_INCLUDE_DIR}) - include_directories(${PROJECT_SOURCE_DIR}/dLua/) -endif(UNIX) - # Add linking directories: link_directories(${PROJECT_BINARY_DIR}) @@ -211,6 +203,7 @@ add_subdirectory(dDatabase) add_subdirectory(dChatFilter) add_subdirectory(dNet) add_subdirectory(dScripts) # Add for dGame to use +add_subdirectory(dLua) add_subdirectory(dGame) add_subdirectory(dZoneManager) add_subdirectory(dPhysics) @@ -246,38 +239,17 @@ target_precompile_headers( ${HEADERS_DZONEMANAGER} ) -# If we are including LUA, include the dLua files in dGame -#if(__include_lua__) -# file( -# GLOB SOURCES_DLUA -# LIST_DIRECTORIES false -# RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" -# ${PROJECT_SOURCE_DIR}/dLua/*.cpp -# ) - -# Append the dLua files to the dGame files -#set(SOURCES_DGAME ${SOURCES_DGAME} ${SOURCES_DLUA}) -#endif(__include_lua__) -## Need to specify to use the CXX compiler language here or else we get errors including . -#target_precompile_headers( -# dDatabase PRIVATE -# "$<$:${HEADERS_DDATABASE}>" -#) +# Need to specify to use the CXX compiler language here or else we get errors including . +target_precompile_headers( + dDatabase PRIVATE + "$<$:${HEADERS_DDATABASE}>" +) target_precompile_headers( dCommon PRIVATE ${HEADERS_DCOMMON} ) -# Link dGame to LUA -#if(__include_lua__) -# find_package(Lua REQUIRED) - -# target_link_libraries(dGame ${LUA_LIBRARIES}) - -# message(STATUS "Linking dGame to LUA " ${LUA_LIBRARIES}) -#endif(UNIX) - target_precompile_headers( tinyxml2 PRIVATE "$<$:${PROJECT_SOURCE_DIR}/thirdparty/tinyxml2/tinyxml2.h>" diff --git a/dGame/CMakeLists.txt b/dGame/CMakeLists.txt index 5acdba31..31ad7bc0 100644 --- a/dGame/CMakeLists.txt +++ b/dGame/CMakeLists.txt @@ -54,6 +54,20 @@ foreach(file ${DSCRIPT_SOURCES}) set(DGAME_SOURCES ${DGAME_SOURCES} "${PROJECT_SOURCE_DIR}/dScripts/${file}") endforeach() +set(DGAME_LIBRARIES dDatabase) + +# If we are including LUA, include the dLua files in dGame +if(__include_lua__) + # Append the dLua files to the dGame files + set(DGAME_SOURCES ${DGAME_SOURCES} ${DGAME_DLUA}) + + find_package(Lua REQUIRED) + + set(DGAME_LIBRARIES ${DGAME_LIBRARIES} ${LUA_LIBRARIES}) + + message(STATUS "Linking dGame to LUA " ${LUA_LIBRARIES}) +endif() + add_library(dGame STATIC ${DGAME_SOURCES}) target_link_libraries(dGame dDatabase) diff --git a/dLua/CMakeLists.txt b/dLua/CMakeLists.txt new file mode 100644 index 00000000..e9fed3af --- /dev/null +++ b/dLua/CMakeLists.txt @@ -0,0 +1,5 @@ +set(DGAME_DLUA "dLua.cpp" + "lCommonTypes.cpp" + "lEntity.cpp" + "LuaScript.cpp" + PARENT_SCOPE) diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt index 119ce4fd..093c7ec7 100644 --- a/thirdparty/CMakeLists.txt +++ b/thirdparty/CMakeLists.txt @@ -233,4 +233,12 @@ if(UNIX AND NOT APPLE) link_directories(${backtrace_SOURCE_DIR}/.libs/) include_directories(${backtrace_SOURCE_DIR}) endif() +endif() + +# Link dGame to LUA +if(__include_lua__) + find_package(Lua REQUIRED) + + include_directories(/usr/include ${LUA_INCLUDE_DIR}) + include_directories(${PROJECT_SOURCE_DIR}/dLua/) endif() \ No newline at end of file