1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Merge pull request #362 from vcmi/appveyor/vcpkg

AppVeyor builds with Vcpkg and CMake improvements
This commit is contained in:
ArseniyShestakov 2017-08-17 01:47:43 +03:00 committed by GitHub
commit d0bd4efbc7
49 changed files with 993 additions and 2484 deletions

View File

@ -1,6 +1,3 @@
project(battleAI)
cmake_minimum_required(VERSION 2.6)
include_directories(${Boost_INCLUDE_DIRS} ${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/include ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/lib)
set(battleAI_SRCS
@ -28,9 +25,12 @@ set(battleAI_HEADERS
ThreatMap.h
)
assign_source_group(${battleAI_SRCS} ${battleAI_HEADERS})
if(ANDROID) # android compiles ai libs into main lib directly, so we skip this library and just reuse sources list
return()
endif()
add_library(BattleAI SHARED ${battleAI_SRCS} ${battleAI_HEADERS})
target_link_libraries(BattleAI vcmi)
@ -39,7 +39,4 @@ vcmi_set_output_dir(BattleAI "AI")
set_target_properties(BattleAI PROPERTIES ${PCH_PROPERTIES})
cotire(BattleAI)
if (NOT APPLE) # Already inside vcmiclient bundle
install(TARGETS BattleAI RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR})
endif()

View File

@ -1,7 +1,12 @@
project(AI)
cmake_minimum_required(VERSION 2.8)
#######################################
# FuzzyLite support #
#######################################
if(NOT WIN32 AND NOT APPLE)
option(FORCE_BUNDLED_FL "Force to use FuzzyLite included into VCMI's source tree" ON)
else()
option(FORCE_BUNDLED_FL "Force to use FuzzyLite included into VCMI's source tree" OFF)
endif()
if(NOT FORCE_BUNDLED_FL)
find_package(FuzzyLite)
@ -13,8 +18,13 @@ if (NOT FL_FOUND)
set(FL_BUILD_BINARY OFF CACHE BOOL "")
set(FL_BUILD_SHARED OFF CACHE BOOL "")
set(FL_BUILD_TESTS OFF CACHE BOOL "")
add_subdirectory(FuzzyLite/fuzzylite)
add_subdirectory(FuzzyLite/fuzzylite EXCLUDE_FROM_ALL)
endif()
#######################################
# Add subdirectories #
#######################################
add_subdirectory(BattleAI)
add_subdirectory(StupidAI)
add_subdirectory(EmptyAI)

View File

@ -1,6 +1,3 @@
project(emptyAI)
cmake_minimum_required(VERSION 2.6)
include_directories(${Boost_INCLUDE_DIRS} ${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/include ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/lib)
set(emptyAI_SRCS
@ -16,11 +13,13 @@ set(emptyAI_HEADERS
CEmptyAI.h
)
assign_source_group(${emptyAI_SRCS} ${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
set_target_properties(EmptyAI PROPERTIES ${PCH_PROPERTIES})
install(TARGETS EmptyAI RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR})
endif()

View File

@ -1,6 +1,3 @@
project(stupidAI)
cmake_minimum_required(VERSION 2.6)
include_directories(${Boost_INCLUDE_DIRS} ${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/include ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/lib)
set(stupidAI_SRCS
@ -16,6 +13,8 @@ set(stupidAI_HEADERS
StupidAI.h
)
assign_source_group(${stupidAI_SRCS} ${stupidAI_HEADERS})
add_library(StupidAI SHARED ${stupidAI_SRCS} ${stupidAI_HEADERS})
target_link_libraries(StupidAI vcmi)
@ -24,7 +23,4 @@ vcmi_set_output_dir(StupidAI "AI")
set_target_properties(StupidAI PROPERTIES ${PCH_PROPERTIES})
cotire(StupidAI)
if (NOT APPLE) # Already inside vcmiclient bundle
install(TARGETS StupidAI RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR})
endif()

View File

@ -1,6 +1,3 @@
project(VCAI)
cmake_minimum_required(VERSION 2.6)
if(FL_FOUND)
include_directories(${FL_INCLUDE_DIRS})
else()
@ -27,6 +24,8 @@ set(VCAI_HEADERS
VCAI.h
)
assign_source_group(${VCAI_SRCS} ${VCAI_HEADERS})
if(ANDROID) # android compiles ai libs into main lib directly, so we skip this library and just reuse sources list
return()
endif()
@ -43,6 +42,4 @@ vcmi_set_output_dir(VCAI "AI")
set_target_properties(VCAI PROPERTIES ${PCH_PROPERTIES})
cotire(VCAI)
if (NOT APPLE) # Already inside vcmiclient bundle
install(TARGETS VCAI RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR})
endif()

View File

@ -1,72 +1,105 @@
# Common configuration for all branches
version: 1.0.{build}
max_jobs: 2
clone_depth: 10
clone_folder: c:\projects\vcmi\source
init:
- cmd: set QTDIR=C:\Qt\5.7\msvc2015
environment:
BUILD_PLATFORM: x86
BUILD_CONFIGURATION: Release
install:
- cmd: >-
cd c:\projects\vcmi\
curl -fsS -o vcmi_depends_%BUILD_PLATFORM%.zip https://dependencies.vcmi.download/msvc/vcmi_depends_%BUILD_PLATFORM%.zip
7z x vcmi_depends_%BUILD_PLATFORM%.zip -odepends
cd source
git submodule update --init --recursive
cd ..
mkdir build_%BUILD_PLATFORM%
cd build_%BUILD_PLATFORM%
cmake -DCMAKE_TOOLCHAIN_FILE=../source/CI/msvc/appveyor_toolchain.txt ../source
- bash c:\projects\vcmi\source\CI\msvc\install.sh
build_script:
- cmd: >-
cd c:\projects\vcmi\build_%BUILD_PLATFORM%
msbuild vcmi.sln /p:configuration=%BUILD_CONFIGURATION% /maxcpucount:2
IF "%APPVEYOR_REPO_TAG%"=="true" cpack
mkdir dist_%BUILD_PLATFORM%
copy %BUILD_CONFIGURATION%\*.exe dist_%BUILD_PLATFORM%
copy %BUILD_CONFIGURATION%\*.dll dist_%BUILD_PLATFORM%
copy %BUILD_CONFIGURATION%\lib\*.dll dist_%BUILD_PLATFORM%
mkdir dist_%BUILD_PLATFORM%\AI
copy %BUILD_CONFIGURATION%\AI\*.dll dist_%BUILD_PLATFORM%\AI
cd dist_%BUILD_PLATFORM%
mkdir platforms
copy %QTDIR%\bin\Qt5Core.dll .
copy %QTDIR%\bin\Qt5Gui.dll .
copy %QTDIR%\bin\Qt5Widgets.dll .
copy %QTDIR%\bin\Qt5Network.dll .
copy %QTDIR%\plugins\platforms\qwindows.dll platforms
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 -mx=7
- cmd: c:\projects\vcmi\source\CI\msvc\build_script.bat
artifacts:
- path: vcmi-x86-Release.zip
- path: build_$(VCMI_BUILD_PLATFORM)\*.exe
notifications:
- provider: Slack
incoming_webhook:
secure: zxT3HTnxL744HiSv7ig7sjGL4LmJ8n3MsY8PEA/kinbVMkmcxrSgVBVkHV79RfSWSyq4oLMSRvMMpG8SuDWnf6oK/qvgaiAWfwwlCIiA7uQ=
# Branch-specific configuration
for:
# Extended configuration for toolchain_test branch
-
branches:
only:
- toolchain_test
environment:
matrix:
- NAME: MSVS 2015 x86 - Release
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
VCMI_GENERATOR: Visual Studio 14 2015
VCMI_BUILD_PLATFORM: x86
VCMI_BUILD_CONFIGURATION: Release
- NAME: MSVS 2015 x86 - Debug
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
VCMI_GENERATOR: Visual Studio 14 2015
VCMI_BUILD_PLATFORM: x86
VCMI_BUILD_CONFIGURATION: Debug
- NAME: MSVS 2015 x64 - Release
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
VCMI_GENERATOR: Visual Studio 14 2015 Win64
VCMI_BUILD_PLATFORM: x64
VCMI_BUILD_CONFIGURATION: Release
- NAME: MSVS 2015 x64 - Debug
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
VCMI_GENERATOR: Visual Studio 14 2015 Win64
VCMI_BUILD_PLATFORM: x64
VCMI_BUILD_CONFIGURATION: Debug
- NAME: MSVS 2017 x86 - Release
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
VCMI_GENERATOR: Visual Studio 15 2017
VCMI_BUILD_PLATFORM: x86
VCMI_BUILD_CONFIGURATION: Release
- NAME: MSVS 2017 x86 - Debug
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
VCMI_GENERATOR: Visual Studio 15 2017
VCMI_BUILD_PLATFORM: x86
VCMI_BUILD_CONFIGURATION: Debug
- NAME: MSVS 2017 x64 - Release
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
VCMI_GENERATOR: Visual Studio 15 2017 Win64
VCMI_BUILD_PLATFORM: x64
VCMI_BUILD_CONFIGURATION: Release
- NAME: MSVS 2017 x64 - Debug
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
VCMI_GENERATOR: Visual Studio 15 2017 Win64
VCMI_BUILD_PLATFORM: x64
VCMI_BUILD_CONFIGURATION: Debug
# Special configuration for coverity_scan branch
-
branches:
only:
- coverity_scan
environment:
matrix:
- NAME: Coverity - MSVS 2015 x86 - Release
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
VCMI_GENERATOR: Visual Studio 14 2015
VCMI_BUILD_PLATFORM: x86
VCMI_BUILD_CONFIGURATION: Release
environment:
coverity_token:
secure: XNnpYevnZxGmXW1zLu+3js2S+pqfWPQmL26hVgOTBTI=
coverity_email:
secure: JDd5yXvYaq/yJEVjoadEhA==
build_script:
- cmd: c:\projects\vcmi\source\CI\msvc\coverity_build_script.bat
after_test:
- ps: c:\projects\vcmi\source\CI\msvc\coverity_upload_script.ps
# Default configuration for all other branches
-
environment:
matrix:
- NAME: MSVS 2015 x86 - Release
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
VCMI_GENERATOR: Visual Studio 14 2015
VCMI_BUILD_PLATFORM: x86
VCMI_BUILD_CONFIGURATION: Release
- NAME: MSVS 2017 x64 - Release
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
VCMI_GENERATOR: Visual Studio 15 2017 Win64
VCMI_BUILD_PLATFORM: x64
VCMI_BUILD_CONFIGURATION: Release

View File

@ -1,14 +1,33 @@
#!/bin/sh
VCMI_PACKAGE_FILE_NAME="${TRAVIS_JOB_ID}-vcmi"
VCMI_PACKAGE_NAME_SUFFIX=""
if [ "$TRAVIS_PULL_REQUEST" = "false" ];
if [ ! -z "$TRAVIS_JOB_ID" ];
then
branch_name=$(echo "$TRAVIS_BRANCH" | sed 's/[^[:alnum:]]\+/_/g')
VCMI_PACKAGE_FILE_NAME="${VCMI_PACKAGE_FILE_NAME}-branch-${branch_name}-${TRAVIS_COMMIT}"
echo "Using Travis environment variables!"
TMP_JOBID="$TRAVIS_JOB_ID"
TMP_BRANCH="$TRAVIS_BRANCH"
TMP_PRID="$TRAVIS_PULL_REQUEST"
TMP_COMMIT="$TRAVIS_COMMIT"
elif [ ! -z "${APPVEYOR_JOB_ID}" ];
then
echo "Using AppVeyor environment variables!"
TMP_JOBID=$(echo "$APPVEYOR_JOB_ID" | sed 's/[^[:digit:]]\+//g')
TMP_BRANCH="$APPVEYOR_REPO_BRANCH"
TMP_PRID="$APPVEYOR_PULL_REQUEST_NUMBER"
TMP_COMMIT="$APPVEYOR_REPO_COMMIT"
else
echo "No Travir or AppVeyor environment variables found!"
exit
fi
VCMI_PACKAGE_FILE_NAME="${TMP_JOBID}-vcmi"
VCMI_PACKAGE_NAME_SUFFIX=""
if [ -z "$TMP_PRID" ];
then
branch_name=$(echo "$TMP_BRANCH" | sed 's/[^[:alnum:]]\+/_/g')
VCMI_PACKAGE_FILE_NAME="${VCMI_PACKAGE_FILE_NAME}-branch-${branch_name}-${TMP_COMMIT}"
VCMI_PACKAGE_NAME_SUFFIX="branch ${branch_name}"
else
VCMI_PACKAGE_FILE_NAME="${VCMI_PACKAGE_FILE_NAME}-PR-${TRAVIS_PULL_REQUEST}-${TRAVIS_COMMIT}"
VCMI_PACKAGE_NAME_SUFFIX="PR ${TRAVIS_PULL_REQUEST}"
VCMI_PACKAGE_FILE_NAME="${VCMI_PACKAGE_FILE_NAME}-PR-${TMP_PRID}-${TMP_COMMIT}"
VCMI_PACKAGE_NAME_SUFFIX="PR ${TMP_PRID}"
fi
VCMI_PACKAGE_NAME_SUFFIX="(${VCMI_PACKAGE_NAME_SUFFIX})"

View File

@ -1,18 +0,0 @@
SET(CMAKE_SYSTEM_NAME Windows)
SET(VCMIBUILD_DIR c:/projects/vcmi)
SET(CMAKE_C_COMPILER cl)
SET(CMAKE_CXX_COMPILER cl)
set(CMAKE_RC_COMPILER rc)
SET(ENV{BOOST_ROOT} C:/Libraries/boost_1_60_0)
SET(ENV{BOOST_LIBRARYDIR} C:/Libraries/boost_1_60_0/lib32-msvc-14.0)
SET(CMAKE_FIND_ROOT_PATH ${VCMIBUILD_DIR}/depends)
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_FIND_ROOT_PATH})
list(APPEND CMAKE_PREFIX_PATH C:/Qt/5.7/msvc2015)
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)

6
CI/msvc/build_script.bat Normal file
View File

@ -0,0 +1,6 @@
cd %APPVEYOR_BUILD_FOLDER%
cd build_%VCMI_BUILD_PLATFORM%
cmake --build . --config %VCMI_BUILD_CONFIGURATION% -- /maxcpucount:2
cpack

View File

@ -0,0 +1,5 @@
cd %APPVEYOR_BUILD_FOLDER%
cd build_%VCMI_BUILD_PLATFORM%
echo Building with coverity...
cov-build.exe --dir cov-int cmake --build . --config %VCMI_BUILD_CONFIGURATION% -- /maxcpucount:2

View File

@ -0,0 +1,17 @@
7z a "$Env:APPVEYOR_BUILD_FOLDER\$Env:APPVEYOR_PROJECT_NAME.zip" "$Env:APPVEYOR_BUILD_FOLDER\build_$Env:VCMI_BUILD_PLATFORM\cov-int\"
# cf. http://stackoverflow.com/a/25045154/335418
Remove-item alias:curl
Write-Host "Uploading Coverity analysis result..." -ForegroundColor "Green"
curl --silent --show-error `
--output curl-out.txt `
--form token="$Env:coverity_token" `
--form email="$Env:coverity_email" `
--form "file=@$Env:APPVEYOR_BUILD_FOLDER\$Env:APPVEYOR_PROJECT_NAME.zip" `
--form version="$Env:APPVEYOR_REPO_COMMIT" `
--form description="CI server scheduled build." `
https://scan.coverity.com/builds?project=vcmi%2Fvcmi
cat .\curl-out.txt

17
CI/msvc/install.sh Normal file
View File

@ -0,0 +1,17 @@
cd $APPVEYOR_BUILD_FOLDER
git submodule update --init --recursive
cd ..
curl -LfsS -o "vcpkg-export-${VCMI_BUILD_PLATFORM}-windows-v140.7z" \
"https://github.com/vcmi/vcmi-deps-windows/releases/download/v1/vcpkg-export-${VCMI_BUILD_PLATFORM}-windows-v140.7z"
7z x "vcpkg-export-${VCMI_BUILD_PLATFORM}-windows-v140.7z"
cd $APPVEYOR_BUILD_FOLDER
mkdir build_$VCMI_BUILD_PLATFORM
cd build_$VCMI_BUILD_PLATFORM
source $APPVEYOR_BUILD_FOLDER/CI/get_package_name.sh
cmake -G "$VCMI_GENERATOR" .. -DCMAKE_TOOLCHAIN_FILE=$APPVEYOR_BUILD_FOLDER/../vcpkg/scripts/buildsystems/vcpkg.cmake \
-DPACKAGE_NAME_SUFFIX:STRING="$VCMI_PACKAGE_NAME_SUFFIX" \
-DPACKAGE_FILE_NAME:STRING="$VCMI_PACKAGE_FILE_NAME"

View File

@ -1,33 +1,112 @@
project(vcmi)
# Minimum required version greatly affect CMake behavior
# So cmake_minimum_required must be called before the project()
# 2.8.12 is used since it's present in Ubuntu 14.04 and Cotire require it
cmake_minimum_required(VERSION 2.8.12)
# TODO:
# 1) Detection of Qt5 and compilation of launcher, unless explicitly disabled
# where to look for cmake modules
set(CMAKE_MODULE_PATH ${CMAKE_HOME_DIRECTORY}/cmake_modules)
project(VCMI)
# TODO
# macOS:
# - There is problem with running fixup_bundle in main project after subdirectories.
# Cmake put them after all install code of main CMakelists in cmake_install.cmake
# Currently I just added extra add_subdirectory and CMakeLists.txt in osx directory to bypass that.
# - Try to fix build with RPATH.
# Currently if CMAKE_MACOSX_RPATH=1 then AI libs unable to find @rpath/libvcmi.dylib
# I tried to set few different INSTALL_RPATH for all targets in AI directory, but nothing worked.
#
# MXE:
# - Try to implement MXE support into BundleUtilities so we can deploy deps automatically
#
# Vckpg:
# - Improve install code once there is better way to deploy DLLs and Qt plugins
# - Move Vcpkg install BundleUtilities code from osx/CMakeLists.txt
#
# Other:
# - Cleanup remove_directory copy_directory if performance will be a problem.
# We can use some macro over copy_if_different since it's only work for single file.
# - Find a way to move add_custom_command for assets deploy out of "lib/CMakeLists.txt"
# - Consider to remove M_DATA_DIR, DM_BIN_DIR, DM_LIB_DIR and not use them in code as well
# - Try to get rid of FOLDER override with define_property
# It's used currently to make sure that 3rd-party dependencies in git submodules get proper FOLDER property
# - Make FindFuzzyLite check for the right version and disable FORCE_BUNDLED_FL by default
# - Find a way to regenerate Version.cpp before each build.
# PRE_BUILD only work for some generators.
# So for now commit hash only updated when CMake reconfigured.
include(VCMIUtils)
############################################
# User-provided options #
############################################
# enable Release mode but only if it was not set
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
"Choose the type of build, options are: Debug Release RelWithDebInfo. Default is RelWithDebInfo."
FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Debug Release RelWithDebInfo)
endif()
# VCMI version
set(VCMI_VERSION_MAJOR 0)
set(VCMI_VERSION_MINOR 99)
set(VCMI_VERSION_PATCH 0)
# Allow to pass package name from Travis CI
set(PACKAGE_NAME_SUFFIX "" CACHE STRING "Suffix for CPack package name")
set(PACKAGE_FILE_NAME "" CACHE STRING "Override for CPack package filename")
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" ON)
option(ENABLE_PCH "Enable compilation using precompiled headers" ON)
# TODO: default to ON when we start distributing macOS binaries
option(ENABLE_SPARKLE "Enable auto-updating with Sparkle on macOS" OFF)
option(ENABLE_GITVERSION "Enable Version.cpp with Git commit hash" ON)
option(ENABLE_DEBUG_CONSOLE "Enable debug console for Windows builds" ON)
# Useful for debugging
option(ENABLE_MONOLITHIC_INSTALL "Install everything in single directory on Linux and Mac" OFF)
# Allow to pass package name from Travis CI
set(PACKAGE_NAME_SUFFIX "" CACHE STRING "Suffix for CPack package name")
set(PACKAGE_FILE_NAME "" CACHE STRING "Override for CPack package filename")
############################################
# Miscellaneous options #
############################################
set(CMAKE_MODULE_PATH ${CMAKE_HOME_DIRECTORY}/cmake_modules)
# Contains custom functions and macros, but don't altering any options
include(VCMIUtils)
# Options to enable folders in CMake generated projects for Visual Studio, Xcode, etc
# Very useful to put 3rd-party libraries such as Minizip, GoogleTest and FuzzyLite in their own folders
set_property(GLOBAL PROPERTY USE_FOLDERS TRUE)
# Make FOLDER property inheritable
# So when we set FOLDER property on AI directory all and targets inside will inherit it
#
# Important! This trick depend on undefined behavior since we override CMake own property.
# In same time define_property documentation states it's function for custom properties.
define_property(
TARGET
PROPERTY FOLDER
INHERITED
BRIEF_DOCS "Set the folder name."
FULL_DOCS "Use to organize targets in an IDE."
)
# Generate Version.cpp
if(ENABLE_GITVERSION)
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)
else()
add_definitions(-DVCMI_NO_EXTRA_VERSION)
endif(ENABLE_GITVERSION)
# Precompiled header configuration
if(ENABLE_PCH)
include(cotire)
set(PCH_PROPERTIES
COTIRE_ENABLE_PRECOMPILED_HEADER ${ENABLE_PCH}
COTIRE_ADD_UNITY_BUILD FALSE
COTIRE_CXX_PREFIX_HEADER_INIT "StdInc.h"
)
else()
set(PCH_PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
macro(cotire ignore)
endmacro(cotire)
endif(ENABLE_PCH)
############################################
# Documentation section #
@ -36,96 +115,86 @@ option(ENABLE_SPARKLE "Enable auto-updating with Sparkle on macOS" OFF)
include(UseDoxygen OPTIONAL)
############################################
# Building section #
# Compile and linking options #
############################################
if(APPLE)
# Default location for thirdparty libs
set(CMAKE_INCLUDE_PATH "../include" "${CMAKE_OSX_SYSROOT}/usr/include")
set(CMAKE_LIBRARY_PATH "../lib")
set(CMAKE_FRAMEWORK_PATH "../Frameworks")
set(BOOST_ROOT "../")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_HOME_DIRECTORY}/bin")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_HOME_DIRECTORY}/bin")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_HOME_DIRECTORY}/bin")
set(CMAKE_XCODE_ATTRIBUTE_CONFIGURATION_BUILD_DIR "${CMAKE_HOME_DIRECTORY}/bin/$(CONFIGURATION)")
set(CMAKE_XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@executable_path/../Frameworks @executable_path/")
# Build with clang ang libc++
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
if(ENABLE_SPARKLE)
# so that OSX_checkForUpdates knows whether to be a noop
add_definitions(-DSPARKLE)
# On OS X we use Sparkle framework for updates
find_path(SPARKLE_INCLUDE_DIR Sparkle.h)
find_library(SPARKLE_FRAMEWORK NAMES Sparkle)
endif()
# Xcode 5.0 fix
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth=256")
# Link with iconv
set(SYSTEM_LIBS ${SYSTEM_LIBS} libiconv.dylib)
endif()
set(CMAKE_MACOSX_RPATH 0)
endif(APPLE)
if(WIN32)
add_definitions(-DBOOST_THREAD_USE_LIB)
# Windows Vista or newer for FuzzyLite 6 to compile
add_definitions(-D_WIN32_WINNT=0x0600)
set(SYSTEM_LIBS ${SYSTEM_LIBS} ole32 oleaut32 ws2_32 mswsock dbghelp)
#delete lib prefix for dlls (libvcmi -> vcmi)
set(CMAKE_SHARED_LIBRARY_PREFIX "")
if(MSVC)
add_definitions(-DBOOST_ALL_NO_LIB)
set(Boost_USE_STATIC_LIBS OFF)
# Don't link with SDLMain
if(ENABLE_DEBUG_CONSOLE)
set(SDL2_BUILDING_LIBRARY ON)
add_definitions(-DVCMI_WITH_DEBUG_CONSOLE)
endif()
# Suppress warnings
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj /wd4251")
endif(MSVC)
if(MINGW)
#MinGW: check for iconv (may be needed for boost.locale)
set(SYSTEM_LIBS ${SYSTEM_LIBS} ole32 oleaut32 ws2_32 mswsock dbghelp)
# Check for iconv (may be needed for Boost.Locale)
include(CheckLibraryExists)
check_library_exists(iconv libiconv_open "" ICONV_FOUND)
if(ICONV_FOUND)
set(SYSTEM_LIBS ${SYSTEM_LIBS} iconv)
endif()
#MinGW: copy runtime to VCMI location
get_filename_component(MINGW_BIN_PATH ${CMAKE_CXX_COMPILER} PATH )
set(dep_files ${dep_files} "${MINGW_BIN_PATH}/libwinpthread-*.dll")
set(dep_files ${dep_files} "${MINGW_BIN_PATH}/libgcc_s_*.dll")
set(dep_files ${dep_files} "${MINGW_BIN_PATH}/libstdc++-*.dll")
# Prevent compiler issues when building Debug
# Assembler might fail with "too many sections"
# With big-obj or 64-bit build will take hours
if(CMAKE_BUILD_TYPE MATCHES Debug)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og")
endif()
endif(MINGW)
endif(WIN32)
#MinGW: use O1 to prevent compiler crash in some cases
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O1")
if(CMAKE_COMPILER_IS_GNUCXX OR NOT WIN32) #so far all *nix compilers support such parameters
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Wall -Wextra -Wpointer-arith -Wuninitialized")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-strict-aliasing -Wno-switch -Wno-sign-compare -Wno-unused-local-typedefs")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter -Wno-overloaded-virtual -Wno-type-limits -Wno-unknown-pragmas")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reorder")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-mismatched-tags -Wno-unknown-warning-option")
endif()
if(MSVC)
#MSVC: Fix problems with linking
add_definitions(-DBOOST_ALL_NO_LIB)
set(Boost_USE_STATIC_LIBS ON)
#MSVC: Don't link with SDLMain
set(SDL2_BUILDING_LIBRARY ON)
#MSVC: Suppress warnings
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj /wd4251")
if(UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
endif()
endif()
# Check if some platform-specific libraries are needed for linking
if(NOT WIN32)
INCLUDE(CheckLibraryExists)
include(CheckLibraryExists)
#check if some platform-specific libraries are needed for linking
# Shared memory functions used by Boost.Interprocess
# FindBoost handle linking with pthreads, but doesn't handle this
CHECK_LIBRARY_EXISTS(rt shm_open "" HAVE_RT_LIB)
if(HAVE_RT_LIB)
set(SYSTEM_LIBS ${SYSTEM_LIBS} rt)
endif()
endif()
set(SYSTEM_LIBS ${SYSTEM_LIBS} ${CMAKE_DL_LIBS})
############################################
# Finding packages #
############################################
set(FFmpeg_FIND_COMPONENTS AVFORMAT SWSCALE)
find_package(Boost 1.48.0 COMPONENTS date_time filesystem locale program_options system thread REQUIRED)
@ -141,43 +210,15 @@ find_package(SDL2_image REQUIRED)
find_package(SDL2_mixer REQUIRED)
find_package(SDL2_ttf REQUIRED)
set(SDL_INCLUDE_DIR "${SDL2_INCLUDE_DIR}")
set(SDLTTF_INCLUDE_DIR "${SDL2_TTF_INCLUDE_DIR}")
set(SDLIMAGE_INCLUDE_DIR "${SDL2_IMAGE_INCLUDE_DIR}")
set(SDLMIXER_INCLUDE_DIR "${SDL2_MIXER_INCLUDE_DIR}")
set(SDL_LIBRARY "${SDL2_LIBRARY}")
set(SDLTTF_LIBRARY "${SDL2_TTF_LIBRARY}")
set(SDLIMAGE_LIBRARY "${SDL2_IMAGE_LIBRARY}")
set(SDLMIXER_LIBRARY "${SDL2_MIXER_LIBRARY}")
include(cotire)
if(ENABLE_LAUNCHER)
# Widgets finds its own dependencies (QtGui and QtCore).
find_package(Qt5Widgets REQUIRED)
endif()
if (ENABLE_LAUNCHER)
find_package(Qt5Network REQUIRED)
endif()
if(ENABLE_TEST)
# find_package overwrites BOOST_* variables which are already set, so all components have to be included again
find_package(Boost 1.48.0 COMPONENTS date_time program_options filesystem system thread locale REQUIRED)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR NOT WIN32) #so far all *nix compilers support such parameters
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CLANG_SPECIFIC_FLAGS "-Wno-mismatched-tags -Wno-unknown-warning-option")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Wall -Wextra -Wpointer-arith -Wno-strict-aliasing -Wno-switch -Wno-sign-compare -Wno-unused-local-typedefs -Wno-unused-parameter -Wuninitialized -Wno-overloaded-virtual -Wno-type-limits -Wno-unknown-pragmas -Wno-reorder ${CLANG_SPECIFIC_FLAGS}")
if(UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
endif()
endif()
############################################
# Output directories #
############################################
if(WIN32) # on Win everything goes into H3 root directory
set(BIN_DIR "." CACHE STRING "Where to install binaries")
@ -187,13 +228,29 @@ elseif(APPLE)
# includes lib path which determines where to install shared libraries (either /lib or /lib64)
include(GNUInstallDirs)
if(ENABLE_MONOLITHIC_INSTALL)
set(BIN_DIR "." CACHE STRING "Where to install binaries")
set(LIB_DIR "." CACHE STRING "Where to install main library")
set(DATA_DIR "../h3" CACHE STRING "Where to install data files")
set(DATA_DIR "." CACHE STRING "Where to install data files")
else()
set(APP_BUNDLE_DIR "${CMAKE_PROJECT_NAME}.app")
set(APP_BUNDLE_CONTENTS_DIR "${APP_BUNDLE_DIR}/Contents")
set(APP_BUNDLE_BINARY_DIR "${APP_BUNDLE_CONTENTS_DIR}/MacOS")
set(APP_BUNDLE_RESOURCES_DIR "${APP_BUNDLE_CONTENTS_DIR}/Resources")
set(BIN_DIR "${APP_BUNDLE_BINARY_DIR}" CACHE STRING "Where to install binaries")
set(LIB_DIR "${APP_BUNDLE_BINARY_DIR}" CACHE STRING "Where to install main library")
set(DATA_DIR "${APP_BUNDLE_RESOURCES_DIR}/Data" CACHE STRING "Where to install data files")
endif()
else()
# includes lib path which determines where to install shared libraries (either /lib or /lib64)
include(GNUInstallDirs)
if(ENABLE_MONOLITHIC_INSTALL)
set(BIN_DIR "." CACHE STRING "Where to install binaries")
set(LIB_DIR "." CACHE STRING "Where to install main library")
set(DATA_DIR "." CACHE STRING "Where to install data files")
else()
if(NOT BIN_DIR)
set(BIN_DIR "bin" CACHE STRING "Where to install binaries")
endif()
@ -204,6 +261,7 @@ else()
set(DATA_DIR "share/vcmi" CACHE STRING "Where to install data files")
endif()
endif()
endif()
set(AI_LIB_DIR "${LIB_DIR}/AI")
set(SCRIPTING_LIB_DIR "${LIB_DIR}/scripting")
@ -213,27 +271,21 @@ add_definitions(-DM_DATA_DIR="${CMAKE_INSTALL_PREFIX}/${DATA_DIR}")
add_definitions(-DM_BIN_DIR="${CMAKE_INSTALL_PREFIX}/${BIN_DIR}")
add_definitions(-DM_LIB_DIR="${CMAKE_INSTALL_PREFIX}/${LIB_DIR}")
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/vcmi")
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# precompiled header configuration
SET(PCH_PROPERTIES
COTIRE_ENABLE_PRECOMPILED_HEADER ${ENABLE_PCH}
COTIRE_ADD_UNITY_BUILD FALSE
COTIRE_CXX_PREFIX_HEADER_INIT "StdInc.h"
)
#######################################
# Add subdirectories #
#######################################
if(ENABLE_ERM)
add_subdirectory(scripting/erm)
endif()
if(NOT MINIZIP_FOUND)
add_subdirectory(lib/minizip)
add_subdirectory_with_folder("3rdparty" lib/minizip)
set(MINIZIP_LIBRARIES minizip)
endif()
add_subdirectory(lib)
add_subdirectory(client)
add_subdirectory(server)
add_subdirectory(AI)
add_subdirectory_with_folder("AI" AI)
if(ENABLE_LAUNCHER)
add_subdirectory(launcher)
endif()
@ -245,12 +297,8 @@ endif()
# Installation section #
#######################################
# For apple these files will be already inside vcmiclient bundle
if (NOT APPLE)
# copy whole directory but .svn control files
install(DIRECTORY config DESTINATION ${DATA_DIR})
# copy vcmi mod along with all its content
install(DIRECTORY Mods/vcmi DESTINATION ${DATA_DIR}/Mods)
install(DIRECTORY Mods DESTINATION ${DATA_DIR})
# that script is useless for Windows
if(NOT WIN32)
@ -259,17 +307,18 @@ if (NOT APPLE)
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
endif()
endif()
if(WIN32)
if(MINGW)
file(GLOB dep_files
${dep_files}
"${CMAKE_FIND_ROOT_PATH}/bin/*.dll")
#Copy debug versions of libraries if build type is debug. Doesn't work in MSVC!
if(CMAKE_BUILD_TYPE MATCHES DEBUG)
if((${CMAKE_CROSSCOMPILING}) AND (DEFINED MSYS))
message(STATUS "Detected MXE build")
elseif(CMAKE_BUILD_TYPE MATCHES Debug)
# Copy debug versions of libraries if build type is debug
set(debug_postfix d)
endif(CMAKE_BUILD_TYPE MATCHES DEBUG)
endif()
if(ENABLE_LAUNCHER)
get_target_property(QtCore_location Qt5::Core LOCATION)
@ -282,12 +331,6 @@ if(WIN32)
${Qtbin_folder}/icu*.dll)
file(GLOB dep_qwindows
${Qtbin_folder}/../plugins/platforms/qwindows${debug_postfix}.dll)
if(MSVC)
file(GLOB dep_files
${dep_files}
${Qtbin_folder}/libEGL.dll
${Qtbin_folder}/libGLESv2.dll)
endif()
endif()
if (ENABLE_LAUNCHER)
@ -296,25 +339,9 @@ if(WIN32)
${Qtbin_folder}/Qt5Network${debug_postfix}.dll)
endif()
if(MSVC)
#install MSVC runtime
include(InstallRequiredSystemLibraries)
install(FILES ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION ${BIN_DIR})
endif()
install(FILES ${dep_files} DESTINATION ${BIN_DIR})
install(FILES ${dep_qwindows} DESTINATION ${BIN_DIR}/platforms)
elseif(NOT APPLE)
#install icons and desktop file on Linux
#FIXME: move to client makefile?
install(FILES "${CMAKE_SOURCE_DIR}/client/icons/vcmiclient.64x64.png" DESTINATION share/icons/hicolor/64x64/apps RENAME vcmiclient.png)
install(FILES "${CMAKE_SOURCE_DIR}/client/icons/vcmiclient.48x48.png" DESTINATION share/icons/hicolor/48x48/apps RENAME vcmiclient.png)
install(FILES "${CMAKE_SOURCE_DIR}/client/icons/vcmiclient.32x32.png" DESTINATION share/icons/hicolor/32x32/apps RENAME vcmiclient.png)
install(FILES "${CMAKE_SOURCE_DIR}/client/icons/vcmiclient.256x256.png" DESTINATION share/icons/hicolor/256x256/apps RENAME vcmiclient.png)
install(FILES "${CMAKE_SOURCE_DIR}/client/icons/vcmiclient.desktop" DESTINATION share/applications)
if (ENABLE_LAUNCHER) #FIXME: move to launcher makefile?
install(FILES "${CMAKE_SOURCE_DIR}/launcher/vcmilauncher.desktop" DESTINATION share/applications)
endif()
endif()
endif(MINGW)
#######################################
# Packaging section #
@ -343,9 +370,9 @@ endif()
set(CPACK_PACKAGE_VENDOR "VCMI team")
if(WIN32)
# Note: due to NSI script generation process all of the backward slashes here are useful
set(CPACK_MONOLITHIC_INSTALL 1)
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/license.txt")
set(CPACK_PACKAGE_EXECUTABLES "VCMI_launcher;VCMI")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/license.txt")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")
if("${PACKAGE_NAME_SUFFIX}" STREQUAL "")
set(CPACK_NSIS_PACKAGE_NAME "VCMI ${CPACK_PACKAGE_VERSION}")
@ -353,21 +380,59 @@ if(WIN32)
set(CPACK_NSIS_PACKAGE_NAME "VCMI ${CPACK_PACKAGE_VERSION} ${PACKAGE_NAME_SUFFIX} ")
endif()
set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES")
if(ENABLE_LAUNCHER)
set(CPACK_PACKAGE_EXECUTABLES "VCMI_launcher;VCMI")
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS " CreateShortCut \\\"$DESKTOP\\\\VCMI.lnk\\\" \\\"$INSTDIR\\\\VCMI_launcher.exe\\\"")
else()
set(CPACK_PACKAGE_EXECUTABLES "VCMI_client;VCMI")
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS " CreateShortCut \\\"$DESKTOP\\\\VCMI.lnk\\\" \\\"$INSTDIR\\\\VCMI_client.exe\\\"")
endif()
set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS " Delete \\\"$DESKTOP\\\\VCMI.lnk\\\" ")
configure_file("${CMAKE_SOURCE_DIR}/cmake_modules/CMakeCPackOptions.cmake.in" "${CMAKE_BINARY_DIR}/CMakeCPackOptions.cmake" @ONLY)
set(CPACK_PROJECT_CONFIG_FILE "${CMAKE_BINARY_DIR}/CMakeCPackOptions.cmake")
elseif(APPLE)
set(CPACK_GENERATOR DragNDrop)
# set the install/unistall icon used for the installer itself
# There is a bug in NSI that does not handle full unix paths properly.
set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}/client\\\\vcmi.ico")
set(CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_SOURCE_DIR}/client\\\\vcmi.ico")
# set the package header icon for MUI
set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/client\\\\vcmi.ico")
set(CPACK_NSIS_MENU_LINKS "http://vcmi.eu/" "VCMI Web Site")
set(CPACK_NSIS_INSTALLED_ICON_NAME "VCMI_client.exe")
set(CPACK_NSIS_COMPRESSOR "/SOLID lzma")
set(CPACK_NSIS_DISPLAY_NAME "${CPACK_NSIS_PACKAGE_NAME}, open-source engine for Heroes of Might and Magic III ")
set(CPACK_NSIS_HELP_LINK "http://vcmi.eu/")
set(CPACK_NSIS_URL_INFO_ABOUT "http://vcmi.eu/")
set(CPACK_NSIS_CONTACT @CPACK_PACKAGE_CONTACT@)
set(CPACK_NSIS_EXECUTABLES_DIRECTORY ".")
# Use BundleUtilities to fix build when Vcpkg is used and disable it for MXE
if(NOT (${CMAKE_CROSSCOMPILING}))
add_subdirectory(osx)
endif()
elseif(APPLE AND NOT ENABLE_MONOLITHIC_INSTALL)
set(CPACK_MONOLITHIC_INSTALL 1)
set(CPACK_GENERATOR "DragNDrop")
set(CPACK_DMG_BACKGROUND_IMAGE "${CMAKE_SOURCE_DIR}/osx/dmg_background.png")
set(CPACK_DMG_DS_STORE "${CMAKE_SOURCE_DIR}/osx/dmg_DS_Store")
set(MACOSX_BUNDLE_NAME "${CMAKE_PROJECT_NAME}")
set(MACOSX_BUNDLE_BUNDLE_NAME "${CMAKE_PROJECT_NAME}")
if(ENABLE_LAUNCHER)
set(MACOSX_BUNDLE_EXECUTABLE_NAME "vcmilauncher")
else()
set(MACOSX_BUNDLE_EXECUTABLE_NAME "vcmiclient")
endif()
set(MACOSX_BUNDLE_ICON_FILE "vcmi.icns")
install(FILES "${CMAKE_SOURCE_DIR}/osx/vcmi.icns" DESTINATION ${APP_BUNDLE_RESOURCES_DIR})
configure_file("${CMAKE_SOURCE_DIR}/osx/Info.plist.in" "${CMAKE_BINARY_DIR}/Info.plist")
install(FILES "${CMAKE_BINARY_DIR}/Info.plist" DESTINATION ${APP_BUNDLE_CONTENTS_DIR})
# Bundle fixing code must be in separate directory to be executed after all other install code
add_subdirectory(osx)
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)
INCLUDE(CPack)
include(CPack)

View File

@ -1,11 +0,0 @@
#ifdef SPARKLE
#import <Cocoa/Cocoa.h>
#import "Sparkle.h"
#endif
void OSX_checkForUpdates() {
#ifdef SPARKLE
SUUpdater* updater = [[SUUpdater alloc] init];
[[SUUpdater sharedUpdater] checkForUpdatesInBackground];
#endif
}

View File

@ -219,11 +219,7 @@ static void SDLLogCallback(void* userdata,
logGlobal->debug("SDL(category %d; priority %d) %s", category, priority, message);
}
#ifdef VCMI_APPLE
void OSX_checkForUpdates();
#endif
#if defined(VCMI_WINDOWS) && !defined (__GNUC__)
#if defined(VCMI_WINDOWS) && !defined(__GNUC__) && defined(VCMI_WITH_DEBUG_CONSOLE)
int wmain(int argc, wchar_t* argv[])
#elif defined(VCMI_APPLE) || defined(VCMI_ANDROID)
int SDL_main(int argc, char *argv[])
@ -235,22 +231,10 @@ int main(int argc, char * argv[])
// boost will crash without this
setenv("LANG", "C", 1);
#endif
#ifdef VCMI_APPLE
#ifndef VCMI_ANDROID
// Correct working dir executable folder (not bundle folder) so we can use executable relative paths
std::string executablePath = argv[0];
std::string workDir = executablePath.substr(0, executablePath.rfind('/'));
chdir(workDir.c_str());
// Check for updates
OSX_checkForUpdates();
// Check that game data is prepared. Otherwise run vcmibuilder helper application
FILE* check = fopen((VCMIDirs::get().userDataPath() / "game_data_prepared").string().c_str(), "r");
if (check == nullptr) {
system("open ./vcmibuilder.app");
return 0;
}
fclose(check);
boost::filesystem::current_path(boost::filesystem::system_complete(argv[0]).parent_path());
#endif
std::cout << "Starting... " << std::endl;
po::options_description opts("Allowed options");

View File

@ -1,8 +1,5 @@
project(vcmiclient)
cmake_minimum_required(VERSION 2.6)
include_directories(${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/include ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/lib)
include_directories(${SDL_INCLUDE_DIR} ${SDLIMAGE_INCLUDE_DIR} ${SDLMIXER_INCLUDE_DIR} ${SDLTTF_INCLUDE_DIR})
include_directories(${SDL2_INCLUDE_DIR} ${SDL2_IMAGE_INCLUDE_DIR} ${SDL2_MIXER_INCLUDE_DIR} ${SDL2_TTF_INCLUDE_DIR})
include_directories(${Boost_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR} ${FFMPEG_INCLUDE_DIRS})
set(client_SRCS
@ -116,95 +113,52 @@ set(client_HEADERS
SDLRWwrapper.h
)
assign_source_group(${client_SRCS} ${client_HEADERS} VCMI_client.rc)
if(ANDROID) # android needs client/server to be libraries, not executables, so we can't reuse the build part of this script
return()
endif()
if(MSVC)
# workaround ffmpeg linking problems
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO")
endif()
if(APPLE)
# OS X specific source files
set(client_SRCS ${client_SRCS} SDLMain.m Autoupdate.mm Info.plist vcmi.icns ../osx/vcmi_dsa_public.pem)
if(ENABLE_SPARKLE)
# OS X specific includes
include_directories(${SPARKLE_INCLUDE_DIR})
# OS X specific libraries
target_link_libraries(vcmiclient ${SPARKLE_FRAMEWORK})
endif()
add_executable(vcmiclient MACOSX_BUNDLE ${client_SRCS} ${client_HEADERS})
# Because server and AI libs would be copies to bundle they need to be built before client
add_dependencies(vcmiclient vcmiserver VCAI EmptyAI StupidAI BattleAI minizip)
# Custom Info.plist
set_target_properties(vcmiclient PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
# Copy icon file and public key for Sparkle
set_source_files_properties(vcmi.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
set_source_files_properties(../osx/vcmi_dsa_public.pem PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
set_target_properties(vcmiclient PROPERTIES XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@executable_path/../Frameworks @executable_path/")
# Copy server executable, libs and game data to bundle
set(BUNDLE_PATH ${CMAKE_HOME_DIRECTORY}/bin/$(CONFIGURATION)/vcmiclient.app/Contents)
set(CopyVendoredMinizip
mkdir -p ${BUNDLE_PATH}/MacOS && cp ${CMAKE_BINARY_DIR}/build/$(CONFIGURATION)/lib/libminizip.dylib ${BUNDLE_PATH}/MacOS/libminizip.dylib)
set(MakeVCMIBundle
# Copy all needed binaries
mkdir -p ${BUNDLE_PATH}/MacOS/AI &&
cp ${CMAKE_BINARY_DIR}/build/$(CONFIGURATION)/vcmiserver ${BUNDLE_PATH}/MacOS/vcmiserver &&
cp ${CMAKE_BINARY_DIR}/build/$(CONFIGURATION)/vcmiclient.app/Contents/MacOS/vcmiclient ${BUNDLE_PATH}/MacOS/vcmiclient &&
cp ${CMAKE_BINARY_DIR}/build/$(CONFIGURATION)/libvcmi.dylib ${BUNDLE_PATH}/MacOS/libvcmi.dylib &&
cp ${CMAKE_BINARY_DIR}/build/$(CONFIGURATION)/AI/libVCAI.dylib ${BUNDLE_PATH}/MacOS/AI/libVCAI.dylib &&
cp ${CMAKE_BINARY_DIR}/build/$(CONFIGURATION)/AI/libStupidAI.dylib ${BUNDLE_PATH}/MacOS/AI/libStupidAI.dylib &&
cp ${CMAKE_BINARY_DIR}/build/$(CONFIGURATION)/AI/libEmptyAI.dylib ${BUNDLE_PATH}/MacOS/AI/libEmptyAI.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 &&
# Copy frameworks
sh -c 'cp -r ${CMAKE_HOME_DIRECTORY}/${CMAKE_FRAMEWORK_PATH} ${BUNDLE_PATH}/Frameworks/ || true' &&
# Copy vcmi data
mkdir -p ${BUNDLE_PATH}/Data &&
mkdir -p ${BUNDLE_PATH}/Data/Mods &&
mkdir -p ${BUNDLE_PATH}/Data/launcher &&
cp -r ${CMAKE_HOME_DIRECTORY}/config/ ${BUNDLE_PATH}/Data/config/ &&
cp -r ${CMAKE_HOME_DIRECTORY}/Mods/vcmi/ ${BUNDLE_PATH}/Data/Mods/vcmi/ &&
sh -c 'cp -r ${CMAKE_HOME_DIRECTORY}/Mods/WoG/ ${BUNDLE_PATH}/Data/Mods/WoG/ || echo "Download WoG mod from http://wiki.vcmi.eu/index.php?title=Mod_list" ' &&
sh -c 'cp -r ${CMAKE_HOME_DIRECTORY}/Mods/hota/ ${BUNDLE_PATH}/Data/Mods/hota/ || echo "Download HOTA mod from http://wiki.vcmi.eu/index.php?title=Mod_list" ' &&
cp -r ${CMAKE_HOME_DIRECTORY}/launcher/icons/ ${BUNDLE_PATH}/Data/launcher/icons/)
if(NOT MINIZIP_FOUND)
add_custom_command(TARGET vcmiclient POST_BUILD COMMAND ${CopyVendoredMinizip})
endif()
add_custom_command(TARGET vcmiclient POST_BUILD COMMAND ${MakeVCMIBundle})
set(client_SRCS ${client_SRCS} SDLMain.m)
elseif(WIN32)
add_executable(vcmiclient ${client_SRCS} ${client_HEADERS} VCMI_client.rc)
else()
add_executable(vcmiclient ${client_SRCS} ${client_HEADERS})
set(client_ICON "VCMI_client.rc")
endif()
if(ENABLE_DEBUG_CONSOLE)
add_executable(vcmiclient ${client_SRCS} ${client_HEADERS} ${client_ICON})
else()
add_executable(vcmiclient WIN32 ${client_SRCS} ${client_HEADERS} ${client_ICON})
endif(ENABLE_DEBUG_CONSOLE)
if(WIN32)
set_target_properties(vcmiclient PROPERTIES OUTPUT_NAME VCMI_client)
set_target_properties(vcmiclient
PROPERTIES
OUTPUT_NAME "VCMI_client"
PROJECT_LABEL "VCMI_client"
)
if(NOT ENABLE_DEBUG_CONSOLE)
target_link_libraries(vcmiclient ${SDLMAIN_LIBRARY})
endif()
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}
${SDL2_LIBRARY} ${SDL2_IMAGE_LIBRARY} ${SDL2_MIXER_LIBRARY} ${SDL2_TTF_LIBRARY}
${ZLIB_LIBRARIES} ${FFMPEG_LIBRARIES} ${FFMPEG_EXTRA_LINKING_OPTIONS} ${SYSTEM_LIBS}
)
vcmi_set_output_dir(vcmiclient "")
set_target_properties(vcmiclient PROPERTIES ${PCH_PROPERTIES})
cotire(vcmiclient)
install(TARGETS vcmiclient DESTINATION ${BIN_DIR})
#install icons and desktop file on Linux
if(NOT WIN32 AND NOT APPLE)
#FIXME: move to client makefile?
install(FILES "${CMAKE_SOURCE_DIR}/client/icons/vcmiclient.64x64.png" DESTINATION share/icons/hicolor/64x64/apps RENAME vcmiclient.png)
install(FILES "${CMAKE_SOURCE_DIR}/client/icons/vcmiclient.48x48.png" DESTINATION share/icons/hicolor/48x48/apps RENAME vcmiclient.png)
install(FILES "${CMAKE_SOURCE_DIR}/client/icons/vcmiclient.32x32.png" DESTINATION share/icons/hicolor/32x32/apps RENAME vcmiclient.png)
install(FILES "${CMAKE_SOURCE_DIR}/client/icons/vcmiclient.256x256.png" DESTINATION share/icons/hicolor/256x256/apps RENAME vcmiclient.png)
install(FILES "${CMAKE_SOURCE_DIR}/client/icons/vcmiclient.desktop" DESTINATION share/applications)
endif()

View File

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIconFile</key>
<string>vcmi.icns</string>
<key>CFBundleVersion</key>
<string>${VCMI_VERSION_MAJOR}.${VCMI_VERSION_MINOR}</string>
<key>CFBundleIdentifier</key>
<string>com.vcmi.vcmiclient</string>
<key>SUFeedURL</key>
<string>https://vcmi.eu/sparkle_appcast.xml</string>
<key>SUPublicDSAKeyFile</key>
<string>vcmi_dsa_public.pem</string>
</dict>
</plist>

View File

@ -1,26 +0,0 @@
# This file is configured at cmake time, and loaded at cpack time.
# To pass variables to cpack from cmake, they must be configured
# in this file.
if(CPACK_GENERATOR MATCHES "NSIS")
set(CPACK_NSIS_INSTALL_ROOT "@CPACK_NSIS_INSTALL_ROOT@")
# set the install/unistall icon used for the installer itself
# There is a bug in NSI that does not handle full unix paths properly.
set(CPACK_NSIS_MUI_ICON "@CMAKE_SOURCE_DIR@/client\\vcmi.ico")
set(CPACK_NSIS_MUI_UNIICON "@CMAKE_SOURCE_DIR@/client\\vcmi.ico")
# set the package header icon for MUI
set(CPACK_PACKAGE_ICON "@CMAKE_SOURCE_DIR@/client\\vcmi.ico")
set(CPACK_NSIS_MENU_LINKS
"http://vcmi.eu/" "VCMI Web Site")
set(CPACK_NSIS_INSTALLED_ICON_NAME "VCMI_client.exe")
set(CPACK_NSIS_COMPRESSOR "/SOLID lzma")
set(CPACK_NSIS_PACKAGE_NAME "@CPACK_NSIS_PACKAGE_NAME@")
set(CPACK_NSIS_DISPLAY_NAME "@CPACK_NSIS_PACKAGE_NAME@, open-source engine for Heroes of Might and Magic III ")
set(CPACK_NSIS_HELP_LINK "http://vcmi.eu/")
set(CPACK_NSIS_URL_INFO_ABOUT "http://vcmi.eu/")
set(CPACK_NSIS_CONTACT @CPACK_PACKAGE_CONTACT@)
set(CPACK_NSIS_EXECUTABLES_DIRECTORY ".")
endif()

View File

@ -156,7 +156,7 @@ endforeach ()
# On OS X we ffmpeg libraries depend on VideoDecodeAcceleration and CoreVideo frameworks
IF (APPLE)
SET(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} "-framework VideoDecodeAcceleration -framework CoreVideo -lbz2")
SET(FFMPEG_EXTRA_LINKING_OPTIONS "-framework VideoDecodeAcceleration -framework CoreVideo -lbz2")
ENDIF()
# Give a nice error message if some of the required vars are missing.

View File

@ -1,18 +1,76 @@
#######################################
# Output directories #
#######################################
# This file should contain custom functions and macro and them only.
# It's should not alter any configuration on inclusion
#######################################
# Build output path #
#######################################
macro(vcmi_set_output_dir name dir)
# multi-config builds (e.g. msvc)
# Multi-config builds for Visual Studio, Xcode
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})
set_target_properties(${name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIGUPPERCASE} ${CMAKE_BINARY_DIR}/bin/${OUTPUTCONFIG}/${dir})
set_target_properties(${name} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIGUPPERCASE} ${CMAKE_BINARY_DIR}/bin/${OUTPUTCONFIG}/${dir})
set_target_properties(${name} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIGUPPERCASE} ${CMAKE_BINARY_DIR}/bin/${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})
# Generic no-config case for Makefiles, Ninja.
# This is what Qt Creator is using
set_target_properties(${name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/${dir})
set_target_properties(${name} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/${dir})
set_target_properties(${name} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/${dir})
endmacro()
#######################################
# Project generation #
#######################################
# Let us have proper tree-like structure in IDEs such as Visual Studio
function(assign_source_group)
foreach(_source IN ITEMS ${ARGN})
if(IS_ABSOLUTE "${_source}")
file(RELATIVE_PATH _source_rel "${CMAKE_CURRENT_SOURCE_DIR}" "${_source}")
else()
set(_source_rel "${_source}")
endif()
get_filename_component(_source_path "${_source_rel}" PATH)
string(REPLACE "/" "\\" _source_path_msvc "${_source_path}")
source_group("${_source_path_msvc}" FILES "${_source}")
endforeach()
endfunction(assign_source_group)
# Macro to add subdirectory and set appropriate FOLDER for generated projects files
function(add_subdirectory_with_folder _folder_name _folder)
add_subdirectory(${_folder} ${ARGN})
set_property(DIRECTORY "${_folder}" PROPERTY FOLDER "${_folder_name}")
endfunction()
# Macro for Xcode Projects generation
# Slightly outdated, but useful reference for all options available here:
# https://pewpewthespells.com/blog/buildsettings.html
# https://github.com/samdmarshall/Xcode-Build-Settings-Reference
if(${CMAKE_GENERATOR} MATCHES "Xcode")
macro(set_xcode_property TARGET XCODE_PROPERTY XCODE_VALUE)
set_property(TARGET ${TARGET} PROPERTY
XCODE_ATTRIBUTE_${XCODE_PROPERTY} ${XCODE_VALUE})
endmacro(set_xcode_property)
endif(${CMAKE_GENERATOR} MATCHES "Xcode")
#######################################
# CMake debugging #
#######################################
# Can be called to see check cmake variables and environment variables
# For "install" debugging just copy it here. There no easy way to include modules from source.
function(vcmi_get_cmake_debug_info)
message(STATUS "Debug - Internal variables:")
get_cmake_property(_variableNames VARIABLES)
foreach(_variableName ${_variableNames})
message(STATUS "${_variableName}=${${_variableName}}")
endforeach()
message(STATUS "Debug - Environment variables:")
execute_process(COMMAND "${CMAKE_COMMAND}" "-E" "environment")
endfunction()

View File

@ -3,7 +3,7 @@
# See the cotire manual for usage hints.
#
#=============================================================================
# Copyright 2012-2016 Sascha Kratky
# Copyright 2012-2017 Sascha Kratky
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
@ -43,7 +43,7 @@ if (NOT CMAKE_SCRIPT_MODE_FILE)
endif()
set (COTIRE_CMAKE_MODULE_FILE "${CMAKE_CURRENT_LIST_FILE}")
set (COTIRE_CMAKE_MODULE_VERSION "1.7.8")
set (COTIRE_CMAKE_MODULE_VERSION "1.7.10")
# activate select policies
if (POLICY CMP0025)
@ -106,6 +106,11 @@ if (POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
endif()
if (POLICY CMP0055)
# strict checking for break() command
cmake_policy(SET CMP0055 NEW)
endif()
include(CMakeParseArguments)
include(ProcessorCount)
@ -293,7 +298,7 @@ function (cotire_get_source_file_property_values _valuesVar _property)
set (${_valuesVar} ${_values} PARENT_SCOPE)
endfunction()
function (cotire_resolve_config_properites _configurations _propertiesVar)
function (cotire_resolve_config_properties _configurations _propertiesVar)
set (_properties "")
foreach (_property ${ARGN})
if ("${_property}" MATCHES "<CONFIG>")
@ -309,8 +314,8 @@ function (cotire_resolve_config_properites _configurations _propertiesVar)
set (${_propertiesVar} ${_properties} PARENT_SCOPE)
endfunction()
function (cotire_copy_set_properites _configurations _type _source _target)
cotire_resolve_config_properites("${_configurations}" _properties ${ARGN})
function (cotire_copy_set_properties _configurations _type _source _target)
cotire_resolve_config_properties("${_configurations}" _properties ${ARGN})
foreach (_property ${_properties})
get_property(_isSet ${_type} ${_source} PROPERTY ${_property} SET)
if (_isSet)
@ -320,13 +325,18 @@ function (cotire_copy_set_properites _configurations _type _source _target)
endforeach()
endfunction()
function (cotire_get_target_usage_requirements _target _targetRequirementsVar)
function (cotire_get_target_usage_requirements _target _config _targetRequirementsVar)
set (_targetRequirements "")
get_target_property(_librariesToProcess ${_target} LINK_LIBRARIES)
while (_librariesToProcess)
# remove from head
list (GET _librariesToProcess 0 _library)
list (REMOVE_AT _librariesToProcess 0)
if (_library MATCHES "^\\$<\\$<CONFIG:${_config}>:([A-Za-z0-9_:-]+)>$")
set (_library "${CMAKE_MATCH_1}")
elseif (_config STREQUAL "None" AND _library MATCHES "^\\$<\\$<CONFIG:>:([A-Za-z0-9_:-]+)>$")
set (_library "${CMAKE_MATCH_1}")
endif()
if (TARGET ${_library})
list (FIND _targetRequirements ${_library} _index)
if (_index LESS 0)
@ -441,7 +451,7 @@ function (cotire_get_target_compile_flags _config _language _target _flagsVar)
# interface compile options from linked library targets
if (_target)
set (_linkedTargets "")
cotire_get_target_usage_requirements(${_target} _linkedTargets)
cotire_get_target_usage_requirements(${_target} ${_config} _linkedTargets)
foreach (_linkedTarget ${_linkedTargets})
get_target_property(_targetOptions ${_linkedTarget} INTERFACE_COMPILE_OPTIONS)
if (_targetOptions)
@ -450,22 +460,21 @@ function (cotire_get_target_compile_flags _config _language _target _flagsVar)
endforeach()
endif()
# handle language standard properties
if (CMAKE_${_language}_STANDARD_DEFAULT)
# used compiler supports language standard levels
if (_target)
get_target_property(_targetLanguageStandard ${_target} ${_language}_STANDARD)
get_target_property(_targetLanguageExtensions ${_target} ${_language}_EXTENSIONS)
get_target_property(_targetLanguageStandardRequired ${_target} ${_language}_STANDARD_REQUIRED)
if (_targetLanguageExtensions)
if (CMAKE_${_language}${_targetLanguageExtensions}_EXTENSION_COMPILE_OPTION)
list (APPEND _compileFlags "${CMAKE_${_language}${_targetLanguageExtensions}_EXTENSION_COMPILE_OPTION}")
if (_targetLanguageStandard)
set (_type "EXTENSION")
get_property(_isSet TARGET ${_target} PROPERTY ${_language}_EXTENSIONS SET)
if (_isSet)
get_target_property(_targetUseLanguageExtensions ${_target} ${_language}_EXTENSIONS)
if (NOT _targetUseLanguageExtensions)
set (_type "STANDARD")
endif()
elseif (_targetLanguageStandard)
if (_targetLanguageStandardRequired)
if (CMAKE_${_language}${_targetLanguageStandard}_STANDARD_COMPILE_OPTION)
list (APPEND _compileFlags "${CMAKE_${_language}${_targetLanguageStandard}_STANDARD_COMPILE_OPTION}")
endif()
else()
if (CMAKE_${_language}${_targetLanguageStandard}_EXTENSION_COMPILE_OPTION)
list (APPEND _compileFlags "${CMAKE_${_language}${_targetLanguageStandard}_EXTENSION_COMPILE_OPTION}")
if (CMAKE_${_language}${_targetLanguageStandard}_${_type}_COMPILE_OPTION)
list (APPEND _compileFlags "${CMAKE_${_language}${_targetLanguageStandard}_${_type}_COMPILE_OPTION}")
endif()
endif()
endif()
@ -574,7 +583,7 @@ function (cotire_get_target_include_directories _config _language _target _inclu
# interface include directories from linked library targets
if (_target)
set (_linkedTargets "")
cotire_get_target_usage_requirements(${_target} _linkedTargets)
cotire_get_target_usage_requirements(${_target} ${_config} _linkedTargets)
foreach (_linkedTarget ${_linkedTargets})
get_target_property(_linkedTargetType ${_linkedTarget} TYPE)
if (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE AND NOT CMAKE_VERSION VERSION_LESS "3.4.0" AND
@ -628,6 +637,25 @@ function (cotire_get_target_include_directories _config _language _target _inclu
if (CMAKE_${_language}_IMPLICIT_INCLUDE_DIRECTORIES)
list (REMOVE_ITEM _includeDirs ${CMAKE_${_language}_IMPLICIT_INCLUDE_DIRECTORIES})
endif()
if (WIN32 AND NOT MINGW)
# convert Windows paths in include directories to CMake paths
if (_includeDirs)
set (_paths "")
foreach (_dir ${_includeDirs})
file (TO_CMAKE_PATH "${_dir}" _path)
list (APPEND _paths "${_path}")
endforeach()
set (_includeDirs ${_paths})
endif()
if (_systemIncludeDirs)
set (_paths "")
foreach (_dir ${_systemIncludeDirs})
file (TO_CMAKE_PATH "${_dir}" _path)
list (APPEND _paths "${_path}")
endforeach()
set (_systemIncludeDirs ${_paths})
endif()
endif()
if (COTIRE_DEBUG AND _includeDirs)
message (STATUS "Target ${_target} include dirs: ${_includeDirs}")
endif()
@ -685,7 +713,7 @@ function (cotire_get_target_compile_definitions _config _language _target _defin
endif()
# interface compile definitions from linked library targets
set (_linkedTargets "")
cotire_get_target_usage_requirements(${_target} _linkedTargets)
cotire_get_target_usage_requirements(${_target} ${_config} _linkedTargets)
foreach (_linkedTarget ${_linkedTargets})
get_target_property(_definitions ${_linkedTarget} INTERFACE_COMPILE_DEFINITIONS)
if (_definitions)
@ -841,6 +869,9 @@ macro (cotire_set_cmd_to_prologue _cmdVar)
list (APPEND ${_cmdVar} "--warn-uninitialized")
endif()
list (APPEND ${_cmdVar} "-DCOTIRE_BUILD_TYPE:STRING=$<CONFIGURATION>")
if (XCODE)
list (APPEND ${_cmdVar} "-DXCODE:BOOL=TRUE")
endif()
if (COTIRE_VERBOSE)
list (APPEND ${_cmdVar} "-DCOTIRE_VERBOSE:BOOL=ON")
elseif("${CMAKE_GENERATOR}" MATCHES "Makefiles")
@ -884,16 +915,16 @@ function (cotire_add_includes_to_cmd _cmdVar _language _includesVar _systemInclu
foreach (_include ${_includeDirs})
if (WIN32 AND CMAKE_${_language}_COMPILER_ID MATCHES "MSVC|Intel")
file (TO_NATIVE_PATH "${_include}" _include)
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_${_language}_SEP}${_include}")
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_SEP_${_language}}${_include}")
else()
set (_index -1)
if ("${CMAKE_INCLUDE_SYSTEM_FLAG_${_language}}" MATCHES ".+")
list (FIND ${_systemIncludesVar} "${_include}" _index)
endif()
if (_index GREATER -1)
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_SYSTEM_FLAG_${_language}}${_include}")
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_SYSTEM_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_SEP_${_language}}${_include}")
else()
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_${_language}_SEP}${_include}")
list (APPEND ${_cmdVar} "${CMAKE_INCLUDE_FLAG_${_language}}${CMAKE_INCLUDE_FLAG_SEP_${_language}}${_include}")
endif()
endif()
endforeach()
@ -1184,7 +1215,7 @@ endfunction()
function (cotire_scan_includes _includesVar)
set(_options "")
set(_oneValueArgs COMPILER_ID COMPILER_EXECUTABLE COMPILER_ARG1 COMPILER_VERSION LANGUAGE UNPARSED_LINES)
set(_oneValueArgs COMPILER_ID COMPILER_EXECUTABLE COMPILER_ARG1 COMPILER_VERSION LANGUAGE UNPARSED_LINES SCAN_RESULT)
set(_multiValueArgs COMPILE_DEFINITIONS COMPILE_FLAGS INCLUDE_DIRECTORIES SYSTEM_INCLUDE_DIRECTORIES
IGNORE_PATH INCLUDE_PATH IGNORE_EXTENSIONS INCLUDE_PRIORITY_PATH COMPILER_LAUNCHER)
cmake_parse_arguments(_option "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN})
@ -1257,6 +1288,9 @@ function (cotire_scan_includes _includesVar)
if (_option_UNPARSED_LINES)
set (${_option_UNPARSED_LINES} ${_unparsedLines} PARENT_SCOPE)
endif()
if (_option_SCAN_RESULT)
set (${_option_SCAN_RESULT} ${_result} PARENT_SCOPE)
endif()
endfunction()
macro (cotire_append_undefs _contentsVar)
@ -1444,12 +1478,13 @@ function (cotire_generate_prefix_header _prefixFile)
INCLUDE_PATH ${_option_INCLUDE_PATH}
IGNORE_EXTENSIONS ${_option_IGNORE_EXTENSIONS}
INCLUDE_PRIORITY_PATH ${_option_INCLUDE_PRIORITY_PATH}
UNPARSED_LINES _unparsedLines)
UNPARSED_LINES _unparsedLines
SCAN_RESULT _scanResult)
cotire_generate_unity_source("${_prefixFile}"
PROLOGUE ${_prologue} EPILOGUE ${_epilogue} LANGUAGE "${_option_LANGUAGE}" ${_selectedHeaders})
set (_unparsedLinesFile "${_prefixFile}.log")
if (_unparsedLines)
if (COTIRE_VERBOSE OR NOT _selectedHeaders)
if (COTIRE_VERBOSE OR _scanResult OR NOT _selectedHeaders)
list (LENGTH _unparsedLines _skippedLineCount)
message (STATUS "${_skippedLineCount} line(s) skipped, see ${_unparsedLinesFile}")
endif()
@ -1635,6 +1670,10 @@ function (cotire_add_pch_compilation_flags _language _compilerID _compilerVersio
get_filename_component(_pchName "${_pchFile}" NAME)
set (_xLanguage_C "c-header")
set (_xLanguage_CXX "c++-header")
set (_pchSuppressMessages FALSE)
if ("${CMAKE_${_language}_FLAGS}" MATCHES ".*-Wno-pch-messages.*")
set(_pchSuppressMessages TRUE)
endif()
if (_flags)
# append to list
if ("${_language}" STREQUAL "CXX")
@ -1642,16 +1681,20 @@ function (cotire_add_pch_compilation_flags _language _compilerID _compilerVersio
endif()
list (APPEND _flags "-include" "${_prefixFile}" "-pch-dir" "${_pchDir}" "-pch-create" "${_pchName}" "-fsyntax-only" "${_hostFile}")
if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0")
if (NOT _pchSuppressMessages)
list (APPEND _flags "-Wpch-messages")
endif()
endif()
else()
# return as a flag string
set (_flags "-include \"${_prefixFile}\" -pch-dir \"${_pchDir}\" -pch-create \"${_pchName}\"")
if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0")
if (NOT _pchSuppressMessages)
set (_flags "${_flags} -Wpch-messages")
endif()
endif()
endif()
endif()
else()
message (FATAL_ERROR "cotire: unsupported ${_language} compiler ${_compilerID} version ${_compilerVersion}.")
endif()
@ -1759,19 +1802,27 @@ function (cotire_add_prefix_pch_inclusion_flags _language _compilerID _compilerV
if (_pchFile)
get_filename_component(_pchDir "${_pchFile}" DIRECTORY)
get_filename_component(_pchName "${_pchFile}" NAME)
set (_pchSuppressMessages FALSE)
if ("${CMAKE_${_language}_FLAGS}" MATCHES ".*-Wno-pch-messages.*")
set(_pchSuppressMessages TRUE)
endif()
if (_flags)
# append to list
list (APPEND _flags "-include" "${_prefixFile}" "-pch-dir" "${_pchDir}" "-pch-use" "${_pchName}")
if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0")
if (NOT _pchSuppressMessages)
list (APPEND _flags "-Wpch-messages")
endif()
endif()
else()
# return as a flag string
set (_flags "-include \"${_prefixFile}\" -pch-dir \"${_pchDir}\" -pch-use \"${_pchName}\"")
if (NOT "${_compilerVersion}" VERSION_LESS "13.1.0")
if (NOT _pchSuppressMessages)
set (_flags "${_flags} -Wpch-messages")
endif()
endif()
endif()
else()
# no precompiled header, force inclusion of prefix header
if (_flags)
@ -1817,6 +1868,14 @@ function (cotire_precompile_prefix_header _prefixFile _pchFile _hostFile)
if (_option_COMPILER_ID MATCHES "MSVC")
# cl.exe messes with the output streams unless the environment variable VS_UNICODE_OUTPUT is cleared
unset (ENV{VS_UNICODE_OUTPUT})
elseif (_option_COMPILER_ID MATCHES "GNU|Clang")
if (_option_COMPILER_LAUNCHER MATCHES "ccache" OR
_option_COMPILER_EXECUTABLE MATCHES "ccache")
# Newer versions of Clang and GCC seem to embed a compilation timestamp into the precompiled header binary,
# which results in "file has been modified since the precompiled header was built" errors if ccache is used.
# We work around the problem by disabling ccache upon pre-compiling the prefix header.
set (ENV{CCACHE_DISABLE} "true")
endif()
endif()
execute_process(
COMMAND ${_cmd}
@ -1856,11 +1915,32 @@ function (cotire_check_precompiled_header_support _language _target _msgVar)
endif()
get_target_property(_launcher ${_target} ${_language}_COMPILER_LAUNCHER)
if (CMAKE_${_language}_COMPILER MATCHES "ccache" OR _launcher MATCHES "ccache")
if (NOT "$ENV{CCACHE_SLOPPINESS}" MATCHES "time_macros|pch_defines")
if (DEFINED ENV{CCACHE_SLOPPINESS})
if (NOT "$ENV{CCACHE_SLOPPINESS}" MATCHES "pch_defines" OR NOT "$ENV{CCACHE_SLOPPINESS}" MATCHES "time_macros")
set (${_msgVar}
"ccache requires the environment variable CCACHE_SLOPPINESS to be set to \"pch_defines,time_macros\"."
PARENT_SCOPE)
endif()
else()
if (_launcher MATCHES "ccache")
get_filename_component(_ccacheExe "${_launcher}" REALPATH)
else()
get_filename_component(_ccacheExe "${CMAKE_${_language}_COMPILER}" REALPATH)
endif()
execute_process(
COMMAND "${_ccacheExe}" "--print-config"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
RESULT_VARIABLE _result
OUTPUT_VARIABLE _ccacheConfig OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET)
if (_result OR NOT
_ccacheConfig MATCHES "sloppiness.*=.*time_macros" OR NOT
_ccacheConfig MATCHES "sloppiness.*=.*pch_defines")
set (${_msgVar}
"ccache requires configuration setting \"sloppiness\" to be set to \"pch_defines,time_macros\"."
PARENT_SCOPE)
endif()
endif()
endif()
if (APPLE)
# PCH compilation not supported by GCC / Clang for multi-architecture builds (e.g., i386, x86_64)
@ -2148,7 +2228,7 @@ function (cotire_generate_target_script _language _configurations _target _targe
XCODE MSVC CMAKE_GENERATOR CMAKE_BUILD_TYPE CMAKE_CONFIGURATION_TYPES
CMAKE_${_language}_COMPILER_ID CMAKE_${_language}_COMPILER_VERSION
CMAKE_${_language}_COMPILER_LAUNCHER CMAKE_${_language}_COMPILER CMAKE_${_language}_COMPILER_ARG1
CMAKE_INCLUDE_FLAG_${_language} CMAKE_INCLUDE_FLAG_${_language}_SEP
CMAKE_INCLUDE_FLAG_${_language} CMAKE_INCLUDE_FLAG_SEP_${_language}
CMAKE_INCLUDE_SYSTEM_FLAG_${_language}
CMAKE_${_language}_FRAMEWORK_SEARCH_FLAG
CMAKE_${_language}_SYSTEM_FRAMEWORK_SEARCH_FLAG
@ -2206,14 +2286,18 @@ function (cotire_setup_pch_file_compilation _language _target _targetScript _pre
else()
file (RELATIVE_PATH _pchFileLogPath "${CMAKE_BINARY_DIR}" "${_pchFile}")
endif()
# make precompiled header compilation depend on the actual compiler executable used to force
# re-compilation when the compiler executable is updated. This prevents "created by a different GCC executable"
# warnings when the precompiled header is included.
get_filename_component(_realCompilerExe "${CMAKE_${_language}_COMPILER}" ABSOLUTE)
if (COTIRE_DEBUG)
message (STATUS "add_custom_command: OUTPUT ${_pchFile} ${_cmds} DEPENDS ${_prefixFile} IMPLICIT_DEPENDS ${_language} ${_prefixFile}")
message (STATUS "add_custom_command: OUTPUT ${_pchFile} ${_cmds} DEPENDS ${_prefixFile} ${_realCompilerExe} IMPLICIT_DEPENDS ${_language} ${_prefixFile}")
endif()
set_property (SOURCE "${_pchFile}" PROPERTY GENERATED TRUE)
add_custom_command(
OUTPUT "${_pchFile}"
COMMAND ${_cmds}
DEPENDS "${_prefixFile}"
DEPENDS "${_prefixFile}" "${_realCompilerExe}"
IMPLICIT_DEPENDS ${_language} "${_prefixFile}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Building ${_language} precompiled header ${_pchFileLogPath}"
@ -2445,8 +2529,12 @@ function (cotire_setup_prefix_generation_command _language _target _targetScript
cotire_set_cmd_to_prologue(_prefixCmd)
list (APPEND _prefixCmd -P "${COTIRE_CMAKE_MODULE_FILE}" "prefix" "${_targetScript}" "${_prefixFile}" ${_unityFiles})
set_property (SOURCE "${_prefixFile}" PROPERTY GENERATED TRUE)
# make prefix header generation depend on the actual compiler executable used to force
# re-generation when the compiler executable is updated. This prevents "file not found"
# errors for compiler version specific system header files.
get_filename_component(_realCompilerExe "${CMAKE_${_language}_COMPILER}" ABSOLUTE)
if (COTIRE_DEBUG)
message (STATUS "add_custom_command: OUTPUT ${_prefixFile} COMMAND ${_prefixCmd} DEPENDS ${_unityFile} ${_dependencySources}")
message (STATUS "add_custom_command: OUTPUT ${_prefixFile} COMMAND ${_prefixCmd} DEPENDS ${_unityFile} ${_dependencySources} ${_realCompilerExe}")
endif()
if (MSVC_IDE)
file (TO_NATIVE_PATH "${_prefixFile}" _prefixFileLogPath)
@ -2478,7 +2566,7 @@ function (cotire_setup_prefix_generation_command _language _target _targetScript
add_custom_command(
OUTPUT "${_prefixFile}" "${_prefixFile}.log"
COMMAND ${_prefixCmd}
DEPENDS ${_unityFiles} ${_dependencySources}
DEPENDS ${_unityFiles} ${_dependencySources} "${_realCompilerExe}"
COMMENT "${_comment}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
VERBATIM)
@ -2639,12 +2727,14 @@ function (cotire_choose_target_languages _target _targetLanguagesVar _wholeTarge
set (${_targetLanguagesVar} "" PARENT_SCOPE)
return()
endif()
if (_targetUsePCH AND "${_language}" MATCHES "^C|CXX$" AND NOT "${CMAKE_${_language}_COMPILER_ID}" STREQUAL "")
if (_targetUsePCH AND "${_language}" MATCHES "^C|CXX$" AND DEFINED CMAKE_${_language}_COMPILER_ID)
if (CMAKE_${_language}_COMPILER_ID)
cotire_check_precompiled_header_support("${_language}" "${_target}" _disableMsg)
if (_disableMsg)
set (_targetUsePCH FALSE)
endif()
endif()
endif()
set (_sourceFiles "")
set (_excludedSources "")
set (_cotiredSources "")
@ -2857,6 +2947,16 @@ function (cotire_setup_pch_target _languages _configurations _target)
endif()
endfunction()
function (cotire_filter_object_libraries _target _objectLibrariesVar)
set (_objectLibraries "")
foreach (_source ${ARGN})
if (_source MATCHES "^\\$<TARGET_OBJECTS:.+>$")
list (APPEND _objectLibraries "${_source}")
endif()
endforeach()
set (${_objectLibrariesVar} ${_objectLibraries} PARENT_SCOPE)
endfunction()
function (cotire_collect_unity_target_sources _target _languages _unityTargetSourcesVar)
get_target_property(_targetSourceFiles ${_target} SOURCES)
set (_unityTargetSources ${_targetSourceFiles})
@ -2875,6 +2975,15 @@ function (cotire_collect_unity_target_sources _target _languages _unityTargetSou
list (APPEND _unityTargetSources ${_unityFiles})
endif()
endforeach()
get_target_property(_linkLibrariesStrategy ${_target} COTIRE_UNITY_LINK_LIBRARIES_INIT)
if ("${_linkLibrariesStrategy}" MATCHES "^COPY_UNITY$")
cotire_filter_object_libraries(${_target} _objectLibraries ${_targetSourceFiles})
if (_objectLibraries)
cotire_map_libraries("${_linkLibrariesStrategy}" _unityObjectLibraries ${_objectLibraries})
list (REMOVE_ITEM _unityTargetSources ${_objectLibraries})
list (APPEND _unityTargetSources ${_unityObjectLibraries})
endif()
endif()
set (${_unityTargetSourcesVar} ${_unityTargetSources} PARENT_SCOPE)
endfunction()
@ -2917,8 +3026,13 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
if (_targetAutoMoc OR _targetAutoUic OR _targetAutoRcc)
# if the original target sources are subject to CMake's automatic Qt processing,
# also include implicitly generated <targetname>_automoc.cpp file
if (CMAKE_VERSION VERSION_LESS "3.8.0")
list (APPEND _unityTargetSources "${_target}_automoc.cpp")
set_property (SOURCE "${_target}_automoc.cpp" PROPERTY GENERATED TRUE)
else()
list (APPEND _unityTargetSources "${_target}_autogen/moc_compilation.cpp")
set_property (SOURCE "${_target}_autogen/moc_compilation.cpp" PROPERTY GENERATED TRUE)
endif()
endif()
# prevent AUTOMOC, AUTOUIC and AUTORCC properties from being set when the unity target is created
set (CMAKE_AUTOMOC OFF)
@ -2933,9 +3047,20 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
else()
add_library(${_unityTargetName} ${_unityTargetSubType} EXCLUDE_FROM_ALL ${_unityTargetSources})
endif()
if ("${CMAKE_GENERATOR}" MATCHES "Visual Studio")
# depend on original target's automoc target, if it exists
if (TARGET ${_target}_automoc)
add_dependencies(${_unityTargetName} ${_target}_automoc)
endif()
else()
if (_targetAutoMoc OR _targetAutoUic OR _targetAutoRcc)
# depend on the original target's implicity generated <targetname>_automoc target
if (CMAKE_VERSION VERSION_LESS "3.8.0")
add_dependencies(${_unityTargetName} ${_target}_automoc)
else()
add_dependencies(${_unityTargetName} ${_target}_autogen)
endif()
endif()
endif()
# copy output location properties
set (_outputDirProperties
@ -2948,8 +3073,8 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
set (_outputDir "${COTIRE_UNITY_OUTPUT_DIRECTORY}")
else()
# append relative COTIRE_UNITY_OUTPUT_DIRECTORY to target's actual output directory
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName} ${_outputDirProperties})
cotire_resolve_config_properites("${_configurations}" _properties ${_outputDirProperties})
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName} ${_outputDirProperties})
cotire_resolve_config_properties("${_configurations}" _properties ${_outputDirProperties})
foreach (_property ${_properties})
get_property(_outputDir TARGET ${_target} PROPERTY ${_property})
if (_outputDir)
@ -2969,11 +3094,11 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
RUNTIME_OUTPUT_DIRECTORY "${_outputDir}")
endif()
else()
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
${_outputDirProperties})
endif()
# copy output name
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
ARCHIVE_OUTPUT_NAME ARCHIVE_OUTPUT_NAME_<CONFIG>
LIBRARY_OUTPUT_NAME LIBRARY_OUTPUT_NAME_<CONFIG>
OUTPUT_NAME OUTPUT_NAME_<CONFIG>
@ -2981,7 +3106,7 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
PREFIX <CONFIG>_POSTFIX SUFFIX
IMPORT_PREFIX IMPORT_SUFFIX)
# copy compile stuff
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
COMPILE_DEFINITIONS COMPILE_DEFINITIONS_<CONFIG>
COMPILE_FLAGS COMPILE_OPTIONS
Fortran_FORMAT Fortran_MODULE_DIRECTORY
@ -2990,14 +3115,15 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
POSITION_INDEPENDENT_CODE
C_COMPILER_LAUNCHER CXX_COMPILER_LAUNCHER
C_INCLUDE_WHAT_YOU_USE CXX_INCLUDE_WHAT_YOU_USE
C_VISIBILITY_PRESET CXX_VISIBILITY_PRESET VISIBILITY_INLINES_HIDDEN)
C_VISIBILITY_PRESET CXX_VISIBILITY_PRESET VISIBILITY_INLINES_HIDDEN
C_CLANG_TIDY CXX_CLANG_TIDY)
# copy compile features
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
C_EXTENSIONS C_STANDARD C_STANDARD_REQUIRED
CXX_EXTENSIONS CXX_STANDARD CXX_STANDARD_REQUIRED
COMPILE_FEATURES)
# copy interface stuff
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
COMPATIBLE_INTERFACE_BOOL COMPATIBLE_INTERFACE_NUMBER_MAX COMPATIBLE_INTERFACE_NUMBER_MIN
COMPATIBLE_INTERFACE_STRING
INTERFACE_COMPILE_DEFINITIONS INTERFACE_COMPILE_FEATURES INTERFACE_COMPILE_OPTIONS
@ -3005,7 +3131,7 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
INTERFACE_POSITION_INDEPENDENT_CODE INTERFACE_SYSTEM_INCLUDE_DIRECTORIES
INTERFACE_AUTOUIC_OPTIONS NO_SYSTEM_FROM_IMPORTED)
# copy link stuff
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
BUILD_WITH_INSTALL_RPATH INSTALL_RPATH INSTALL_RPATH_USE_LINK_PATH SKIP_BUILD_RPATH
LINKER_LANGUAGE LINK_DEPENDS LINK_DEPENDS_NO_SHARED
LINK_FLAGS LINK_FLAGS_<CONFIG>
@ -3013,18 +3139,19 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
LINK_INTERFACE_MULTIPLICITY LINK_INTERFACE_MULTIPLICITY_<CONFIG>
LINK_SEARCH_START_STATIC LINK_SEARCH_END_STATIC
STATIC_LIBRARY_FLAGS STATIC_LIBRARY_FLAGS_<CONFIG>
NO_SONAME SOVERSION VERSION)
NO_SONAME SOVERSION VERSION
LINK_WHAT_YOU_USE BUILD_RPATH)
# copy cmake stuff
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
IMPLICIT_DEPENDS_INCLUDE_TRANSFORM RULE_LAUNCH_COMPILE RULE_LAUNCH_CUSTOM RULE_LAUNCH_LINK)
# copy Apple platform specific stuff
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
BUNDLE BUNDLE_EXTENSION FRAMEWORK FRAMEWORK_VERSION INSTALL_NAME_DIR
MACOSX_BUNDLE MACOSX_BUNDLE_INFO_PLIST MACOSX_FRAMEWORK_INFO_PLIST MACOSX_RPATH
OSX_ARCHITECTURES OSX_ARCHITECTURES_<CONFIG> PRIVATE_HEADER PUBLIC_HEADER RESOURCE XCTEST
IOS_INSTALL_COMBINED)
IOS_INSTALL_COMBINED XCODE_EXPLICIT_FILE_TYPE XCODE_PRODUCT_TYPE)
# copy Windows platform specific stuff
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
GNUtoMS
COMPILE_PDB_NAME COMPILE_PDB_NAME_<CONFIG>
COMPILE_PDB_OUTPUT_DIRECTORY COMPILE_PDB_OUTPUT_DIRECTORY_<CONFIG>
@ -3036,9 +3163,11 @@ function (cotire_setup_unity_build_target _languages _configurations _target)
VS_SCC_AUXPATH VS_SCC_LOCALPATH VS_SCC_PROJECTNAME VS_SCC_PROVIDER
VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION
VS_WINRT_COMPONENT VS_WINRT_EXTENSIONS VS_WINRT_REFERENCES
WIN32_EXECUTABLE WINDOWS_EXPORT_ALL_SYMBOLS)
WIN32_EXECUTABLE WINDOWS_EXPORT_ALL_SYMBOLS
DEPLOYMENT_REMOTE_DIRECTORY VS_CONFIGURATION_TYPE
VS_SDK_REFERENCES VS_USER_PROPS VS_DEBUGGER_WORKING_DIRECTORY)
# copy Android platform specific stuff
cotire_copy_set_properites("${_configurations}" TARGET ${_target} ${_unityTargetName}
cotire_copy_set_properties("${_configurations}" TARGET ${_target} ${_unityTargetName}
ANDROID_API ANDROID_API_MIN ANDROID_GUI
ANDROID_ANT_ADDITIONAL_OPTIONS ANDROID_ARCH ANDROID_ASSETS_DIRECTORIES
ANDROID_JAR_DEPENDENCIES ANDROID_JAR_DIRECTORIES ANDROID_JAVA_SOURCE_DIR
@ -3151,9 +3280,15 @@ function (cotire_map_libraries _strategy _mappedLibrariesVar)
if (_library MATCHES "^\\$<LINK_ONLY:(.+)>$")
set (_libraryName "${CMAKE_MATCH_1}")
set (_linkOnly TRUE)
set (_objectLibrary FALSE)
elseif (_library MATCHES "^\\$<TARGET_OBJECTS:(.+)>$")
set (_libraryName "${CMAKE_MATCH_1}")
set (_linkOnly FALSE)
set (_objectLibrary TRUE)
else()
set (_libraryName "${_library}")
set (_linkOnly FALSE)
set (_objectLibrary FALSE)
endif()
if ("${_strategy}" MATCHES "COPY_UNITY")
cotire_is_target_supported(${_libraryName} _isSupported)
@ -3163,6 +3298,8 @@ function (cotire_map_libraries _strategy _mappedLibrariesVar)
if (TARGET "${_libraryUnityTargetName}")
if (_linkOnly)
list (APPEND _mappedLibraries "$<LINK_ONLY:${_libraryUnityTargetName}>")
elseif (_objectLibrary)
list (APPEND _mappedLibraries "$<TARGET_OBJECTS:${_libraryUnityTargetName}>")
else()
list (APPEND _mappedLibraries "${_libraryUnityTargetName}")
endif()

View File

@ -1,9 +1,8 @@
project(vcmilauncher)
cmake_minimum_required(VERSION 2.8.7)
# Detailed information about CMake compatibility available on Qt website
# https://doc.qt.io/qt-5/cmake-manual.html
include_directories(${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/include ${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${ZLIB_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS})
include_directories(${SDL_INCLUDE_DIR})
include_directories(${SDL2_INCLUDE_DIR})
set(launcher_modmanager_SRCS
modManager/cdownloadmanager_moc.cpp
@ -59,6 +58,8 @@ set(launcher_FORMS
mainwindow_moc.ui
)
assign_source_group(${launcher_SRCS} ${launcher_HEADERS} VCMI_launcher.rc)
# Tell CMake to run moc when necessary:
set(CMAKE_AUTOMOC ON)
@ -66,40 +67,59 @@ set(CMAKE_AUTOMOC ON)
# to always look for includes there:
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# We need add -DQT_WIDGETS_LIB when using QtWidgets in Qt 5.
add_definitions(${Qt5Widgets_DEFINITIONS})
add_definitions(${Qt5Network_DEFINITIONS})
if("${CMAKE_VERSION}" VERSION_LESS 2.8.12)
# Executables fail to build with Qt 5 in the default configuration
# without -fPIE. We add that here.
set(CMAKE_CXX_FLAGS "${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS} ${CMAKE_CXX_FLAGS}")
endif()
qt5_wrap_ui(launcher_UI_HEADERS ${launcher_FORMS})
if(WIN32)
add_executable(vcmilauncher WIN32 ${launcher_SRCS} ${launcher_HEADERS} ${launcher_UI_HEADERS} VCMI_launcher.rc)
set_target_properties(vcmilauncher PROPERTIES OUTPUT_NAME VCMI_launcher)
else()
add_executable(vcmilauncher ${launcher_SRCS} ${launcher_HEADERS} ${launcher_UI_HEADERS})
set(launcher_ICON VCMI_launcher.rc)
endif()
if(MSVC)
# Fix _WinMain@16 linking error
target_link_libraries(vcmilauncher vcmi ${Qt5Core_QTMAIN_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES} ${SDL_LIBRARY})
else()
# The Qt5Widgets_LIBRARIES variable also includes QtGui and QtCore
target_link_libraries(vcmilauncher vcmi ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES} ${SDL_LIBRARY})
add_executable(vcmilauncher WIN32 ${launcher_SRCS} ${launcher_HEADERS} ${launcher_UI_HEADERS} ${launcher_ICON})
if(WIN32)
set_target_properties(vcmilauncher
PROPERTIES
OUTPUT_NAME "VCMI_launcher"
PROJECT_LABEL "VCMI_launcher"
)
# FIXME: Can't to get CMP0020 working with Vcpkg and CMake 3.8.2
# So far I tried:
# - cmake_minimum_required set to 2.8.11 globally and in this file
# - cmake_policy in all possible places
# - used NO_POLICY_SCOPE to make sure no other parts reset policies
# Still nothing worked, warning kept appearing and WinMain didn't link automatically
target_link_libraries(vcmilauncher Qt5::WinMain)
endif()
if(APPLE)
# This makes Xcode project prettier by moving vcmilauncher_autogen directory into vcmiclient subfolder
set_property(GLOBAL PROPERTY AUTOGEN_TARGETS_FOLDER vcmilauncher)
endif()
target_link_libraries(vcmilauncher vcmi Qt5::Widgets Qt5::Network ${SDL2_LIBRARY})
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)
if (NOT APPLE) # Already inside bundle
install(TARGETS vcmilauncher DESTINATION ${BIN_DIR})
# copy whole directory but .svn control files
install(DIRECTORY icons DESTINATION ${DATA_DIR}/launcher PATTERN ".svn" EXCLUDE)
endif()
# Copy to build directory for easier debugging
add_custom_command(TARGET vcmilauncher POST_BUILD
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/launcher/icons
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/launcher/icons ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/launcher/icons
)
install(TARGETS vcmilauncher DESTINATION ${BIN_DIR})
# copy whole directory
install(DIRECTORY icons DESTINATION ${DATA_DIR}/launcher)
# Install icons and desktop file on Linux
if(NOT WIN32 AND NOT APPLE)
install(FILES "vcmilauncher.desktop" DESTINATION share/applications)
endif()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

@ -1,8 +1,5 @@
project(libvcmi)
cmake_minimum_required(VERSION 2.6)
include_directories(${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/include ${CMAKE_CURRENT_SOURCE_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/lib)
include_directories(${Boost_INCLUDE_DIRS} ${SDL_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR})
include_directories(${Boost_INCLUDE_DIRS} ${SDL2_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR})
set(lib_SRCS
StdInc.cpp
@ -288,13 +285,18 @@ set(lib_HEADERS
VCMI_Lib.h
)
assign_source_group(${lib_SRCS} ${lib_HEADERS})
add_library(vcmi SHARED ${lib_SRCS} ${lib_HEADERS})
set_target_properties(vcmi PROPERTIES XCODE_ATTRIBUTE_LD_DYLIB_INSTALL_NAME "@rpath/libvcmi.dylib")
set_target_properties(vcmi PROPERTIES COMPILE_DEFINITIONS "VCMI_DLL=1")
target_link_libraries(vcmi ${MINIZIP_LIBRARIES} ${Boost_LIBRARIES} ${SDL_LIBRARY} ${ZLIB_LIBRARIES} ${SYSTEM_LIBS})
target_link_libraries(vcmi ${MINIZIP_LIBRARIES} ${Boost_LIBRARIES} ${SDL2_LIBRARY} ${ZLIB_LIBRARIES} ${SYSTEM_LIBS})
if(WIN32)
set_target_properties(vcmi PROPERTIES OUTPUT_NAME VCMI_lib)
set_target_properties(vcmi
PROPERTIES
OUTPUT_NAME "VCMI_lib"
PROJECT_LABEL "VCMI_lib"
)
endif()
if(ANDROID)
@ -306,6 +308,12 @@ vcmi_set_output_dir(vcmi "")
set_target_properties(vcmi PROPERTIES ${PCH_PROPERTIES})
cotire(vcmi)
if (NOT APPLE) # Already inside vcmiclient bundle
# We want to deploy assets into build directory for easier debugging without install
add_custom_command(TARGET vcmi POST_BUILD
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/config
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/Mods
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/config ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/config
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/Mods ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/Mods
)
install(TARGETS vcmi RUNTIME DESTINATION ${LIB_DIR} LIBRARY DESTINATION ${LIB_DIR})
endif()

View File

@ -452,7 +452,17 @@ bfs::path VCMIDirsOSX::userConfigPath() const { return userDataPath() / "config"
std::vector<bfs::path> VCMIDirsOSX::dataPaths() const
{
return std::vector<bfs::path>(1, "../Data");
std::vector<bfs::path> ret;
//FIXME: need some proper codepath for detecting running from build output directory
if(bfs::exists("config") && bfs::exists("Mods") && bfs::exists("vcmiserver"))
{
ret.push_back(".");
}
else
{
ret.push_back("../Resources/Data");
}
return ret;
}
bfs::path VCMIDirsOSX::libraryPath() const { return "."; }
@ -521,7 +531,13 @@ std::vector<bfs::path> VCMIDirsXDG::dataPaths() const
const char* tempResult;
ret.push_back(M_DATA_DIR);
if ((tempResult = getenv("XDG_DATA_DIRS")) != nullptr)
//FIXME: need some proper codepath for detecting running from build output directory
if(bfs::exists("config") && bfs::exists("Mods") && bfs::exists("vcmiserver"))
{
//For now we'll disable usage of system directories when VCMI running from bin directory
ret.push_back(".");
}
else if((tempResult = getenv("XDG_DATA_DIRS")) != nullptr)
{
std::string dataDirsEnv = tempResult;
std::vector<std::string> dataDirs;

View File

@ -1,5 +1,4 @@
project(minizip)
cmake_minimum_required(VERSION 2.6)
include_directories(${ZLIB_INCLUDE_DIR})
@ -14,25 +13,10 @@ set(lib_SRCS
add_library(minizip SHARED ${lib_SRCS})
if(MSVC)
set_target_properties(minizip PROPERTIES COMPILE_DEFINITIONS "MINIZIP_DLL;ZLIB_DLL;ZLIB_INTERNAL")
elseif(APPLE)
set_target_properties(minizip PROPERTIES XCODE_ATTRIBUTE_LD_DYLIB_INSTALL_NAME "@rpath/libminizip.dylib")
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)
vcmi_set_output_dir(minizip "")
target_link_libraries(minizip ${ZLIB_LIBRARIES})
if (NOT APPLE) # Already inside vcmiclient bundle
install(TARGETS minizip RUNTIME DESTINATION ${LIB_DIR} LIBRARY DESTINATION ${LIB_DIR})
endif()

47
osx/CMakeLists.txt Normal file
View File

@ -0,0 +1,47 @@
# We need to keep this code into separate directory so CMake will execute it after all other subdirectories install code
# Otherwise we can't fix Mac bundle dependencies since binaries wouldn't be there when this code executed
if(APPLE)
if(ENABLE_LAUNCHER)
find_program(TOOL_MACDEPLOYQT NAMES macdeployqt PATHS ${qt_base_dir}/bin)
if(NOT TOOL_MACDEPLOYQT)
message(FATAL_ERROR "Could not find macdeployqt")
endif()
install(CODE "
execute_process(COMMAND ${TOOL_MACDEPLOYQT} \"\${CMAKE_INSTALL_PREFIX}/${APP_BUNDLE_DIR}\" -verbose=2)
")
endif()
install(CODE "
set(BU_CHMOD_BUNDLE_ITEMS ON)
include(BundleUtilities)
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/${APP_BUNDLE_DIR}\" \"\" \"\")
" COMPONENT Runtime)
endif(APPLE)
# This will likely only work for Vcpkg
if(WIN32)
if(ENABLE_LAUNCHER)
# Temporary ugly fix for Qt deployment since windeployqt broken in Vcpkg
install(CODE "
execute_process(
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/bin/\${BUILD_TYPE}/bearer \${CMAKE_INSTALL_PREFIX}/bearer
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/bin/\${BUILD_TYPE}/iconengines \${CMAKE_INSTALL_PREFIX}/iconengines
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/bin/\${BUILD_TYPE}/imageformats \${CMAKE_INSTALL_PREFIX}/imageformats
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/bin/\${BUILD_TYPE}/platforminputcontexts \${CMAKE_INSTALL_PREFIX}/platforminputcontexts
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/bin/\${BUILD_TYPE}/platforms \${CMAKE_INSTALL_PREFIX}/platforms
)
")
endif()
install(CODE "
if(\"\${BUILD_TYPE}\" STREQUAL \"Debug\")
set(dirs \"${CMAKE_PREFIX_PATH}/debug/bin/\")
else()
set(dirs \"${CMAKE_PREFIX_PATH}/bin/\")
endif()
set(BU_CHMOD_BUNDLE_ITEMS ON)
include(BundleUtilities)
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/VCMI_Client.exe\" \"\" \"\${dirs}\")
" COMPONENT Runtime)
endif(WIN32)

34
osx/Info.plist.in Normal file
View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
<key>CFBundleGetInfoString</key>
<string>${MACOSX_BUNDLE_INFO_STRING}</string>
<key>CFBundleIconFile</key>
<string>${MACOSX_BUNDLE_ICON_FILE}</string>
<key>CFBundleIdentifier</key>
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
<key>CFBundleLongVersionString</key>
<string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
<key>CFBundleName</key>
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
<key>CFBundleVersion</key>
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHighResolutionCapable</key>
<string>True</string>
</dict>
</plist>

View File

@ -1,15 +0,0 @@
if [ -f ../.osx_dependencies_installed ];
then
echo "OS X prebuilt dependencies are already installled"
else
# Download and unpack OS X prebuilt dependencies
curl -o ../xcode-pack.zip -L http://download.vcmi.eu/xcode-pack.zip
unzip ../xcode-pack.zip -d ../
rm -rf ../__MACOSX
# Build vcmibuilder
xcodebuild -project osx/osx-vcmibuilder/vcmibuilder.xcodeproj/ -configuration Release
mv osx/osx-vcmibuilder/build/Release/vcmibuilder.app osx/vcmibuilder.app
touch ../.osx_dependencies_installed
fi

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,307 +0,0 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
A8467DFF16760A4E00A9F095 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A8467DFE16760A4E00A9F095 /* Cocoa.framework */; };
A8467E0916760A4E00A9F095 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = A8467E0716760A4E00A9F095 /* InfoPlist.strings */; };
A8467E0B16760A4E00A9F095 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = A8467E0A16760A4E00A9F095 /* main.m */; };
A8467E1216760A4E00A9F095 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = A8467E1116760A4E00A9F095 /* AppDelegate.m */; };
A8467E1516760A4E00A9F095 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = A8467E1316760A4E00A9F095 /* MainMenu.xib */; };
A866001516760C5B00DBFB19 /* vcmibuilder.icns in Resources */ = {isa = PBXBuildFile; fileRef = A866001416760C5B00DBFB19 /* vcmibuilder.icns */; };
A8F36836167632DC0009832A /* innoextract in Resources */ = {isa = PBXBuildFile; fileRef = A8F36834167632DC0009832A /* innoextract */; };
A8F36837167632DC0009832A /* unshield in Resources */ = {isa = PBXBuildFile; fileRef = A8F36835167632DC0009832A /* unshield */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
A8467DFA16760A4E00A9F095 /* vcmibuilder.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = vcmibuilder.app; sourceTree = BUILT_PRODUCTS_DIR; };
A8467DFE16760A4E00A9F095 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
A8467E0116760A4E00A9F095 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
A8467E0216760A4E00A9F095 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
A8467E0316760A4E00A9F095 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
A8467E0616760A4E00A9F095 /* vcmibuilder-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "vcmibuilder-Info.plist"; sourceTree = "<group>"; };
A8467E0816760A4E00A9F095 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
A8467E0A16760A4E00A9F095 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
A8467E0C16760A4E00A9F095 /* vcmibuilder-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "vcmibuilder-Prefix.pch"; sourceTree = "<group>"; };
A8467E1016760A4E00A9F095 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
A8467E1116760A4E00A9F095 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
A8467E1416760A4E00A9F095 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = "<group>"; };
A866001416760C5B00DBFB19 /* vcmibuilder.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = vcmibuilder.icns; sourceTree = "<group>"; };
A8F36834167632DC0009832A /* innoextract */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = innoextract; sourceTree = "<group>"; };
A8F36835167632DC0009832A /* unshield */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = unshield; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
A8467DF716760A4E00A9F095 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
A8467DFF16760A4E00A9F095 /* Cocoa.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
A8467DEF16760A4E00A9F095 = {
isa = PBXGroup;
children = (
A8F36834167632DC0009832A /* innoextract */,
A8F36835167632DC0009832A /* unshield */,
A866001416760C5B00DBFB19 /* vcmibuilder.icns */,
A8467E0416760A4E00A9F095 /* vcmibuilder */,
A8467DFD16760A4E00A9F095 /* Frameworks */,
A8467DFB16760A4E00A9F095 /* Products */,
);
sourceTree = "<group>";
};
A8467DFB16760A4E00A9F095 /* Products */ = {
isa = PBXGroup;
children = (
A8467DFA16760A4E00A9F095 /* vcmibuilder.app */,
);
name = Products;
sourceTree = "<group>";
};
A8467DFD16760A4E00A9F095 /* Frameworks */ = {
isa = PBXGroup;
children = (
A8467DFE16760A4E00A9F095 /* Cocoa.framework */,
A8467E0016760A4E00A9F095 /* Other Frameworks */,
);
name = Frameworks;
sourceTree = "<group>";
};
A8467E0016760A4E00A9F095 /* Other Frameworks */ = {
isa = PBXGroup;
children = (
A8467E0116760A4E00A9F095 /* AppKit.framework */,
A8467E0216760A4E00A9F095 /* CoreData.framework */,
A8467E0316760A4E00A9F095 /* Foundation.framework */,
);
name = "Other Frameworks";
sourceTree = "<group>";
};
A8467E0416760A4E00A9F095 /* vcmibuilder */ = {
isa = PBXGroup;
children = (
A8467E1016760A4E00A9F095 /* AppDelegate.h */,
A8467E1116760A4E00A9F095 /* AppDelegate.m */,
A8467E1316760A4E00A9F095 /* MainMenu.xib */,
A8467E0516760A4E00A9F095 /* Supporting Files */,
);
path = vcmibuilder;
sourceTree = "<group>";
};
A8467E0516760A4E00A9F095 /* Supporting Files */ = {
isa = PBXGroup;
children = (
A8467E0616760A4E00A9F095 /* vcmibuilder-Info.plist */,
A8467E0716760A4E00A9F095 /* InfoPlist.strings */,
A8467E0A16760A4E00A9F095 /* main.m */,
A8467E0C16760A4E00A9F095 /* vcmibuilder-Prefix.pch */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
A8467DF916760A4E00A9F095 /* vcmibuilder */ = {
isa = PBXNativeTarget;
buildConfigurationList = A8467E1816760A4E00A9F095 /* Build configuration list for PBXNativeTarget "vcmibuilder" */;
buildPhases = (
A8467DF616760A4E00A9F095 /* Sources */,
A8467DF716760A4E00A9F095 /* Frameworks */,
A8467DF816760A4E00A9F095 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = vcmibuilder;
productName = vcmibuilder;
productReference = A8467DFA16760A4E00A9F095 /* vcmibuilder.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
A8467DF116760A4E00A9F095 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0450;
ORGANIZATIONNAME = "Alexey Petruchik";
};
buildConfigurationList = A8467DF416760A4E00A9F095 /* Build configuration list for PBXProject "vcmibuilder" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = A8467DEF16760A4E00A9F095;
productRefGroup = A8467DFB16760A4E00A9F095 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
A8467DF916760A4E00A9F095 /* vcmibuilder */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
A8467DF816760A4E00A9F095 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
A8467E0916760A4E00A9F095 /* InfoPlist.strings in Resources */,
A8467E1516760A4E00A9F095 /* MainMenu.xib in Resources */,
A866001516760C5B00DBFB19 /* vcmibuilder.icns in Resources */,
A8F36836167632DC0009832A /* innoextract in Resources */,
A8F36837167632DC0009832A /* unshield in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
A8467DF616760A4E00A9F095 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
A8467E0B16760A4E00A9F095 /* main.m in Sources */,
A8467E1216760A4E00A9F095 /* AppDelegate.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
A8467E0716760A4E00A9F095 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
A8467E0816760A4E00A9F095 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
A8467E1316760A4E00A9F095 /* MainMenu.xib */ = {
isa = PBXVariantGroup;
children = (
A8467E1416760A4E00A9F095 /* en */,
);
name = MainMenu.xib;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
A8467E1616760A4E00A9F095 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_INHIBIT_ALL_WARNINGS = NO;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
name = Debug;
};
A8467E1716760A4E00A9F095 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_INHIBIT_ALL_WARNINGS = NO;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
SDKROOT = macosx;
};
name = Release;
};
A8467E1916760A4E00A9F095 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
COMBINE_HIDPI_IMAGES = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "vcmibuilder/vcmibuilder-Prefix.pch";
INFOPLIST_FILE = "vcmibuilder/vcmibuilder-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Debug;
};
A8467E1A16760A4E00A9F095 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
COMBINE_HIDPI_IMAGES = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "vcmibuilder/vcmibuilder-Prefix.pch";
INFOPLIST_FILE = "vcmibuilder/vcmibuilder-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
A8467DF416760A4E00A9F095 /* Build configuration list for PBXProject "vcmibuilder" */ = {
isa = XCConfigurationList;
buildConfigurations = (
A8467E1616760A4E00A9F095 /* Debug */,
A8467E1716760A4E00A9F095 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
A8467E1816760A4E00A9F095 /* Build configuration list for PBXNativeTarget "vcmibuilder" */ = {
isa = XCConfigurationList;
buildConfigurations = (
A8467E1916760A4E00A9F095 /* Debug */,
A8467E1A16760A4E00A9F095 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = A8467DF116760A4E00A9F095 /* Project object */;
}

View File

@ -1,53 +0,0 @@
#import <Cocoa/Cocoa.h>
@interface AppDelegate : NSObject <NSApplicationDelegate, NSURLDownloadDelegate>
{
NSString* outputDir;
NSString* tempDir;
NSString* dataDir;
NSString* currentArchiveName;
NSString* currentArchiveFilename;
NSMutableArray* actions;
int64_t bytesRecieved;
int64_t bytesExpected;
BOOL installationCompleted;
}
@property (strong) IBOutlet NSWindow *window;
@property (weak) IBOutlet NSButton *cd1Button;
@property (weak) IBOutlet NSTextField *cd1TextField;
@property (weak) IBOutlet NSButton *cd2Button;
@property (weak) IBOutlet NSTextField *cd2TextField;
@property (weak) IBOutlet NSProgressIndicator *progressIndicator;
@property (weak) IBOutlet NSTextField *progressLabel;
@property (weak) IBOutlet NSButton *installButton;
@property (weak) IBOutlet NSTextField *errorLabel;
@property (strong) NSURLDownload* download;
- (IBAction)selectCD1:(id)sender;
- (IBAction)selectCD2:(id)sender;
- (IBAction)install:(id)sender;
- (void)selectFile:(NSArray*)fileTypes withTextField:(NSTextField*)textField;
- (void)showProgressText:(NSString*)text;
- (void)showErrorText:(NSString*)text;
- (void)showNotification:(NSString*)text;
- (void)nextAction;
- (int)runTask:(NSString*)executable withArgs:(NSArray*)args withWorkingDir:(NSString*)workingDir withPipe:(NSPipe*)pipe;
- (void)downloadWogArchive;
- (void)unzipWogArchive;
- (void)downloadVcmiArchive;
- (void)unzipVcmiArchive;
- (void)extractGameData;
- (void)innoexctract;
- (NSString*)attachDiskImage:(NSString*)path;
- (void)unshield;
- (void)detachDiskImage:(NSString*)mountedPath;
- (void)extractionCompleted;
@end

View File

@ -1,395 +0,0 @@
#import "AppDelegate.h"
@implementation AppDelegate
- (void)applicationDidFinishLaunching:(NSNotification*)aNotification
{
installationCompleted = NO;
outputDir = [[[NSBundle mainBundle] bundlePath] stringByAppendingString:@"/../../Data"];
tempDir = NSTemporaryDirectory();
// Output to Application Support
NSArray* appSupportDirs = [[NSFileManager defaultManager] URLsForDirectory:NSApplicationSupportDirectory inDomains:NSUserDomainMask];
outputDir = [[appSupportDirs[0] path] stringByAppendingString:@"/vcmi"];
}
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)sender
{
return YES;
}
- (void)download:(NSURLDownload*)download didReceiveResponse:(NSURLResponse*)response
{
self->bytesRecieved = 0;
self->bytesExpected = [response expectedContentLength];
}
- (void)download:(NSURLDownload*)download didReceiveDataOfLength:(NSUInteger)length
{
self->bytesRecieved += length;
[self showProgressText:[NSString stringWithFormat:@"Downloading %@ archive: %3.1f Mb / %3.1f Mb", self->currentArchiveName,
self->bytesRecieved / 1024.0f / 1024.0f, self->bytesExpected / 1024.0f / 1024.0f]];
}
- (void)download:(NSURLDownload*)download decideDestinationWithSuggestedFilename:(NSString*)filename
{
[download setDestination:[tempDir stringByAppendingString:currentArchiveFilename] allowOverwrite:YES];
}
- (void)downloadDidFinish:(NSURLDownload*)download
{
[self showProgressText:[NSString stringWithFormat:@"Downloading %@ archive: completed", self->currentArchiveName]];
[self nextAction];
}
- (void)download:(NSURLDownload*)download didFailWithError:(NSError*)error
{
[self showProgressText:[NSString stringWithFormat:@"Downloading %@ archive: failed", self->currentArchiveName]];
[self showErrorText:[error localizedDescription]];
}
- (void)nextAction
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
if ([actions count] > 0) {
SEL sel = NSSelectorFromString(actions[0]);
[actions removeObjectAtIndex:0];
@try {
[self performSelector:sel];
}
@catch (NSException* e) {
[self showErrorText:[e name]];
}
}
});
}
- (int)runTask:(NSString*)executable withArgs:(NSArray*)args withWorkingDir:(NSString*)workingDir withPipe:(NSPipe*)pipe
{
if (![executable hasPrefix:@"/usr/"]) {
executable = [[[NSBundle mainBundle] resourcePath] stringByAppendingString:executable];
}
NSTask* task = [[NSTask alloc] init];
[task setLaunchPath:executable];
if (workingDir != nil) {
[task setCurrentDirectoryPath:workingDir];
}
if (pipe != nil) {
[task setStandardOutput:pipe];
}
[task setArguments:args];
[task launch];
[task waitUntilExit];
return [task terminationStatus];
}
- (void)validateAction
{
// Before starting anything run validations
if (![[NSFileManager defaultManager] fileExistsAtPath:[self.cd1TextField stringValue]]) {
return [self showErrorText:@"Please select existing file"];
}
// Show progress controls
[self.progressIndicator setHidden:NO];
[self.progressIndicator startAnimation:self];
[self showProgressText:@"Installing VCMI..."];
[self nextAction];
}
- (void)downloadWogArchive
{
// First of all we need to download WoG archive
// Downloading should be done on main thread because of callbacks
dispatch_async(dispatch_get_main_queue(), ^{
self->currentArchiveName = @"WoG";
self->currentArchiveFilename = @"/wog.zip";
NSURL* url = [NSURL URLWithString:@"https://download.vcmi.eu/WoG/wog.zip"];
self.download = [[NSURLDownload alloc] initWithRequest:[NSURLRequest requestWithURL:url] delegate:self];
});
}
- (void)unzipWogArchive
{
// Then we unzip downloaded WoG archive
[self showProgressText:@"Unzipping WoG archive"];
if ([self runTask:@"/usr/bin/unzip" withArgs:@[@"-qo", [tempDir stringByAppendingString:currentArchiveFilename], @"-d", outputDir] withWorkingDir:nil withPipe:nil] != 0) {
return [self showErrorText:@"Failed to unzip WoG archive"];
}
[self nextAction];
}
- (void)downloadVcmiArchive
{
// Than we need to download VCMI archive
// Downloading should be done on main thread because of callbacks
dispatch_async(dispatch_get_main_queue(), ^{
self->currentArchiveName = @"VCMI";
self->currentArchiveFilename = @"/core.zip";
NSURL* url = [NSURL URLWithString:@"https://download.vcmi.eu/core.zip"];
self.download = [[NSURLDownload alloc] initWithRequest:[NSURLRequest requestWithURL:url] delegate:self];
});
}
- (void)unzipVcmiArchive
{
// Then we unzip downloaded VCMI archive
[self showProgressText:@"Unzipping VCMI archive"];
if ([self runTask:@"/usr/bin/unzip" withArgs:@[@"-qo", [tempDir stringByAppendingString:currentArchiveFilename], @"-d", outputDir, @"-x", @"*.json", @"*.txt", @"*.PAL"] withWorkingDir:nil withPipe:nil] != 0) {
return [self showErrorText:@"Failed to unzip VCMI archive"];
}
[self nextAction];
}
- (void)extractGameData
{
// Then we extract game data from provided iso files using unshield or from innosetup exe
if ([[self.cd1TextField stringValue] hasSuffix:@".exe"]) {
[self innoexctract];
} else {
[self unshield];
}
[self nextAction];
}
- (void)innoexctract
{
// Extraction via innoextact is pretty straightforward
[self showProgressText:@"Extracting game data using innoextract..."];
if ([self runTask:@"/innoextract" withArgs:@[[self.cd1TextField stringValue]] withWorkingDir:tempDir withPipe:nil] != 0) {
[self showErrorText:@"Failed to exctract game data using innoextract"];
}
dataDir = [tempDir stringByAppendingString:@"/app"];
}
- (NSString*)attachDiskImage:(NSString*)path
{
[self showProgressText:[NSString stringWithFormat:@"Mounting image \"%@\"", path]];
// Run hdiutil to mount specified disk image
NSPipe* pipe = [NSPipe pipe];
if ([self runTask:@"/usr/bin/hdiutil" withArgs:@[@"attach", path] withWorkingDir:nil withPipe:pipe] != 0) {
[NSException raise:[NSString stringWithFormat:@"Failed to mount \"%@\"", path] format:nil];
}
// Capture hdiutil output to get mounted disk image filesystem path
NSFileHandle* file = [pipe fileHandleForReading];
NSString* output = [[NSString alloc] initWithData:[file readDataToEndOfFile] encoding:NSUTF8StringEncoding];
NSRegularExpression* regex = [NSRegularExpression regularExpressionWithPattern:@"(/Volumes/.*)$" options:0 error:nil];
NSTextCheckingResult* match = [regex firstMatchInString:output options:0 range:NSMakeRange(0, [output length])];
return [output substringWithRange:[match range]];
}
- (void)detachDiskImage:(NSString*)mountedPath
{
if ([self runTask:@"/usr/bin/hdiutil" withArgs:@[@"detach", mountedPath] withWorkingDir:nil withPipe:nil] != 0) {
[NSException raise:[NSString stringWithFormat:@"Failed to unmount \"%@\"", mountedPath] format:nil];
}
}
- (void)unshield
{
// In case of iso files we should mount them first
// If CD2 is not specified use the same path as for CD1
NSString* cd1 = [self attachDiskImage:[self.cd1TextField stringValue]];
NSString* cd2 = [[self.cd2TextField stringValue] isEqualToString:@""] ? cd1 : [self attachDiskImage:[self.cd2TextField stringValue]];
// Extract
[self showProgressText:@"Extracting game data using unshield..."];
NSArray* knownLocations = @[
@"/_setup/data1.cab",
@"/Autorun/Setup/data1.cab"
];
bool success = false;
for (NSString* location in knownLocations) {
NSString* cabLocation = [cd1 stringByAppendingString:location];
if ([[NSFileManager defaultManager] fileExistsAtPath:cabLocation]) {
int result = [self runTask:@"/unshield" withArgs:@[@"-d", tempDir, @"x", cabLocation] withWorkingDir:tempDir withPipe:nil];
if (result == 0) {
success = true;
break;
}
}
}
if (!success) {
return [self showErrorText:@"Failed to extract game data using unshield"];
}
NSArray* knownDataDirs = @[
@"/Heroes3",
@"/Program_Files",
@"/Data",
];
success = false;
for (NSString* knownDir in knownDataDirs) {
dataDir = [tempDir stringByAppendingString:knownDir];
if ([[NSFileManager defaultManager] fileExistsAtPath:dataDir]) {
success = true;
break;
}
}
if (!success) {
return [self showErrorText:@"Failed to extract game data using unshield"];
}
// Unmount CD1. Unmount CD2 if needed
[self detachDiskImage:cd1];
if (![cd1 isEqualToString:cd2]) {
[self detachDiskImage:cd2];
}
}
- (void)extractionCompleted
{
// After game data is extracted we should move it to destination place
[self showProgressText:@"Moving items into place"];
NSFileManager* fileManager = [NSFileManager defaultManager];
[fileManager moveItemAtPath:[dataDir stringByAppendingString:@"/Data"] toPath:[outputDir stringByAppendingString:@"/Data"] error:nil];
[fileManager moveItemAtPath:[dataDir stringByAppendingString:@"/Maps"] toPath:[outputDir stringByAppendingString:@"/Maps"] error:nil];
if ([fileManager fileExistsAtPath:[dataDir stringByAppendingString:@"/MP3"] isDirectory:nil]) {
[fileManager moveItemAtPath:[dataDir stringByAppendingString:@"/MP3"] toPath:[outputDir stringByAppendingString:@"/Mp3"] error:nil];
} else {
[fileManager moveItemAtPath:[dataDir stringByAppendingString:@"/Mp3"] toPath:[outputDir stringByAppendingString:@"/Mp3"] error:nil];
}
// After everythin is complete we create marker file. VCMI will look for this file to exists on startup and
// will run this setup otherwise
system([[NSString stringWithFormat:@"touch \"%@/game_data_prepared\"", outputDir] UTF8String]);
[self showProgressText:@"Installation complete"];
[self.installButton setTitle:@"Run VCMI"];
[self.progressIndicator stopAnimation:self];
// Notify user that installation completed
[self showNotification:@"Installation completed"];
// Hide all progress related controls
[self.progressIndicator setHidden:YES];
[self.progressIndicator stopAnimation:self];
[self.progressLabel setHidden:YES];
[self.installButton setEnabled:YES];
installationCompleted = YES;
}
- (void)selectFile:(NSArray*)fileTypes withTextField:(NSTextField*)textField
{
NSOpenPanel* openPanel = [NSOpenPanel openPanel];
[openPanel setCanChooseFiles:YES];
[openPanel setAllowedFileTypes:fileTypes];
[openPanel setAllowsMultipleSelection:NO];
if ([openPanel runModal] == NSOKButton) {
NSString* path = [[openPanel URL] path];
[textField setStringValue:path];
}
}
- (IBAction)selectCD1:(id)sender
{
[self selectFile:@[@"iso", @"exe"] withTextField:self.cd1TextField];
}
- (IBAction)selectCD2:(id)sender
{
[self selectFile:@[@"iso"] withTextField:self.cd2TextField];
}
- (IBAction)install:(id)sender
{
if (installationCompleted) {
// Run vcmi
system([[NSString stringWithFormat:@"open %@/../../..", [[NSBundle mainBundle] bundlePath]] UTF8String]);
[NSApp terminate: nil];
} else {
// Run installation
[self.cd1Button setEnabled:NO];
[self.cd2Button setEnabled:NO];
[self.installButton setEnabled:NO];
actions = [NSMutableArray arrayWithObjects:
@"validateAction",
@"downloadWogArchive",
@"unzipWogArchive",
@"downloadVcmiArchive",
@"unzipVcmiArchive",
@"extractGameData",
@"extractionCompleted",
nil
];
[self nextAction];
}
}
- (void)showNotification:(NSString*)text
{
// Notification Center is supported only on OS X 10.8 and newer
NSUserNotification* notification = [[NSUserNotification alloc] init];
if (notification != nil) {
notification.title = @"VCMI";
notification.informativeText = text;
notification.deliveryDate = [NSDate dateWithTimeInterval:0 sinceDate:[NSDate date]];
notification.soundName = NSUserNotificationDefaultSoundName;
[[NSUserNotificationCenter defaultUserNotificationCenter] scheduleNotification:notification];
} else {
// On older OS X version force dock icon to jump
[NSApp requestUserAttention:NSCriticalRequest];
}
}
- (void)showProgressText:(NSString*)text
{
// All GUI updates should be done on main thread
dispatch_async(dispatch_get_main_queue(), ^{
[self.progressLabel setHidden:NO];
[self.progressLabel setStringValue:text];
});
}
- (void)showErrorText:(NSString*)text
{
// All GUI updates should be done on main thread
dispatch_async(dispatch_get_main_queue(), ^{
[self showNotification:@"Installation failed"];
// Show error alert
NSAlert *alert = [[NSAlert alloc] init];
[alert setMessageText:@"Error"];
[alert setInformativeText:text];
[alert beginSheetModalForWindow:self.window modalDelegate:nil didEndSelector:nil contextInfo:nil];
// Enable select file buttons again
[self.cd1Button setEnabled:YES];
[self.cd2Button setEnabled:YES];
[self.installButton setEnabled:YES];
// Hide all progress related controls
[self.progressIndicator setHidden:YES];
[self.progressIndicator stopAnimation:self];
[self.progressLabel setHidden:YES];
});
}
@end

View File

@ -1,2 +0,0 @@
/* Localized versions of Info.plist keys */

View File

@ -1,772 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1070</int>
<string key="IBDocument.SystemVersion">11G63</string>
<string key="IBDocument.InterfaceBuilderVersion">2844</string>
<string key="IBDocument.AppKitVersion">1138.51</string>
<string key="IBDocument.HIToolboxVersion">569.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">2844</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>NSButton</string>
<string>NSButtonCell</string>
<string>NSCustomObject</string>
<string>NSMenu</string>
<string>NSMenuItem</string>
<string>NSProgressIndicator</string>
<string>NSTextField</string>
<string>NSTextFieldCell</string>
<string>NSView</string>
<string>NSWindowTemplate</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</array>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1048">
<object class="NSCustomObject" id="1021">
<string key="NSClassName">NSApplication</string>
</object>
<object class="NSCustomObject" id="1014">
<string key="NSClassName">FirstResponder</string>
</object>
<object class="NSCustomObject" id="1050">
<string key="NSClassName">NSApplication</string>
</object>
<object class="NSMenu" id="649796088">
<string key="NSTitle">AMainMenu</string>
<array class="NSMutableArray" key="NSMenuItems">
<object class="NSMenuItem" id="694149608">
<reference key="NSMenu" ref="649796088"/>
<string key="NSTitle">vcmibuilder</string>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<object class="NSCustomResource" key="NSOnImage" id="35465992">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">NSMenuCheckmark</string>
</object>
<object class="NSCustomResource" key="NSMixedImage" id="502551668">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">NSMenuMixedState</string>
</object>
<string key="NSAction">submenuAction:</string>
<object class="NSMenu" key="NSSubmenu" id="110575045">
<string key="NSTitle">vcmibuilder</string>
<array class="NSMutableArray" key="NSMenuItems">
<object class="NSMenuItem" id="238522557">
<reference key="NSMenu" ref="110575045"/>
<string key="NSTitle">About vcmibuilder</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
<object class="NSMenuItem" id="1056857174">
<reference key="NSMenu" ref="110575045"/>
<bool key="NSIsDisabled">YES</bool>
<bool key="NSIsSeparator">YES</bool>
<string key="NSTitle"/>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
<object class="NSMenuItem" id="632727374">
<reference key="NSMenu" ref="110575045"/>
<string key="NSTitle">Quit vcmibuilder</string>
<string key="NSKeyEquiv">q</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="35465992"/>
<reference key="NSMixedImage" ref="502551668"/>
</object>
</array>
<string key="NSName">_NSAppleMenu</string>
</object>
</object>
</array>
<string key="NSName">_NSMainMenu</string>
</object>
<object class="NSWindowTemplate" id="972006081">
<int key="NSWindowStyleMask">7</int>
<int key="NSWindowBacking">2</int>
<string key="NSWindowRect">{{335, 390}, {572, 194}}</string>
<int key="NSWTFlags">1954021376</int>
<string key="NSWindowTitle">VCMI Install</string>
<string key="NSWindowClass">NSWindow</string>
<nil key="NSViewClass"/>
<nil key="NSUserInterfaceItemIdentifier"/>
<string key="NSWindowContentMinSize">{572, 207}</string>
<object class="NSView" key="NSWindowView" id="439893737">
<reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="NSTextField" id="84390780">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">12</int>
<string key="NSFrame">{{20, 83}, {483, 22}}</string>
<reference key="NSSuperview" ref="439893737"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="528248641"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="679319045">
<int key="NSCellFlags">-2074083263</int>
<int key="NSCellFlags2">272631872</int>
<string key="NSContents"/>
<object class="NSFont" key="NSSupport" id="745107099">
<string key="NSName">LucidaGrande</string>
<double key="NSSize">13</double>
<int key="NSfFlags">1044</int>
</object>
<string key="NSPlaceholderString">CD1 ISO disk image or installer executable</string>
<string key="NSCellIdentifier">_NS:9</string>
<reference key="NSControlView" ref="84390780"/>
<bool key="NSDrawsBackground">YES</bool>
<object class="NSColor" key="NSBackgroundColor" id="485513480">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">textBackgroundColor</string>
<object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
</object>
</object>
<object class="NSColor" key="NSTextColor" id="216028668">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">textColor</string>
<object class="NSColor" key="NSColor" id="167214173">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
</object>
</object>
</object>
</object>
<object class="NSTextField" id="768593036">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">12</int>
<string key="NSFrame">{{20, 51}, {483, 22}}</string>
<reference key="NSSuperview" ref="439893737"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="722999995"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="827292020">
<int key="NSCellFlags">-2074083263</int>
<int key="NSCellFlags2">272631872</int>
<string key="NSContents"/>
<reference key="NSSupport" ref="745107099"/>
<string key="NSPlaceholderString">CD2 ISO disk image (optional)</string>
<string key="NSCellIdentifier">_NS:9</string>
<reference key="NSControlView" ref="768593036"/>
<bool key="NSDrawsBackground">YES</bool>
<reference key="NSBackgroundColor" ref="485513480"/>
<reference key="NSTextColor" ref="216028668"/>
</object>
</object>
<object class="NSTextField" id="977326994">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{17, 140}, {538, 34}}</string>
<reference key="NSSuperview" ref="439893737"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="84390780"/>
<string key="NSReuseIdentifierKey">_NS:1535</string>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="907438656">
<int key="NSCellFlags">68157504</int>
<int key="NSCellFlags2">272630784</int>
<string key="NSContents">In order to complete VCMI installation you need original Heroes III: Shadow of Death
game data. Please select ISO disk image or installer executable and press Install.</string>
<reference key="NSSupport" ref="745107099"/>
<string key="NSCellIdentifier">_NS:1535</string>
<reference key="NSControlView" ref="977326994"/>
<object class="NSColor" key="NSBackgroundColor" id="548777339">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">controlColor</string>
<object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
</object>
</object>
<object class="NSColor" key="NSTextColor" id="136788794">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">controlTextColor</string>
<reference key="NSColor" ref="167214173"/>
</object>
</object>
</object>
<object class="NSButton" id="528248641">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{505, 76}, {53, 32}}</string>
<reference key="NSSuperview" ref="439893737"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="768593036"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="664923606">
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">134217728</int>
<string key="NSContents">...</string>
<reference key="NSSupport" ref="745107099"/>
<string key="NSCellIdentifier">_NS:9</string>
<reference key="NSControlView" ref="528248641"/>
<int key="NSButtonFlags">-2038284288</int>
<int key="NSButtonFlags2">129</int>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
</object>
<object class="NSButton" id="722999995">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{505, 44}, {53, 32}}</string>
<reference key="NSSuperview" ref="439893737"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="812825571"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="870085374">
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">134217728</int>
<string key="NSContents">...</string>
<reference key="NSSupport" ref="745107099"/>
<string key="NSCellIdentifier">_NS:9</string>
<reference key="NSControlView" ref="722999995"/>
<int key="NSButtonFlags">-2038284288</int>
<int key="NSButtonFlags2">129</int>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
</object>
<object class="NSButton" id="715543543">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{461, 12}, {97, 32}}</string>
<reference key="NSSuperview" ref="439893737"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="750074650">
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">134217728</int>
<string key="NSContents">Install</string>
<reference key="NSSupport" ref="745107099"/>
<string key="NSCellIdentifier">_NS:9</string>
<reference key="NSControlView" ref="715543543"/>
<int key="NSButtonFlags">-2038284288</int>
<int key="NSButtonFlags2">129</int>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
</object>
<object class="NSProgressIndicator" id="812825571">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">-2147483380</int>
<string key="NSFrame">{{20, 22}, {16, 16}}</string>
<reference key="NSSuperview" ref="439893737"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="231983332"/>
<string key="NSReuseIdentifierKey">_NS:945</string>
<int key="NSpiFlags">20746</int>
<double key="NSMaxValue">100</double>
</object>
<object class="NSTextField" id="231983332">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">-2147483380</int>
<string key="NSFrame">{{41, 22}, {419, 17}}</string>
<reference key="NSSuperview" ref="439893737"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="715543543"/>
<string key="NSReuseIdentifierKey">_NS:1535</string>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="101005403">
<int key="NSCellFlags">67108928</int>
<int key="NSCellFlags2">272631808</int>
<string key="NSContents">Label</string>
<reference key="NSSupport" ref="745107099"/>
<string key="NSCellIdentifier">_NS:1535</string>
<reference key="NSControlView" ref="231983332"/>
<reference key="NSBackgroundColor" ref="548777339"/>
<reference key="NSTextColor" ref="136788794"/>
</object>
</object>
</array>
<string key="NSFrameSize">{572, 194}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="977326994"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
<string key="NSMinSize">{572, 229}</string>
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
<bool key="NSWindowIsRestorable">YES</bool>
</object>
<object class="NSCustomObject" id="976324537">
<string key="NSClassName">AppDelegate</string>
</object>
<object class="NSCustomObject" id="755631768">
<string key="NSClassName">NSFontManager</string>
</object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
<array class="NSMutableArray" key="connectionRecords">
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">terminate:</string>
<reference key="source" ref="1050"/>
<reference key="destination" ref="632727374"/>
</object>
<int key="connectionID">449</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">orderFrontStandardAboutPanel:</string>
<reference key="source" ref="1021"/>
<reference key="destination" ref="238522557"/>
</object>
<int key="connectionID">142</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="1021"/>
<reference key="destination" ref="976324537"/>
</object>
<int key="connectionID">495</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">window</string>
<reference key="source" ref="976324537"/>
<reference key="destination" ref="972006081"/>
</object>
<int key="connectionID">532</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">cd1Button</string>
<reference key="source" ref="976324537"/>
<reference key="destination" ref="528248641"/>
</object>
<int key="connectionID">615</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">cd2Button</string>
<reference key="source" ref="976324537"/>
<reference key="destination" ref="722999995"/>
</object>
<int key="connectionID">616</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">cd1TextField</string>
<reference key="source" ref="976324537"/>
<reference key="destination" ref="84390780"/>
</object>
<int key="connectionID">617</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">cd2TextField</string>
<reference key="source" ref="976324537"/>
<reference key="destination" ref="768593036"/>
</object>
<int key="connectionID">618</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">selectCD1:</string>
<reference key="source" ref="976324537"/>
<reference key="destination" ref="528248641"/>
</object>
<int key="connectionID">619</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">selectCD2:</string>
<reference key="source" ref="976324537"/>
<reference key="destination" ref="722999995"/>
</object>
<int key="connectionID">620</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">progressLabel</string>
<reference key="source" ref="976324537"/>
<reference key="destination" ref="231983332"/>
</object>
<int key="connectionID">622</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">progressIndicator</string>
<reference key="source" ref="976324537"/>
<reference key="destination" ref="812825571"/>
</object>
<int key="connectionID">623</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">installButton</string>
<reference key="source" ref="976324537"/>
<reference key="destination" ref="715543543"/>
</object>
<int key="connectionID">624</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">install:</string>
<reference key="source" ref="976324537"/>
<reference key="destination" ref="715543543"/>
</object>
<int key="connectionID">625</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
<object class="IBObjectRecord">
<int key="objectID">0</int>
<array key="object" id="0"/>
<reference key="children" ref="1048"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="1021"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="1014"/>
<reference key="parent" ref="0"/>
<string key="objectName">First Responder</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-3</int>
<reference key="object" ref="1050"/>
<reference key="parent" ref="0"/>
<string key="objectName">Application</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">29</int>
<reference key="object" ref="649796088"/>
<array class="NSMutableArray" key="children">
<reference ref="694149608"/>
</array>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">56</int>
<reference key="object" ref="694149608"/>
<array class="NSMutableArray" key="children">
<reference ref="110575045"/>
</array>
<reference key="parent" ref="649796088"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">57</int>
<reference key="object" ref="110575045"/>
<array class="NSMutableArray" key="children">
<reference ref="238522557"/>
<reference ref="632727374"/>
<reference ref="1056857174"/>
</array>
<reference key="parent" ref="694149608"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">58</int>
<reference key="object" ref="238522557"/>
<reference key="parent" ref="110575045"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">136</int>
<reference key="object" ref="632727374"/>
<reference key="parent" ref="110575045"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">149</int>
<reference key="object" ref="1056857174"/>
<reference key="parent" ref="110575045"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">371</int>
<reference key="object" ref="972006081"/>
<array class="NSMutableArray" key="children">
<reference ref="439893737"/>
</array>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">372</int>
<reference key="object" ref="439893737"/>
<array class="NSMutableArray" key="children">
<reference ref="977326994"/>
<reference ref="84390780"/>
<reference ref="768593036"/>
<reference ref="528248641"/>
<reference ref="722999995"/>
<reference ref="715543543"/>
<reference ref="812825571"/>
<reference ref="231983332"/>
</array>
<reference key="parent" ref="972006081"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">420</int>
<reference key="object" ref="755631768"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">494</int>
<reference key="object" ref="976324537"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">536</int>
<reference key="object" ref="84390780"/>
<array class="NSMutableArray" key="children">
<reference ref="679319045"/>
</array>
<reference key="parent" ref="439893737"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">537</int>
<reference key="object" ref="679319045"/>
<reference key="parent" ref="84390780"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">541</int>
<reference key="object" ref="768593036"/>
<array class="NSMutableArray" key="children">
<reference ref="827292020"/>
</array>
<reference key="parent" ref="439893737"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">542</int>
<reference key="object" ref="827292020"/>
<reference key="parent" ref="768593036"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">549</int>
<reference key="object" ref="977326994"/>
<array class="NSMutableArray" key="children">
<reference ref="907438656"/>
</array>
<reference key="parent" ref="439893737"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">550</int>
<reference key="object" ref="907438656"/>
<reference key="parent" ref="977326994"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">562</int>
<reference key="object" ref="528248641"/>
<array class="NSMutableArray" key="children">
<reference ref="664923606"/>
</array>
<reference key="parent" ref="439893737"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">563</int>
<reference key="object" ref="664923606"/>
<reference key="parent" ref="528248641"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">569</int>
<reference key="object" ref="722999995"/>
<array class="NSMutableArray" key="children">
<reference ref="870085374"/>
</array>
<reference key="parent" ref="439893737"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">570</int>
<reference key="object" ref="870085374"/>
<reference key="parent" ref="722999995"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">581</int>
<reference key="object" ref="715543543"/>
<array class="NSMutableArray" key="children">
<reference ref="750074650"/>
</array>
<reference key="parent" ref="439893737"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">582</int>
<reference key="object" ref="750074650"/>
<reference key="parent" ref="715543543"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">587</int>
<reference key="object" ref="812825571"/>
<reference key="parent" ref="439893737"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">593</int>
<reference key="object" ref="231983332"/>
<array class="NSMutableArray" key="children">
<reference ref="101005403"/>
</array>
<reference key="parent" ref="439893737"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">594</int>
<reference key="object" ref="101005403"/>
<reference key="parent" ref="231983332"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="-3.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="136.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="149.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="29.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES" key="371.IBNSWindowAutoPositionCentersHorizontal"/>
<boolean value="YES" key="371.IBNSWindowAutoPositionCentersVertical"/>
<string key="371.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="371.IBWindowTemplateEditedContentRect">{{380, 496}, {480, 360}}</string>
<integer value="1" key="371.NSWindowTemplate.visibleAtLaunch"/>
<string key="372.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="420.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="494.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="536.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="537.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="541.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="542.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="549.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="550.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="56.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="562.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="563.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="569.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="57.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="570.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="58.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="581.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="582.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="587.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="593.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="594.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">730</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">AppDelegate</string>
<string key="superclassName">NSObject</string>
<dictionary class="NSMutableDictionary" key="actions">
<string key="install:">id</string>
<string key="selectCD1:">id</string>
<string key="selectCD2:">id</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="actionInfosByName">
<object class="IBActionInfo" key="install:">
<string key="name">install:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="selectCD1:">
<string key="name">selectCD1:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="selectCD2:">
<string key="name">selectCD2:</string>
<string key="candidateClassName">id</string>
</object>
</dictionary>
<dictionary class="NSMutableDictionary" key="outlets">
<string key="cd1Button">NSButton</string>
<string key="cd1TextField">NSTextField</string>
<string key="cd2Button">NSButton</string>
<string key="cd2TextField">NSTextField</string>
<string key="errorLabel">NSTextField</string>
<string key="installButton">NSButton</string>
<string key="progressIndicator">NSProgressIndicator</string>
<string key="progressLabel">NSTextField</string>
<string key="window">NSWindow</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
<object class="IBToOneOutletInfo" key="cd1Button">
<string key="name">cd1Button</string>
<string key="candidateClassName">NSButton</string>
</object>
<object class="IBToOneOutletInfo" key="cd1TextField">
<string key="name">cd1TextField</string>
<string key="candidateClassName">NSTextField</string>
</object>
<object class="IBToOneOutletInfo" key="cd2Button">
<string key="name">cd2Button</string>
<string key="candidateClassName">NSButton</string>
</object>
<object class="IBToOneOutletInfo" key="cd2TextField">
<string key="name">cd2TextField</string>
<string key="candidateClassName">NSTextField</string>
</object>
<object class="IBToOneOutletInfo" key="errorLabel">
<string key="name">errorLabel</string>
<string key="candidateClassName">NSTextField</string>
</object>
<object class="IBToOneOutletInfo" key="installButton">
<string key="name">installButton</string>
<string key="candidateClassName">NSButton</string>
</object>
<object class="IBToOneOutletInfo" key="progressIndicator">
<string key="name">progressIndicator</string>
<string key="candidateClassName">NSProgressIndicator</string>
</object>
<object class="IBToOneOutletInfo" key="progressLabel">
<string key="name">progressLabel</string>
<string key="candidateClassName">NSTextField</string>
</object>
<object class="IBToOneOutletInfo" key="window">
<string key="name">window</string>
<string key="candidateClassName">NSWindow</string>
</object>
</dictionary>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/AppDelegate.h</string>
</object>
</object>
</array>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<dictionary class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
<string key="NSMenuCheckmark">{11, 11}</string>
<string key="NSMenuMixedState">{10, 3}</string>
</dictionary>
</data>
</archive>

View File

@ -1,6 +0,0 @@
#import <Cocoa/Cocoa.h>
int main(int argc, char *argv[])
{
return NSApplicationMain(argc, (const char **)argv);
}

View File

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>vcmibuilder</string>
<key>CFBundleIdentifier</key>
<string>com.vcmi.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2012 Alexey Petruchik. All rights reserved.</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>

View File

@ -1,7 +0,0 @@
//
// Prefix header for all source files of the 'vcmibuilder' target in the 'vcmibuilder' project
//
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#endif

View File

@ -1,15 +0,0 @@
# Clean previous build
rm -rf build
rm -rf bin
rm -rf osx/osx-vcmibuilder/build
rm -rf osx/vcmibuilder.app
# Build vcmibuilder
xcodebuild -project osx/osx-vcmibuilder/vcmibuilder.xcodeproj/ -configuration Release
mv osx/osx-vcmibuilder/build/Release/vcmibuilder.app osx/vcmibuilder.app
# Build vcmi
mkdir build
cd build
cmake -G Xcode .. -DENABLE_LAUNCHER=OFF
xcodebuild -project vcmi.xcodeproj/ -configuration Release -target package

View File

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:sparkle="http://vcmi.eu/xml-namespaces/sparkle" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>VCMI App Changelog</title>
<link>https://vcmi.eu/sparkle_appcast.xml</link>
<description>Most recent changes with links to updates.</description>
<language>en</language>
<item>
<title>Version 0.94</title>
<description>Version 0.94</description>
<pubDate>Wed, 09 Jan 2006 19:20:11 +0000</pubDate>
<sparkle:releaseNotesLink>http://vcmi.eu/sparkle_release_notes.html</sparkle:releaseNotesLink>
<enclosure url="http://download.vcmi.eu/vcmi-0.94.dmg" sparkle:version="0.94" length="35355069" type="application/octet-stream" sparkle:dsaSignature="MC0CFC13LTYNtAd5Nzq3Xu5R7Sle8aRuAhUA56mj9AAiYWARBkw07emy68HBUt8=" />
</item>
<item>
<title>Version 0.93</title>
<description>Version 0.93</description>
<pubDate>Wed, 09 Jan 2006 19:20:11 +0000</pubDate>
<sparkle:releaseNotesLink>http://vcmi.eu/sparkle_release_notes.html</sparkle:releaseNotesLink>
<enclosure url="http://download.vcmi.eu/vcmi-0.93.dmg" sparkle:version="0.93" length="35355069" type="application/octet-stream" sparkle:dsaSignature="MC0CFAkKqQ3J9lRjmNbtL7YaiTEmTs/VAhUAuADhN+gNPwXNwrJOVY6NXtPpLfk=" />
</item>
<item>
<title>Version 0.92</title>
<description>Version 0.92</description>
<pubDate>Wed, 09 Jan 2006 19:20:11 +0000</pubDate>
<sparkle:releaseNotesLink>http://vcmi.eu/sparkle_release_notes.html</sparkle:releaseNotesLink>
<enclosure url="http://download.vcmi.eu/vcmi-0.92.dmg" sparkle:version="0.92" length="34906250" type="application/octet-stream" sparkle:dsaSignature="MC0CFF75UKfXunY2GNSW4hs1O6MaWycLAhUA3YiRM9uUrnoS/PhWHgjRjwWcHo4=" />
</item>
</channel>
</rss>

View File

@ -1,171 +0,0 @@
<html>
<body>
<h2>0.94</h2>
<b>GENERAL</b>
<ul>
<li>Filesystem now supports zip archives. They can be loaded similarly to other archives in filesystem.json. Mods can use Content.zip instead of Content/ directory.</li>
<li>fixed "get txt" console command</li>
<li>command "extract" to extract file by name</li>
<li>command "def2bmp" to convert def into set of frames.</li>
<li>fixed crash related to cammander's SPELL_AFTER_ATTACK spell id not initialized properly (text id was resolved on copy of bonus)</li>
<li>fixed duels, added no-GUI mode for automatic AI testing</li>
<li>Sir Mullich is available at the start of the game</li>
<li>Upgrade cost will never be negative.</li>
<li>support for Chinese fonts (GBK 2-byte encoding)</li>
</ul>
<b>ADVENTURE MAP</b>
<ul>
<li>if Quick Combat option is turned on, battles will be resolved by AI</li>
<li>first hero is awakened on new turn</li>
<li>fixed 3000 gems reward in shipwreck</li>
</ul>
<b>BATTLES</b>
<ul>
<li>autofight implemented</li>
<li>most of the animations is time-based</li>
<li>simplified postioning of units in battle, should fix remaining issues with unit positioning</li>
<li>synchronized attack/defence animation</li>
<li>spell animation speed uses game settings</li>
<li>fixed disrupting ray duration</li>
<li>added logging domain for battle animations</li>
<li>Fixed crashes on Land Mines / Fire Wall casting.</li>
<li>UI will be correctly greyed-out during opponent turn</li>
<li>fixed remaining issues with blit order</li>
<li>Catapult attacks should be identical to H3. Catapult may miss and attack another part of wall instead (this is how it works in H3)</li>
<li>Fixed Remove Obstacle.</li>
<li>defeating hero will yield 500 XP</li>
<li>Added lots of missing spell immunities from Strategija</li>
<li>Added stone gaze immunity for Troglodytes (did you know about it?)</li>
<li>damage done by turrets is properly increased by built buldings</li>
<li>Wyverns will cast Poison instead of Stone Gaze.</li>
</ul>
<b>TOWN</b>
<ul>
<li>Fixed issue that allowed to build multiple boats in town.</li>
<li>fix for lookout tower</li>
</ul>
<br>
<h2>0.93</h2>
<b>GENERAL</b>
<ul>
<li>Support for SoD-only installations, WoG becomes optional addition</li>
<li>New logging framework</li>
<li>Negative luck support, disabled by default</li>
<li>Several new icons for creature abilities (Fire Shield, Non-living, Magic Mirror, Spell-like Attack)</li>
<li>Fixed stack artifact (and related buttons) not displaying in creature window.</li>
<li>Fixed crash at month of double population.</li>
</ul>
<b>MODS</b>
<ul>
<li>See http://wiki.vcmi.eu/index.php?title=Modding_changelog#0.92_-.3E_0.93 for compatibility info.</li>
<li>Improved json validation. Now it support most of features from latest json schema draft.</li>
<li>Icons use path to icon instead of image indexes.</li>
<li>It is possible to edit data of another mod or H3 data via mods.</li>
<li>Mods can access only ID's from dependenies, virtual "core" mod and itself (optional for some mods compatibility)</li>
<li>Removed no longer needed field "projectile spins"</li>
<li>Heroes: split heroes.json in manner similar to creatures\factions; string ID's for H3 heroes; h3 hero classes and artifacts can be modified via json.</li>
</ul>
<b>BATTLES</b>
<ul>
<li>Fixed Death Stare of Commanders</li>
<li>Projectile blitting should be closer to original H3. But still not perfect.</li>
<li>Fixed missing Mirth effects</li>
<li>Stack affected by Berserk should not try to attack itself</li>
<li>Fixed several cases of incorrect positioning of creatures in battles</li>
<li>Fixed abilities of Efreet.</li>
<li>Fixed broken again palette in some battle backgrounds</li>
</ul>
<b>TOWN</b>
<ul>
<li>VCMI will not crash if building selection area is smaller than def</li>
<li>Detection of transparency on selection area is closer to H3</li>
<li>Improved handling buildings with mode "auto":
<ul>
<li>they will be properly processed (new creatures will be added if dwelling, spells learned if mage guild, and so on)</li>
<li>transitive dependencies are handled (A makes B build, and B makes C and D)</li>
</ul>
</li>
</ul>
<b>SOUND</b>
<ul>
<li>Added missing WoG creature sounds (from Kuririn).</li>
<li>The Windows package comes with DLLs needed to play .ogg files</li>
<li>(linux) convertMP3 option for vcmibuilder for systems where SDL_Mixer can't play mp3's</li>
<li>some missing sounds for battle effects</li>
</ul>
<b>ARTIFACTS</b>
<ul>
<li>Several fixes to combined artifacts added via mods.</li>
<li>Fixed Spellbinder's Hat giving level 1 spells instead of 5.</li>
<li>Fixed incorrect components of Cornucopia.</li>
<li>Cheat code with grant all artifacts, including the ones added by mods</li>
</ul>
<br>
<h2>0.92</h2>
<b>GENERAL</b>
<ul>
<li>hero crossover between missions in campaigns</li>
<li>introduction before missions in campaigns</li>
</ul>
<b>MODS</b>
<ul>
<li>Added CREATURE_SPELL_POWER for commanders</li>
<li>Added spell modifiers to various spells: Hypnotize (Astral), Firewall (Luna), Landmine </li>
<li>Fixed ENEMY_DEFENCE_REDUCTION, GENERAL_ATTACK_REDUCTION</li>
<li>Extended usefulness of ONLY_DISTANCE_FIGHT, ONLY_MELEE_FIGHT ranges</li>
<li>Double growth creatures are configurable now</li>
<li>Drain Life now has % effect depending on bonus value</li>
<li>Stack can use more than 2 attacks. Additional attacks can now be separated as "ONLY_MELEE_FIGHT and "ONLY_DISTANCE_FIGHT".</li>
<li>Moat damage configurable</li>
<li>More config options for spells:
<ul>
<li>mind immunity handled by config</li>
<li>direct damage immunity handled by config</li>
<li>immunity icon configurable</li>
<li>removed mind_spell flag</li>
</ul>
</li>
<li>creature config use string ids now.</li>
<li>support for string subtype id in short bonus format</li>
<li>primary skill identifiers for bonuses</li>
</ul>
<h2>0.91</h2>
<b>GENERAL</b>
<ul>
<li>VCMI build on OS X is now supported</li>
<li>Completely removed autotools</li>
<li>Added RMG interace and ability to generate simplest working maps</li>
<li>Added loading screen</li>
</ul>
<b>MODS</b>
<ul>
<li>Simplified mod structure. Mods from 0.9 will not be compatible.</li>
<ul>
<li>Mods can be turned on and off in config/modSettings.json file</li>
<li>Support for new factions, including:</li>
</ul>
<li>New towns</li>
<li>New hero classes</li>
<li>New heroes</li>
<li>New town-related external dwellings</li>
<ul>
<li>Support for new artifact, including combined, commander and stack artifacts</li>
<li>Extended configuration options</li>
</ul>
<li>All game objects are referenced by string identifiers</li>
<li>Subtype resolution for bonuses</li>
</ul>
<b>BATTLES</b>
<ul>
<li>Support for "enchanted" WoG ability</li>
</ul>
<b>ADVENTURE AI</b>
<ul>
<li>AI will try to use Subterranean Gate, Redwood Observatory and Cartographer for exploration</li>
<li>Improved exploration algorithm</li>
<li>AI will prioritize dwellings and mines when there are no opponents visible</li>
</ul>
</body>
</html>

View File

@ -1,12 +0,0 @@
-----BEGIN PUBLIC KEY-----
MIIBuDCCASwGByqGSM44BAEwggEfAoGBAPBRGeziJsHw0F7CM9JmSOiIOBmJ4hYl
dbmdU1iJR7XHX5lZIUOl323cCANhzOogVAzkvEVhFedA6H4iO6VRt7nTJSgLA4hO
gMqMJGKp4bDQIwupUK5xQUUcaXumT03Aj8jzzibW9YjNB8NeuSSMfMi5KGZw5pkf
nSvZM0TUVVX/AhUA74nJWqRFwUPc6aPGCOgfsRzPYMsCgYEApYMP5/tIr4yrqHVM
xHLj1s+Y/Zgs3+kRqudTLgYE20Br3Tmmi2ejM9phrEHn5mv6Ss/FYyWqKxdtzCEN
PjRA/JkKMpoX+sy/S3OE/NrrnikVjCRvgOJcM6FPt9iaENRqjz20dZMIq42vqeE9
K5u1XJ/YtiwU2b1fX0nNtREhjUwDgYUAAoGBAJT2cMQ2qTGecdNIjEByCFMZpWg0
nV+jKgpthNUahwxbUN3ru9nrWMUNv1pBiS3pxqFV6ec7qozKnedwyTx+IRJXTN4T
IrxYsgPJDHhkBeoVVAkacihkLUtwPSphorZWF4OMFmrlc5WsmYt2lEahR2TZGQrW
5GBNP18/S/nDBe7j
-----END PUBLIC KEY-----

View File

@ -1,6 +1,3 @@
project(vcmiERM)
cmake_minimum_required(VERSION 2.6)
include_directories(${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/include ${CMAKE_CURRENT_SOURCE_DIRECTORY})
set(lib_SRCS

View File

@ -1,6 +1,3 @@
project(vcmiserver)
cmake_minimum_required(VERSION 2.6)
include_directories(${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/include ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/lib)
include_directories(${Boost_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR})
@ -20,6 +17,9 @@ set(server_HEADERS
CQuery.h
CVCMIServer.h
)
assign_source_group(${server_SRCS} ${server_HEADERS})
if(ANDROID) # android needs client/server to be libraries, not executables, so we can't reuse the build part of this script
return()
endif()
@ -29,15 +29,16 @@ add_executable(vcmiserver ${server_SRCS} ${server_HEADERS})
target_link_libraries(vcmiserver vcmi ${Boost_LIBRARIES} ${SYSTEM_LIBS})
if(WIN32)
set_target_properties(vcmiserver PROPERTIES OUTPUT_NAME VCMI_server)
set_target_properties(vcmiserver
PROPERTIES
OUTPUT_NAME "VCMI_server"
PROJECT_LABEL "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)
if (NOT APPLE) # Already inside vcmiclient bundle
install(TARGETS vcmiserver DESTINATION ${BIN_DIR})
endif()

View File

@ -609,7 +609,7 @@ void handleLinuxSignal(int sig)
int main(int argc, char * argv[])
{
#ifdef VCMI_APPLE
#ifndef VCMI_WINDOWS
// Correct working dir executable folder (not bundle folder) so we can use executable relative paths
std::string executablePath = argv[0];
std::string workDir = executablePath.substr(0, executablePath.rfind('/'));

View File

@ -1,13 +1,9 @@
cmake_minimum_required(VERSION 2.8.7)
project(test)
enable_testing()
set(googleTest_Dir ${CMAKE_CURRENT_SOURCE_DIR}/googletest)
if(EXISTS ${googleTest_Dir})
SET(GTestSrc ${googleTest_Dir}/googletest)
SET(GMockSrc ${googleTest_Dir}/googlemock)
set(GTestSrc ${googleTest_Dir}/googletest)
set(GMockSrc ${googleTest_Dir}/googlemock)
else()
message(FATAL_ERROR "No googletest src dir found!")
endif()
@ -36,10 +32,13 @@ set(test_HEADERS
map/MapComparer.h
)
assign_source_group(${test_SRCS} ${test_HEADERS})
set(mock_HEADERS
mock/mock_UnitHealthInfo.h
)
add_subdirectory(googletest)
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})
@ -51,7 +50,6 @@ set_target_properties(vcmitest PROPERTIES ${PCH_PROPERTIES})
cotire(vcmitest)
# Files to copy to the build directory
add_custom_target(vcmitestFiles ALL)
set(vcmitest_FILES
testdata/TerrainViewTest.h3m
testdata/terrainViewMappings.json
@ -62,7 +60,7 @@ set(vcmitest_FILES
)
foreach(file ${vcmitest_FILES})
add_custom_command(TARGET vcmitestFiles POST_BUILD
add_custom_command(TARGET vcmitest POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/${file}" ${CMAKE_CURRENT_BINARY_DIR}
)
endforeach()