mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
CMake version bump to 3.16, removed MXE workarounds
This commit is contained in:
parent
e938a9bb6c
commit
8e13ed74d7
@ -1,7 +1,7 @@
|
||||
# Minimum required version greatly affect CMake behavior
|
||||
# So cmake_minimum_required must be called before the project()
|
||||
# 3.10.0 is used since it's minimal in MXE dependencies for now
|
||||
cmake_minimum_required(VERSION 3.10.0)
|
||||
# 3.16.0 is used since it's used by our currently oldest suppored system: Ubuntu-20.04
|
||||
cmake_minimum_required(VERSION 3.16.0)
|
||||
|
||||
project(VCMI)
|
||||
# TODO
|
||||
@ -10,9 +10,6 @@ project(VCMI)
|
||||
# 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.
|
||||
#
|
||||
# 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
|
||||
#
|
||||
@ -57,9 +54,8 @@ if(APPLE_IOS)
|
||||
else()
|
||||
option(ENABLE_TEST "Enable compilation of unit tests" OFF)
|
||||
endif()
|
||||
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.16.0")
|
||||
option(ENABLE_PCH "Enable compilation using precompiled headers" ON)
|
||||
endif(NOT ${CMAKE_VERSION} VERSION_LESS "3.16.0")
|
||||
|
||||
option(ENABLE_PCH "Enable compilation using precompiled headers" ON)
|
||||
option(ENABLE_GITVERSION "Enable Version.cpp with Git commit hash" ON)
|
||||
option(ENABLE_DEBUG_CONSOLE "Enable debug console for Windows builds" ON)
|
||||
option(ENABLE_STRICT_COMPILATION "Treat all compiler warnings as errors" OFF)
|
||||
@ -90,11 +86,6 @@ if(APPLE_IOS AND COPY_CONFIG_ON_BUILD)
|
||||
set(COPY_CONFIG_ON_BUILD OFF)
|
||||
endif()
|
||||
|
||||
# No QT Linguist on MXE
|
||||
if((MINGW) AND (${CMAKE_CROSSCOMPILING}) AND (NOT USING_CONAN))
|
||||
set(ENABLE_TRANSLATIONS OFF)
|
||||
endif()
|
||||
|
||||
############################################
|
||||
# Miscellaneous options #
|
||||
############################################
|
||||
@ -138,10 +129,6 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_
|
||||
set(ENABLE_PCH OFF) # broken
|
||||
endif()
|
||||
|
||||
if( ${CMAKE_VERSION} VERSION_LESS "3.16.0")
|
||||
set(ENABLE_PCH OFF) #not supported
|
||||
endif()
|
||||
|
||||
if(ENABLE_PCH)
|
||||
macro(enable_pch name)
|
||||
target_precompile_headers(${name} PRIVATE $<$<COMPILE_LANGUAGE:CXX>:<StdInc.h$<ANGLE-R>>)
|
||||
@ -296,13 +283,6 @@ if(CMAKE_COMPILER_IS_GNUCXX OR NOT WIN32)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-sign-compare") # low chance of any significant issues
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-varargs") # emitted in fuzzylite headers, disabled
|
||||
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-pragmas") # emitted only by ancient gcc 5.5 in MXE build, remove after upgrade
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas") # emitted only by ancient gcc 5.5 in MXE build, remove after upgrade
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-variable") # emitted only by ancient gcc 5.5 in MXE build, remove after upgrade
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-maybe-uninitialized") # emitted only by ancient gcc 5.5 in MXE build, remove after upgrade
|
||||
endif()
|
||||
|
||||
if(ENABLE_STRICT_COMPILATION)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=array-bounds") # false positives in boost::multiarray during release build, keep as warning-only
|
||||
@ -407,14 +387,7 @@ endif()
|
||||
|
||||
if(ENABLE_LUA)
|
||||
find_package(luajit)
|
||||
# MXE paths hardcoded for current dependencies pack - tried and could not make it work another way
|
||||
if((MINGW) AND (${CMAKE_CROSSCOMPILING}) AND (DEFINED MSYS) AND (NOT TARGET luajit::luajit))
|
||||
add_library(luajit::luajit STATIC IMPORTED)
|
||||
set_target_properties(luajit::luajit PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "/usr/lib/mxe/usr/i686-w64-mingw32.static/include/luajit-2.0")
|
||||
set_target_properties(luajit::luajit PROPERTIES
|
||||
IMPORTED_LOCATION "/usr/lib/mxe/usr/i686-w64-mingw32.static/lib/libluajit-5.1.a")
|
||||
endif()
|
||||
|
||||
if(TARGET luajit::luajit)
|
||||
message(STATUS "Using LuaJIT provided by system")
|
||||
else()
|
||||
@ -580,9 +553,7 @@ if(WIN32)
|
||||
"${CMAKE_FIND_ROOT_PATH}/bin/*.dll")
|
||||
endif()
|
||||
|
||||
if((${CMAKE_CROSSCOMPILING}) AND (DEFINED MSYS))
|
||||
message(STATUS "Detected MXE build")
|
||||
elseif(CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
if(CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
# Copy debug versions of libraries if build type is debug
|
||||
set(debug_postfix d)
|
||||
endif()
|
||||
@ -685,7 +656,7 @@ if(WIN32)
|
||||
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
|
||||
# Use BundleUtilities to fix build when Vcpkg is used and disable it for mingw
|
||||
if(NOT (${CMAKE_CROSSCOMPILING}))
|
||||
add_subdirectory(win)
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user