mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-30 04:30:42 +02:00
add ability to build VCMI as single process
"Client process -> shared VCMI lib <- Server process" is turned into "shared Client-VCMI lib -> process <- static Server-VCMI lib" - adds lib_client and lib_server targets that define distinct namespaces - lib_client is a dynamic library which is shared with AI libs, lib_server is static
This commit is contained in:
parent
0a1f824add
commit
c6e51852d0
@ -33,7 +33,7 @@ endif()
|
||||
|
||||
add_library(BattleAI SHARED ${battleAI_SRCS} ${battleAI_HEADERS})
|
||||
target_include_directories(BattleAI PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_link_libraries(BattleAI PRIVATE vcmi)
|
||||
target_link_libraries(BattleAI PRIVATE ${VCMI_LIB_TARGET})
|
||||
|
||||
vcmi_set_output_dir(BattleAI "AI")
|
||||
enable_pch(BattleAI)
|
||||
|
@ -15,7 +15,7 @@ assign_source_group(${emptyAI_SRCS} ${emptyAI_HEADERS})
|
||||
|
||||
add_library(EmptyAI SHARED ${emptyAI_SRCS} ${emptyAI_HEADERS})
|
||||
target_include_directories(EmptyAI PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_link_libraries(EmptyAI PRIVATE vcmi)
|
||||
target_link_libraries(EmptyAI PRIVATE ${VCMI_LIB_TARGET})
|
||||
|
||||
vcmi_set_output_dir(EmptyAI "AI")
|
||||
enable_pch(EmptyAI)
|
||||
|
@ -130,7 +130,7 @@ add_library(Nullkiller SHARED ${Nullkiller_SRCS} ${Nullkiller_HEADERS})
|
||||
|
||||
target_include_directories(Nullkiller PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
target_link_libraries(Nullkiller PRIVATE vcmi fuzzylite::fuzzylite)
|
||||
target_link_libraries(Nullkiller PRIVATE ${VCMI_LIB_TARGET} fuzzylite::fuzzylite)
|
||||
|
||||
target_link_libraries(Nullkiller PRIVATE TBB::tbb)
|
||||
|
||||
|
@ -14,7 +14,7 @@ set(stupidAI_HEADERS
|
||||
assign_source_group(${stupidAI_SRCS} ${stupidAI_HEADERS})
|
||||
|
||||
add_library(StupidAI SHARED ${stupidAI_SRCS} ${stupidAI_HEADERS})
|
||||
target_link_libraries(StupidAI PRIVATE vcmi)
|
||||
target_link_libraries(StupidAI PRIVATE ${VCMI_LIB_TARGET})
|
||||
target_include_directories(StupidAI PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
vcmi_set_output_dir(StupidAI "AI")
|
||||
|
@ -107,7 +107,7 @@ add_library(VCAI SHARED ${VCAI_SRCS} ${VCAI_HEADERS})
|
||||
|
||||
target_include_directories(VCAI PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
target_link_libraries(VCAI PRIVATE vcmi fuzzylite::fuzzylite)
|
||||
target_link_libraries(VCAI PRIVATE ${VCMI_LIB_TARGET} fuzzylite::fuzzylite)
|
||||
|
||||
vcmi_set_output_dir(VCAI "AI")
|
||||
enable_pch(VCAI)
|
||||
|
@ -34,6 +34,10 @@ if(APPLE)
|
||||
endif()
|
||||
endif(APPLE)
|
||||
|
||||
if(APPLE_IOS)
|
||||
set(BUILD_SINGLE_APP 1)
|
||||
endif()
|
||||
|
||||
############################################
|
||||
# User-provided options #
|
||||
############################################
|
||||
@ -412,7 +416,15 @@ if(NOT TARGET minizip::minizip)
|
||||
add_subdirectory_with_folder("3rdparty" lib/minizip)
|
||||
add_library(minizip::minizip ALIAS minizip)
|
||||
endif()
|
||||
add_subdirectory(lib)
|
||||
|
||||
include(VCMI_lib)
|
||||
if(BUILD_SINGLE_APP)
|
||||
add_subdirectory(lib_client)
|
||||
add_subdirectory(lib_server)
|
||||
else()
|
||||
add_subdirectory(lib)
|
||||
endif()
|
||||
|
||||
add_subdirectory(client)
|
||||
add_subdirectory(server)
|
||||
add_subdirectory_with_folder("AI" AI)
|
||||
|
@ -224,8 +224,14 @@ elseif(APPLE_IOS)
|
||||
set_source_files_properties(ios/Images.xcassets PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
|
||||
endif()
|
||||
|
||||
if(BUILD_SINGLE_APP)
|
||||
target_link_libraries(vcmiclient PRIVATE vcmiserver)
|
||||
set(VCMI_LIB_TARGET vcmi_lib_client)
|
||||
else()
|
||||
set(VCMI_LIB_TARGET vcmi)
|
||||
endif()
|
||||
target_link_libraries(vcmiclient PRIVATE
|
||||
vcmi SDL2::SDL2 SDL2::Image SDL2::Mixer SDL2::TTF
|
||||
${VCMI_LIB_TARGET} SDL2::SDL2 SDL2::Image SDL2::Mixer SDL2::TTF
|
||||
)
|
||||
|
||||
if(ffmpeg_LIBRARIES)
|
||||
|
2
lib_client/CMakeLists.txt
Normal file
2
lib_client/CMakeLists.txt
Normal file
@ -0,0 +1,2 @@
|
||||
add_main_lib(vcmi_lib_client SHARED)
|
||||
target_compile_definitions(vcmi_lib_client PUBLIC VCMI_LIB_NAMESPACE=LIB_CLIENT)
|
2
lib_server/CMakeLists.txt
Normal file
2
lib_server/CMakeLists.txt
Normal file
@ -0,0 +1,2 @@
|
||||
add_main_lib(vcmi_lib_server STATIC)
|
||||
target_compile_definitions(vcmi_lib_server PUBLIC VCMI_LIB_NAMESPACE=LIB_SERVER)
|
@ -26,9 +26,14 @@ if(ANDROID) # android needs client/server to be libraries, not executables, so w
|
||||
return()
|
||||
endif()
|
||||
|
||||
add_executable(vcmiserver ${server_SRCS} ${server_HEADERS})
|
||||
if(BUILD_SINGLE_APP)
|
||||
add_library(vcmiserver STATIC ${server_SRCS} ${server_HEADERS})
|
||||
set(server_LIBS vcmi_lib_server)
|
||||
else()
|
||||
add_executable(vcmiserver ${server_SRCS} ${server_HEADERS})
|
||||
set(server_LIBS vcmi)
|
||||
endif()
|
||||
|
||||
set(server_LIBS vcmi)
|
||||
if(CMAKE_SYSTEM_NAME MATCHES FreeBSD)
|
||||
set(server_LIBS execinfo ${server_LIBS})
|
||||
elseif(APPLE_IOS)
|
||||
|
Loading…
x
Reference in New Issue
Block a user