diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9e0511921de24..7d83acb6370e8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -46,7 +46,10 @@ endif()
message(STATUS "${PROJECT_NAME} build environment --")
message(STATUS "Build realm is: ${CMAKE_SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_PROCESSOR}")
-if (NOT CMAKE_BUILD_TYPE)
+get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL
+ PROPERTY GENERATOR_IS_MULTI_CONFIG
+)
+if (NOT CMAKE_BUILD_TYPE AND NOT GENERATOR_IS_MULTI_CONFIG)
set(CMAKE_BUILD_TYPE Debug)
endif ()
@@ -94,6 +97,10 @@ endif ()
include(CheckCXXCompilerFlag)
+if(DEFINED ENV{MSYSTEM})
+ set(MSYS2 True)
+ add_definitions(-DMSYS2)
+endif()
#FIXME: Add dest build choice: m32 for 32 bit or m64 for 64 bit version
#add_definitions("-m32")
#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
diff --git a/CMakeModules/Find/FindSDL2_image.cmake b/CMakeModules/Find/FindSDL2_image.cmake
index f42a15176c03e..14aeb29476da6 100644
--- a/CMakeModules/Find/FindSDL2_image.cmake
+++ b/CMakeModules/Find/FindSDL2_image.cmake
@@ -107,6 +107,10 @@ if(NOT DYNAMIC_LINKING AND PKG_CONFIG_FOUND)
find_package(JPEG REQUIRED)
find_package(PNG REQUIRED)
find_package(TIFF REQUIRED)
+ pkg_check_modules(WEBP REQUIRED IMPORTED_TARGET libwebp)
+ target_link_libraries(TIFF::TIFF INTERFACE
+ PkgConfig::WEBP
+ )
find_library(JBIG jbig REQUIRED)
find_package(LibLZMA REQUIRED)
target_link_libraries(SDL2_image::SDL2_image-static INTERFACE
@@ -117,16 +121,63 @@ if(NOT DYNAMIC_LINKING AND PKG_CONFIG_FOUND)
LibLZMA::LibLZMA
${ZSTD}
)
- pkg_check_modules(WEBP REQUIRED IMPORTED_TARGET libwebp)
pkg_check_modules(ZIP REQUIRED IMPORTED_TARGET libzip)
pkg_check_modules(ZSTD REQUIRED IMPORTED_TARGET libzstd)
pkg_check_modules(DEFLATE REQUIRED IMPORTED_TARGET libdeflate)
target_link_libraries(SDL2_image::SDL2_image-static INTERFACE
- PkgConfig::WEBP
PkgConfig::ZIP
PkgConfig::ZSTD
PkgConfig::DEFLATE
)
+ if(MSYS2)
+ # only SHARED: find_package(libavif REQUIRED)
+ find_library(AVIF avif)
+ add_library(libavif STATIC IMPORTED)
+ set_target_properties(libavif PROPERTIES
+ IMPORTED_LOCATION ${AVIF}
+ )
+ pkg_check_modules(libyuv REQUIRED IMPORTED_TARGET libyuv)
+ pkg_check_modules(dav1d REQUIRED IMPORTED_TARGET dav1d)
+ pkg_check_modules(rav1e REQUIRED IMPORTED_TARGET rav1e)
+ pkg_check_modules(SvtAv1Enc REQUIRED IMPORTED_TARGET SvtAv1Enc)
+ target_link_libraries(PkgConfig::rav1e INTERFACE
+ ntdll
+ )
+ pkg_check_modules(aom REQUIRED IMPORTED_TARGET aom)
+ target_link_libraries(libavif INTERFACE
+ PkgConfig::libyuv
+ PkgConfig::dav1d
+ PkgConfig::rav1e
+ PkgConfig::SvtAv1Enc
+ PkgConfig::aom
+ )
+ pkg_check_modules(JXL REQUIRED IMPORTED_TARGET libjxl libjxl_threads)
+ # only SHARED: find_package(hwy REQUIRED)
+ pkg_check_modules(hwy REQUIRED IMPORTED_TARGET libhwy)
+ target_link_libraries(PkgConfig::JXL INTERFACE
+ PkgConfig::hwy
+ PkgConfig::BROTLI
+ )
+ find_package(libjpeg-turbo REQUIRED)
+ pkg_check_modules(Lerc REQUIRED IMPORTED_TARGET Lerc)
+ target_link_libraries(SDL2_image::SDL2_image-static INTERFACE
+ libavif
+ PkgConfig::JXL
+ PkgConfig::Lerc
+ libjpeg-turbo::turbojpeg
+ )
+ pkg_check_modules(WEBPDEMUX REQUIRED IMPORTED_TARGET libwebpdemux)
+ pkg_check_modules(WEBPDECODER REQUIRED IMPORTED_TARGET libwebpdecoder)
+ target_link_libraries(TIFF::TIFF INTERFACE
+ WEBPDEMUX
+ WEBPDECODER
+ JPEG::JPEG
+ )
+ pkg_check_modules(sharpyuv REQUIRED IMPORTED_TARGET libsharpyuv)
+ target_link_libraries(PkgConfig::WEBP INTERFACE
+ PkgConfig::sharpyuv
+ )
+ endif()
elseif(NOT TARGET SDL2_image::SDL2_image)
add_library(SDL2_image::SDL2_image UNKNOWN IMPORTED)
set_target_properties(SDL2_image::SDL2_image PROPERTIES
diff --git a/CMakeModules/Find/FindSDL2_mixer.cmake b/CMakeModules/Find/FindSDL2_mixer.cmake
index e14a1557f42b1..8c6dc1625cadb 100644
--- a/CMakeModules/Find/FindSDL2_mixer.cmake
+++ b/CMakeModules/Find/FindSDL2_mixer.cmake
@@ -119,6 +119,21 @@ if(PKG_CONFIG_FOUND)
target_link_libraries(SDL2_mixer::SDL2_mixer-static INTERFACE
PkgConfig::FLAC
)
+ if(MSYS2)
+ pkg_check_modules(libmpg123 REQUIRED IMPORTED_TARGET libmpg123)
+ pkg_check_modules(opus REQUIRED IMPORTED_TARGET opus)
+ pkg_check_modules(opusfile REQUIRED IMPORTED_TARGET opusfile)
+ # SHARED only: find_package(Ogg REQUIRED)
+ pkg_check_modules(ogg REQUIRED IMPORTED_TARGET ogg)
+ target_link_libraries(PkgConfig::opusfile INTERFACE
+ PkgConfig::ogg
+ PkgConfig::opus
+ )
+ target_link_libraries(SDL2_mixer::SDL2_mixer-static INTERFACE
+ PkgConfig::libmpg123
+ PkgConfig::opusfile
+ )
+ endif()
elseif(TARGET SDL2_mixer::SDL2_mixer)
pkg_check_modules(FLAC REQUIRED IMPORTED_TARGET flac)
target_link_libraries(SDL2_mixer::SDL2_mixer INTERFACE
diff --git a/CMakeModules/Find/FindSDL2_ttf.cmake b/CMakeModules/Find/FindSDL2_ttf.cmake
index 1bddc196f4860..e7519c54473fe 100644
--- a/CMakeModules/Find/FindSDL2_ttf.cmake
+++ b/CMakeModules/Find/FindSDL2_ttf.cmake
@@ -104,16 +104,43 @@ if (NOT DYNAMIC_LINKING AND PKG_CONFIG_FOUND)
)
endif()
message(STATUS "Searching for SDL_ttf deps libraries --")
- find_package(Freetype REQUIRED)
- find_package(Harfbuzz REQUIRED)
- target_link_libraries(SDL2_ttf::SDL2_ttf-static INTERFACE
- Freetype::Freetype
- harfbuzz::harfbuzz
- )
+ if(MSYS2)
+ pkg_check_modules(Freetype REQUIRED IMPORTED_TARGET freetype2)
+ pkg_check_modules(harfbuzz REQUIRED IMPORTED_TARGET harfbuzz)
+ pkg_check_modules(graphite REQUIRED IMPORTED_TARGET graphite2)
+ target_link_libraries(PkgConfig::harfbuzz INTERFACE
+ PkgConfig::graphite
+ rpcrt4
+ )
+ target_link_libraries(SDL2_ttf::SDL2_ttf-static INTERFACE
+ PkgConfig::Freetype
+ PkgConfig::harfbuzz
+ )
+ else()
+ find_package(Freetype REQUIRED)
+ find_package(Harfbuzz REQUIRED)
+ get_target_property(_loc harfbuzz::harfbuzz IMPORTED_LOCATION)
+ set_target_properties(harfbuzz::harfbuzz PROPERTIES
+ IMPORTED_IMPLIB_RELEASE ${_loc}
+ IMPORTED_IMPLIB_DEBUG ${_loc}
+ IMPORTED_IMPLIB_RELWITHDEBINFO ${_loc}
+ )
+ target_link_libraries(SDL2_ttf::SDL2_ttf-static INTERFACE
+ Freetype::Freetype
+ harfbuzz::harfbuzz
+ )
+ endif()
pkg_check_modules(BROTLI REQUIRED IMPORTED_TARGET libbrotlidec libbrotlicommon)
- target_link_libraries(Freetype::Freetype INTERFACE
- PkgConfig::BROTLI
- )
+ if(MSYS2)
+ pkg_check_modules(bzip2 REQUIRED IMPORTED_TARGET bzip2)
+ target_link_libraries(PkgConfig::Freetype INTERFACE
+ PkgConfig::bzip2
+ )
+ else()
+ target_link_libraries(Freetype::Freetype INTERFACE
+ PkgConfig::BROTLI
+ )
+ endif()
elseif(NOT TARGET SDL2_ttf::SDL2_ttf)
add_library(SDL2_ttf::SDL2_ttf UNKNOWN IMPORTED)
set_target_properties(SDL2_ttf::SDL2_ttf PROPERTIES
diff --git a/CMakePresets.json b/CMakePresets.json
index 2ec03e333a6b6..52c38460a4390 100644
--- a/CMakePresets.json
+++ b/CMakePresets.json
@@ -6,6 +6,18 @@
"patch": 0
},
"configurePresets": [
+ {
+ "name": "windows-tiles-sounds-x64",
+ "binaryDir": "${sourceDir}/out/build/${presetName}",
+ "displayName": "Windows Tiles Sounds x64 MSYS2 (MinGW)",
+ "description": "Target Windows (64-bit) with the MingGW Win64 development environment.",
+ "generator": "Ninja Multi-Config",
+ "cacheVariables": {
+ "DYNAMIC_LINKING": "False",
+ "CURSES": "False", "LOCALIZE": "True", "TILES": "True", "SOUND": "True", "TESTS": "True",
+ "CMAKE_INSTALL_MESSAGE": "NEVER"
+ }
+ },
{
"name": "windows-tiles-sounds-x64-msvc",
"binaryDir": "${sourceDir}/out/build/${presetName}",
@@ -19,7 +31,7 @@
"CMAKE_PROJECT_INCLUDE_BEFORE": "${sourceDir}/build-scripts/${presetName}.cmake",
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/build-scripts/MSVC.cmake",
"VCPKG_TARGET_TRIPLET": "x64-windows-static",
- "DYNAMIC_LINKING": "False", "CMAKE_BUILD_TYPE": "RelWithDebInfo",
+ "DYNAMIC_LINKING": "False",
"CURSES": "False", "LOCALIZE": "True", "TILES": "True", "SOUND": "True", "TESTS": "True",
"CMAKE_INSTALL_MESSAGE": "NEVER"
}
@@ -31,7 +43,7 @@
"description": "Target Linux (64-bit) with the GCC development environment.",
"generator": "Ninja Multi-Config",
"cacheVariables": {
- "DYNAMIC_LINKING": "True", "CMAKE_BUILD_TYPE": "RelWithDebInfo",
+ "DYNAMIC_LINKING": "True",
"CURSES": "False", "LOCALIZE": "True", "TILES": "True", "SOUND": "True", "TESTS": "True",
"CMAKE_INSTALL_MESSAGE": "NEVER"
}
@@ -53,6 +65,10 @@
}
],
"buildPresets": [
+ {
+ "name": "windows-tiles-sounds-x64",
+ "configurePreset": "windows-tiles-sounds-x64"
+ },
{
"name": "linux-tiles-sounds-x64",
"configurePreset": "linux-tiles-sounds-x64"
@@ -60,6 +76,10 @@
{
"name": "linux-tiles-sounds-x64-vcpkg",
"configurePreset": "linux-tiles-sounds-x64-vcpkg"
+ },
+ {
+ "name": "windows-tiles-sounds-x64-msvc",
+ "configurePreset": "windows-tiles-sounds-x64-msvc"
}
],
"testPresets": [
diff --git a/build-scripts/.gitignore b/build-scripts/.gitignore
new file mode 100644
index 0000000000000..75bbd2b1099dd
--- /dev/null
+++ b/build-scripts/.gitignore
@@ -0,0 +1,2 @@
+sym-db
+sym-locatedb
diff --git a/build-scripts/MSVC.cmake b/build-scripts/MSVC.cmake
index b2d37ad0715ea..458176b9ae97b 100644
--- a/build-scripts/MSVC.cmake
+++ b/build-scripts/MSVC.cmake
@@ -21,6 +21,7 @@ C++ flags used by all builds:
/GF Eliminate Duplicate Strings
/wd4068 unknown pragma
/wd4146 negate unsigned
+/wd4661 explicit template undefined
/wd4819 codepage?
/wd6237 short-circuit eval
/wd6319 a, b: unused a
@@ -54,7 +55,7 @@ set(CMAKE_C_COMPILER cl.exe)
set(CMAKE_CXX_COMPILER ${CMAKE_C_COMPILER})
set(CMAKE_CXX_FLAGS_INIT "\
/MP /utf-8 /bigobj /permissive- /sdl- /FC /Gd /GS- /Gy /GF \
-/wd4068 /wd4146 /wd4819 /wd6237 /wd6319 /wd26444 /wd26451 /wd26495 /WX- /W1 \
+/wd4068 /wd4146 /wd4661 /wd4819 /wd6237 /wd6319 /wd26444 /wd26451 /wd26495 /WX- /W1 \
/TP /Zc:forScope /Zc:inline /Zc:wchar_t"
)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT
@@ -71,7 +72,6 @@ add_link_options(
/OPT:REF
/OPT:ICF
/LTCG:OFF
- /MANIFEST:NO
/INCREMENTAL:NO
/DYNAMICBASE
/NXCOMPAT
diff --git a/build-scripts/VsDevCmd.cmake b/build-scripts/VsDevCmd.cmake
deleted file mode 100644
index efdefa3bdb3ab..0000000000000
--- a/build-scripts/VsDevCmd.cmake
+++ /dev/null
@@ -1,115 +0,0 @@
-#[=======================================================================[
-
-VsDevCmd.cmake
---------------
-
-Run VsDevCmd.bat and extracts environment variables it changes.
-Inject them into the global scope and _MSVC_DEVENV for
-CMakeUserPreset.json at a later step.
-
-#]=======================================================================]
-
-if("$ENV{VSCMD_VER}" STREQUAL "")
- # This cmake process is running under VsDevCmd.bat or VS IDE GUI
- # Avoid to run VsDevCmd.bat twice
-
- if ("$ENV{DevEnvDir}" STREQUAL "")
- # Use Community Edition when not specified
- file(DOWNLOAD https://github.com/microsoft/vswhere/releases/download/3.0.3/vswhere.exe vswhere.exe
- TLS_VERIFY ON
- EXPECTED_HASH SHA1=8569081535767af53811f47c0e6abeabd695f8f4
- STATUS vswhere
- )
- list(GET vswhere 0 vswhere)
- if("0" EQUAL vswhere)
- execute_process(COMMAND vswhere.exe -all -latest -property productPath
- OUTPUT_VARIABLE DevEnvDir
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- cmake_path(GET DevEnvDir PARENT_PATH DevEnvDir)
- set(ENV{DevEnvDir} ${DevEnvDir})
- else()
- set(ENV{DevEnvDir} "C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/")
- endif()
- endif()
-
- # Run VsDevCmd.bat and set all environment variables it changes
- set(DevEnvDir $ENV{DevEnvDir})
- cmake_path(APPEND DevEnvDir ../Tools/VsDevCmd.bat OUTPUT_VARIABLE VSDEVCMD_BAT)
- cmake_path(NATIVE_PATH VSDEVCMD_BAT NORMALIZE VSDEVCMD_BAT)
- cmake_path(NATIVE_PATH DevEnvDir NORMALIZE DevEnvDir)
- set(ENV{DevEnvDir} ${DevEnvDir})
- set(ENV{VSDEVCMD_BAT} \"${VSDEVCMD_BAT}\")
- # Use short DOS path names because of spaces in path names
- # See https://gitlab.kitware.com/cmake/cmake/-/issues/16321
- execute_process(COMMAND cmd /c for %A in (%VSDEVCMD_BAT%) do @echo %~sA
- OUTPUT_STRIP_TRAILING_WHITESPACE
- OUTPUT_VARIABLE VSDEVCMD_BAT)
- # Run it
- execute_process(COMMAND cmd /c ${VSDEVCMD_BAT} -no_logo -arch=amd64 && set
- OUTPUT_STRIP_TRAILING_WHITESPACE
- OUTPUT_VARIABLE _ENV)
- # This list the environment variables we need.
- # It is essentially a revised result of:
- # comm -1 -3 <(sort before.txt) <(sort after.txt) |egrep -o '^[^=]+='"
- set(_replace
- ExtensionSdkDir=
- Framework40Version=
- FrameworkDIR64=
- FrameworkDir=
- FrameworkVersion64=
- FrameworkVersion=
- INCLUDE=
- LIB=
- LIBPATH=
- NETFXSDKDir=
- Path=
- UCRTVersion=
- UniversalCRTSdkDir=
- VCIDEInstallDir=
- VCINSTALLDIR=
- VCToolsInstallDir=
- VCToolsRedistDir=
- VCToolsVersion=
- VS170COMNTOOLS=
- VSCMD_ARG_HOST_ARCH=
- VSCMD_ARG_TGT_ARCH=
- VSCMD_ARG_app_plat=
- VSCMD_VER=
- VSINSTALLDIR=
- VisualStudioVersion=
- WindowsLibPath=
- WindowsSDKLibVersion=
- WindowsSDKVersion=
- WindowsSDK_ExecutablePath_x64=
- WindowsSDK_ExecutablePath_x86=
- WindowsSdkBinPath=
- WindowsSdkDir=
- WindowsSdkVerBinPath=
- )
- string(REGEX REPLACE ";" "\\\\;" _ENV "${_ENV}")
- string(REGEX MATCHALL "[^\n]+\n" _ENV "${_ENV}")
- foreach(_env IN LISTS _ENV)
- string(REGEX MATCH ^[^=]+ _key "${_env}")
- string(REGEX MATCH =[^\n]+\n _value "${_env}")
- # We may get some spurious output. Skip the line
- if(NOT _value MATCHES ^=)
- continue()
- endif()
- string(SUBSTRING "${_value}" 1 -1 _value) # Removes the = at begin
- string(STRIP "${_value}" _value) # Remove the \r
- list(FIND _replace ${_key}= _idx)
- if(-1 EQUAL _idx)
- continue()
- endif()
- list(REMOVE_AT _replace ${_idx})
- set(ENV{${_key}} "${_value}")
- string(REPLACE \\ \\\\ _value "${_value}")
- set(_json_entry "\"${_key}\": \"${_value}\"")
- if("${_MSVC_DEVENV}" STREQUAL "")
- string(APPEND _MSVC_DEVENV "${_json_entry}")
- continue()
- endif()
- string(APPEND _MSVC_DEVENV ",\n${_json_entry}")
- endforeach() # _ENV
-endif() # VSCMD_VER
-
diff --git a/build-scripts/sym b/build-scripts/sym
new file mode 100644
index 0000000000000..91274545d8d79
--- /dev/null
+++ b/build-scripts/sym
@@ -0,0 +1,28 @@
+# Find a symbol in all MSYS2 system object libraries
+# Print files for find_package() or pkg_check_modules()
+
+[[ ! -f sym-locatedb ]] && {
+ echo "Creating filesystem database ..."
+ updatedb --localpaths='/usr/lib /mingw64/lib' \
+ --output=sym-locatedb
+}
+[[ ! -f sym-db ]] && {
+ echo "Creating symbols database ..."
+ locate --database=sym-locatedb \*.a | \
+ parallel -j 8 nm --print-file-name --defined-only >>sym-db
+}
+echo "Searching symbol ..."
+definitions=$(grep $1$ sym-db)
+found=$(cut --delimiter=\ --fields=3 <<<"$definitions" | sort --unique)
+echo "Found symbols:"
+echo "$found"
+files=$(cygpath --unix -f - <<<"$definitions")
+files=$(cut --delimiter=: --fields=1 <<<"$files" |sort --unique)
+echo "Files containing symbols:"
+echo "$files"
+packages=$(pacman --query --owns --quiet $files |sort --unique)
+echo "Packages containing files:"
+echo "$packages"
+pfiles=$(pacman --query --list --quiet $packages)
+echo "Useful files in packages:"
+echo "$pfiles" |egrep 'pkgconfig|\.cmake'
diff --git a/build-scripts/windows-tiles-sounds-x64-msvc.cmake b/build-scripts/windows-tiles-sounds-x64-msvc.cmake
index 6bb7d17cd9d7b..5d3ea10c0986f 100644
--- a/build-scripts/windows-tiles-sounds-x64-msvc.cmake
+++ b/build-scripts/windows-tiles-sounds-x64-msvc.cmake
@@ -7,9 +7,6 @@ Pre-load script for Microsoft Visual Studio builds.
Used by CMakePresets.json -> "cacheVariables" -> "CMAKE_PROJECT_INCLUDE_BEFORE".
-When CMake does not run under VS environment, it sources the VsDevCmd.bat on it own.
-It then writes CMakeUserPresets.json -> "buildPresets" -> "environment"
-
#]=======================================================================]
# Ref https://github.com/actions/virtual-environments/blob/win19/20220515.1/images/win/Windows2019-Readme.md#environment-variables
@@ -20,19 +17,3 @@ endif()
if ("$ENV{VCPKG_ROOT}" STREQUAL "" AND WIN32)
set(ENV{VCPKG_ROOT} $CACHE{VCPKG_ROOT})
endif()
-
-include(${CMAKE_SOURCE_DIR}/build-scripts/VsDevCmd.cmake)
-
-# It's fine to keep @_MSVC_DEVENV@ undefined
-set(BUILD_PRESET_NAME "windows-tiles-sounds-x64-msvc")
-set(CONFIGURE_PRESET "windows-tiles-sounds-x64-msvc")
-configure_file(
- ${CMAKE_SOURCE_DIR}/build-scripts/CMakeUserPresets.json.in
- ${CMAKE_SOURCE_DIR}/CMakeUserPresets.json
- @ONLY
-)
-
-# Ninja is provided by Microsoft but not in the Path
-if (CMAKE_GENERATOR MATCHES "^Ninja")
- set(CMAKE_MAKE_PROGRAM $ENV{DevEnvDir}\\CommonExtensions\\Microsoft\\CMake\\Ninja\\ninja.exe CACHE PATH "")
-endif()
diff --git a/data/application_manifest.xml b/data/application_manifest.xml
index 07d043b30b4d4..11193850cc5d3 100644
--- a/data/application_manifest.xml
+++ b/data/application_manifest.xml
@@ -1,11 +1,6 @@
-
-
- UTF-8
-
-
+
+
+
+
+
+
+
+
+
+ UTF-8
+
+
diff --git a/doc/COMPILING/COMPILING-CMAKE.md b/doc/COMPILING/COMPILING-CMAKE.md
index 83b2d0e9f6290..ff8b969bb4885 100644
--- a/doc/COMPILING/COMPILING-CMAKE.md
+++ b/doc/COMPILING/COMPILING-CMAKE.md
@@ -25,7 +25,7 @@ For the official way to build CataclysmDDA, see:
You'll need to have these libraries and their development headers installed in order to build CataclysmDDA:
* General
- * `cmake` >= 3.0.0
+ * `cmake` >= 3.20.0
* `gcc-libs`
* `glibc`
* `zlib`
@@ -72,28 +72,7 @@ Obtain the packages listed above with your system package manager.
## Windows Environment (MSYS2)
-1. Follow steps from here:
-2. Install CataclysmDDA build deps:
-
- ```
- pacman -S mingw-w64-i686-toolchain msys/git \
- mingw-w64-i686-cmake \
- mingw-w64-i686-SDL2_{image,mixer,ttf} \
- ncurses-devel \
- gettext-devel
- ```
-
- This should get your environment set up to build both the console and tiles versions for Windows.
-
- **NOTE**: This is only for 32bit builds. 64bit builds require the x86_64 instead of the i686 packages listed above:
-
- ```
- pacman -S mingw-w64-x86_64-toolchain msys/git \
- mingw-w64-x86_64-cmake \
- mingw-w64-x86_64-SDL2_{image,mixer,ttf} \
- ncurses-devel \
- gettext-devel
- ```
+Please refer to `COMPILING-MSYS.md`
**NOTE**: If you're trying to test with Jetbrains CLion, point to the CMake version in the msys32/mingw32 path instead of using the built in. This will let CMake detect the installed packages.
@@ -138,75 +117,14 @@ $ cmake-gui ..
## CMake Build for MSYS2 (MinGW)
-**NOTE**: For development purposes it is preferred to use `MinGW Win64 Shell` or `MinGW Win32 Shell` instead of `MSYS2 Shell`. In the other case, you will need to set the `PATH` variable manually.
-
-For MinGW, MSYS, or MSYS2 you should set [Makefiles generator](https://cmake.org/cmake/help/v3.0/manual/cmake-generators.7.html) to "MSYS Makefiles". Setting it to "MinGW Makefiles" might work as well, but might also require some additional hackery.
-
-Example:
+1. Follow `COMPILING-MSYS.md`
+2. Run
```
-$ cd
-$ mkdir build
-$ cd build
-$ cmake .. -G "MSYS Makefiles"
-$ make # or $ cmake --build .
+cmake --preset windows-tiles-sounds-x64
+cmake --build --preset windows-tiles-sounds-x64
```
-The resulting binary will be placed inside the source code directory.
-
-Shared libraries:
-
-If you got a `libgcc_s_dw2-1.dll not found` error, you need to copy shared libraries to the directory with the CataclysmDDA executables.
-
-**NOTE**: For `-DRELEASE=OFF` development builds, you can automate the copy process with:
-
-```
-$ make install
-```
-
-However, it will likely fail because you have a different build environment setup. :)
-
-Currently known dependencies (may be outdated; use `ldd.exe` to correct it for your system):
-
-* MINGW deps:
- * `libwinpthread-1.dll`
- * `libgcc_s_dw2-1.dll`
- * `libstdc++-6.dll`
-
-* LOCALIZE deps:
- * `libintl-8.dll`
- * `libiconv-2.dll`
-
-* TILES deps:
- * `SDL2.dll`
- * `SDL2_ttf.dll`
- * `libfreetype-6.dll`
- * `libbz2-1.dll`
- * `libharfbuzz-0.dll`
- * `SDL2_image.dll`
- * `libpng16-16.dll`
- * `libjpeg-8.dll`
- * `libtiff-5.dll`
- * `libjbig-0.dll`
- * `liblzma-5.dll`
- * `libwebp-5.dll`
- * `zlib1.dll`
- * `libglib-2.0-0.dll`
-
-* SOUND deps:
- * `SDL2_mixer.dll`
- * `libFLAC-8.dll`
- * `libogg-0.dll`
- * `libfluidsynth-1.dll`
- * `libportaudio-2.dll`
- * `libsndfile-1.dll`
- * `libvorbis-0.dll`
- * `libvorbisenc-2.dll`
- * `libmodplug-1.dll`
- * `smpeg2.dll`
- * `libvorbisfile-3.dll`
-
-
## CMake Build for Visual Studio / MSBuild
CMake can generate `.sln` and `.vcxproj` files used either by Visual Studio itself or by the MSBuild command line compiler (if you don't want a full fledged IDE) and have more "native" binaries than what MSYS/Cygwin can provide.
diff --git a/doc/COMPILING/COMPILING-MSYS.md b/doc/COMPILING/COMPILING-MSYS.md
index 3a8af2ac7b269..5a64c7acdfdfd 100644
--- a/doc/COMPILING/COMPILING-MSYS.md
+++ b/doc/COMPILING/COMPILING-MSYS.md
@@ -2,15 +2,19 @@
This guide contains instructions for compiling Cataclysm-DDA on Windows under MSYS2. **PLEASE NOTE:** These instructions *are not intended* to produce a redistributable copy of CDDA. Please download the official builds from the website or [cross-compile from Linux](https://github.com/CleverRaven/Cataclysm-DDA/blob/master/doc/COMPILING/COMPILING.md#cross-compile-to-windows-from-linux) if that is your intention.
-These instructions were written using 64-bit Windows 7 and the 64-bit version of MSYS2; the steps should be the same for other versions of Windows.
## Prerequisites:
-* Windows 7, 8, 8.1, or 10
+**Note:** Windows XP is unsupported!
+
+### MINGW64
+* Windows 7, 8, 8.1
* NTFS partition with ~10 Gb free space (~2 Gb for MSYS2 installation, ~3 Gb for repository and ~5 Gb for ccache)
* 64-bit version of MSYS2
-**Note:** Windows XP is unsupported!
+### UCRT64
+* Windows 10 and later
+
## Installation:
@@ -20,6 +24,15 @@ These instructions were written using 64-bit Windows 7 and the 64-bit version of
3. After installation, run MSYS2 64bit now.
+When working from Microsoft Terminal default MSYS2 profile, run:
+```
+MSYSTEM=MINGW64 bash -l
+```
+or
+```
+MSYSTEM=UCRT64 bash -l
+```
+
## Configuration:
1. Update the package database and core system packages:
@@ -38,41 +51,17 @@ pacman -Su
4. Install packages required for compilation:
+-> Windows 7, 8, 8.1
```bash
-pacman -S git make mingw-w64-x86_64-{astyle,ccache,gcc,libmad,libwebp,pkg-config,SDL2} mingw-w64-x86_64-SDL2_{image,mixer,ttf}
+pacman -S git make ncurses-devel gettext-devel mingw-w64-x86_64-{astyle,ccache,cmake,gcc,libmad,libwebp,pkgconf,SDL2,libzip,libavif} mingw-w64-x86_64-SDL2_{image,mixer,ttf}
```
-5. Close MSYS2.
-
-6. Update path variables in the system-wide profile file (e.g. `C:\dev\msys64\etc\profile`) as following:
-
-- find lines:
-
-```
- MSYS2_PATH="/usr/local/bin:/usr/bin:/bin"
- MANPATH='/usr/local/man:/usr/share/man:/usr/man:/share/man'
- INFOPATH='/usr/local/info:/usr/share/info:/usr/info:/share/info'
-```
-
-and
-
-```
- PKG_CONFIG_PATH="/usr/lib/pkgconfig:/usr/share/pkgconfig:/lib/pkgconfig"
-```
-
-- and replace them with:
-
-```
- MSYS2_PATH="/usr/local/bin:/usr/bin:/bin:/mingw64/bin"
- MANPATH='/usr/local/man:/usr/share/man:/usr/man:/share/man:/mingw64/share/man'
- INFOPATH='/usr/local/info:/usr/share/info:/usr/info:/share/info:/mingw64/share/man'
+-> Windows 10 and later
+```bash
+pacman -S git make ncurses-devel gettext-devel mingw-w64-ucrt-x86_64-{astyle,ccache,cmake,gcc,libmad,libwebp,pkgconf,SDL2,libzip,libavif} mingw-w64-ucrt-x86_64-SDL2_{image,mixer,ttf}
```
-and
-
-```
- PKG_CONFIG_PATH="/usr/lib/pkgconfig:/usr/share/pkgconfig:/lib/pkgconfig:/mingw64/lib/pkgconfig:/mingw64/share/pkgconfig"
-```
+5. Close MSYS2.
## Cloning and compilation:
@@ -85,6 +74,8 @@ git clone https://github.com/CleverRaven/Cataclysm-DDA.git ./Cataclysm-DDA
**Note:** This will download the entire CDDA repository and all of its history (3GB). If you're just testing, you should probably add `--depth=1` (~350MB).
+**Note:** See `COMPILING-CMAKE.md` section `CMake Build for MSYS2 (MinGW)` for using the CMake build system.
+
2. Compile with following command line:
```bash
@@ -96,6 +87,8 @@ You will receive warnings about unterminated character constants; they do not im
**Note**: This will compile a release version with Sound and Tiles support and all localization languages, skipping checks and tests, and using ccache for build acceleration. You can use other switches, but `MSYS2=1`, `DYNAMIC_LINKING=1` and probably `RELEASE=1` are required to compile without issues.
+See `COMPILING-CMAKE.md` section `CMake Build for MSYS2 (MinGW)` for using the CMake build system.
+
## Running:
1. Run inside MSYS2 from Cataclysm's directory with the following command:
diff --git a/doc/COMPILING/COMPILING.md b/doc/COMPILING/COMPILING.md
index f8c26b8265ca8..c2370b9d98d95 100644
--- a/doc/COMPILING/COMPILING.md
+++ b/doc/COMPILING/COMPILING.md
@@ -213,12 +213,10 @@ Installation
```bash
sudo apt install astyle autoconf automake autopoint bash bison bzip2 cmake flex gettext git g++ gperf intltool libffi-dev libgdk-pixbuf2.0-dev libtool libltdl-dev libssl-dev libxml-parser-perl lzip make mingw-w64 openssl p7zip-full patch perl pkg-config python3 ruby scons sed unzip wget xz-utils g++-multilib libc6-dev-i386 libtool-bin
-mkdir -p ~/src/Cataclysm-DDA
-mkdir -p ~/src/mxe
mkdir -p ~/src/libbacktrace
cd ~/src
-git clone https://github.com/CleverRaven/Cataclysm-DDA.git ./Cataclysm-DDA
-git clone https://github.com/mxe/mxe.git ./mxe
+git clone https://github.com/CleverRaven/Cataclysm-DDA.git
+git clone https://github.com/mxe/mxe.git
cd mxe
make -j$((`nproc`+0)) MXE_TARGETS='x86_64-w64-mingw32.static i686-w64-mingw32.static' MXE_PLUGIN_DIRS=plugins/gcc11 sdl2 sdl2_ttf sdl2_image sdl2_mixer gettext
cd ../libbacktrace/
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6d5d148bee6bc..bf79a2e2c89ba 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -51,6 +51,16 @@ if (TILES)
${MAIN_CPP}
${MESSAGES_CPP}
${RESOURCE_RC})
+ if(MSYS2)
+ # /MANIFESTINPUT not supported by GNU linker
+ # Defaul embed via `windres.exe` compiling `resource.rc` -> `resource.rc.obj`
+ else()
+ # Embed manifest directly to avoid:
+ # "fatal error CVT1100: duplicate resource. type:MANIFEST, name:1, language:0x0409"
+ target_link_options(cataclysm-tiles PRIVATE
+ "LINKER:/MANIFESTINPUT:${CMAKE_SOURCE_DIR}/data/application_manifest.xml"
+ )
+ endif()
else ()
add_executable(cataclysm-tiles
${MAIN_CPP}
diff --git a/src/chkjson/CMakeLists.txt b/src/chkjson/CMakeLists.txt
index bf83a3d0a9664..f179ad2d716d1 100644
--- a/src/chkjson/CMakeLists.txt
+++ b/src/chkjson/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.1.4)
+cmake_minimum_required(VERSION 3.20)
set(CHKJSON_SOURCES
${CMAKE_SOURCE_DIR}/src/json.cpp
diff --git a/src/resource.rc b/src/resource.rc
index 753f317b0e251..4502a26cd3831 100644
--- a/src/resource.rc
+++ b/src/resource.rc
@@ -3,6 +3,10 @@
#include
0 ICON "../data/cataicon.ico"
+#if defined(CMAKE) && !defined(MSYS2)
+ // Will embed it with MSVC' linker /MANIFESTINPUT:
+#else
1 RT_MANIFEST "../data/application_manifest.xml"
+#endif
#endif // RESOURCE_RC_INCLUDED
diff --git a/src/third-party/CMakeLists.txt b/src/third-party/CMakeLists.txt
index 98f3fbf54934f..e12593cbb7c41 100644
--- a/src/third-party/CMakeLists.txt
+++ b/src/third-party/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.1.4)
+cmake_minimum_required(VERSION 3.20)
# Don't clang-tidy third party code
set(CMAKE_CXX_CLANG_TIDY "")
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index bfe0773c2442f..7cc34b866ffd9 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.1.4)
+cmake_minimum_required(VERSION 3.20)
if (BUILD_TESTING)
file(GLOB CATACLYSM_DDA_TEST_SOURCES
diff --git a/tools/clang-tidy-plugin/CMakeLists.txt b/tools/clang-tidy-plugin/CMakeLists.txt
index 22a1fe639b1a1..59b1829a78cf8 100644
--- a/tools/clang-tidy-plugin/CMakeLists.txt
+++ b/tools/clang-tidy-plugin/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.1.4)
+cmake_minimum_required(VERSION 3.20)
include(ExternalProject)
find_package(LLVM REQUIRED CONFIG)