Commit Graph

92 Commits

Author SHA1 Message Date
Scott Mansell
c863abc0d3
Merge pull request #14770 from JoshuaVandaele/gen-approved-hash
AchievementApprovedHash: Automatically generate hash using CMake
2026-07-29 17:49:48 +12:00
Joshua Vandaële
55c015e6ac
AchievementApprovedHash: Automatically generate hash using CMake 2026-07-27 07:09:11 +02:00
Joshua Vandaële
24361f49d1
CMake: Enforce minimum stdlib versions 2026-07-25 06:10:43 +02:00
Joshua Vandaële
13238340ae
CMake: Enforce minimum toolset versions 2026-07-25 04:32:28 +02:00
Joshua Vandaële
c1261e7406
CMake: Introduce Presets, replacing Settings
This introduces a CMakePresets file for both Unix-likes and Windows that replace the old CMakeSettings.

It adds presets for **Debug** and **Release** profiles for both **x64** and **ARM64** architectures, as well as **Generic builds**.
Presets can be used using[ Visual Studio's built-in CMakePresets support](https://learn.microsoft.com/en-us/cpp/build/cmake-presets-vs?view=msvc-170), or [Visual Studio Code's CMake Tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools) extension.

They can also be used from the command line, like so:

- x64/Unix-like/Ninja:
  - Configure: `cmake --preset ninja-release-x64`
  - Build: `cmake --build --preset ninja-build-release-x64`
  - Configure + Build: `cmake --workflow --preset ninja-release-x64`
- ARM64/Windows/Visual Studio:
  - Configure: `cmake --preset visualstudio-release-arm64`
  - Build: `cmake --build --preset visualstudio-build-release-arm64`
  - Configure + Build: `cmake --workflow --preset visualstudio-release-arm64`

The Ninja generator is available to both Windows and Unix-likes, while the Visual Studio Generator is only available on Windows.

**Cross-compiling**

On **Windows**, the Visual Studio generator automatically takes care of everything, you just need to select an ARM64 preset.

On **Unix-likes**, to cross-compile you need to install a cross-compiler and (optionally) a sysroot of the target system.
Here is an example to compile from x64 to ARM64 with a sysroot:

- `cmake --preset ninja-release-arm64 -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_SYSROOT=/opt/sysroots/aarch64-linux-gnu`
- `cmake --build --preset ninja-build-release-arm64`

You will need a sysroot to link against Qt, since we do not vendor it in on platforms other than Windows.

**User presets**

A `CMakeUserPresets.json` file may be created locally at the root of the project to further customize your presets.
For example, here are the user presets I used to test this PR on Arch Linux with a generic Arch Linux ARM sysroot:

```json
{
  "version": 10,
  "configurePresets": [
    {
      "name": "gcc-debug-arm64",
      "inherits": "ninja-debug-arm64",
      "cacheVariables": {
        "CMAKE_C_COMPILER": "aarch64-linux-gnu-gcc",
        "CMAKE_CXX_COMPILER": "aarch64-linux-gnu-g++",
        "CMAKE_EXE_LINKER_FLAGS": "-L/opt/sysroots/ArchLinuxARM/lib",
        "CMAKE_SYSROOT": "/opt/sysroots/ArchLinuxARM"
      }
    },
    {
      "name": "clang-debug-arm64",
      "inherits": "ninja-debug-arm64",
      "cacheVariables": {
        "CMAKE_C_COMPILER": "clang",
        "CMAKE_CXX_COMPILER": "clang++",
        "CMAKE_C_FLAGS": "-target aarch64-linux-gnu",
        "CMAKE_CXX_FLAGS": "-target aarch64-linux-gnu",
        "CMAKE_SYSROOT": "/opt/sysroots/ArchLinuxARM"
      }
    },
    {
      "name": "clang-debug-x64",
      "inherits": "ninja-debug-x64",
      "cacheVariables": {
        "CMAKE_C_COMPILER": "clang",
        "CMAKE_CXX_COMPILER": "clang++"
      }
    }
  ],
  "buildPresets": [
    {
      "name": "gcc-build-debug-arm64",
      "configurePreset": "gcc-debug-arm64"
    },
    {
      "name": "clang-build-debug-arm64",
      "configurePreset": "clang-debug-arm64"
    },
    {
      "name": "clang-build-debug-x64",
      "configurePreset": "clang-debug-x64"
    }
  ],
  "workflowPresets": [
    {
      "name": "gcc-debug-arm64",
      "steps": [
        { "type": "configure", "name": "gcc-debug-arm64" },
        { "type": "build", "name": "gcc-build-debug-arm64" }
      ]
    },
    {
      "name": "clang-debug-arm64",
      "steps": [
        { "type": "configure", "name": "clang-debug-arm64" },
        { "type": "build", "name": "clang-build-debug-arm64" }
      ]
    },
    {
      "name": "clang-debug-x64",
      "steps": [
        { "type": "configure", "name": "clang-debug-x64" },
        { "type": "build", "name": "clang-build-debug-x64" }
      ]
    }
  ]
}
```

They are then used like so:
Configure + Build with GCC: `cmake --workflow --preset gcc-debug-arm64`
Configure + Build with Clang: `cmake --workflow --preset clang-debug-arm64`
Configure + Build with Clang (x64): `cmake --workflow --preset clang-debug-x64`

*Addendum: It should also now be possible to cross-compile from Windows to Unix-likes, and Unix-like to other Unix-like (e.g. Linux -> FreeBSD), however this is untested.*
2026-07-24 03:45:13 +02:00
Joshua Vandaële
3d9f46cd64
CMake: Remove LINUX_LOCAL_DEV and symlink required files 2026-07-24 03:45:13 +02:00
OatmealDome
6094cfcf7b
ScmRevGen: Bump version to 2606 2026-06-24 18:36:03 -04:00
OatmealDome
a28fff3f00
Merge pull request #14224 from JoshuaVandaele/windows-mz-ng-fix
Externals: Fix clashing dependencies
2026-03-15 12:27:02 -04:00
OatmealDome
d8558142ea
ScmRevGen: Bump version to 2603 2026-03-11 19:36:49 -04:00
Joshua Vandaële
3cea68c2e5
LibUSB: Improve library detection
Our FindLibUSB.cmake was previously entirely unused unless SDL was being built from Externals, we now rely on it again. It will use PkgConfig if applicable or fall back to looking around on the system, and more importantly it will always create an imported target.
2026-02-25 07:25:29 +01:00
Joshua Vandaële
11065e9911
CMake: Error out when switching sources for dependencies
Currently, configuring from System>Bundled doesn't work, it instead produces cryptic errors. And configuring from Bundled>System wont produce errors, but wont use the system libraries either. This change produces a clear error in both cases.
2026-02-25 07:25:29 +01:00
Joshua Vandaële
d74c6b5ca5
CCache: Add support for Objective-C/Objective-C++ 2026-01-11 22:46:05 +01:00
Joshua Vandaële
7f6bf67182
CMake: Apply editorconfig formatting 2026-01-04 12:59:56 +01:00
OatmealDome
2614969fa8
ScmRevGen: Bump version to 2512 2025-12-21 22:55:27 -05:00
TellowKrinkle
143fac254e CMake: Allow both glslang 15 and 16 2025-11-08 02:32:47 -06:00
Joshua Vandaële
713dfb41df
JitRegister: Remove OProfile profiler
OProfile is not used at all these days, most major distributions do not ship it anymore (Debian, Fedora, and Alpine to name the few I've checked) and following a discussion on Discord, nobody is apparently using it, most devs not even being aware of it. This removes an optional dependency from Dolphin.
2025-10-26 20:48:15 +01:00
Jordan Woyak
5865116f97
ScmRevGen: Bump version to 2509 2025-09-15 19:42:21 -04:00
OatmealDome
9843115ad8
ScmRevGen: Bump version to 2506a 2025-06-05 02:52:15 -04:00
OatmealDome
aed420c95d
ScmRevGen: Bump version to 2506 2025-06-04 00:10:41 -04:00
OatmealDome
de2826d995 Merge branch 'release-prep-2503a' 2025-04-21 17:03:52 -04:00
OatmealDome
e40c9b674c ScmRevGen: Bump version to 2503a 2025-04-21 00:38:22 -04:00
JMC47
9f43f59c9b
Merge pull request #13276 from JoshuaVandaele/sfml-3.0.0
Migrate to SFML 3.0.0
2025-03-10 15:03:36 -04:00
OatmealDome
9e23a0a506 Merge branch 'release-prep-2503' 2025-03-10 12:34:02 -04:00
OatmealDome
9763c0a1e2 ScmRevGen: Bump major version to 2503 2025-03-10 00:46:00 -04:00
Luz Paz
325c1a24b9 CMake: fix various typos
Also includes a fix for BuildMacOSUniversalBinary.py
2025-03-05 20:57:52 -05:00
Joshua Vandaële
0a83783fae
Migrate to SFML>=3.0.0 2025-02-25 06:42:13 +01:00
OatmealDome
795e78685f
Merge pull request #13187 from OatmealDome/flatpak-appinfo
Flatpak: Use ScmRevGen to generate metainfo XML
2025-01-17 17:47:10 -05:00
Admiral H. Curtiss
93fc5c02ac
Merge pull request #13179 from TellowKrinkle/ForceSystemLib
CMake: Optional system library fixes
2025-01-10 04:56:08 +01:00
OatmealDome
4fc259710f Flatpak: Use ScmRevGen to generate metainfo XML 2025-01-07 02:35:14 -05:00
OatmealDome
e05b033dd2 ScmRevGen: Don't generate Info.plist files directly
Some generators (like Unix Makefiles and Xcode) copy an app's Info.plist at configure time.
This causes a problem when we need to generate the Info.plist at build time, like how we
currently do it with ScmRevGen. Instead of generating the Info.plist directly in ScmRevGen,
provide an Info.plist without any version information to CMake at configure time, have
ScmRevGen generate a separate plist file with the version information at build time, and
then merge the two together to create the final Info.plist.
2024-12-05 14:56:08 -05:00
OatmealDome
992b4ea930 ScmRevGen: Bump major version to 2412 2024-12-01 18:00:52 -05:00
TellowKrinkle
613c959bda CMake: Pass RESOLVED_USE_SYSTEM_<lib> as a parameter
Because we were setting it with a scope, it wasn't making its way into called functions that would try to inspect it.  Now it does.
2024-11-06 21:47:10 -06:00
TellowKrinkle
432d4a2a06 CMake: Properly abort when requested system lib is missing 2024-11-06 21:30:29 -06:00
OatmealDome
3c4d4fcd09 ScmRevGen: Bump major version to 2409 2024-09-04 00:43:45 -04:00
OatmealDome
4fa78be3ad DolphinPostprocessBundle: Separate "-D" from DOLPHIN_BUNDLE_PATH definition
For whatever reason, the previous way would inject backslashes into any path that has spaces.
2024-08-01 22:06:55 -04:00
OatmealDome
b0ca5f2666 DolphinPostprocessBundle: Use TARGET_BUNDLE_DIR to avoid having to make a relative path absolute 2024-08-01 22:06:55 -04:00
OatmealDome
b92e354389 ScmRevGen: Bump major version to 2407 2024-07-02 02:36:16 -04:00
OatmealDome
1ad982f469 ScmRevGen: Silence output on the standard error when getting the current tag 2024-06-30 16:55:47 -04:00
OatmealDome
35f383d9b0 ScmRevGen: Set commits ahead to zero when on a tag 2024-06-29 22:59:40 -04:00
Neui
a1c54063d0 CMake: CCache: Always make clang happy
When we are using ccache anyway, always add the flags to make clang
happy. Also, fix copy-paste error regarding what variable to modify for
it.
2024-06-10 23:44:46 +02:00
Neui
f91413db8f CMake: Fix CCache support when already using _LAUNCHER
The official ccache documentation[1] recommends to set
`CMAKE_C(XX)_COMPILER_LAUNCHER` to ccache to enable ccache.
These also work as envionment variables (supported by CMake itself).
However, using these instructions generates the following error during
building:

    ccache: error: Recursive invocation (the name of the ccache binary must be "ccache")

This is because Dolphin adds an additional command ccache layer (ccache
ccache compiler ...).

This fixes that issue by checking for `CMAKE_C(XX)_COMPILER_LAUNCHER`
before inserting our own. Also, use `CMAKE_C(XX)_COMPILER_LAUNCHER`
to add ccache because the CMake docs discourages the use of
`RULE_LAUNCH_COMPILE` in favour of `CMAKE_C(XX)_COMPILER_LAUNCHER`.

[1]: https://github.com/ccache/ccache/wiki/CMake
2024-06-08 16:05:14 +02:00
OatmealDome
c3e0aeb184
Merge pull request #12728 from OatmealDome/mac-version-numbers-2
ScmRevGen: Generate Info.plist files containing the current version
2024-05-30 01:13:32 -04:00
Guilherme Janczak
cd25e91ca2
use pkg_search_module to find minizip-ng or minizip
OpenBSD calls minizip-ng's .pc file minizip.pc
Others call   minizip-ng's .pc file minizip-ng.pc
2024-05-07 04:25:04 +00:00
OatmealDome
c154134e28 ScmRevGen: Generate Info.plist for MacUpdater 2024-04-21 13:28:21 -04:00
OatmealDome
3ad1037d7f ScmRevGen: Generate Info.plist for DolphinQt 2024-04-21 13:28:21 -04:00
OatmealDome
1cb6ce6057 ScmRevGen: Refactor file configuration into a function 2024-04-21 13:28:18 -04:00
Jordan Woyak
02f57a4778 Replace SCM_IS_MASTER with SCM_COMMITS_AHEAD_MASTER 2024-03-23 16:48:52 -05:00
Jordan Woyak
25833cfd62 CMake: Hide warnings in Externals also for non-msvc. 2024-03-19 01:12:52 -05:00
Admiral H. Curtiss
fa81006b51
Merge pull request #11955 from TellowKrinkle/CMakeDependencies
CMake: Allow ignoring system packages
2023-06-30 19:06:04 +02:00
Admiral H. Curtiss
2a6f4d879c
CMake: Generate scmrev.h at build time instead of configure time. 2023-06-29 03:23:31 +02:00