1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Change the output path for cmake so all files go into the same root directory

This commit is contained in:
Victor Luchits 2017-07-04 23:46:49 +03:00
parent 4d204095cf
commit 30cc2f6a01
11 changed files with 38 additions and 1 deletions

View File

@ -34,6 +34,8 @@ endif()
add_library(BattleAI SHARED ${battleAI_SRCS} ${battleAI_HEADERS})
target_link_libraries(BattleAI vcmi)
vcmi_set_output_dir(BattleAI "AI")
set_target_properties(BattleAI PROPERTIES ${PCH_PROPERTIES})
cotire(BattleAI)

View File

@ -19,6 +19,8 @@ set(emptyAI_HEADERS
add_library(EmptyAI SHARED ${emptyAI_SRCS} ${emptyAI_HEADERS})
target_link_libraries(EmptyAI vcmi)
vcmi_set_output_dir(EmptyAI "AI")
if (NOT APPLE) # Already inside vcmiclient bundle
install(TARGETS EmptyAI RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR})
endif()

View File

@ -19,6 +19,8 @@ set(stupidAI_HEADERS
add_library(StupidAI SHARED ${stupidAI_SRCS} ${stupidAI_HEADERS})
target_link_libraries(StupidAI vcmi)
vcmi_set_output_dir(StupidAI "AI")
set_target_properties(StupidAI PROPERTIES ${PCH_PROPERTIES})
cotire(StupidAI)

View File

@ -38,6 +38,8 @@ else()
target_link_libraries(VCAI fl-static vcmi)
endif()
vcmi_set_output_dir(VCAI "AI")
set_target_properties(VCAI PROPERTIES ${PCH_PROPERTIES})
cotire(VCAI)

View File

@ -6,6 +6,8 @@ cmake_minimum_required(VERSION 2.8.12)
# where to look for cmake modules
set(CMAKE_MODULE_PATH ${CMAKE_HOME_DIRECTORY}/cmake_modules)
include(VCMIUtils)
# enable Release mode but only if it was not set
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo)
@ -363,7 +365,6 @@ else()
set(CPACK_GENERATOR TGZ)
endif()
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Version.cpp.in" "${CMAKE_BINARY_DIR}/Version.cpp" @ONLY)

View File

@ -200,6 +200,8 @@ endif()
target_link_libraries(vcmiclient vcmi ${Boost_LIBRARIES} ${SDL_LIBRARY} ${SDLIMAGE_LIBRARY} ${SDLMIXER_LIBRARY} ${SDLTTF_LIBRARY} ${ZLIB_LIBRARIES} ${FFMPEG_LIBRARIES} ${SYSTEM_LIBS})
vcmi_set_output_dir(vcmiclient "")
set_target_properties(vcmiclient PROPERTIES ${PCH_PROPERTIES})
cotire(vcmiclient)

View File

@ -0,0 +1,18 @@
#######################################
# Output directories #
#######################################
macro(vcmi_set_output_dir name dir)
# multi-config builds (e.g. msvc)
foreach (OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIGUPPERCASE)
set_target_properties(${name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIGUPPERCASE} ${CMAKE_BINARY_DIR}/${OUTPUTCONFIG}/${dir})
set_target_properties(${name} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIGUPPERCASE} ${CMAKE_BINARY_DIR}/${OUTPUTCONFIG}/${dir})
set_target_properties(${name} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIGUPPERCASE} ${CMAKE_BINARY_DIR}/${OUTPUTCONFIG}/${dir})
endforeach()
# generic no-config case (e.g. with mingw)
set_target_properties(${name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/build/${dir})
set_target_properties(${name} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/build/${dir})
set_target_properties(${name} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/build/${dir})
endmacro()

View File

@ -68,6 +68,8 @@ else()
target_link_libraries(vcmilauncher vcmi ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES} ${SDL_LIBRARY})
endif()
vcmi_set_output_dir(vcmilauncher "")
# temporary(?) disabled - generation of PCH takes too much time since cotire is trying to collect all Qt headers
#set_target_properties(vcmilauncher PROPERTIES ${PCH_PROPERTIES})
#cotire(vcmilauncher)

View File

@ -301,6 +301,8 @@ if (ANDROID)
return()
endif()
vcmi_set_output_dir(vcmi "")
set_target_properties(vcmi PROPERTIES ${PCH_PROPERTIES})
cotire(vcmi)

View File

@ -32,6 +32,8 @@ if(WIN32)
set_target_properties(vcmiserver PROPERTIES OUTPUT_NAME VCMI_server)
endif()
vcmi_set_output_dir(vcmiserver "")
set_target_properties(vcmiserver PROPERTIES ${PCH_PROPERTIES})
set_target_properties(vcmiserver PROPERTIES XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@executable_path/../Frameworks @executable_path/")
cotire(vcmiserver)

View File

@ -26,6 +26,8 @@ add_executable(vcmitest ${test_SRCS} ${test_HEADERS})
target_link_libraries(vcmitest vcmi ${Boost_LIBRARIES} ${RT_LIB} ${DL_LIB})
add_test(vcmitest vcmitest)
vcmi_set_output_dir(vcmitest "")
set_target_properties(vcmitest PROPERTIES ${PCH_PROPERTIES})
cotire(vcmitest)