mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
Cmake: Rewrite build and use inherited dependencies (#12)
This commit is contained in:
@@ -1,7 +1,2 @@
|
||||
CU_SET_PATH("CMAKE_MOD_ELUNA_ENGINE_DIR" "${CMAKE_CURRENT_LIST_DIR}")
|
||||
CU_ADD_HOOK(AFTER_LOAD_CONF "${CMAKE_CURRENT_LIST_DIR}/cmake/after_load_conf.cmake")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
CU_ADD_HOOK(AFTER_LOAD_CMAKE_MODULES "${CMAKE_CURRENT_LIST_DIR}/cmake/after_load_cmake_modules.cmake")
|
||||
|
||||
@@ -1,28 +1,31 @@
|
||||
CollectIncludeDirectories(
|
||||
${CMAKE_MOD_ELUNA_ENGINE_DIR}
|
||||
PUBLIC_INCLUDES)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine
|
||||
${CMAKE_MOD_ELUNA_ENGINE_DIR}/lualib
|
||||
${CMAKE_MOD_ELUNA_ENGINE_DIR}/src
|
||||
)
|
||||
|
||||
target_include_directories(game-interface
|
||||
INTERFACE
|
||||
${PUBLIC_INCLUDES})
|
||||
|
||||
add_dependencies(game lualib)
|
||||
target_link_libraries(game lualib)
|
||||
|
||||
target_link_libraries(game
|
||||
PUBLIC
|
||||
lualib)
|
||||
|
||||
if( WIN32 )
|
||||
if ( MSVC )
|
||||
add_custom_command(TARGET game
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/lua_scripts/extensions/"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine/extensions" "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/lua_scripts/extensions/"
|
||||
)
|
||||
elseif ( MINGW )
|
||||
add_custom_command(TARGET game
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/lua_scripts/extensions/"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine/extensions" "${CMAKE_BINARY_DIR}/bin/lua_scripts/extensions/"
|
||||
)
|
||||
endif()
|
||||
if ( MSVC )
|
||||
add_custom_command(TARGET game
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/lua_scripts/extensions/"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine/extensions" "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/lua_scripts/extensions/"
|
||||
)
|
||||
elseif ( MINGW )
|
||||
add_custom_command(TARGET game
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/lua_scripts/extensions/"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine/extensions" "${CMAKE_BINARY_DIR}/bin/lua_scripts/extensions/"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
install(DIRECTORY "${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine/extensions" DESTINATION "${CMAKE_INSTALL_PREFIX}/bin/lua_scripts/")
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
add_subdirectory(${CMAKE_MOD_ELUNA_ENGINE_DIR}/lualib)
|
||||
|
||||
add_definitions(-DELUNA)
|
||||
add_definitions(-DAZEROTHCORE)
|
||||
add_definitions(-DWOTLK)
|
||||
|
||||
CU_ADD_HOOK(BEFORE_GAME_LIBRARY "${CMAKE_MOD_ELUNA_ENGINE_DIR}/cmake/before_gs_install.cmake")
|
||||
CU_ADD_HOOK(AFTER_GAME_LIBRARY "${CMAKE_MOD_ELUNA_ENGINE_DIR}/cmake/after_gs_install.cmake")
|
||||
CU_ADD_HOOK(BEFORE_SCRIPTS_LIBRARY "${CMAKE_MOD_ELUNA_ENGINE_DIR}/cmake/before_script_install.cmake")
|
||||
@@ -10,4 +12,3 @@ CU_ADD_HOOK(AFTER_WORLDSERVER_CMAKE "${CMAKE_MOD_ELUNA_ENGINE_DIR}/cmake/after_w
|
||||
AC_ADD_CONFIG_FILE("${CMAKE_MOD_ELUNA_ENGINE_DIR}/conf/mod_LuaEngine.conf.dist")
|
||||
|
||||
message("** [Eluna Module] LuaEngine is enable!")
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
|
||||
include_directories(
|
||||
${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine
|
||||
${CMAKE_MOD_ELUNA_ENGINE_DIR}/lualib
|
||||
${CMAKE_MOD_ELUNA_ENGINE_DIR}/src
|
||||
)
|
||||
@@ -2,15 +2,12 @@ file(GLOB_RECURSE method_headers ${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine/*Method
|
||||
file(GLOB_RECURSE sources_ElunaFile_CPP ${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine/*.cpp )
|
||||
file(GLOB_RECURSE sources_ElunaFile_H ${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine/*.h)
|
||||
|
||||
set(game_STAT_SRCS
|
||||
${game_STAT_SRCS}
|
||||
${sources_ElunaFile_H}
|
||||
${sources_ElunaFile_CPP}
|
||||
set(ElunaLuaEngineFiles
|
||||
${ElunaLuaEngineFiles}
|
||||
${sources_ElunaFile_H}
|
||||
${sources_ElunaFile_CPP}
|
||||
)
|
||||
|
||||
source_group("LuaEngine\\Methods" FILES ${method_headers})
|
||||
|
||||
source_group("LuaEngine\\Header Files" FILES ${sources_ElunaFile_H})
|
||||
|
||||
source_group("LuaEngine\\Source Files" FILES ${sources_ElunaFile_CPP})
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
include_directories(
|
||||
${CMAKE_MOD_ELUNA_ENGINE_DIR}/LuaEngine
|
||||
${CMAKE_MOD_ELUNA_ENGINE_DIR}/lualib
|
||||
${CMAKE_MOD_ELUNA_ENGINE_DIR}/src
|
||||
)
|
||||
@@ -4,16 +4,25 @@
|
||||
# Please see the included DOCS/LICENSE.md for more information
|
||||
#
|
||||
|
||||
file(GLOB sources *.c)
|
||||
list(REMOVE_ITEM sources ${CMAKE_CURRENT_SOURCE_DIR}/lua.c)
|
||||
list(REMOVE_ITEM sources ${CMAKE_CURRENT_SOURCE_DIR}/luac.c)
|
||||
|
||||
set(lua_STAT_SRCS
|
||||
${sources}
|
||||
)
|
||||
|
||||
include_directories(
|
||||
CollectSourceFiles(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
PRIVATE_SOURCES
|
||||
# Exclude
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Debugging
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
|
||||
|
||||
add_library(lualib STATIC ${lua_STAT_SRCS})
|
||||
list(REMOVE_ITEM PRIVATE_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/lua.c)
|
||||
list(REMOVE_ITEM PRIVATE_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/luac.c)
|
||||
|
||||
add_library(lualib STATIC
|
||||
${PRIVATE_SOURCES})
|
||||
|
||||
CollectIncludeDirectories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
PUBLIC_INCLUDES)
|
||||
|
||||
target_include_directories(lualib
|
||||
PUBLIC
|
||||
${PUBLIC_INCLUDES}
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
Reference in New Issue
Block a user