mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-04 22:14:25 +02:00
Merge pull request #329 from viciious/cmake_msvc
Change output path for cmake builds
This commit is contained in:
commit
d0e603a418
@ -34,6 +34,8 @@ endif()
|
|||||||
add_library(BattleAI SHARED ${battleAI_SRCS} ${battleAI_HEADERS})
|
add_library(BattleAI SHARED ${battleAI_SRCS} ${battleAI_HEADERS})
|
||||||
target_link_libraries(BattleAI vcmi)
|
target_link_libraries(BattleAI vcmi)
|
||||||
|
|
||||||
|
vcmi_set_output_dir(BattleAI "AI")
|
||||||
|
|
||||||
set_target_properties(BattleAI PROPERTIES ${PCH_PROPERTIES})
|
set_target_properties(BattleAI PROPERTIES ${PCH_PROPERTIES})
|
||||||
cotire(BattleAI)
|
cotire(BattleAI)
|
||||||
|
|
||||||
|
@ -19,6 +19,8 @@ set(emptyAI_HEADERS
|
|||||||
add_library(EmptyAI SHARED ${emptyAI_SRCS} ${emptyAI_HEADERS})
|
add_library(EmptyAI SHARED ${emptyAI_SRCS} ${emptyAI_HEADERS})
|
||||||
target_link_libraries(EmptyAI vcmi)
|
target_link_libraries(EmptyAI vcmi)
|
||||||
|
|
||||||
|
vcmi_set_output_dir(EmptyAI "AI")
|
||||||
|
|
||||||
if (NOT APPLE) # Already inside vcmiclient bundle
|
if (NOT APPLE) # Already inside vcmiclient bundle
|
||||||
install(TARGETS EmptyAI RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR})
|
install(TARGETS EmptyAI RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR})
|
||||||
endif()
|
endif()
|
||||||
|
@ -19,6 +19,8 @@ set(stupidAI_HEADERS
|
|||||||
add_library(StupidAI SHARED ${stupidAI_SRCS} ${stupidAI_HEADERS})
|
add_library(StupidAI SHARED ${stupidAI_SRCS} ${stupidAI_HEADERS})
|
||||||
target_link_libraries(StupidAI vcmi)
|
target_link_libraries(StupidAI vcmi)
|
||||||
|
|
||||||
|
vcmi_set_output_dir(StupidAI "AI")
|
||||||
|
|
||||||
set_target_properties(StupidAI PROPERTIES ${PCH_PROPERTIES})
|
set_target_properties(StupidAI PROPERTIES ${PCH_PROPERTIES})
|
||||||
cotire(StupidAI)
|
cotire(StupidAI)
|
||||||
|
|
||||||
|
@ -38,6 +38,8 @@ else()
|
|||||||
target_link_libraries(VCAI fl-static vcmi)
|
target_link_libraries(VCAI fl-static vcmi)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
vcmi_set_output_dir(VCAI "AI")
|
||||||
|
|
||||||
set_target_properties(VCAI PROPERTIES ${PCH_PROPERTIES})
|
set_target_properties(VCAI PROPERTIES ${PCH_PROPERTIES})
|
||||||
cotire(VCAI)
|
cotire(VCAI)
|
||||||
|
|
||||||
|
@ -40,27 +40,15 @@ build_script:
|
|||||||
|
|
||||||
mkdir dist_%BUILD_PLATFORM%
|
mkdir dist_%BUILD_PLATFORM%
|
||||||
|
|
||||||
cp launcher\%BUILD_CONFIGURATION%\VCMI_launcher.exe dist_%BUILD_PLATFORM%
|
copy %BUILD_CONFIGURATION%\*.exe dist_%BUILD_PLATFORM%
|
||||||
|
|
||||||
cp client\%BUILD_CONFIGURATION%\VCMI_client.exe dist_%BUILD_PLATFORM%
|
copy %BUILD_CONFIGURATION%\*.dll dist_%BUILD_PLATFORM%
|
||||||
|
|
||||||
cp server\%BUILD_CONFIGURATION%\VCMI_server.exe dist_%BUILD_PLATFORM%
|
|
||||||
|
|
||||||
cp lib\%BUILD_CONFIGURATION%\VCMI_lib.dll dist_%BUILD_PLATFORM%
|
|
||||||
|
|
||||||
cp lib\minizip\%BUILD_CONFIGURATION%\minizip.dll dist_%BUILD_PLATFORM%
|
|
||||||
|
|
||||||
|
copy %BUILD_CONFIGURATION%\lib\*.dll dist_%BUILD_PLATFORM%
|
||||||
|
|
||||||
mkdir dist_%BUILD_PLATFORM%\AI
|
mkdir dist_%BUILD_PLATFORM%\AI
|
||||||
|
|
||||||
cp AI\VCAI\%BUILD_CONFIGURATION%\VCAI.dll dist_%BUILD_PLATFORM%\AI
|
copy %BUILD_CONFIGURATION%\AI\*.dll dist_%BUILD_PLATFORM%\AI
|
||||||
|
|
||||||
cp AI\EmptyAI\%BUILD_CONFIGURATION%\EmptyAI.dll dist_%BUILD_PLATFORM%\AI
|
|
||||||
|
|
||||||
cp AI\BattleAI\%BUILD_CONFIGURATION%\BattleAI.dll dist_%BUILD_PLATFORM%\AI
|
|
||||||
|
|
||||||
cp AI\StupidAI\%BUILD_CONFIGURATION%\StupidAI.dll dist_%BUILD_PLATFORM%\AI
|
|
||||||
|
|
||||||
|
|
||||||
cd dist_%BUILD_PLATFORM%
|
cd dist_%BUILD_PLATFORM%
|
||||||
|
|
||||||
@ -76,9 +64,9 @@ build_script:
|
|||||||
|
|
||||||
copy %QTDIR%\plugins\platforms\qwindows.dll platforms
|
copy %QTDIR%\plugins\platforms\qwindows.dll platforms
|
||||||
|
|
||||||
7z a c:\projects\vcmi\source\vcmi-%BUILD_PLATFORM%-%BUILD_CONFIGURATION%.zip * -r -x!*.exp -x!*.lib
|
7z a c:\projects\vcmi\source\vcmi-%BUILD_PLATFORM%-%BUILD_CONFIGURATION%.zip * -mx=7 -r -x!*.exp -x!*.lib
|
||||||
|
|
||||||
7z a c:\projects\vcmi\source\vcmi-%BUILD_PLATFORM%-%BUILD_CONFIGURATION%.zip c:\projects\vcmi\depends\bin\*.dll
|
7z a c:\projects\vcmi\source\vcmi-%BUILD_PLATFORM%-%BUILD_CONFIGURATION%.zip c:\projects\vcmi\depends\bin\*.dll -mx=7
|
||||||
artifacts:
|
artifacts:
|
||||||
- path: vcmi-x86-Release.zip
|
- path: vcmi-x86-Release.zip
|
||||||
notifications:
|
notifications:
|
||||||
|
@ -6,6 +6,8 @@ cmake_minimum_required(VERSION 2.8.12)
|
|||||||
# where to look for cmake modules
|
# where to look for cmake modules
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_HOME_DIRECTORY}/cmake_modules)
|
set(CMAKE_MODULE_PATH ${CMAKE_HOME_DIRECTORY}/cmake_modules)
|
||||||
|
|
||||||
|
include(VCMIUtils)
|
||||||
|
|
||||||
# enable Release mode but only if it was not set
|
# enable Release mode but only if it was not set
|
||||||
if (NOT CMAKE_BUILD_TYPE)
|
if (NOT CMAKE_BUILD_TYPE)
|
||||||
set(CMAKE_BUILD_TYPE RelWithDebInfo)
|
set(CMAKE_BUILD_TYPE RelWithDebInfo)
|
||||||
@ -363,7 +365,6 @@ else()
|
|||||||
set(CPACK_GENERATOR TGZ)
|
set(CPACK_GENERATOR TGZ)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
include(GetGitRevisionDescription)
|
include(GetGitRevisionDescription)
|
||||||
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
|
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
|
||||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Version.cpp.in" "${CMAKE_BINARY_DIR}/Version.cpp" @ONLY)
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Version.cpp.in" "${CMAKE_BINARY_DIR}/Version.cpp" @ONLY)
|
||||||
|
@ -157,18 +157,17 @@ if(APPLE)
|
|||||||
set(BUNDLE_PATH ${CMAKE_HOME_DIRECTORY}/bin/$(CONFIGURATION)/vcmiclient.app/Contents)
|
set(BUNDLE_PATH ${CMAKE_HOME_DIRECTORY}/bin/$(CONFIGURATION)/vcmiclient.app/Contents)
|
||||||
|
|
||||||
set(CopyVendoredMinizip
|
set(CopyVendoredMinizip
|
||||||
mkdir -p ${BUNDLE_PATH}/MacOS &&
|
mkdir -p ${BUNDLE_PATH}/MacOS && cp ${CMAKE_BINARY_DIR}/build/$(CONFIGURATION)/lib/libminizip.dylib ${BUNDLE_PATH}/MacOS/libminizip.dylib)
|
||||||
cp ${CMAKE_HOME_DIRECTORY}/bin/$(CONFIGURATION)/libminizip.dylib ${BUNDLE_PATH}/MacOS/libminizip.dylib)
|
|
||||||
|
|
||||||
set(MakeVCMIBundle
|
set(MakeVCMIBundle
|
||||||
# Copy all needed binaries
|
# Copy all needed binaries
|
||||||
mkdir -p ${BUNDLE_PATH}/MacOS/AI &&
|
mkdir -p ${BUNDLE_PATH}/MacOS/AI &&
|
||||||
cp ${CMAKE_HOME_DIRECTORY}/bin/$(CONFIGURATION)/vcmiserver ${BUNDLE_PATH}/MacOS/vcmiserver &&
|
cp ${CMAKE_BINARY_DIR}/build/$(CONFIGURATION)/vcmiserver ${BUNDLE_PATH}/MacOS/vcmiserver &&
|
||||||
cp ${CMAKE_HOME_DIRECTORY}/bin/$(CONFIGURATION)/libvcmi.dylib ${BUNDLE_PATH}/MacOS/libvcmi.dylib &&
|
cp ${CMAKE_BINARY_DIR}/build/$(CONFIGURATION)/libvcmi.dylib ${BUNDLE_PATH}/MacOS/libvcmi.dylib &&
|
||||||
cp ${CMAKE_HOME_DIRECTORY}/bin/$(CONFIGURATION)/libVCAI.dylib ${BUNDLE_PATH}/MacOS/AI/libVCAI.dylib &&
|
cp ${CMAKE_BINARY_DIR}/build/$(CONFIGURATION)/AI/libVCAI.dylib ${BUNDLE_PATH}/MacOS/AI/libVCAI.dylib &&
|
||||||
cp ${CMAKE_HOME_DIRECTORY}/bin/$(CONFIGURATION)/libStupidAI.dylib ${BUNDLE_PATH}/MacOS/AI/libStupidAI.dylib &&
|
cp ${CMAKE_BINARY_DIR}/build/$(CONFIGURATION)/AI/libStupidAI.dylib ${BUNDLE_PATH}/MacOS/AI/libStupidAI.dylib &&
|
||||||
cp ${CMAKE_HOME_DIRECTORY}/bin/$(CONFIGURATION)/libEmptyAI.dylib ${BUNDLE_PATH}/MacOS/AI/libEmptyAI.dylib &&
|
cp ${CMAKE_BINARY_DIR}/build/$(CONFIGURATION)/AI/libEmptyAI.dylib ${BUNDLE_PATH}/MacOS/AI/libEmptyAI.dylib &&
|
||||||
cp ${CMAKE_HOME_DIRECTORY}/bin/$(CONFIGURATION)/libBattleAI.dylib ${BUNDLE_PATH}/MacOS/AI/libBattleAI.dylib &&
|
cp ${CMAKE_BINARY_DIR}/build/$(CONFIGURATION)/AI/libBattleAI.dylib ${BUNDLE_PATH}/MacOS/AI/libBattleAI.dylib &&
|
||||||
cp -r ${CMAKE_HOME_DIRECTORY}/osx/vcmibuilder.app ${BUNDLE_PATH}/MacOS/vcmibuilder.app &&
|
cp -r ${CMAKE_HOME_DIRECTORY}/osx/vcmibuilder.app ${BUNDLE_PATH}/MacOS/vcmibuilder.app &&
|
||||||
|
|
||||||
# Copy frameworks
|
# Copy frameworks
|
||||||
@ -187,6 +186,7 @@ if(APPLE)
|
|||||||
if(NOT MINIZIP_FOUND)
|
if(NOT MINIZIP_FOUND)
|
||||||
add_custom_command(TARGET vcmiclient POST_BUILD COMMAND ${CopyVendoredMinizip})
|
add_custom_command(TARGET vcmiclient POST_BUILD COMMAND ${CopyVendoredMinizip})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_custom_command(TARGET vcmiclient POST_BUILD COMMAND ${MakeVCMIBundle})
|
add_custom_command(TARGET vcmiclient POST_BUILD COMMAND ${MakeVCMIBundle})
|
||||||
elseif(WIN32)
|
elseif(WIN32)
|
||||||
add_executable(vcmiclient ${client_SRCS} ${client_HEADERS} VCMI_client.rc)
|
add_executable(vcmiclient ${client_SRCS} ${client_HEADERS} VCMI_client.rc)
|
||||||
@ -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})
|
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})
|
set_target_properties(vcmiclient PROPERTIES ${PCH_PROPERTIES})
|
||||||
cotire(vcmiclient)
|
cotire(vcmiclient)
|
||||||
|
|
||||||
|
18
cmake_modules/VCMIUtils.cmake
Normal file
18
cmake_modules/VCMIUtils.cmake
Normal 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 or MacOS)
|
||||||
|
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()
|
@ -68,6 +68,8 @@ else()
|
|||||||
target_link_libraries(vcmilauncher vcmi ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES} ${SDL_LIBRARY})
|
target_link_libraries(vcmilauncher vcmi ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES} ${SDL_LIBRARY})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
vcmi_set_output_dir(vcmilauncher "")
|
||||||
|
|
||||||
# temporary(?) disabled - generation of PCH takes too much time since cotire is trying to collect all Qt headers
|
# 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})
|
#set_target_properties(vcmilauncher PROPERTIES ${PCH_PROPERTIES})
|
||||||
#cotire(vcmilauncher)
|
#cotire(vcmilauncher)
|
||||||
|
@ -301,6 +301,8 @@ if (ANDROID)
|
|||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
vcmi_set_output_dir(vcmi "")
|
||||||
|
|
||||||
set_target_properties(vcmi PROPERTIES ${PCH_PROPERTIES})
|
set_target_properties(vcmi PROPERTIES ${PCH_PROPERTIES})
|
||||||
cotire(vcmi)
|
cotire(vcmi)
|
||||||
|
|
||||||
|
@ -18,6 +18,19 @@ elseif(APPLE)
|
|||||||
set_target_properties(minizip PROPERTIES XCODE_ATTRIBUTE_LD_DYLIB_INSTALL_NAME "@rpath/libminizip.dylib")
|
set_target_properties(minizip PROPERTIES XCODE_ATTRIBUTE_LD_DYLIB_INSTALL_NAME "@rpath/libminizip.dylib")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# multi-config builds (e.g. msvc)
|
||||||
|
foreach (OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
|
||||||
|
string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIGUPPERCASE)
|
||||||
|
set_target_properties(minizip PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIGUPPERCASE} ${CMAKE_BINARY_DIR}/${OUTPUTCONFIG}/lib)
|
||||||
|
set_target_properties(minizip PROPERTIES LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIGUPPERCASE} ${CMAKE_BINARY_DIR}/${OUTPUTCONFIG}/lib)
|
||||||
|
set_target_properties(minizip PROPERTIES ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIGUPPERCASE} ${CMAKE_BINARY_DIR}/${OUTPUTCONFIG}/lib)
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# generic no-config case (e.g. with mingw)
|
||||||
|
set_target_properties(minizip PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/build/lib)
|
||||||
|
set_target_properties(minizip PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/build/lib)
|
||||||
|
set_target_properties(minizip PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/build/lib)
|
||||||
|
|
||||||
target_link_libraries(minizip ${ZLIB_LIBRARIES})
|
target_link_libraries(minizip ${ZLIB_LIBRARIES})
|
||||||
|
|
||||||
if (NOT APPLE) # Already inside vcmiclient bundle
|
if (NOT APPLE) # Already inside vcmiclient bundle
|
||||||
|
@ -32,6 +32,8 @@ if(WIN32)
|
|||||||
set_target_properties(vcmiserver PROPERTIES OUTPUT_NAME VCMI_server)
|
set_target_properties(vcmiserver PROPERTIES OUTPUT_NAME VCMI_server)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
vcmi_set_output_dir(vcmiserver "")
|
||||||
|
|
||||||
set_target_properties(vcmiserver PROPERTIES ${PCH_PROPERTIES})
|
set_target_properties(vcmiserver PROPERTIES ${PCH_PROPERTIES})
|
||||||
set_target_properties(vcmiserver PROPERTIES XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@executable_path/../Frameworks @executable_path/")
|
set_target_properties(vcmiserver PROPERTIES XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@executable_path/../Frameworks @executable_path/")
|
||||||
cotire(vcmiserver)
|
cotire(vcmiserver)
|
||||||
|
@ -26,6 +26,8 @@ add_executable(vcmitest ${test_SRCS} ${test_HEADERS})
|
|||||||
target_link_libraries(vcmitest vcmi ${Boost_LIBRARIES} ${RT_LIB} ${DL_LIB})
|
target_link_libraries(vcmitest vcmi ${Boost_LIBRARIES} ${RT_LIB} ${DL_LIB})
|
||||||
add_test(vcmitest vcmitest)
|
add_test(vcmitest vcmitest)
|
||||||
|
|
||||||
|
vcmi_set_output_dir(vcmitest "")
|
||||||
|
|
||||||
set_target_properties(vcmitest PROPERTIES ${PCH_PROPERTIES})
|
set_target_properties(vcmitest PROPERTIES ${PCH_PROPERTIES})
|
||||||
cotire(vcmitest)
|
cotire(vcmitest)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user