2012-07-01 17:27:41 +03:00
|
|
|
project(vcmi)
|
2014-10-12 16:37:10 +03:00
|
|
|
cmake_minimum_required(VERSION 2.8.12)
|
2013-08-19 14:50:53 +03:00
|
|
|
# TODO:
|
2014-10-12 16:50:39 +03:00
|
|
|
# 1) Detection of Qt5 and compilation of launcher, unless explicitly disabled
|
2012-07-01 17:27:41 +03:00
|
|
|
|
|
|
|
# where to look for cmake modules
|
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_HOME_DIRECTORY}/cmake_modules)
|
|
|
|
|
2012-07-19 21:52:44 +03:00
|
|
|
# enable Release mode but only if it was not set
|
|
|
|
if (NOT CMAKE_BUILD_TYPE)
|
2014-07-11 11:01:03 +03:00
|
|
|
set(CMAKE_BUILD_TYPE RelWithDebInfo)
|
2012-07-19 21:52:44 +03:00
|
|
|
endif()
|
2012-07-01 17:27:41 +03:00
|
|
|
|
2013-02-21 20:32:50 +03:00
|
|
|
# VCMI version
|
|
|
|
set(VCMI_VERSION_MAJOR 0)
|
2014-07-01 21:02:03 +03:00
|
|
|
set(VCMI_VERSION_MINOR 96)
|
2013-02-21 20:32:50 +03:00
|
|
|
set(VCMI_VERSION_PATCH 0)
|
|
|
|
|
2013-06-29 16:05:48 +03:00
|
|
|
option(ENABLE_ERM "Enable compilation of ERM scripting module" OFF)
|
2013-02-17 00:14:36 +03:00
|
|
|
option(ENABLE_EDITOR "Enable compilation of map editor" OFF)
|
2013-11-14 16:21:09 +03:00
|
|
|
option(ENABLE_LAUNCHER "Enable compilation of launcher" ON)
|
2013-04-22 17:49:28 +03:00
|
|
|
option(ENABLE_TEST "Enable compilation of unit tests" OFF)
|
2014-02-26 17:19:14 +03:00
|
|
|
option(ENABLE_PCH "Enable compilation using precompiled headers" ON)
|
2014-05-24 16:52:43 +03:00
|
|
|
option(ENABLE_SDL2 "Use SDL2 for compilation instead of SDL 1.2" ON)
|
2012-10-05 15:38:17 +03:00
|
|
|
|
|
|
|
############################################
|
|
|
|
# Building section #
|
|
|
|
############################################
|
|
|
|
|
2012-12-01 09:30:52 +03:00
|
|
|
if (APPLE)
|
|
|
|
# Default location for thirdparty libs
|
2012-12-27 12:21:30 +03:00
|
|
|
set(CMAKE_INCLUDE_PATH "../include" "${CMAKE_OSX_SYSROOT}/usr/include")
|
2012-12-01 09:30:52 +03:00
|
|
|
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)")
|
2014-03-04 06:51:17 +03:00
|
|
|
set(CMAKE_XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@executable_path/../Frameworks @executable_path/")
|
2012-12-01 09:30:52 +03:00
|
|
|
|
|
|
|
# Build with clang ang libc++
|
|
|
|
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
|
|
|
|
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
|
2013-03-02 00:32:26 +03:00
|
|
|
|
|
|
|
# On OS X we use Sparkle framework for updates
|
|
|
|
find_path(SPARKLE_INCLUDE_DIR Sparkle.h)
|
|
|
|
find_library(SPARKLE_FRAMEWORK NAMES Sparkle)
|
2013-10-07 04:19:02 +03:00
|
|
|
|
|
|
|
# Xcode 5.0 fix
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth=256")
|
2014-10-12 16:38:53 +03:00
|
|
|
|
|
|
|
# Link with iconv
|
|
|
|
set(SYSTEM_LIBS ${SYSTEM_LIBS} libiconv.dylib)
|
2012-12-01 09:30:52 +03:00
|
|
|
endif()
|
|
|
|
|
2014-07-09 01:43:13 +03:00
|
|
|
if (WIN32)
|
|
|
|
add_definitions(-DBOOST_THREAD_USE_LIB)
|
|
|
|
add_definitions(-D_WIN32_WINNT=0x0501)
|
2014-07-10 00:41:31 +03:00
|
|
|
set(SYSTEM_LIBS ${SYSTEM_LIBS} ole32 oleaut32 ws2_32 mswsock)
|
2014-07-11 00:23:06 +03:00
|
|
|
|
2014-10-12 16:38:53 +03:00
|
|
|
#delete lib prefix for dlls (libvcmi -> vcmi)
|
2014-07-11 17:29:46 +03:00
|
|
|
set(CMAKE_SHARED_LIBRARY_PREFIX "")
|
|
|
|
|
|
|
|
if(MINGW)
|
2014-10-12 16:38:53 +03:00
|
|
|
#MinGW: 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
|
2014-07-12 14:10:44 +03:00
|
|
|
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")
|
2014-07-16 11:37:57 +03:00
|
|
|
set(dep_files ${dep_files} "${MINGW_BIN_PATH}/libstdc++-*.dll")
|
|
|
|
|
2014-10-12 16:38:53 +03:00
|
|
|
#MinGW: use O1 to prevent compiler crash in some cases
|
2014-07-16 11:37:57 +03:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O1")
|
2014-07-11 17:29:46 +03:00
|
|
|
endif()
|
2014-07-10 00:41:31 +03:00
|
|
|
|
2014-10-12 16:38:53 +03:00
|
|
|
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")
|
|
|
|
endif()
|
2014-07-10 00:41:31 +03:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT WIN32)
|
|
|
|
INCLUDE(CheckLibraryExists)
|
|
|
|
|
2014-07-11 11:01:03 +03:00
|
|
|
#check if some platform-specific libraries are needed for linking
|
2014-07-10 00:41:31 +03:00
|
|
|
CHECK_LIBRARY_EXISTS(rt shm_open "" HAVE_RT_LIB)
|
|
|
|
if(HAVE_RT_LIB)
|
|
|
|
set(SYSTEM_LIBS ${SYSTEM_LIBS} rt)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_DL_LIB)
|
|
|
|
if(HAVE_DL_LIB)
|
|
|
|
set(SYSTEM_LIBS ${SYSTEM_LIBS} dl)
|
|
|
|
endif()
|
2014-07-09 01:43:13 +03:00
|
|
|
endif()
|
|
|
|
|
2014-07-11 12:43:24 +03:00
|
|
|
set(FFmpeg_FIND_COMPONENTS AVFORMAT SWSCALE)
|
2014-10-12 16:40:24 +03:00
|
|
|
find_package(Boost 1.48.0 COMPONENTS filesystem locale program_options system thread REQUIRED)
|
2012-07-01 17:27:41 +03:00
|
|
|
find_package(ZLIB REQUIRED)
|
2014-07-11 12:43:24 +03:00
|
|
|
find_package(FFmpeg REQUIRED)
|
2014-10-12 16:50:39 +03:00
|
|
|
find_package(Minizip)
|
|
|
|
if (MINIZIP_FOUND)
|
|
|
|
add_definitions(-DUSE_SYSTEM_MINIZIP)
|
|
|
|
endif()
|
2014-05-24 16:52:43 +03:00
|
|
|
|
|
|
|
if (ENABLE_SDL2)
|
2014-07-05 21:47:03 +03:00
|
|
|
find_package(SDL2 REQUIRED)
|
|
|
|
find_package(SDL2_image REQUIRED)
|
|
|
|
find_package(SDL2_mixer REQUIRED)
|
|
|
|
find_package(SDL2_ttf REQUIRED)
|
|
|
|
|
|
|
|
set(SDL_INCLUDE_DIR "${SDL2_INCLUDE_DIR}")
|
2014-08-04 21:35:23 +03:00
|
|
|
set(SDLTTF_INCLUDE_DIR "${SDL2_TTF_INCLUDE_DIR}")
|
|
|
|
set(SDLIMAGE_INCLUDE_DIR "${SDL2_IMAGE_INCLUDE_DIR}")
|
|
|
|
set(SDLMIXER_INCLUDE_DIR "${SDL2_MIXER_INCLUDE_DIR}")
|
2014-07-05 21:47:03 +03:00
|
|
|
set(SDL_LIBRARY "${SDL2_LIBRARY}")
|
|
|
|
set(SDLTTF_LIBRARY "${SDL2_TTF_LIBRARY}")
|
|
|
|
set(SDLIMAGE_LIBRARY "${SDL2_IMAGE_LIBRARY}")
|
|
|
|
set(SDLMIXER_LIBRARY "${SDL2_MIXER_LIBRARY}")
|
2014-05-24 16:52:43 +03:00
|
|
|
else()
|
|
|
|
find_package(SDL REQUIRED)
|
|
|
|
find_package(SDL_image REQUIRED)
|
|
|
|
find_package(SDL_mixer REQUIRED)
|
|
|
|
find_package(SDL_ttf REQUIRED)
|
|
|
|
endif()
|
2014-02-05 23:25:36 +03:00
|
|
|
include(cotire)
|
2014-02-01 16:37:26 +03:00
|
|
|
|
2013-08-19 14:50:53 +03:00
|
|
|
if (ENABLE_EDITOR OR ENABLE_LAUNCHER)
|
2013-02-17 00:14:36 +03:00
|
|
|
# Widgets finds its own dependencies (QtGui and QtCore).
|
|
|
|
find_package(Qt5Widgets REQUIRED)
|
|
|
|
endif()
|
|
|
|
|
2013-08-19 14:50:53 +03:00
|
|
|
if (ENABLE_LAUNCHER)
|
|
|
|
find_package(Qt5Network REQUIRED)
|
|
|
|
endif()
|
|
|
|
|
2013-04-22 17:49:28 +03:00
|
|
|
if(ENABLE_TEST)
|
2014-07-10 00:41:31 +03:00
|
|
|
# find_package overwrites BOOST_* variables which are already set, so all components have to be included again
|
2014-07-11 11:01:03 +03:00
|
|
|
find_package(Boost 1.48.0 COMPONENTS program_options filesystem system thread locale unit_test_framework REQUIRED)
|
2013-12-13 14:51:15 +03:00
|
|
|
endif()
|
|
|
|
|
2012-10-05 15:38:17 +03:00
|
|
|
if(CMAKE_COMPILER_IS_GNUCXX OR NOT WIN32) #so far all *nix compilers support such parameters
|
2013-08-19 21:20:11 +03:00
|
|
|
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
2014-07-12 14:10:44 +03:00
|
|
|
set(CLANG_SPECIFIC_FLAGS "-Wno-mismatched-tags -Wno-unknown-warning-option")
|
2013-08-19 21:20:11 +03:00
|
|
|
endif()
|
2014-07-11 14:09:14 +03:00
|
|
|
|
2014-07-11 22:54:50 +03:00
|
|
|
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 ${CLANG_SPECIFIC_FLAGS}")
|
2014-06-24 00:05:53 +03:00
|
|
|
|
|
|
|
if(UNIX)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
|
|
|
|
endif()
|
|
|
|
|
2012-07-15 19:05:41 +03:00
|
|
|
endif()
|
|
|
|
|
2012-10-05 15:38:17 +03:00
|
|
|
if(WIN32) # on Win everything goes into H3 root directory
|
2014-07-07 23:21:59 +03:00
|
|
|
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")
|
2012-12-01 09:30:52 +03:00
|
|
|
elseif(APPLE)
|
|
|
|
# includes lib path which determines where to install shared libraries (either /lib or /lib64)
|
|
|
|
include(GNUInstallDirs)
|
|
|
|
|
|
|
|
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")
|
2012-10-05 15:38:17 +03:00
|
|
|
else()
|
2012-10-06 19:09:20 +03:00
|
|
|
# includes lib path which determines where to install shared libraries (either /lib or /lib64)
|
|
|
|
include(GNUInstallDirs)
|
|
|
|
|
2013-02-25 22:17:36 +03:00
|
|
|
if (NOT BIN_DIR)
|
2014-07-11 11:01:03 +03:00
|
|
|
set(BIN_DIR "bin" CACHE STRING "Where to install binaries")
|
2013-02-25 22:17:36 +03:00
|
|
|
endif()
|
|
|
|
if (NOT LIB_DIR)
|
|
|
|
set(LIB_DIR "${CMAKE_INSTALL_LIBDIR}/vcmi" CACHE STRING "Where to install main library")
|
|
|
|
endif()
|
|
|
|
if (NOT DATA_DIR)
|
|
|
|
set(DATA_DIR "share/vcmi" CACHE STRING "Where to install data files")
|
|
|
|
endif()
|
2012-07-01 17:27:41 +03:00
|
|
|
endif()
|
|
|
|
|
2012-10-05 15:38:17 +03:00
|
|
|
set (AI_LIB_DIR "${LIB_DIR}/AI")
|
2013-04-13 14:07:32 +03:00
|
|
|
set (SCRIPTING_LIB_DIR "${LIB_DIR}/scripting")
|
2012-10-05 15:38:17 +03:00
|
|
|
|
2012-07-15 19:05:41 +03:00
|
|
|
#define required constants
|
2012-10-05 15:38:17 +03:00
|
|
|
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}")
|
2012-07-15 19:05:41 +03:00
|
|
|
|
2012-11-03 22:31:16 +03:00
|
|
|
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/vcmi")
|
2012-10-06 19:09:20 +03:00
|
|
|
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
|
|
|
|
2014-02-05 23:25:36 +03:00
|
|
|
# precompiled header configuration
|
|
|
|
SET(PCH_PROPERTIES
|
|
|
|
COTIRE_ENABLE_PRECOMPILED_HEADER ${ENABLE_PCH}
|
|
|
|
COTIRE_ADD_UNITY_BUILD FALSE
|
|
|
|
COTIRE_CXX_PREFIX_HEADER_INIT "StdInc.h"
|
|
|
|
)
|
|
|
|
|
2013-11-03 15:07:23 +03:00
|
|
|
if (ENABLE_ERM)
|
2014-07-11 11:01:03 +03:00
|
|
|
add_subdirectory(scripting/erm)
|
2013-11-03 15:07:23 +03:00
|
|
|
endif()
|
2014-09-02 16:20:34 +03:00
|
|
|
if (NOT MINIZIP_FOUND)
|
|
|
|
add_subdirectory(lib/minizip)
|
|
|
|
set(MINIZIP_LIBRARIES minizip)
|
|
|
|
endif()
|
2012-07-01 17:27:41 +03:00
|
|
|
add_subdirectory(lib)
|
|
|
|
add_subdirectory(client)
|
|
|
|
add_subdirectory(server)
|
|
|
|
add_subdirectory(AI)
|
2013-02-17 00:14:36 +03:00
|
|
|
if (ENABLE_EDITOR)
|
2013-04-13 14:07:32 +03:00
|
|
|
add_subdirectory(editor)
|
2013-02-17 00:14:36 +03:00
|
|
|
endif()
|
2013-08-19 14:50:53 +03:00
|
|
|
if (ENABLE_LAUNCHER)
|
|
|
|
add_subdirectory(launcher)
|
|
|
|
endif()
|
2013-04-22 17:49:28 +03:00
|
|
|
if(ENABLE_TEST)
|
|
|
|
add_subdirectory(test)
|
|
|
|
endif()
|
2012-07-19 21:52:44 +03:00
|
|
|
|
2012-10-05 15:38:17 +03:00
|
|
|
#######################################
|
|
|
|
# Installation section #
|
|
|
|
#######################################
|
|
|
|
|
2012-12-01 09:30:52 +03:00
|
|
|
# For apple this files will be already inside vcmiclient bundle
|
|
|
|
if (NOT APPLE)
|
2013-05-04 16:14:23 +03:00
|
|
|
# copy whole directory but .svn control files
|
2013-04-11 22:24:14 +03:00
|
|
|
install(DIRECTORY config DESTINATION ${DATA_DIR} PATTERN ".svn" EXCLUDE)
|
2012-12-01 09:30:52 +03:00
|
|
|
# copy vcmi mod along with all its content
|
|
|
|
install(DIRECTORY Mods/vcmi DESTINATION ${DATA_DIR}/Mods PATTERN ".svn" EXCLUDE)
|
2012-12-03 19:00:17 +03:00
|
|
|
|
2012-12-10 23:08:00 +03:00
|
|
|
install(FILES vcmibuilder DESTINATION ${BIN_DIR} PERMISSIONS
|
|
|
|
OWNER_WRITE OWNER_READ OWNER_EXECUTE
|
|
|
|
GROUP_READ GROUP_EXECUTE
|
|
|
|
WORLD_READ WORLD_EXECUTE)
|
2012-12-01 09:30:52 +03:00
|
|
|
endif()
|
2012-10-05 15:38:17 +03:00
|
|
|
|
|
|
|
if(WIN32)
|
2014-07-11 17:29:46 +03:00
|
|
|
file(GLOB dep_files
|
|
|
|
${dep_files}
|
|
|
|
"${CMAKE_FIND_ROOT_PATH}/bin/*.dll")
|
|
|
|
|
2014-10-12 16:40:24 +03:00
|
|
|
#Copy debug versions of libraries if build type is debug. Doesn't work in MSVC!
|
|
|
|
if(CMAKE_BUILD_TYPE MATCHES DEBUG)
|
|
|
|
set(debug_postfix d)
|
|
|
|
endif(CMAKE_BUILD_TYPE MATCHES DEBUG)
|
|
|
|
|
2014-07-11 14:08:20 +03:00
|
|
|
if (ENABLE_EDITOR OR ENABLE_LAUNCHER)
|
|
|
|
get_target_property(QtCore_location Qt5::Core LOCATION)
|
|
|
|
get_filename_component(Qtbin_folder ${QtCore_location} PATH)
|
2014-07-11 17:29:46 +03:00
|
|
|
file(GLOB dep_files
|
|
|
|
${dep_files}
|
2014-10-12 16:40:24 +03:00
|
|
|
${Qtbin_folder}/Qt5Core${debug_postfix}.dll
|
|
|
|
${Qtbin_folder}/Qt5Gui${debug_postfix}.dll
|
|
|
|
${Qtbin_folder}/Qt5Widgets${debug_postfix}.dll
|
2014-07-11 14:08:20 +03:00
|
|
|
${Qtbin_folder}/icu*.dll)
|
2014-10-12 16:40:24 +03:00
|
|
|
file(GLOB dep_qwindows
|
|
|
|
${Qtbin_folder}/../plugins/platforms/qwindows${debug_postfix}.dll)
|
2014-10-12 18:03:47 +03:00
|
|
|
if(MSVC)
|
|
|
|
file(GLOB dep_files
|
|
|
|
${dep_files}
|
|
|
|
${Qtbin_folder}/libEGL.dll
|
|
|
|
${Qtbin_folder}/libGLESv2.dll)
|
|
|
|
endif()
|
2014-07-11 14:08:20 +03:00
|
|
|
endif()
|
2014-07-11 17:29:46 +03:00
|
|
|
|
2014-07-11 14:08:20 +03:00
|
|
|
if (ENABLE_LAUNCHER)
|
2014-07-11 17:29:46 +03:00
|
|
|
file(GLOB dep_files
|
|
|
|
${dep_files}
|
2014-10-12 16:40:24 +03:00
|
|
|
${Qtbin_folder}/Qt5Network${debug_postfix}.dll)
|
2014-07-11 14:08:20 +03:00
|
|
|
endif()
|
|
|
|
|
2014-10-12 18:03:47 +03:00
|
|
|
if(MSVC)
|
|
|
|
#install MSVC runtime
|
|
|
|
include(InstallRequiredSystemLibraries)
|
|
|
|
install(FILES ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION ${BIN_DIR})
|
|
|
|
endif()
|
2014-07-11 14:08:20 +03:00
|
|
|
install(FILES ${dep_files} DESTINATION ${BIN_DIR})
|
2014-10-12 16:40:24 +03:00
|
|
|
install(FILES ${dep_qwindows} DESTINATION ${BIN_DIR}/platforms)
|
|
|
|
elseif(NOT APPLE)
|
2012-10-05 15:38:17 +03:00
|
|
|
#install icons and desktop file on Linux
|
2013-11-16 21:13:30 +03:00
|
|
|
#FIXME: move to client makefile?
|
2013-02-21 20:32:50 +03:00
|
|
|
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)
|
2013-02-01 11:58:14 +03:00
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/client/icons/vcmiclient.256x256.png" DESTINATION share/icons/hicolor/256x256/apps RENAME vcmiclient.png)
|
2013-02-21 20:32:50 +03:00
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/client/icons/vcmiclient.desktop" DESTINATION share/applications)
|
2013-11-16 21:13:30 +03:00
|
|
|
if (ENABLE_LAUNCHER) #FIXME: move to launcher makefile?
|
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/launcher/vcmilauncher.desktop" DESTINATION share/applications)
|
|
|
|
endif()
|
2012-10-05 15:38:17 +03:00
|
|
|
endif()
|
|
|
|
|
|
|
|
#######################################
|
|
|
|
# Packaging section #
|
|
|
|
#######################################
|
|
|
|
|
2013-02-21 20:32:50 +03:00
|
|
|
set(CPACK_PACKAGE_VERSION_MAJOR ${VCMI_VERSION_MAJOR})
|
|
|
|
set(CPACK_PACKAGE_VERSION_MINOR ${VCMI_VERSION_MINOR})
|
|
|
|
set(CPACK_PACKAGE_VERSION_PATCH ${VCMI_VERSION_PATCH})
|
2012-10-05 15:38:17 +03:00
|
|
|
|
|
|
|
# vcmi does not have "patch version" in version string
|
|
|
|
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
|
|
|
|
#TODO: remove version from Global.h and use this one as define?
|
|
|
|
|
|
|
|
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)
|
|
|
|
|
|
|
|
if(WIN32)
|
2014-07-14 01:23:57 +03:00
|
|
|
set(CPACK_MONOLITHIC_INSTALL 1)
|
|
|
|
set(CPACK_PACKAGE_NAME "VCMI")
|
|
|
|
set(CPACK_PACKAGE_VENDOR "VCMI team")
|
|
|
|
set(CPACK_PACKAGE_FILE_NAME "vcmi-${CPACK_PACKAGE_VERSION}-win32")
|
|
|
|
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/license.txt")
|
|
|
|
set(CPACK_PACKAGE_EXECUTABLES "VCMI_launcher;VCMI")
|
|
|
|
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")
|
|
|
|
set(CPACK_NSIS_PACKAGE_NAME "VCMI ${CPACK_PACKAGE_VERSION}")
|
|
|
|
set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES")
|
|
|
|
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS " CreateShortCut \\\"$DESKTOP\\\\VCMI.lnk\\\" \\\"$INSTDIR\\\\VCMI_launcher.exe\\\"")
|
|
|
|
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")
|
2012-12-01 09:30:52 +03:00
|
|
|
elseif(APPLE)
|
|
|
|
set(CPACK_GENERATOR DragNDrop)
|
2012-12-27 12:21:30 +03:00
|
|
|
set(CPACK_DMG_BACKGROUND_IMAGE "${CMAKE_SOURCE_DIR}/osx/dmg_background.png")
|
|
|
|
set(CPACK_DMG_DS_STORE "${CMAKE_SOURCE_DIR}/osx/dmg_DS_Store")
|
2012-10-05 15:38:17 +03:00
|
|
|
else()
|
|
|
|
set(CPACK_GENERATOR TGZ)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
INCLUDE(CPack)
|
|
|
|
|