mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
CMake: structure changes and other small improvements
- Now cmake_minimum_required used properly and set to 2.8.12 - cmake_modules/CMakeCPackOptions.cmake.in is removed
This commit is contained in:
parent
fee999300e
commit
2b3a467728
@ -1,3 +1,7 @@
|
|||||||
|
#######################################
|
||||||
|
# FuzzyLite support #
|
||||||
|
#######################################
|
||||||
|
|
||||||
option(FORCE_BUNDLED_FL "Force to use FuzzyLite included into VCMI's source tree" OFF)
|
option(FORCE_BUNDLED_FL "Force to use FuzzyLite included into VCMI's source tree" OFF)
|
||||||
|
|
||||||
if(NOT FORCE_BUNDLED_FL)
|
if(NOT FORCE_BUNDLED_FL)
|
||||||
@ -10,10 +14,14 @@ if(NOT FL_FOUND)
|
|||||||
set(FL_BUILD_BINARY OFF CACHE BOOL "")
|
set(FL_BUILD_BINARY OFF CACHE BOOL "")
|
||||||
set(FL_BUILD_SHARED OFF CACHE BOOL "")
|
set(FL_BUILD_SHARED OFF CACHE BOOL "")
|
||||||
set(FL_BUILD_TESTS OFF CACHE BOOL "")
|
set(FL_BUILD_TESTS OFF CACHE BOOL "")
|
||||||
add_subdirectory_with_folder("AI" FuzzyLite/fuzzylite EXCLUDE_FROM_ALL)
|
add_subdirectory(FuzzyLite/fuzzylite EXCLUDE_FROM_ALL)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory_with_folder("AI" BattleAI)
|
#######################################
|
||||||
add_subdirectory_with_folder("AI" StupidAI)
|
# Add subdirectories #
|
||||||
add_subdirectory_with_folder("AI" EmptyAI)
|
#######################################
|
||||||
add_subdirectory_with_folder("AI" VCAI)
|
|
||||||
|
add_subdirectory(BattleAI)
|
||||||
|
add_subdirectory(StupidAI)
|
||||||
|
add_subdirectory(EmptyAI)
|
||||||
|
add_subdirectory(VCAI)
|
||||||
|
195
CMakeLists.txt
195
CMakeLists.txt
@ -1,15 +1,32 @@
|
|||||||
|
# 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)
|
||||||
|
|
||||||
project(VCMI)
|
project(VCMI)
|
||||||
# TODO
|
# TODO
|
||||||
# - macOS: there is problem with running fixup_bundle in main project after subdirectories.
|
# 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
|
# 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.
|
# Currently I just added extra add_subdirectory and CMakeLists.txt in osx directory to bypass that.
|
||||||
# - macOS: fix install with built-in minizip
|
# - Try to fix build with RPATH.
|
||||||
# - macOS: try to fix build with RPATH.
|
|
||||||
# Currently if CMAKE_MACOSX_RPATH=1 then AI libs unable to find @rpath/libvcmi.dylib
|
# 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.
|
# I tried to set few different INSTALL_RPATH for all targets in AI directory, but nothing worked.
|
||||||
# - build: cleanup remove_directory copy_directory mess.
|
#
|
||||||
# When I was trying to fix it copy_if_different failed to work for me.
|
# MXE:
|
||||||
# - build: and find a way to move add_custom_command for assets deploy out of "lib/CMakeLists.txt"
|
# - Try to implement MXE support into BundleUtilities so we can deploy deps automatically
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
|
||||||
|
############################################
|
||||||
|
# User-provided options #
|
||||||
|
############################################
|
||||||
|
|
||||||
if(NOT CMAKE_BUILD_TYPE)
|
if(NOT CMAKE_BUILD_TYPE)
|
||||||
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
|
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
|
||||||
@ -18,9 +35,6 @@ if(NOT CMAKE_BUILD_TYPE)
|
|||||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Debug Release RelWithDebInfo)
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Debug Release RelWithDebInfo)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_HOME_DIRECTORY}/cmake_modules)
|
|
||||||
include(VCMIUtils)
|
|
||||||
|
|
||||||
set(VCMI_VERSION_MAJOR 0)
|
set(VCMI_VERSION_MAJOR 0)
|
||||||
set(VCMI_VERSION_MINOR 99)
|
set(VCMI_VERSION_MINOR 99)
|
||||||
set(VCMI_VERSION_PATCH 0)
|
set(VCMI_VERSION_PATCH 0)
|
||||||
@ -37,23 +51,42 @@ option(ENABLE_MONOLITHIC_INSTALL "Install everything in single directory on Linu
|
|||||||
set(PACKAGE_NAME_SUFFIX "" CACHE STRING "Suffix for CPack package name")
|
set(PACKAGE_NAME_SUFFIX "" CACHE STRING "Suffix for CPack package name")
|
||||||
set(PACKAGE_FILE_NAME "" CACHE STRING "Override for CPack package filename")
|
set(PACKAGE_FILE_NAME "" CACHE STRING "Override for CPack package filename")
|
||||||
|
|
||||||
if(ENABLE_PCH)
|
############################################
|
||||||
# Cotire require CMake 2.8.12
|
# Miscellaneous options #
|
||||||
cmake_minimum_required(VERSION 2.8.12)
|
############################################
|
||||||
elseif(ENABLE_LAUNCHER)
|
|
||||||
# Some of Qt5 linking policies require 2.8.11
|
|
||||||
cmake_minimum_required(VERSION 2.8.11)
|
|
||||||
elseif(ENABLE_TEST)
|
|
||||||
# For whatever reason test requirement is 2.8.7
|
|
||||||
cmake_minimum_required(VERSION 2.8.7)
|
|
||||||
else()
|
|
||||||
cmake_minimum_required(VERSION 2.6)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Find better place for this
|
set(CMAKE_MODULE_PATH ${CMAKE_HOME_DIRECTORY}/cmake_modules)
|
||||||
if(APPLE)
|
# Contains custom functions and macros, but don't altering any options
|
||||||
set(CMAKE_MACOSX_RPATH 0)
|
include(VCMIUtils)
|
||||||
endif()
|
|
||||||
|
# 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
|
||||||
|
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)
|
||||||
|
|
||||||
|
# Precompiled header configuration
|
||||||
|
include(cotire)
|
||||||
|
set(PCH_PROPERTIES
|
||||||
|
COTIRE_ENABLE_PRECOMPILED_HEADER ${ENABLE_PCH}
|
||||||
|
COTIRE_ADD_UNITY_BUILD FALSE
|
||||||
|
COTIRE_CXX_PREFIX_HEADER_INIT "StdInc.h"
|
||||||
|
)
|
||||||
|
|
||||||
############################################
|
############################################
|
||||||
# Documentation section #
|
# Documentation section #
|
||||||
@ -62,56 +95,65 @@ endif()
|
|||||||
include(UseDoxygen OPTIONAL)
|
include(UseDoxygen OPTIONAL)
|
||||||
|
|
||||||
############################################
|
############################################
|
||||||
# Building section #
|
# Compile and linking options #
|
||||||
############################################
|
############################################
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
|
set(CMAKE_MACOSX_RPATH 0)
|
||||||
|
endif(APPLE)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
add_definitions(-DBOOST_THREAD_USE_LIB)
|
add_definitions(-DBOOST_THREAD_USE_LIB)
|
||||||
# Windows Vista or newer for FuzzyLite 6 to compile
|
# Windows Vista or newer for FuzzyLite 6 to compile
|
||||||
add_definitions(-D_WIN32_WINNT=0x0600)
|
add_definitions(-D_WIN32_WINNT=0x0600)
|
||||||
set(SYSTEM_LIBS ${SYSTEM_LIBS} ole32 oleaut32 ws2_32 mswsock dbghelp)
|
|
||||||
|
|
||||||
#delete lib prefix for dlls (libvcmi -> vcmi)
|
#delete lib prefix for dlls (libvcmi -> vcmi)
|
||||||
set(CMAKE_SHARED_LIBRARY_PREFIX "")
|
set(CMAKE_SHARED_LIBRARY_PREFIX "")
|
||||||
|
|
||||||
if(MINGW)
|
|
||||||
#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: use O1 to prevent compiler crash in some cases
|
|
||||||
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O1")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
#MSVC: Fix problems with linking
|
|
||||||
add_definitions(-DBOOST_ALL_NO_LIB)
|
add_definitions(-DBOOST_ALL_NO_LIB)
|
||||||
set(Boost_USE_STATIC_LIBS OFF)
|
set(Boost_USE_STATIC_LIBS OFF)
|
||||||
|
|
||||||
#MSVC: Don't link with SDLMain
|
# Don't link with SDLMain
|
||||||
#set(SDL2_BUILDING_LIBRARY ON)
|
#set(SDL2_BUILDING_LIBRARY ON)
|
||||||
|
|
||||||
#MSVC: Suppress warnings
|
# Suppress warnings
|
||||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||||
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
|
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj /wd4251")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj /wd4251")
|
||||||
endif()
|
endif()
|
||||||
endif(WIN32)
|
endif(WIN32)
|
||||||
|
|
||||||
|
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(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)
|
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)
|
CHECK_LIBRARY_EXISTS(rt shm_open "" HAVE_RT_LIB)
|
||||||
if(HAVE_RT_LIB)
|
if(HAVE_RT_LIB)
|
||||||
set(SYSTEM_LIBS ${SYSTEM_LIBS} rt)
|
set(SYSTEM_LIBS ${SYSTEM_LIBS} rt)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(SYSTEM_LIBS ${SYSTEM_LIBS} ${CMAKE_DL_LIBS})
|
############################################
|
||||||
|
# Finding packages #
|
||||||
|
############################################
|
||||||
|
|
||||||
set(FFmpeg_FIND_COMPONENTS AVFORMAT SWSCALE)
|
set(FFmpeg_FIND_COMPONENTS AVFORMAT SWSCALE)
|
||||||
find_package(Boost 1.48.0 COMPONENTS date_time filesystem locale program_options system thread REQUIRED)
|
find_package(Boost 1.48.0 COMPONENTS date_time filesystem locale program_options system thread REQUIRED)
|
||||||
@ -119,7 +161,7 @@ find_package(ZLIB REQUIRED)
|
|||||||
find_package(FFmpeg REQUIRED)
|
find_package(FFmpeg REQUIRED)
|
||||||
find_package(Minizip)
|
find_package(Minizip)
|
||||||
if(MINIZIP_FOUND)
|
if(MINIZIP_FOUND)
|
||||||
add_definitions(-DUSE_SYSTEM_MINIZIP)
|
add_definitions(-DUSE_SYSTEM_MINIZIP)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(SDL2 REQUIRED)
|
find_package(SDL2 REQUIRED)
|
||||||
@ -127,35 +169,15 @@ find_package(SDL2_image REQUIRED)
|
|||||||
find_package(SDL2_mixer REQUIRED)
|
find_package(SDL2_mixer REQUIRED)
|
||||||
find_package(SDL2_ttf 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)
|
if(ENABLE_LAUNCHER)
|
||||||
# Widgets finds its own dependencies (QtGui and QtCore).
|
# Widgets finds its own dependencies (QtGui and QtCore).
|
||||||
find_package(Qt5Widgets REQUIRED)
|
find_package(Qt5Widgets REQUIRED)
|
||||||
find_package(Qt5Network REQUIRED)
|
find_package(Qt5Network REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX OR NOT WIN32) #so far all *nix compilers support such parameters
|
############################################
|
||||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
# Output directories #
|
||||||
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()
|
|
||||||
|
|
||||||
if(WIN32) # on Win everything goes into H3 root directory
|
if(WIN32) # on Win everything goes into H3 root directory
|
||||||
set(BIN_DIR "." CACHE STRING "Where to install binaries")
|
set(BIN_DIR "." CACHE STRING "Where to install binaries")
|
||||||
@ -208,12 +230,9 @@ add_definitions(-DM_DATA_DIR="${CMAKE_INSTALL_PREFIX}/${DATA_DIR}")
|
|||||||
add_definitions(-DM_BIN_DIR="${CMAKE_INSTALL_PREFIX}/${BIN_DIR}")
|
add_definitions(-DM_BIN_DIR="${CMAKE_INSTALL_PREFIX}/${BIN_DIR}")
|
||||||
add_definitions(-DM_LIB_DIR="${CMAKE_INSTALL_PREFIX}/${LIB_DIR}")
|
add_definitions(-DM_LIB_DIR="${CMAKE_INSTALL_PREFIX}/${LIB_DIR}")
|
||||||
|
|
||||||
# precompiled header configuration
|
#######################################
|
||||||
set(PCH_PROPERTIES
|
# Add subdirectories #
|
||||||
COTIRE_ENABLE_PRECOMPILED_HEADER ${ENABLE_PCH}
|
#######################################
|
||||||
COTIRE_ADD_UNITY_BUILD FALSE
|
|
||||||
COTIRE_CXX_PREFIX_HEADER_INIT "StdInc.h"
|
|
||||||
)
|
|
||||||
|
|
||||||
if(ENABLE_ERM)
|
if(ENABLE_ERM)
|
||||||
add_subdirectory(scripting/erm)
|
add_subdirectory(scripting/erm)
|
||||||
@ -276,8 +295,7 @@ set(CPACK_PACKAGE_VENDOR "VCMI team")
|
|||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(CPACK_MONOLITHIC_INSTALL 1)
|
set(CPACK_MONOLITHIC_INSTALL 1)
|
||||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/license.txt")
|
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/license.txt")
|
||||||
set(CPACK_PACKAGE_EXECUTABLES "VCMI_launcher;VCMI")
|
|
||||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")
|
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")
|
||||||
if("${PACKAGE_NAME_SUFFIX}" STREQUAL "")
|
if("${PACKAGE_NAME_SUFFIX}" STREQUAL "")
|
||||||
set(CPACK_NSIS_PACKAGE_NAME "VCMI ${CPACK_PACKAGE_VERSION}")
|
set(CPACK_NSIS_PACKAGE_NAME "VCMI ${CPACK_PACKAGE_VERSION}")
|
||||||
@ -286,14 +304,31 @@ if(WIN32)
|
|||||||
endif()
|
endif()
|
||||||
set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES")
|
set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES")
|
||||||
if(ENABLE_LAUNCHER)
|
if(ENABLE_LAUNCHER)
|
||||||
|
set(CPACK_PACKAGE_EXECUTABLES "VCMI_launcher;VCMI")
|
||||||
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS " CreateShortCut \\\"$DESKTOP\\\\VCMI.lnk\\\" \\\"$INSTDIR\\\\VCMI_launcher.exe\\\"")
|
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS " CreateShortCut \\\"$DESKTOP\\\\VCMI.lnk\\\" \\\"$INSTDIR\\\\VCMI_launcher.exe\\\"")
|
||||||
else()
|
else()
|
||||||
|
set(CPACK_PACKAGE_EXECUTABLES "VCMI_client;VCMI")
|
||||||
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS " CreateShortCut \\\"$DESKTOP\\\\VCMI.lnk\\\" \\\"$INSTDIR\\\\VCMI_client.exe\\\"")
|
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS " CreateShortCut \\\"$DESKTOP\\\\VCMI.lnk\\\" \\\"$INSTDIR\\\\VCMI_client.exe\\\"")
|
||||||
endif()
|
endif()
|
||||||
set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS " Delete \\\"$DESKTOP\\\\VCMI.lnk\\\" ")
|
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 the install/unistall icon used for the installer itself
|
||||||
set(CPACK_PROJECT_CONFIG_FILE "${CMAKE_BINARY_DIR}/CMakeCPackOptions.cmake")
|
# 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 ".")
|
||||||
|
|
||||||
elseif(APPLE AND NOT ENABLE_MONOLITHIC_INSTALL)
|
elseif(APPLE AND NOT ENABLE_MONOLITHIC_INSTALL)
|
||||||
set(CPACK_MONOLITHIC_INSTALL 1)
|
set(CPACK_MONOLITHIC_INSTALL 1)
|
||||||
set(CPACK_GENERATOR "DragNDrop")
|
set(CPACK_GENERATOR "DragNDrop")
|
||||||
@ -320,8 +355,4 @@ else()
|
|||||||
set(CPACK_GENERATOR TGZ)
|
set(CPACK_GENERATOR TGZ)
|
||||||
endif()
|
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)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
include_directories(${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/include ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/lib)
|
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})
|
include_directories(${Boost_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR} ${FFMPEG_INCLUDE_DIRS})
|
||||||
|
|
||||||
set(client_SRCS
|
set(client_SRCS
|
||||||
@ -136,8 +136,10 @@ if(WIN32)
|
|||||||
target_link_libraries(vcmiclient ${SDLMAIN_LIBRARY})
|
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} ${FFMPEG_EXTRA_LINKING_OPTIONS} ${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 "")
|
vcmi_set_output_dir(vcmiclient "")
|
||||||
|
|
||||||
set_target_properties(vcmiclient PROPERTIES ${PCH_PROPERTIES})
|
set_target_properties(vcmiclient PROPERTIES ${PCH_PROPERTIES})
|
||||||
|
@ -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()
|
|
@ -1,5 +1,8 @@
|
|||||||
|
# This file should contain custom functions and macro and them only.
|
||||||
|
# It's should not alter any configuration on inclusion
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
# Build output directories #
|
# Build output path #
|
||||||
#######################################
|
#######################################
|
||||||
macro(vcmi_set_output_dir name dir)
|
macro(vcmi_set_output_dir name dir)
|
||||||
# Multi-config builds for Visual Studio, Xcode
|
# Multi-config builds for Visual Studio, Xcode
|
||||||
@ -18,7 +21,7 @@ macro(vcmi_set_output_dir name dir)
|
|||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
# Better project generation #
|
# Project generation #
|
||||||
#######################################
|
#######################################
|
||||||
|
|
||||||
# Let us have proper tree-like structure in IDEs such as Visual Studio
|
# Let us have proper tree-like structure in IDEs such as Visual Studio
|
||||||
@ -35,17 +38,7 @@ function(assign_source_group)
|
|||||||
endforeach()
|
endforeach()
|
||||||
endfunction(assign_source_group)
|
endfunction(assign_source_group)
|
||||||
|
|
||||||
# Options to enable folders in CMake generated projects for Visual Studio, Xcode, etc
|
# Macro to add subdirectory and set appropriate FOLDER for generated projects files
|
||||||
# Very useful to put 3rd-party libraries such as Minizip, GoogleTest and FuzzyLite in their own folders
|
|
||||||
set_property(GLOBAL PROPERTY USE_FOLDERS TRUE)
|
|
||||||
define_property(
|
|
||||||
TARGET
|
|
||||||
PROPERTY FOLDER
|
|
||||||
INHERITED
|
|
||||||
BRIEF_DOCS "Set the folder name."
|
|
||||||
FULL_DOCS "Use to organize targets in an IDE."
|
|
||||||
)
|
|
||||||
|
|
||||||
function(add_subdirectory_with_folder _folder_name _folder)
|
function(add_subdirectory_with_folder _folder_name _folder)
|
||||||
add_subdirectory(${_folder} ${ARGN})
|
add_subdirectory(${_folder} ${ARGN})
|
||||||
set_property(DIRECTORY "${_folder}" PROPERTY FOLDER "${_folder_name}")
|
set_property(DIRECTORY "${_folder}" PROPERTY FOLDER "${_folder_name}")
|
||||||
@ -65,7 +58,7 @@ if(${CMAKE_GENERATOR} MATCHES "Xcode")
|
|||||||
endif(${CMAKE_GENERATOR} MATCHES "Xcode")
|
endif(${CMAKE_GENERATOR} MATCHES "Xcode")
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
# CMake debugging #
|
# CMake debugging #
|
||||||
#######################################
|
#######################################
|
||||||
|
|
||||||
# Can be called to see check cmake variables and environment variables
|
# Can be called to see check cmake variables and environment variables
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# https://doc.qt.io/qt-5/cmake-manual.html
|
# https://doc.qt.io/qt-5/cmake-manual.html
|
||||||
include_directories(${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/include ${CMAKE_CURRENT_SOURCE_DIR})
|
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(${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
|
set(launcher_modmanager_SRCS
|
||||||
modManager/cdownloadmanager_moc.cpp
|
modManager/cdownloadmanager_moc.cpp
|
||||||
@ -102,7 +102,7 @@ if(APPLE)
|
|||||||
set_property(GLOBAL PROPERTY AUTOGEN_TARGETS_FOLDER vcmilauncher)
|
set_property(GLOBAL PROPERTY AUTOGEN_TARGETS_FOLDER vcmilauncher)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(vcmilauncher vcmi Qt5::Widgets Qt5::Network ${SDL_LIBRARY})
|
target_link_libraries(vcmilauncher vcmi Qt5::Widgets Qt5::Network ${SDL2_LIBRARY})
|
||||||
|
|
||||||
vcmi_set_output_dir(vcmilauncher "")
|
vcmi_set_output_dir(vcmilauncher "")
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
include_directories(${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/include ${CMAKE_CURRENT_SOURCE_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/lib)
|
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
|
set(lib_SRCS
|
||||||
StdInc.cpp
|
StdInc.cpp
|
||||||
@ -289,7 +289,7 @@ assign_source_group(${lib_SRCS} ${lib_HEADERS})
|
|||||||
|
|
||||||
add_library(vcmi SHARED ${lib_SRCS} ${lib_HEADERS})
|
add_library(vcmi SHARED ${lib_SRCS} ${lib_HEADERS})
|
||||||
set_target_properties(vcmi PROPERTIES COMPILE_DEFINITIONS "VCMI_DLL=1")
|
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)
|
if(WIN32)
|
||||||
set_target_properties(vcmi
|
set_target_properties(vcmi
|
||||||
|
Loading…
Reference in New Issue
Block a user