mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
enable StupidAI and EmptyAI for static AI
This commit is contained in:
@@ -49,10 +49,8 @@ endif()
|
||||
|
||||
add_subdirectory(BattleAI)
|
||||
add_subdirectory(VCAI)
|
||||
if(NOT ENABLE_STATIC_AI_LIBS)
|
||||
add_subdirectory(StupidAI)
|
||||
add_subdirectory(EmptyAI)
|
||||
endif()
|
||||
add_subdirectory(StupidAI)
|
||||
add_subdirectory(EmptyAI)
|
||||
if(ENABLE_NULLKILLER_AI)
|
||||
add_subdirectory(Nullkiller)
|
||||
endif()
|
||||
|
@@ -1,8 +1,5 @@
|
||||
set(emptyAI_SRCS
|
||||
StdInc.cpp
|
||||
|
||||
CEmptyAI.cpp
|
||||
exp_funcs.cpp
|
||||
)
|
||||
|
||||
set(emptyAI_HEADERS
|
||||
@@ -11,13 +8,20 @@ set(emptyAI_HEADERS
|
||||
CEmptyAI.h
|
||||
)
|
||||
|
||||
if(NOT ENABLE_STATIC_AI_LIBS)
|
||||
list(APPEND emptyAI_SRCS main.cpp StdInc.cpp)
|
||||
endif()
|
||||
assign_source_group(${emptyAI_SRCS} ${emptyAI_HEADERS})
|
||||
|
||||
add_library(EmptyAI SHARED ${emptyAI_SRCS} ${emptyAI_HEADERS})
|
||||
if(ENABLE_STATIC_AI_LIBS)
|
||||
add_library(EmptyAI STATIC ${emptyAI_SRCS} ${emptyAI_HEADERS})
|
||||
else()
|
||||
add_library(EmptyAI SHARED ${emptyAI_SRCS} ${emptyAI_HEADERS})
|
||||
install(TARGETS EmptyAI RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR})
|
||||
endif()
|
||||
|
||||
target_include_directories(EmptyAI PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_link_libraries(EmptyAI PRIVATE ${VCMI_LIB_TARGET})
|
||||
|
||||
vcmi_set_output_dir(EmptyAI "AI")
|
||||
enable_pch(EmptyAI)
|
||||
|
||||
install(TARGETS EmptyAI RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR} OPTIONAL)
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* exp_funcs.cpp, part of VCMI engine
|
||||
* main.cpp, part of VCMI engine
|
||||
*
|
||||
* Authors: listed in file AUTHORS in main folder
|
||||
*
|
@@ -1,7 +1,4 @@
|
||||
set(stupidAI_SRCS
|
||||
StdInc.cpp
|
||||
|
||||
main.cpp
|
||||
StupidAI.cpp
|
||||
)
|
||||
|
||||
@@ -11,13 +8,20 @@ set(stupidAI_HEADERS
|
||||
StupidAI.h
|
||||
)
|
||||
|
||||
if(NOT ENABLE_STATIC_AI_LIBS)
|
||||
list(APPEND stupidAI_SRCS main.cpp StdInc.cpp)
|
||||
endif()
|
||||
assign_source_group(${stupidAI_SRCS} ${stupidAI_HEADERS})
|
||||
|
||||
add_library(StupidAI SHARED ${stupidAI_SRCS} ${stupidAI_HEADERS})
|
||||
if(ENABLE_STATIC_AI_LIBS)
|
||||
add_library(StupidAI STATIC ${stupidAI_SRCS} ${stupidAI_HEADERS})
|
||||
else()
|
||||
add_library(StupidAI SHARED ${stupidAI_SRCS} ${stupidAI_HEADERS})
|
||||
install(TARGETS StupidAI RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR})
|
||||
endif()
|
||||
|
||||
target_link_libraries(StupidAI PRIVATE ${VCMI_LIB_TARGET})
|
||||
target_include_directories(StupidAI PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
vcmi_set_output_dir(StupidAI "AI")
|
||||
enable_pch(StupidAI)
|
||||
|
||||
install(TARGETS StupidAI RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR})
|
||||
|
@@ -255,6 +255,7 @@ add_dependencies(vcmiclient vcmiserver)
|
||||
if(NOT ENABLE_STATIC_AI_LIBS)
|
||||
add_dependencies(vcmiclient
|
||||
BattleAI
|
||||
EmptyAI
|
||||
StupidAI
|
||||
VCAI
|
||||
)
|
||||
|
@@ -20,6 +20,8 @@
|
||||
# include "AI/VCAI/VCAI.h"
|
||||
# include "AI/Nullkiller/AIGateway.h"
|
||||
# include "AI/BattleAI/BattleAI.h"
|
||||
# include "AI/StupidAI/StupidAI.h"
|
||||
# include "AI/EmptyAI/CEmptyAI.h"
|
||||
#else
|
||||
# ifdef VCMI_WINDOWS
|
||||
# include <windows.h> //for .dll libs
|
||||
@@ -113,7 +115,11 @@ std::shared_ptr<CGlobalAI> createAny(const boost::filesystem::path & libpath, co
|
||||
template<>
|
||||
std::shared_ptr<CBattleGameInterface> createAny(const boost::filesystem::path & libpath, const std::string & methodName)
|
||||
{
|
||||
return std::make_shared<CBattleAI>();
|
||||
if(libpath.stem() == "libBattleAI")
|
||||
return std::make_shared<CBattleAI>();
|
||||
else if(libpath.stem() == "libStupidAI")
|
||||
return std::make_shared<CStupidAI>();
|
||||
return std::make_shared<CEmptyAI>();
|
||||
}
|
||||
|
||||
#endif // STATIC_AI
|
||||
|
@@ -3,6 +3,8 @@ if(ENABLE_STATIC_AI_LIBS)
|
||||
target_compile_definitions(${VCMI_LIB_TARGET} PRIVATE STATIC_AI)
|
||||
target_link_libraries(${VCMI_LIB_TARGET} PRIVATE
|
||||
BattleAI
|
||||
EmptyAI
|
||||
StupidAI
|
||||
VCAI
|
||||
)
|
||||
if(ENABLE_NULLKILLER_AI)
|
||||
|
Reference in New Issue
Block a user