mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
change static AI approach to use static libvcmi
- now links to static AI lib targets - solves uncaught boost exception on closing server
This commit is contained in:
parent
4c19d8794d
commit
71d51beab2
@ -30,16 +30,14 @@ endif()
|
||||
assign_source_group(${battleAI_SRCS} ${battleAI_HEADERS})
|
||||
|
||||
if(ENABLE_STATIC_AI_LIBS)
|
||||
list(TRANSFORM battleAI_SRCS PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/")
|
||||
set(VCMILIB_AI_SOURCES ${VCMILIB_AI_SOURCES} ${battleAI_SRCS} PARENT_SCOPE)
|
||||
return()
|
||||
add_library(BattleAI STATIC ${battleAI_SRCS} ${battleAI_HEADERS})
|
||||
else()
|
||||
add_library(BattleAI SHARED ${battleAI_SRCS} ${battleAI_HEADERS})
|
||||
install(TARGETS BattleAI RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR})
|
||||
endif()
|
||||
|
||||
add_library(BattleAI SHARED ${battleAI_SRCS} ${battleAI_HEADERS})
|
||||
target_include_directories(BattleAI PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_link_libraries(BattleAI PRIVATE ${VCMI_LIB_TARGET})
|
||||
|
||||
vcmi_set_output_dir(BattleAI "AI")
|
||||
enable_pch(BattleAI)
|
||||
|
||||
install(TARGETS BattleAI RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR})
|
||||
|
@ -56,5 +56,3 @@ endif()
|
||||
if(ENABLE_NULLKILLER_AI)
|
||||
add_subdirectory(Nullkiller)
|
||||
endif()
|
||||
set(VCMILIB_AI_SOURCES ${VCMILIB_AI_SOURCES} PARENT_SCOPE)
|
||||
set(VCMILIB_AI_LIBRARIES ${VCMILIB_AI_LIBRARIES} PARENT_SCOPE)
|
||||
|
@ -122,23 +122,19 @@ if(NOT ENABLE_STATIC_AI_LIBS)
|
||||
endif()
|
||||
assign_source_group(${Nullkiller_SRCS} ${Nullkiller_HEADERS})
|
||||
|
||||
list(APPEND requiredLibs fuzzylite::fuzzylite TBB::tbb)
|
||||
|
||||
if(ENABLE_STATIC_AI_LIBS)
|
||||
list(TRANSFORM Nullkiller_SRCS PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/")
|
||||
set(VCMILIB_AI_SOURCES ${VCMILIB_AI_SOURCES} ${Nullkiller_SRCS} PARENT_SCOPE)
|
||||
set(VCMILIB_AI_LIBRARIES ${VCMILIB_AI_LIBRARIES} ${requiredLibs} PARENT_SCOPE)
|
||||
return()
|
||||
add_library(Nullkiller STATIC ${Nullkiller_SRCS} ${Nullkiller_HEADERS})
|
||||
else()
|
||||
add_library(Nullkiller SHARED ${Nullkiller_SRCS} ${Nullkiller_HEADERS})
|
||||
install(TARGETS Nullkiller RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR})
|
||||
endif()
|
||||
|
||||
add_library(Nullkiller SHARED ${Nullkiller_SRCS} ${Nullkiller_HEADERS})
|
||||
target_include_directories(Nullkiller PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_link_libraries(Nullkiller PRIVATE ${VCMI_LIB_TARGET} ${requiredLibs})
|
||||
target_link_libraries(Nullkiller PUBLIC ${VCMI_LIB_TARGET} fuzzylite::fuzzylite TBB::tbb)
|
||||
|
||||
vcmi_set_output_dir(Nullkiller "AI")
|
||||
enable_pch(Nullkiller)
|
||||
|
||||
install(TARGETS Nullkiller RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR})
|
||||
if(APPLE_IOS AND NOT USING_CONAN)
|
||||
install(IMPORTED_RUNTIME_ARTIFACTS TBB::tbb LIBRARY DESTINATION ${LIB_DIR}) # CMake 3.21+
|
||||
endif()
|
||||
|
@ -99,20 +99,15 @@ if(NOT ENABLE_STATIC_AI_LIBS)
|
||||
endif()
|
||||
assign_source_group(${VCAI_SRCS} ${VCAI_HEADERS})
|
||||
|
||||
list(APPEND requiredLibs fuzzylite::fuzzylite)
|
||||
|
||||
if(ENABLE_STATIC_AI_LIBS)
|
||||
list(TRANSFORM VCAI_SRCS PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/")
|
||||
set(VCMILIB_AI_SOURCES ${VCMILIB_AI_SOURCES} ${VCAI_SRCS} PARENT_SCOPE)
|
||||
set(VCMILIB_AI_LIBRARIES ${VCMILIB_AI_LIBRARIES} ${requiredLibs} PARENT_SCOPE)
|
||||
return()
|
||||
add_library(VCAI STATIC ${VCAI_SRCS} ${VCAI_HEADERS})
|
||||
else()
|
||||
add_library(VCAI SHARED ${VCAI_SRCS} ${VCAI_HEADERS})
|
||||
install(TARGETS VCAI RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR})
|
||||
endif()
|
||||
|
||||
add_library(VCAI SHARED ${VCAI_SRCS} ${VCAI_HEADERS})
|
||||
target_include_directories(VCAI PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_link_libraries(VCAI PRIVATE ${VCMI_LIB_TARGET} ${requiredLibs})
|
||||
target_link_libraries(VCAI PUBLIC ${VCMI_LIB_TARGET} fuzzylite::fuzzylite)
|
||||
|
||||
vcmi_set_output_dir(VCAI "AI")
|
||||
enable_pch(VCAI)
|
||||
|
||||
install(TARGETS VCAI RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR})
|
||||
|
@ -1,8 +1,15 @@
|
||||
add_main_lib(${VCMI_LIB_TARGET} SHARED)
|
||||
target_sources(${VCMI_LIB_TARGET} PRIVATE ${VCMILIB_AI_SOURCES})
|
||||
target_link_libraries(${VCMI_LIB_TARGET} PRIVATE ${VCMILIB_AI_LIBRARIES})
|
||||
if(ENABLE_STATIC_AI_LIBS)
|
||||
add_main_lib(${VCMI_LIB_TARGET} STATIC)
|
||||
target_compile_definitions(${VCMI_LIB_TARGET} PRIVATE STATIC_AI)
|
||||
target_link_libraries(${VCMI_LIB_TARGET} PRIVATE
|
||||
BattleAI
|
||||
VCAI
|
||||
)
|
||||
if(ENABLE_NULLKILLER_AI)
|
||||
target_link_libraries(${VCMI_LIB_TARGET} PRIVATE Nullkiller)
|
||||
endif()
|
||||
else()
|
||||
add_main_lib(${VCMI_LIB_TARGET} SHARED)
|
||||
endif()
|
||||
if(ENABLE_SINGLE_APP_BUILD)
|
||||
target_compile_definitions(${VCMI_LIB_TARGET} PUBLIC VCMI_LIB_NAMESPACE=LIB_CLIENT)
|
||||
|
Loading…
Reference in New Issue
Block a user