mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
CMake more transitive
-Moving AIs cmake to target focusing code -Beign explicit when link libraries
This commit is contained in:
parent
c310a05ee0
commit
ec536e613c
@ -1,5 +1,3 @@
|
||||
include_directories(${Boost_INCLUDE_DIRS} ${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/include ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/lib)
|
||||
|
||||
set(battleAI_SRCS
|
||||
StdInc.cpp
|
||||
|
||||
@ -34,7 +32,8 @@ if(ANDROID) # android compiles ai libs into main lib directly, so we skip this l
|
||||
endif()
|
||||
|
||||
add_library(BattleAI SHARED ${battleAI_SRCS} ${battleAI_HEADERS})
|
||||
target_link_libraries(BattleAI vcmi)
|
||||
target_include_directories(BattleAI PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_link_libraries(BattleAI PRIVATE vcmi)
|
||||
|
||||
vcmi_set_output_dir(BattleAI "AI")
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
include_directories(${Boost_INCLUDE_DIRS} ${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/include ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/lib)
|
||||
|
||||
set(emptyAI_SRCS
|
||||
StdInc.cpp
|
||||
|
||||
@ -16,7 +14,8 @@ set(emptyAI_HEADERS
|
||||
assign_source_group(${emptyAI_SRCS} ${emptyAI_HEADERS})
|
||||
|
||||
add_library(EmptyAI SHARED ${emptyAI_SRCS} ${emptyAI_HEADERS})
|
||||
target_link_libraries(EmptyAI vcmi)
|
||||
target_include_directories(EmptyAI PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_link_libraries(EmptyAI PRIVATE vcmi)
|
||||
|
||||
vcmi_set_output_dir(EmptyAI "AI")
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
include_directories(${Boost_INCLUDE_DIRS} ${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/include ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/lib)
|
||||
|
||||
set(stupidAI_SRCS
|
||||
StdInc.cpp
|
||||
|
||||
@ -16,7 +14,8 @@ set(stupidAI_HEADERS
|
||||
assign_source_group(${stupidAI_SRCS} ${stupidAI_HEADERS})
|
||||
|
||||
add_library(StupidAI SHARED ${stupidAI_SRCS} ${stupidAI_HEADERS})
|
||||
target_link_libraries(StupidAI vcmi)
|
||||
target_link_libraries(StupidAI PRIVATE vcmi)
|
||||
target_include_directories(StupidAI PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
vcmi_set_output_dir(StupidAI "AI")
|
||||
|
||||
|
@ -1,10 +1,3 @@
|
||||
if(FL_FOUND)
|
||||
include_directories(${FL_INCLUDE_DIRS})
|
||||
else()
|
||||
include_directories(${CMAKE_HOME_DIRECTORY}/AI/FuzzyLite/fuzzylite)
|
||||
endif()
|
||||
include_directories(${Boost_INCLUDE_DIRS} ${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/include ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/lib)
|
||||
|
||||
set(VCAI_SRCS
|
||||
StdInc.cpp
|
||||
|
||||
@ -115,10 +108,18 @@ if(ANDROID) # android compiles ai libs into main lib directly, so we skip this l
|
||||
endif()
|
||||
|
||||
add_library(VCAI SHARED ${VCAI_SRCS} ${VCAI_HEADERS})
|
||||
|
||||
if(FL_FOUND)
|
||||
target_link_libraries(VCAI ${FL_LIBRARIES} vcmi)
|
||||
target_include_directories(VCAI PUBLIC ${FL_INCLUDE_DIRS})
|
||||
else()
|
||||
target_link_libraries(VCAI fl-static vcmi)
|
||||
target_include_directories(VCAI PUBLIC ${CMAKE_HOME_DIRECTORY}/AI/FuzzyLite/fuzzylite)
|
||||
endif()
|
||||
target_include_directories(VCAI PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
if(FL_FOUND)
|
||||
target_link_libraries(VCAI PRIVATE ${FL_LIBRARIES} vcmi)
|
||||
else()
|
||||
target_link_libraries(VCAI PRIVATE fl-static vcmi)
|
||||
endif()
|
||||
|
||||
vcmi_set_output_dir(VCAI "AI")
|
||||
|
@ -46,7 +46,7 @@ set(VCMI_VERSION_PATCH 0)
|
||||
|
||||
option(ENABLE_ERM "Enable compilation of ERM scripting module" OFF)
|
||||
option(ENABLE_LAUNCHER "Enable compilation of launcher" ON)
|
||||
option(ENABLE_TEST "Enable compilation of unit tests" OFF)
|
||||
option(ENABLE_TEST "Enable compilation of unit tests" ON)
|
||||
option(ENABLE_PCH "Enable compilation using precompiled headers" ON)
|
||||
option(ENABLE_GITVERSION "Enable Version.cpp with Git commit hash" ON)
|
||||
option(ENABLE_DEBUG_CONSOLE "Enable debug console for Windows builds" ON)
|
||||
|
@ -173,9 +173,9 @@ if(WIN32)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_link_libraries(vcmiclient vcmi ${Boost_LIBRARIES}
|
||||
${SDL2_LIBRARY} ${SDL2_IMAGE_LIBRARY} ${SDL2_MIXER_LIBRARY} ${SDL2_TTF_LIBRARY}
|
||||
${ZLIB_LIBRARIES} ${FFMPEG_LIBRARIES} ${FFMPEG_EXTRA_LINKING_OPTIONS} ${SYSTEM_LIBS}
|
||||
target_link_libraries(vcmiclient PRIVATE
|
||||
vcmi ${SDL2_LIBRARY} ${SDL2_IMAGE_LIBRARY} ${SDL2_MIXER_LIBRARY} ${SDL2_TTF_LIBRARY}
|
||||
${FFMPEG_LIBRARIES} ${FFMPEG_EXTRA_LINKING_OPTIONS}
|
||||
)
|
||||
|
||||
target_include_directories(vcmi
|
||||
|
@ -353,7 +353,10 @@ assign_source_group(${lib_SRCS} ${lib_HEADERS})
|
||||
|
||||
add_library(vcmi SHARED ${lib_SRCS} ${lib_HEADERS})
|
||||
set_target_properties(vcmi PROPERTIES COMPILE_DEFINITIONS "VCMI_DLL=1")
|
||||
target_link_libraries(vcmi ${MINIZIP_LIBRARIES} ${Boost_LIBRARIES} ${SDL2_LIBRARY} ${ZLIB_LIBRARIES} ${SYSTEM_LIBS})
|
||||
target_link_libraries(vcmi PUBLIC
|
||||
${MINIZIP_LIBRARIES} ${SDL2_LIBRARY} ${ZLIB_LIBRARIES}
|
||||
${SYSTEM_LIBS} ${Boost_LIBRARIES}
|
||||
)
|
||||
|
||||
target_include_directories(vcmi
|
||||
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
|
@ -24,7 +24,7 @@ endif()
|
||||
|
||||
add_executable(vcmiserver ${server_SRCS} ${server_HEADERS})
|
||||
|
||||
target_link_libraries(vcmiserver vcmi ${Boost_LIBRARIES} ${SYSTEM_LIBS})
|
||||
target_link_libraries(vcmiserver PRIVATE vcmi)
|
||||
|
||||
target_include_directories(vcmiserver
|
||||
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
|
@ -108,10 +108,10 @@ set(mock_HEADERS
|
||||
|
||||
add_subdirectory_with_folder("3rdparty" googletest EXCLUDE_FROM_ALL)
|
||||
|
||||
add_executable(vcmitest ${test_SRCS} ${test_HEADERS} ${mock_HEADERS} ${GTestSrc}/src/gtest-all.cc ${GMockSrc}/src/gmock-all.cc)
|
||||
target_link_libraries(vcmitest vcmi ${RT_LIB} ${DL_LIB})
|
||||
add_executable(vcmitest ${test_SRCS} ${test_HEADERS} ${mock_HEADERS})
|
||||
target_link_libraries(vcmitest PRIVATE gtest gmock vcmi ${SYSTEM_LIBS} VCAI)
|
||||
|
||||
target_include_directories(
|
||||
target_include_directories(vcmitest
|
||||
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
PRIVATE ${GTestSrc}
|
||||
PRIVATE ${GTestSrc}/include
|
||||
|
Loading…
Reference in New Issue
Block a user