Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(port): CMake improvements (#3457)
* Add build options from Cataclysm-common.props * Add more build options from msvc-full-features/ * Use main-pch instead of stdafx.h * Copy msvc-full-features/vcpkg.json to source root * Add gettext and its tools as dependency * Move MSVC options to own toolchain file * Add a CMake presets file created by Visual Studio * Uses vcpkg pointed by VCPKG_ROOT * Uses build-scripts/MSVC.cmake * TILES only for now * Fix not finding .lib files * Do not autogenerate a manifest * Add gettext tools only duing Windows builds * Comment CL flags * Expose JPEG library from SDL * Switch back to Ninja, no build performance gains wtih MSBuild * Tell VCPKG to use static linking * Revert "build(cmake): deduplicate library setup (#3248)" This reverts commit a526591. * Fix missing symbols required by SDL * Fix validate_json.py test by removing UTF-8 BOM from presets file * Include vcpkg.cmake instead of using as toolchain file * Rewrite presets from scratch * Find VCPK installation through env * Move Ninja to MSVC preset * Upgrade to CMake 3.20 to allow new policies * Use CMAKE_CXX_FLAGS_INIT instead of add_compile_options() * Typo * Specific flag for RelWithDebInfo * Set new policies to remove other flags * Allow using /MT * Add a CMake build preset * Add x64-debug for MSVC * Add /GF as suggested * Removed as requested. CMake version refers * Add /OPT as requested * Skip PCH when generating compile_commands.json * tab vs. spaces * Update CMakeLists.txt Line too long (101/100) * Move vcpkg.json into msvc directory * Using project's VCPKG Triplets * Forgot ENV{} is special in if() * Edit comments * Use Windows path separator * Retrieve VS environment variables from VsDevCmd * Rewrite the list of envs to be a CMake list * Loop over envs modified by VsDevCmd * Split environment variable in key/value and trim value * Set CMake environment with VsDevCmd set values * Write a JSON string for CMakeUserPresets build environment * Write CMakeUserPresets.json based on VsDevCmd envs * Set the C and C++ compilers to VS * Remove the CMake build presets now in CMakeUserPreset.json * Moving user presets hack into the include_before script One should not use CMAKE_SOURCE_DIR because changes during compiler features testing and wastes time too. Renaming the script because it's not more just looking for VCPKG. * More MS linker flags from linking stage in .vcxproj * Use MinGW's msgfmt.exe from Git for Windows * Removing vcpkg triplets for gha as requested * Set default msgfmt * Search ninja.exe only when generator is Ninja* * Add MSYS to find_program msgfmt.exe * Removing gettext/msgfmt whole build, as requested * Fix sourcing VsDevCmd.bat twice * Enable LOCALIZE in Release * PREFIX doesn't go through C preprocessor stringification * Apply -Wno-unknown-warning-option to clang only * Remove GNU C++ extensions * Define PREFIX in prefix.h. Similar as done with version.h Removes the Q/QUOTE stringify macros * Fix cmake-lint * Correct logic for -Wno-unknown-warning-option * Correct logic for -Wno-unknown-warning-option It looks like both AppleClang and LLVM Clang use -Wno-unknown-warning-option instead of -Wno-unknown-warning, so this updates the logic from b1e5ada to match that. It'd probably also be possible to just add both -Wno-unknown-warning and -Wno-unknown-warning-option, but who knows. * Quote in if condition of CMakeLists.txt Co-authored-by: Jianxiang Wang (王健翔) <[email protected]> * Use correct cmake variable for prefix.h.in * Use CMake 3.21 or later * Change all target_link_libraries to interface form * Change find_package if using VCPKG manitest - Add all SDL2:: targets found by VCPKG - Fix clang-tidy and cmake-lint * Set the correct property for using ccache * Set compiler launchers before adding subdirectories * Fix release installation paths * Align CMake release install * Do not use our Find* modules under VCPKG * Remove redundant modules from CMakeModules CMakeParseArguments.cmake since v3.4 CMakePushCheckState.cmake since v2.8.6 CheckLibraryExists since v2.8.2 FindCurses since v3.21.0 FindPackageHandleStandardArgs since v3.1.0 FindPackageMessage since v3.0.0 * Add documentation for CMake+VCPKG build - Move build configuration into the preset - Explain how to use multi-config generator - Fix "/permessive" description Co-authored-by: akrieger <[email protected]> * Use VCPKG triplets from build-scripts/ - Point to triplets from base configuration - Move Ninja to basic preset requirement - Remove x64-debug because not used * Optmize replacing ENV vars loop with find() * Force ninja.exe path in the INCLUDE_BEFORE file * Add varialbes to "name" and "configurePreset" This way CMakeUserPresets.json.in can be reused for other targets * Rename presets to match release.yml names Rename preset to MSVC and pre-load script to be consistent. * Move VsDevCmd environment parsing to its dedicated script * Fix checking for DevEnvDir * Fix parsing non variables output * Document and improve VsDevCmd.cmake It uses DOS short names to workaround a CMake issue. * Use vswhere.exe as suggested by akrieger Fix not finding VS prereleases * Makes Ninja generators on Windows optional * Move hardcoded path into preset * Build a release * Rewrite instructions addin VS procedure. Change displayed name * Add a missing target public interface * Update doc/COMPILING/COMPILING-CMAKE-VCPKG.md Co-authored-by: akrieger <[email protected]> * Reverting SDL2 TTF library name resolution in VCPKG Requires VCPK at their commit 659b6b5 * Move VCPKG to Windows only builds * Use SDL2_ttf when not using VCPKG * Disable the MSYS build preset * Search for gettext in one place * Make VCPKG_ROOT optional in MSVC too Fixes an error when using cmake-gui * Allow to configure msgfmt and VCPKG paths * Fix using cache var in find_program(). Remove extra find_package * Use correct Git for Windows directory Co-authored-by: akrieger <[email protected]> * Make building tests optional. Use "TESTS" cache var * Install more directories * Update doc/COMPILING/COMPILING-CMAKE-VCPKG.md Co-authored-by: akrieger <[email protected]> * Satisfy cmake-lint * Move logic non belonging to data/ up * Install VERSION.txt * Switch building tests from CMake to presets * Add shlwapi required by mpg123 * Split SDL2 mixer package names * Enable sound * Correct CMake install locations on *nix * Remove x86 specific macro definitions in MSVC build in CMake (#62602) * Fix CMake compilation and localization Localization: - Outdated .gitignore entry Compilation: - `target_link_libraries` mixed signature error * Enable -g1 in CMake release build to produce source and line number in stack trace (#64705) * Add CMake option for XDG directories * Update vcpkg configuration, again * Downgrade cmake files to v3.20 * Use CMake version 3.20 and presets version 2 * Flatten presets into one * Use presetName for the include file * Start using multi-config generators * Add a Linux release configuration and build preset * Display PROJECT_NAME during configuration * Fix all SDL2 related target names * Add VERSION.txt to .gitignore * Add 'out/' to .gitignore * Fix merge conflict related to PCH, always use PCH * BNify link in VERSION.txt * BNify comment * Fix Lua build * Makefile fix * Restore builtin-baseline in manifest * Make USE_PREFIX_DATA_DIR option available to Unix only * Replace all system specific *_DIR with CMAKE_INSTALL_* * Use relative paths, use list append command * Configure prefix.h.in earlier * Compact presets. VCPKG_ROOT now an env variable * Remove cmake_minimum_required from subdirectories * Reduce CMake configuration output for releases * Use pkg-config to help finding mostly static libraries The FindSDL2*.cmake modules create the *::*-static imported targets like VCPKG does. This way we can reuse the same names and reduce the complexity in the main and src CMakeLists.txt. * Prefer MSBuild on Windows * Make Linux preset name refer to VCPKG The presets inherits from the configuration not using VCPKG * Dynamically link SDL2_mixer * Add a function to force an fs::path to a dir * Use the normalized directory path * Add SDL2 targets for dynamic linking * Add more required libs to SDL2_image imported target * Removing libzip not required for dynamic linking * Hotfix: Append a path delimiter for the 'dot' directory. * Improve CMake behavior on Unix and macOS * Improve CMake behavior on Unix and macOS * Make USE_PREFIX_DATA_DIR on by default on unix * Disable lang install * style(autofix.ci): automated formatting * Enable Lua in presets * Add CMake+MSVC build to CI * Remove VCPKG_ROOT override * Remove Strawberry Pearl from PATH * Add freetype overlay port * Remove brotli feature from freetype * Small fixes in CMake build in Linux * Resolve more dependencies * Use dynamic linking for non-VCPKG configuration * Fix typo for pkg-config * Link FLAC libraries for dynamic linking too * Add INTERFACE_INCLUDE_DIRECTORIES to SDL2 targets * Move pkg-config required FLAC dependency inside conditions * Fix clang-tidy workflow by installing 'required' libflac-dev * Add libflac to matrix * Fix merge mistakes and style differences * Don't re-define LUA * Style fixes * Fix wrong merge * Add CMake + MSYS2 build to matrix * Update vcpkg * BNify install dir * Use CMake to build translations in CI * Update documentation * Add separate preset for VS 2022 * Implement missing members of vpart iterators * Remove deprecated headers from stdafx.h * Fix float conversion warnings C4244 * Show current path if failed to find data dir * Force translation tests to end up on english * Fix build config setup in msvc Cmake preset * Fix path to tests * Add RelWithDebInfo to gitignore * Set cwd for debugging in VS * Add Debug configuration, enable tests * Add docs on running from VS * style(autofix.ci): automated formatting * Add Release configuration style(autofix.ci): automated formatting * ci: run MSYS on upload only * Unify CMake and Makefile warnings * ci: tweak msys cmake build * Remove /permissive- * Alt fix for compiling Lua with CXX compiler * Add PCH to tests * Fix more UB on global statics cleanup * Tweaks to VS CMake guide * Add new options to CMake guide * Fix port mistake * Remove automatic CMake formatter * Only run CMake+MSVC on upload --------- Co-authored-by: alef <[email protected]> Co-authored-by: Perry Fraser <[email protected]> Co-authored-by: Jianxiang Wang (王健翔) <[email protected]> Co-authored-by: Perry Fraser <[email protected]> Co-authored-by: akrieger <[email protected]> Co-authored-by: Binrui Dong <[email protected]> Co-authored-by: Clarence "Sparr" Risher <[email protected]> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
- Loading branch information