--- a/CMakeLists.txt Wed May 16 18:22:28 2018 +0200
+++ b/CMakeLists.txt Wed Jul 31 23:14:27 2019 +0200
@@ -27,10 +27,8 @@
option(BUILD_SHARED_LIBS "Build libraries as shared modules (on)" ON)
if(WIN32 OR APPLE)
- option(PHYSFS_SYSTEM "Use system physfs (off)" OFF)
option(LUA_SYSTEM "Use system lua (off)" OFF)
else()
- option(PHYSFS_SYSTEM "Use system physfs (on)" ON)
option(LUA_SYSTEM "Use system lua (on)" ON)
endif()
@@ -53,6 +51,14 @@
option(NOVERSIONINFOUPDATE "Disable update of version_info.txt. To be used if source is in a git/repo that is NOT the hedgewars repo" OFF)
+if(BUILD_ENGINE_C AND NOT NOVIDEOREC)
+ if((CMAKE_BUILD_TYPE MATCHES "RELEASE") OR (CMAKE_BUILD_TYPE MATCHES "RELWITHDEBUGINFO"))
+ message("NOTE: Video recorder support disabled. It's incompatible with BUILD_ENGINE_C")
+ set(BUILD_ENGINE_C ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE)
+ else()
+ message("WARNING: Video recorder support is currently incompatible with BUILD_ENGINE_C, the video recorder won't work (but demos are fine)! See <https://issues.hedgewars.org/show_bug.cgi?id=722>.")
+ endif()
+endif()
if(BUILD_ENGINE_JS)
if(NOT CMAKE_TOOLCHAIN_FILE)
message(FATAL_ERROR "Missing emscripten toolchain file\nClean your cache and rerun cmake with -DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/cmake_modules/Platform/Emscripten.cmake")
@@ -61,7 +67,6 @@
set(BUILD_ENGINE_C ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE)
set(BUILD_ENGINE_LIBRARY ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE)
set(NOAUTOUPDATE ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE)
- set(PHYSFS_SYSTEM OFF CACHE STRING "Required for BUILD_ENGINE_JS" FORCE)
set(LUA_SYSTEM OFF CACHE STRING "Required for BUILD_ENGINE_JS" FORCE)
set(NOVIDEOREC ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE)
set(NOSERVER ON CACHE STRING "Required for BUILD_ENGINE_JS" FORCE)
@@ -72,17 +77,25 @@
set(target_library_install_dir "lib" CACHE PATH "install dest for libs")
endif()
+if("${CMAKE_SIZEOF_VOID_P}" EQUAL "4" AND UNIX AND NOT APPLE)
+ set(BUILD_ENGINE_C ON CACHE STRING "PAS2C force-enabled due to a freepascal 32 bit alignment bug" FORCE)
+endif()
+
#system paths for finding required fonts (see share/hedgewars/Data/fonts)
#subdirectories will NOT be searched.
#all fonts that can't be found will be bundled with hedgewars
set(FONTS_DIRS "" CACHE STRING "Additional paths to folders where required fonts can be found ( ; is separator)")
#versioning
-set(CPACK_PACKAGE_VERSION_MAJOR 0)
-set(CPACK_PACKAGE_VERSION_MINOR 9)
-set(CPACK_PACKAGE_VERSION_PATCH "24.1")
-set(HEDGEWARS_PROTO_VER 55)
-set(HEDGEWARS_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
+set(CPACK_PACKAGE_VERSION_MAJOR 1)
+set(CPACK_PACKAGE_VERSION_MINOR 0)
+set(CPACK_PACKAGE_VERSION_PATCH 0)
+set(HEDGEWARS_PROTO_VER 58)
+if((CMAKE_BUILD_TYPE MATCHES "RELEASE") OR (CMAKE_BUILD_TYPE MATCHES "RELWITHDEBUGINFO"))
+ set(HEDGEWARS_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
+else()
+ set(HEDGEWARS_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-dev")
+endif()
include(${CMAKE_MODULE_PATH}/revinfo.cmake)
message(STATUS "Building ${HEDGEWARS_VERSION}-r${HEDGEWARS_REVISION} (${HEDGEWARS_HASH})")
@@ -116,12 +129,21 @@
endif()
#set default compiler flags
-add_flag_append(CMAKE_C_FLAGS "-Wall -pipe")
-add_flag_append(CMAKE_C_FLAGS_RELEASE "-O2")
-add_flag_append(CMAKE_C_FLAGS_DEBUG "-Wextra -O0")
-add_flag_append(CMAKE_CXX_FLAGS "-Wall -pipe")
-add_flag_append(CMAKE_CXX_FLAGS_RELEASE "-O2")
-add_flag_append(CMAKE_CXX_FLAGS_DEBUG "-Wextra -O0")
+if(WIN32 AND VCPKG_TOOLCHAIN)
+ add_flag_append(CMAKE_C_FLAGS "/DWIN32_VCPKG /Wall")
+ add_flag_append(CMAKE_C_FLAGS_RELEASE "/Ox")
+ add_flag_append(CMAKE_C_FLAGS_DEBUG "/Od")
+ add_flag_append(CMAKE_CXX_FLAGS "/DWIN32_VCPKG /Wall")
+ add_flag_append(CMAKE_CXX_FLAGS_RELEASE "/Ox")
+ add_flag_append(CMAKE_CXX_FLAGS_DEBUG "/Od")
+else()
+ add_flag_append(CMAKE_C_FLAGS "-Wall -pipe")
+ add_flag_append(CMAKE_C_FLAGS_RELEASE "-O2")
+ add_flag_append(CMAKE_C_FLAGS_DEBUG "-Wextra -O0")
+ add_flag_append(CMAKE_CXX_FLAGS "-Wall -pipe")
+ add_flag_append(CMAKE_CXX_FLAGS_RELEASE "-O2")
+ add_flag_append(CMAKE_CXX_FLAGS_DEBUG "-Wextra -O0")
+endif()
#CMake adds a lot of additional configuration flags, so let's clear them up
if(MINIMAL_FLAGS)
@@ -199,40 +221,32 @@
#physfs discovery
-if(PHYSFS_SYSTEM)
- if(NOT PHYSFS_LIBRARY OR NOT PHYSFS_INCLUDE_DIR)
- find_package(PhysFS)
- endif()
-
- find_file(physfs_h physfs.h ${PHYSFS_INCLUDE_DIR})
- if(physfs_h)
- file(STRINGS ${physfs_h} physfs_majorversion REGEX "PHYSFS_VER_MAJOR[\t' ']+[0-9]+")
- file(STRINGS ${physfs_h} physfs_minorversion REGEX "PHYSFS_VER_MINOR[\t' ']+[0-9]+")
- file(STRINGS ${physfs_h} physfs_patchversion REGEX "PHYSFS_VER_PATCH[\t' ']+[0-9]+")
- string(REGEX MATCH "([0-9]+)" physfs_majorversion "${physfs_majorversion}")
- string(REGEX MATCH "([0-9]+)" physfs_minorversion "${physfs_minorversion}")
- string(REGEX MATCH "([0-9]+)" physfs_patchversion "${physfs_patchversion}")
- set(physfs_detected_ver "${physfs_majorversion}.${physfs_minorversion}.${physfs_patchversion}")
+if(NOT PHYSFS_LIBRARY OR NOT PHYSFS_INCLUDE_DIR)
+ find_package(PhysFS)
+endif()
- if(${physfs_detected_ver} VERSION_LESS 2.0.0)
- message(FATAL_ERROR "PhysFS version is too old (detected ${physfs_detected_ver}, required 2.0.0)\n"
- "Perform an update or rerun cmake with -DPHYSFS_SYSTEM=off to build the internal version")
- endif()
- endif()
+find_file(physfs_h physfs.h ${PHYSFS_INCLUDE_DIR})
+if(physfs_h)
+ file(STRINGS ${physfs_h} physfs_majorversion REGEX "PHYSFS_VER_MAJOR[\t' ']+[0-9]+")
+ file(STRINGS ${physfs_h} physfs_minorversion REGEX "PHYSFS_VER_MINOR[\t' ']+[0-9]+")
+ file(STRINGS ${physfs_h} physfs_patchversion REGEX "PHYSFS_VER_PATCH[\t' ']+[0-9]+")
+ string(REGEX MATCH "([0-9]+)" physfs_majorversion "${physfs_majorversion}")
+ string(REGEX MATCH "([0-9]+)" physfs_minorversion "${physfs_minorversion}")
+ string(REGEX MATCH "([0-9]+)" physfs_patchversion "${physfs_patchversion}")
+ set(physfs_detected_ver "${physfs_majorversion}.${physfs_minorversion}.${physfs_patchversion}")
- if(PHYSFS_LIBRARY AND PHYSFS_INCLUDE_DIR)
- #use an IMPORTED tharget so that we can just use 'physfs' to link
- add_library(physfs UNKNOWN IMPORTED)
- set_target_properties(physfs PROPERTIES IMPORTED_LOCATION ${PHYSFS_LIBRARY})
- else()
- message(FATAL_ERROR "Missing PhysFS! Rerun cmake with -DPHYSFS_SYSTEM=off to build the internal version")
+ if(${physfs_detected_ver} VERSION_LESS 3.0.0)
+ message(FATAL_ERROR "PhysFS version is too old (detected ${physfs_detected_ver}, required 3.0.0)\n"
+ "Perform an update of PhysFS to fix this.")
endif()
+endif()
+
+if(PHYSFS_LIBRARY AND PHYSFS_INCLUDE_DIR)
+ #use an IMPORTED tharget so that we can just use 'physfs' to link
+ add_library(physfs UNKNOWN IMPORTED)
+ set_target_properties(physfs PROPERTIES IMPORTED_LOCATION ${PHYSFS_LIBRARY})
else()
- if(NOT PHYSFS_LIBRARY OR NOT PHYSFS_INCLUDE_DIR)
- message(STATUS "PhysFS will be provided by the bundled sources")
- endif()
- set(physfs_output_name "hwphysfs")
- add_subdirectory(misc/libphysfs)
+ message(FATAL_ERROR "Missing PhysFS! Install PhysFS to fix this.")
endif()
find_package_or_disable_msg(LIBAV NOVIDEOREC "Video recording will not be built")