Browse Source
[cmake] refactor: cpmfile, deps prefetch, force system and more (#322)
[cmake] refactor: cpmfile, deps prefetch, force system and more (#322)
CPM Dependencies are now managed in a singular json file, where each can be properly prefetched at-will via `tools/cpm-fetch.sh <packages...>`, or all at once via `tools/cpm-fetch-all.sh`.
Adds docs for CPMUtil as well.
Also adds `<package>_FORCE_{BUNDLED,SYSTEM}` overrides
Signed-off-by: crueter <crueter@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/322
Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
pull/346/head
No known key found for this signature in database
GPG Key ID: 425ACD2D4830EBC6
23 changed files with 1254 additions and 563 deletions
-
1.gitignore
-
299CMakeLists.txt
-
354CMakeModules/CPMUtil.cmake
-
1CMakeModules/DownloadExternals.cmake
-
19CMakeModules/FindSPIRV-Tools.cmake
-
17CMakeModules/Findzstd.cmake
-
147cpmfile.json
-
252docs/CPM.md
-
142externals/CMakeLists.txt
-
109externals/cpmfile.json
-
12externals/ffmpeg/CMakeLists.txt
-
8externals/ffmpeg/cpmfile.json
-
67externals/nx_tzdb/CMakeLists.txt
-
8externals/nx_tzdb/cpmfile.json
-
5src/android/app/build.gradle.kts
-
8src/common/CMakeLists.txt
-
86src/dynarmic/externals/CMakeLists.txt
-
47src/dynarmic/externals/cpmfile.json
-
2src/shader_recompiler/CMakeLists.txt
-
13src/yuzu/externals/CMakeLists.txt
-
12src/yuzu/externals/cpmfile.json
-
10tools/cpm-fetch-all.sh
-
198tools/cpm-fetch.sh
@ -0,0 +1,19 @@ |
|||||
|
# SPDX-FileCopyrightText: 2022 yuzu Emulator Project |
||||
|
# SPDX-License-Identifier: GPL-2.0-or-later |
||||
|
|
||||
|
include(FindPackageHandleStandardArgs) |
||||
|
|
||||
|
find_package(PkgConfig QUIET) |
||||
|
pkg_search_module(SPIRV-Tools QUIET IMPORTED_TARGET SPIRV-Tools) |
||||
|
find_package_handle_standard_args(SPIRV-Tools |
||||
|
REQUIRED_VARS SPIRV-Tools_LINK_LIBRARIES |
||||
|
VERSION_VAR SPIRV-Tools_VERSION |
||||
|
) |
||||
|
|
||||
|
if (SPIRV-Tools_FOUND AND NOT TARGET SPIRV-Tools::SPIRV-Tools) |
||||
|
if (TARGET SPIRV-Tools) |
||||
|
add_library(SPIRV-Tools::SPIRV-Tools ALIAS SPIRV-Tools) |
||||
|
else() |
||||
|
add_library(SPIRV-Tools::SPIRV-Tools ALIAS PkgConfig::SPIRV-Tools) |
||||
|
endif() |
||||
|
endif() |
||||
@ -0,0 +1,147 @@ |
|||||
|
{ |
||||
|
"openssl": { |
||||
|
"ci": true, |
||||
|
"package": "OpenSSL", |
||||
|
"name": "openssl", |
||||
|
"repo": "crueter-ci/OpenSSL", |
||||
|
"version": "3.5.2", |
||||
|
"min_version": "1.1.1" |
||||
|
}, |
||||
|
"boost": { |
||||
|
"package": "Boost", |
||||
|
"repo": "boostorg/boost", |
||||
|
"tag": "boost-1.88.0", |
||||
|
"artifact": "boost-1.88.0-cmake.7z", |
||||
|
"hash": "e5b049e5b61964480ca816395f63f95621e66cb9bcf616a8b10e441e0e69f129e22443acb11e77bc1e8170f8e4171b9b7719891efc43699782bfcd4b3a365f01", |
||||
|
"git_version": "1.88.0", |
||||
|
"version": "1.57" |
||||
|
}, |
||||
|
"fmt": { |
||||
|
"repo": "fmtlib/fmt", |
||||
|
"sha": "40626af88b", |
||||
|
"hash": "d59f06c24339f223de4ec2afeba1c67b5835a0f350a1ffa86242a72fc3e616a6b8b21798355428d4200c75287308b66634619ffa0b52ba5bd74cc01772ea1a8a", |
||||
|
"version": "8", |
||||
|
"options": [ |
||||
|
"FMT_INSTALL OFF" |
||||
|
] |
||||
|
}, |
||||
|
"lz4": { |
||||
|
"name": "lz4", |
||||
|
"repo": "lz4/lz4", |
||||
|
"sha": "ebb370ca83", |
||||
|
"hash": "43600e87b35256005c0f2498fa56a77de6783937ba4cfce38c099f27c03188d097863e8a50c5779ca0a7c63c29c4f7ed0ae526ec798c1fd2e3736861b62e0a37", |
||||
|
"source_subdir": "build/cmake" |
||||
|
}, |
||||
|
"nlohmann": { |
||||
|
"package": "nlohmann_json", |
||||
|
"repo": "nlohmann/json", |
||||
|
"sha": "55f93686c0", |
||||
|
"hash": "b739749b066800e21154506ea150d2c5cbce8a45344177f46f884547a1399d26753166fd0df8135269ce28cf223552b1b65cd625b88c844d54753f2434900486", |
||||
|
"version": "3.8" |
||||
|
}, |
||||
|
"zlib": { |
||||
|
"package": "ZLIB", |
||||
|
"repo": "madler/zlib", |
||||
|
"sha": "51b7f2abda", |
||||
|
"hash": "16eaf1f3752489d12fd9ce30f7b5f7cbd5cb8ff53d617005a9847ae72d937f65e01e68be747f62d7ac19fd0c9aeba9956e60f16d6b465c5fdc2f3d08b4db2e6c", |
||||
|
"version": "1.2", |
||||
|
"options": [ |
||||
|
"ZLIB_BUILD_SHARED OFF", |
||||
|
"ZLIB_INSTALL OFF" |
||||
|
] |
||||
|
}, |
||||
|
"zstd": { |
||||
|
"repo": "facebook/zstd", |
||||
|
"sha": "f8745da6ff", |
||||
|
"hash": "3037007f990040fe32573b46f9bef8762fd5dbeeb07ffffcbfeba51ec98167edae39bb9c87f9299efcd61c4e467c5e84f7c19f0df7799bc1fc04864a278792ee", |
||||
|
"version": "1.5", |
||||
|
"source_subdir": "build/cmake", |
||||
|
"find_args": "MODULE", |
||||
|
"options": [ |
||||
|
"ZSTD_BUILD_SHARED OFF" |
||||
|
] |
||||
|
}, |
||||
|
"catch2": { |
||||
|
"package": "Catch2", |
||||
|
"repo": "catchorg/Catch2", |
||||
|
"sha": "644821ce28", |
||||
|
"hash": "f8795f98acf2c02c0db8e734cc866d5caebab4b4a306e93598b97cb3c0c728dafe8283dce27ffe8d42460e5ae7302f3f32e7e274a7f991b73511ac88eef21b1f", |
||||
|
"version": "3.0.1" |
||||
|
}, |
||||
|
"enet": { |
||||
|
"repo": "lsalzman/enet", |
||||
|
"sha": "2662c0de09", |
||||
|
"hash": "3de1beb4fa3d6b1e03eda8dd1e7580694f854af3ed3975dcdabfdcdf76b97f322b9734d35ea7f185855bb490d957842b938b26da4dd2dfded509390f8d2794dd", |
||||
|
"version": "1.3", |
||||
|
"find_args": "MODULE" |
||||
|
}, |
||||
|
"opus": { |
||||
|
"package": "Opus", |
||||
|
"repo": "xiph/opus", |
||||
|
"sha": "5ded705cf4", |
||||
|
"hash": "0dc89e58ddda1f3bc6a7037963994770c5806c10e66f5cc55c59286fc76d0544fe4eca7626772b888fd719f434bc8a92f792bdb350c807968b2ac14cfc04b203", |
||||
|
"version": "1.3", |
||||
|
"find_args": "MODULE", |
||||
|
"options": [ |
||||
|
"OPUS_BUILD_TESTING OFF", |
||||
|
"OPUS_BUILD_PROGRAMS OFF", |
||||
|
"OPUS_INSTALL_PKG_CONFIG_MODULE OFF", |
||||
|
"OPUS_INSTALL_CMAKE_CONFIG_MODULE OFF" |
||||
|
] |
||||
|
}, |
||||
|
"cubeb": { |
||||
|
"repo": "mozilla/cubeb", |
||||
|
"sha": "fa02160712", |
||||
|
"hash": "82d808356752e4064de48c8fecbe7856715ade1e76b53937116bf07129fc1cc5b3de5e4b408de3cd000187ba8dc32ca4109661cb7e0355a52e54bd81b9be1c61", |
||||
|
"find_args": "CONFIG", |
||||
|
"options": [ |
||||
|
"USE_SANITIZERS OFF", |
||||
|
"BUILD_TESTS OFF", |
||||
|
"BUILD_TOOLS OFF", |
||||
|
"BUNDLE_SPEEX ON" |
||||
|
] |
||||
|
}, |
||||
|
"boost_headers": { |
||||
|
"repo": "boostorg/headers", |
||||
|
"sha": "0456900fad", |
||||
|
"hash": "50cd75dcdfc5f082225cdace058f47b4fb114a47585f7aee1d22236a910a80b667186254c214fa2fcebac67ae6d37ba4b6e695e1faea8affd6fd42a03cf996e3", |
||||
|
"bundled": true |
||||
|
}, |
||||
|
"discord-rpc": { |
||||
|
"repo": "eden-emulator/discord-rpc", |
||||
|
"sha": "1cf7772bb6", |
||||
|
"hash": "e9b35e6f2c075823257bcd59f06fe7bb2ccce1976f44818d2e28810435ef79c712a3c4f20f40da41f691342a4058cf86b078eb7f9d9e4dae83c0547c21ec4f97" |
||||
|
}, |
||||
|
"simpleini": { |
||||
|
"package": "SimpleIni", |
||||
|
"repo": "brofield/simpleini", |
||||
|
"sha": "09c21bda1d", |
||||
|
"hash": "99779ca9b6e040d36558cadf484f9ffdab5b47bcc8fc72e4d33639d1d60c0ceb4410d335ba445d72a4324e455167fd6769d99b459943aa135bec085dff2d4b7c", |
||||
|
"find_args": "MODULE" |
||||
|
}, |
||||
|
"sdl2_generic": { |
||||
|
"package": "SDL2", |
||||
|
"repo": "libsdl-org/SDL", |
||||
|
"sha": "54772f345a", |
||||
|
"hash": "2a68a0e01c390043aa9d9df63d8a20a52076c88bb460ac4e0f33194ca7d9bc8fadbbcc04e7506872ac4b6354a73fbc267c036f82200da59465789b87c7d9e3a4", |
||||
|
"key": "generic", |
||||
|
"bundled": true |
||||
|
}, |
||||
|
"sdl2_steamdeck": { |
||||
|
"package": "SDL2", |
||||
|
"repo": "libsdl-org/SDL", |
||||
|
"sha": "cc016b0046", |
||||
|
"hash": "34d5ef58da6a4f9efa6689c82f67badcbd741f5a4f562a9c2c30828fa839830fb07681c5dc6a7851520e261c8405a416ac0a2c2513b51984fb3b4fa4dcb3e20b", |
||||
|
"key": "steamdeck", |
||||
|
"bundled": true |
||||
|
}, |
||||
|
"sdl2": { |
||||
|
"ci": true, |
||||
|
"package": "SDL2", |
||||
|
"name": "SDL2", |
||||
|
"repo": "crueter-ci/SDL2", |
||||
|
"version": "2.32.8", |
||||
|
"min_version": "2.26.4", |
||||
|
"cmake_filename": "sdl2" |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,252 @@ |
|||||
|
# CPM |
||||
|
|
||||
|
CPM (CMake Package Manager) is the preferred method of managing dependencies within Eden. |
||||
|
|
||||
|
Global Options: |
||||
|
|
||||
|
- `YUZU_USE_CPM` is set by default on MSVC and Android. Other platforms should use this if certain "required" system dependencies (e.g. OpenSSL) are broken or missing |
||||
|
* If this is `OFF`, required system dependencies will be searched via `find_package`, although certain externals use CPM regardless. |
||||
|
- `CPMUTIL_FORCE_SYSTEM` (default `OFF`): Require all CPM dependencies to use system packages. NOT RECOMMENDED! |
||||
|
* Many packages, e.g. mcl, sirit, xbyak, discord-rpc, are not generally available as a system package. |
||||
|
* You may optionally override these (see CPMUtil section) |
||||
|
- `CPMUTIL_FORCE_BUNDLED` (default `ON` on MSVC and Android, `OFF` elsewhere): Require all CPM dependencies to use bundled packages. |
||||
|
|
||||
|
## CPMUtil |
||||
|
|
||||
|
CPMUtil is a wrapper around CPM that aims to reduce boilerplate and add useful utility functions to make dependency management a piece of cake. |
||||
|
|
||||
|
### AddPackage |
||||
|
|
||||
|
`AddPackage` is the core of the CPMUtil wrapper, and is generally the lowest level you will need to go when dealing with dependencies. |
||||
|
|
||||
|
**Identification/Fetching** |
||||
|
|
||||
|
- `NAME` (required): The package name (must be the same as the `find_package` name if applicable) |
||||
|
- `VERSION`: The minimum version of this package that can be used on the system |
||||
|
- `GIT_VERSION`: The version found within git, only used for identification |
||||
|
- `URL`: The URL to fetch. |
||||
|
- `REPO`: The GitHub repo to use (`owner/repo`). |
||||
|
* Only GitHub is supported for now, though other platforms will see support at some point |
||||
|
- `TAG`: The tag to fetch, if applicable. |
||||
|
- `ARTIFACT`: The name of the artifact, if applicable. |
||||
|
- `SHA`: Commit sha to fetch, if applicable. |
||||
|
- `BRANCH`: Branch to fetch, if applicable. |
||||
|
|
||||
|
The following configurations are supported, in descending order of precedence: |
||||
|
|
||||
|
- `URL`: Bare URL download, useful for custom artifacts |
||||
|
* If this is set, `GIT_URL` or `REPO` should be set to allow the dependency viewer to link to the project's Git repository. |
||||
|
* If this is NOT set, `REPO` must be defined. |
||||
|
- `REPO + TAG + ARTIFACT`: GitHub release artifact |
||||
|
* The final download URL will be `https://github.com/${REPO}/releases/download/${TAG}/${ARTIFACT}` |
||||
|
* Useful for prebuilt libraries and prefetched archives |
||||
|
- `REPO + TAG`: GitHub tag archive |
||||
|
* The final download URL will be `https://github.com/${REPO}/archive/refs/tags/${TAG}.tar.gz` |
||||
|
* Useful for pinning to a specific tag, better for build identification |
||||
|
- `REPO + SHA`: GitHub commit archive |
||||
|
* The final download URL will be `https://github.com/${REPO}/archive/${SHA}.zip` |
||||
|
* Useful for pinning to a specific commit |
||||
|
- `REPO + BRANCH`: GitHub branch archive |
||||
|
* The final download URL will be `https://github.com/${REPO}/archive/refs/heads/${BRANCH}.zip` |
||||
|
* Generally not recommended unless the branch is frozen |
||||
|
- `REPO`: GitHub master archive |
||||
|
* The final download URL will be `https://github.com/${REPO}/archive/refs/heads/master.zip` |
||||
|
* Generally not recommended unless the project is dead |
||||
|
|
||||
|
**Hashing** |
||||
|
|
||||
|
Hashing is used for verifying downloads. It's highly recommended to use these. |
||||
|
|
||||
|
- `HASH_ALGO` (default `SHA512`): Hash algorithm to use |
||||
|
|
||||
|
Hashing strategies, descending order of precedence: |
||||
|
|
||||
|
- `HASH`: Bare hash verification, useful for static downloads e.g. commit archives |
||||
|
- `HASH_SUFFIX`: Download the hash as `${DOWNLOAD_URL}.${HASH_SUFFIX}` |
||||
|
* The downloaded hash *must* match the hash algorithm and contain nothing but the hash; no filenames or extra content. |
||||
|
- `HASH_URL`: Download the hash from a separate URL |
||||
|
|
||||
|
**Additional Options** |
||||
|
|
||||
|
- `KEY`: Custom cache key to use (stored as `.cache/cpm/${packagename_lower}/${key}`) |
||||
|
* Default is based on, in descending order of precedence: |
||||
|
- First 4 characters of the sha |
||||
|
- `GIT_VERSION`, or `VERSION` if not specified |
||||
|
- Tag |
||||
|
- Otherwise, CPM defaults will be used. This is not recommended as it doesn't produce reproducible caches |
||||
|
- `DOWNLOAD_ONLY`: Whether or not to configure the downloaded package via CMake |
||||
|
* Useful to turn `OFF` if the project doesn't use CMake |
||||
|
- `SOURCE_SUBDIR`: Subdirectory of the project containing a CMakeLists.txt file |
||||
|
- `FIND_PACKAGE_ARGUMENTS`: Arguments to pass to the `find_package` call |
||||
|
- `BUNDLED_PACKAGE`: Set to `ON` to force the usage of a bundled package |
||||
|
- `OPTIONS`: Options to pass to the configuration of the package |
||||
|
- `PATCHES`: Patches to apply to the package, stored in `.patch/${packagename_lower}/0001-patch-name.patch` and so on |
||||
|
- Other arguments can be passed to CPM as well |
||||
|
|
||||
|
**Extra Variables** |
||||
|
|
||||
|
For each added package, users may additionally force usage of the system/bundled package. |
||||
|
|
||||
|
- `${package}_FORCE_SYSTEM`: Require the package to be installed on the system |
||||
|
- `${package}_FORCE_BUNDLED`: Force the package to be fetched and use the bundled version |
||||
|
|
||||
|
**Bundled/System Switching** |
||||
|
|
||||
|
Descending order of precedence: |
||||
|
- If `${package}_FORCE_SYSTEM` is true, requires the package to be on the system |
||||
|
- If `${package}_FORCE_BUNDLED` is true, forcefully uses the bundled package |
||||
|
- If `CPMUTIL_FORCE_SYSTEM` is true, requires the package to be on the system |
||||
|
- If `CPMUTIL_FORCE_BUNDLED` is true, forcefully uses the bundled package |
||||
|
- If the `BUNDLED_PACKAGE` argument is true, forcefully uses the bundled package |
||||
|
- Otherwise, CPM will search for the package first, and if not found, will use the bundled package |
||||
|
|
||||
|
**Identification** |
||||
|
|
||||
|
All dependencies must be identifiable in some way for usage in the dependency viewer. Lists are provided in descending order of precedence. |
||||
|
|
||||
|
URLs: |
||||
|
|
||||
|
- `GIT_URL` |
||||
|
- `REPO` as a GitHub repository |
||||
|
- `URL` |
||||
|
|
||||
|
Versions (bundled): |
||||
|
|
||||
|
- `SHA` |
||||
|
- `GIT_VERSION` |
||||
|
- `VERSION` |
||||
|
- `TAG` |
||||
|
- "unknown" |
||||
|
|
||||
|
If the package is a system package, AddPackage will attempt to determine the package version and append ` (system)` to the identifier. Otherwise, it will be marked as `unknown (system)` |
||||
|
|
||||
|
### AddCIPackage |
||||
|
|
||||
|
Adds a package that follows crueter's CI repository spec. |
||||
|
|
||||
|
- `VERSION` (required): The version to get (the tag will be `v${VERSION}`) |
||||
|
- `NAME` (required): Name used within the artifacts |
||||
|
- `REPO` (required): CI repository, e.g. `crueter-ci/OpenSSL` |
||||
|
- `PACKAGE` (required): `find_package` package name |
||||
|
- `EXTENSION`: Artifact extension (default `tar.zst`) |
||||
|
- `MIN_VERSION`: Minimum version for `find_package`. Only used if platform does not support this package as a bundled artifact |
||||
|
- `DISABLED_PLATFORMS`: List of platforms that lack artifacts for this package. One of: |
||||
|
* `windows-amd64` |
||||
|
* `windows-arm64` |
||||
|
* `android` |
||||
|
* `solaris` |
||||
|
* `freebsd` |
||||
|
* `linux` |
||||
|
* `linux-aarch64` |
||||
|
- `CMAKE_FILENAME`: Custom CMake filename, relative to the package root (default `${PACKAGE_ROOT}/${NAME}.cmake`) |
||||
|
|
||||
|
### AddJsonPackage |
||||
|
|
||||
|
This is the recommended method of usage for CPMUtil. In each directory that utilizes `CPMUtil`, there must be a `cpmfile.json` that defines dependencies in a similar manner to the individual calls. |
||||
|
|
||||
|
The cpmfile is an object of objects, with each sub-object being named according to the package's identifier, e.g. `openssl`, which can then be fetched with `AddJsonPackage(<identifier>)`. Options are designed to map closely to the argument names, and are always strings unless otherwise specified. |
||||
|
|
||||
|
- `package` -> `NAME` (`PACKAGE` for CI), defaults to the object key |
||||
|
- `repo` -> `REPO` |
||||
|
- `version` -> `VERSION` |
||||
|
- `ci` (bool) |
||||
|
|
||||
|
If `ci` is `false`: |
||||
|
|
||||
|
- `hash` -> `HASH` |
||||
|
- `sha` -> `SHA` |
||||
|
- `tag` -> `TAG` |
||||
|
- `artifact` -> `ARTIFACT` |
||||
|
- `git_version` -> `GIT_VERSION` |
||||
|
- `source_subdir` -> `SOURCE_SUBDIR` |
||||
|
- `bundled` -> `BUNDLED_PACKAGE` |
||||
|
- `find_args` -> `FIND_PACKAGE_ARGUMENTS` |
||||
|
- `patches` -> `PATCHES` (array) |
||||
|
- `options` -> `OPTIONS` (array) |
||||
|
|
||||
|
Other arguments aren't currently supported. If you wish to add them, see the `AddJsonPackage` function in `CMakeModules/CPMUtil.cmake`. |
||||
|
|
||||
|
If `ci` is `true`: |
||||
|
|
||||
|
- `name` -> `NAME`, defaults to the object key |
||||
|
- `extension` -> `EXTENSION`, defaults to `tar.zst` |
||||
|
- `min_version` -> `MIN_VERSION` |
||||
|
- `cmake_filename` -> `CMAKE_FILENAME` |
||||
|
- `extension` -> `EXTENSION` |
||||
|
|
||||
|
### Examples |
||||
|
|
||||
|
In order: OpenSSL CI, Boost (tag + artifact), discord-rpc (sha + options + patches), Opus (options + find_args) |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"openssl": { |
||||
|
"ci": true, |
||||
|
"package": "OpenSSL", |
||||
|
"name": "openssl", |
||||
|
"repo": "crueter-ci/OpenSSL", |
||||
|
"version": "3.5.2", |
||||
|
"min_version": "1.1.1" |
||||
|
}, |
||||
|
"boost": { |
||||
|
"package": "Boost", |
||||
|
"repo": "boostorg/boost", |
||||
|
"tag": "boost-1.88.0", |
||||
|
"artifact": "boost-1.88.0-cmake.7z", |
||||
|
"hash": "e5b049e5b61964480ca816395f63f95621e66cb9bcf616a8b10e441e0e69f129e22443acb11e77bc1e8170f8e4171b9b7719891efc43699782bfcd4b3a365f01", |
||||
|
"git_version": "1.88.0", |
||||
|
"version": "1.57" |
||||
|
}, |
||||
|
"opus": { |
||||
|
"package": "Opus", |
||||
|
"repo": "xiph/opus", |
||||
|
"sha": "5ded705cf4", |
||||
|
"hash": "0dc89e58ddda1f3bc6a7037963994770c5806c10e66f5cc55c59286fc76d0544fe4eca7626772b888fd719f434bc8a92f792bdb350c807968b2ac14cfc04b203", |
||||
|
"version": "1.3", |
||||
|
"find_args": "MODULE", |
||||
|
"options": [ |
||||
|
"OPUS_BUILD_TESTING OFF", |
||||
|
"OPUS_BUILD_PROGRAMS OFF", |
||||
|
"OPUS_INSTALL_PKG_CONFIG_MODULE OFF", |
||||
|
"OPUS_INSTALL_CMAKE_CONFIG_MODULE OFF" |
||||
|
] |
||||
|
}, |
||||
|
"discord-rpc": { |
||||
|
"repo": "discord/discord-rpc", |
||||
|
"sha": "963aa9f3e5", |
||||
|
"hash": "386e1344e9a666d730f2d335ee3aef1fd05b1039febefd51aa751b705009cc764411397f3ca08dffd46205c72f75b235c870c737b2091a4ed0c3b061f5919bde", |
||||
|
"options": [ |
||||
|
"BUILD_EXAMPLES OFF" |
||||
|
], |
||||
|
"patches": [ |
||||
|
"0001-cmake-version.patch", |
||||
|
"0002-no-clang-format.patch", |
||||
|
"0003-fix-cpp17.patch" |
||||
|
] |
||||
|
}, |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
### Inclusion |
||||
|
|
||||
|
To include CPMUtil: |
||||
|
|
||||
|
```cmake |
||||
|
set(CPMUTIL_JSON_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cpmfile.json) |
||||
|
include(CPMUtil) |
||||
|
``` |
||||
|
|
||||
|
You may omit the first line if you are not utilizing cpmfile. |
||||
|
|
||||
|
## Prefetching |
||||
|
|
||||
|
- To prefetch a CPM dependency (requires cpmfile): |
||||
|
* `tools/cpm-fetch.sh <packages>` |
||||
|
- To prefetch all CPM dependencies: |
||||
|
* `tools/cpm-fetch-all.sh` |
||||
|
|
||||
|
Currently, `cpm-fetch.sh` defines the following directories for cpmfiles: |
||||
|
|
||||
|
`externals src/yuzu/externals externals/ffmpeg src/dynarmic/externals externals/nx_tzdb` |
||||
|
|
||||
|
Whenever you add a new cpmfile, update the script accordingly |
||||
@ -0,0 +1,109 @@ |
|||||
|
{ |
||||
|
"mbedtls": { |
||||
|
"repo": "Mbed-TLS/mbedtls", |
||||
|
"sha": "8c88150ca1", |
||||
|
"hash": "769ad1e94c570671071e1f2a5c0f1027e0bf6bcdd1a80ea8ac970f2c86bc45ce4e31aa88d6d8110fc1bed1de81c48bc624df1b38a26f8b340a44e109d784a966", |
||||
|
"patches": [ |
||||
|
"0001-cmake-version.patch" |
||||
|
] |
||||
|
}, |
||||
|
"spirv-headers": { |
||||
|
"package": "SPIRV-Headers", |
||||
|
"repo": "KhronosGroup/SPIRV-Headers", |
||||
|
"sha": "4e209d3d7e", |
||||
|
"hash": "f48bbe18341ed55ea0fe280dbbbc0a44bf222278de6e716e143ca1e95ca320b06d4d23d6583fbf8d03e1428f3dac8fa00e5b82ddcd6b425e6236d85af09550a4" |
||||
|
}, |
||||
|
"sirit": { |
||||
|
"repo": "eden-emulator/sirit", |
||||
|
"sha": "db1f1e8ab5", |
||||
|
"hash": "73eb3a042848c63a10656545797e85f40d142009dfb7827384548a385e1e28e1ac72f42b25924ce530d58275f8638554281e884d72f9c7aaf4ed08690a414b05", |
||||
|
"options": [ |
||||
|
"SIRIT_USE_SYSTEM_SPIRV_HEADERS ON" |
||||
|
] |
||||
|
}, |
||||
|
"httplib": { |
||||
|
"repo": "yhirose/cpp-httplib", |
||||
|
"sha": "a609330e4c", |
||||
|
"hash": "dd3fd0572f8367d8549e1319fd98368b3e75801a293b0c3ac9b4adb806473a4506a484b3d389dc5bee5acc460cb90af7a20e5df705a1696b56496b30b9ce7ed2" |
||||
|
}, |
||||
|
"cpp-jwt": { |
||||
|
"version": "1.4", |
||||
|
"repo": "arun11299/cpp-jwt", |
||||
|
"sha": "a54fa08a3b", |
||||
|
"hash": "a90f7e594ada0c7e49d5ff9211c71097534e7742a8e44bf0851b0362642a7271d53f5d83d04eeaae2bad17ef3f35e09e6818434d8eaefa038f3d1f7359d0969a", |
||||
|
"find_args": "CONFIG", |
||||
|
"options": [ |
||||
|
"CPP_JWT_BUILD_EXAMPLES OFF", |
||||
|
"CPP_JWT_BUILD_TESTS OFF", |
||||
|
"CPP_JWT_USE_VENDORED_NLOHMANN_JSON OFF" |
||||
|
], |
||||
|
"patches": [ |
||||
|
"0001-no-install.patch", |
||||
|
"0002-missing-decl.patch" |
||||
|
] |
||||
|
}, |
||||
|
"vulkan-headers": { |
||||
|
"package": "VulkanHeaders", |
||||
|
"version": "1.3.274", |
||||
|
"repo": "KhronosGroup/Vulkan-Headers", |
||||
|
"sha": "89268a6d17", |
||||
|
"hash": "3ab349f74298ba72cafb8561015690c0674d428a09fb91ccd3cd3daca83650d190d46d33fd97b0a8fd4223fe6df2bcabae89136fbbf7c0bfeb8776f9448304c8" |
||||
|
}, |
||||
|
"vulkan-utility-libraries": { |
||||
|
"package": "VulkanUtilityLibraries", |
||||
|
"repo": "KhronosGroup/Vulkan-Utility-Libraries", |
||||
|
"sha": "df2e358152", |
||||
|
"hash": "3e468c3d9ff93f6d418d71e5527abe0a12c8c7ab5b0b52278bbbee4d02bb87e99073906729b727e0147242b7e3fd5dedf68b803f1878cb4c0e4f730bc2238d79" |
||||
|
}, |
||||
|
"vulkan-memory-allocator": { |
||||
|
"package": "VulkanMemoryAllocator", |
||||
|
"repo": "GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator", |
||||
|
"sha": "1076b348ab", |
||||
|
"hash": "a46b44e4286d08cffda058e856c47f44c7fed3da55fe9555976eb3907fdcc20ead0b1860b0c38319cda01dbf9b1aa5d4b4038c7f1f8fbd97283d837fa9af9772", |
||||
|
"find_args": "CONFIG" |
||||
|
}, |
||||
|
"spirv-tools": { |
||||
|
"package": "SPIRV-Tools", |
||||
|
"repo": "KhronosGroup/SPIRV-Tools", |
||||
|
"sha": "40eb301f32", |
||||
|
"hash": "58d0fb1047d69373cf24c73e6f78c73a72a6cca3b4df1d9f083b9dcc0962745ef154abf3dbe9b3623b835be20c6ec769431cf11733349f45e7568b3525f707aa", |
||||
|
"find_args": "MODULE", |
||||
|
"options": [ |
||||
|
"SPIRV_SKIP_EXECUTABLES ON" |
||||
|
] |
||||
|
}, |
||||
|
"xbyak_sun": { |
||||
|
"package": "xbyak", |
||||
|
"repo": "Lizzie841/xbyak", |
||||
|
"sha": "51f507b0b3", |
||||
|
"hash": "4a29a3c2f97f7d5adf667a21a008be03c951fb6696b0d7ba27e7e4afa037bc76eb5e059bb84860e01baf741d4d3ac851b840cd54c99d038812fbe0f1fa6d38a4", |
||||
|
"bundled": true |
||||
|
}, |
||||
|
"xbyak": { |
||||
|
"package": "xbyak", |
||||
|
"repo": "Lizzie841/xbyak", |
||||
|
"sha": "4e44f4614d", |
||||
|
"hash": "5824e92159e07fa36a774aedd3b3ef3541d0241371d522cffa4ab3e1f215fa5097b1b77865b47b2481376c704fa079875557ea463ca63d0a7fd6a8a20a589e70", |
||||
|
"bundled": true |
||||
|
}, |
||||
|
"oaknut": { |
||||
|
"version": "2.0.1", |
||||
|
"repo": "merryhime/oaknut", |
||||
|
"sha": "94c726ce03", |
||||
|
"hash": "d8d082242fa1881abce3c82f8dafa002c4e561e66a69e7fc038af67faa5eff2630f082d3d19579c88c4c9f9488e54552accc8cb90e7ce743efe043b6230c08ac" |
||||
|
}, |
||||
|
"libadrenotools": { |
||||
|
"repo": "bylaws/libadrenotools", |
||||
|
"sha": "8fae8ce254", |
||||
|
"hash": "c74fa855f0edebbf25c9bce40b00966daa2447bfc5e15f0cf1a95f86cbf70fc6b02590707edbde16328a0a2a4fb9a1fc419d2dfc22a4a4150971be91892d4edb", |
||||
|
"patches": [ |
||||
|
"0001-linkerns-cpm.patch" |
||||
|
] |
||||
|
}, |
||||
|
"oboe": { |
||||
|
"repo": "google/oboe", |
||||
|
"sha": "2bc873e53c", |
||||
|
"hash": "02329058a7f9cf7d5039afaae5ab170d9f42f60f4c01e21eaf4f46073886922b057a9ae30eeac040b3ac182f51b9c1bfe9fe1050a2c9f6ce567a1a9a0ec2c768", |
||||
|
"bundled": true |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,8 @@ |
|||||
|
{ |
||||
|
"ffmpeg": { |
||||
|
"repo": "FFmpeg/FFmpeg", |
||||
|
"sha": "c2184b65d2", |
||||
|
"hash": "2a89d664119debbb3c006ab1c48d5d7f26e889f4a65ad2e25c8b0503308295123d5a9c5c78bf683aef5ff09acef8c3fc2837f22d3e8c611528b933bf03bcdd97", |
||||
|
"bundled": true |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,8 @@ |
|||||
|
{ |
||||
|
"tzdb": { |
||||
|
"package": "nx_tzdb", |
||||
|
"url": "https://github.com/crueter/tzdb_to_nx/releases/download/250725/250725.zip", |
||||
|
"hash": "8f60b4b29f285e39c0443f3d5572a73780f3dbfcfd5b35004451fadad77f3a215b2e2aa8d0fffe7e348e2a7b0660882b35228b6178dda8804a14ce44509fd2ca", |
||||
|
"version": "250725" |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,47 @@ |
|||||
|
{ |
||||
|
"biscuit": { |
||||
|
"version": "0.9.1", |
||||
|
"repo": "lioncash/biscuit", |
||||
|
"sha": "76b0be8dae", |
||||
|
"hash": "47d55ed02d032d6cf3dc107c6c0a9aea686d5f25aefb81d1af91db027b6815bd5add1755505e19d76625feeb17aa2db6cd1668fe0dad2e6a411519bde6ca4489" |
||||
|
}, |
||||
|
"mcl": { |
||||
|
"version": "0.1.12", |
||||
|
"repo": "azahar-emu/mcl", |
||||
|
"sha": "7b08d83418", |
||||
|
"hash": "f943bac39c1879986decad7a442ff4288eaeca4a2907684c7914e115a55ecc43c2782ded85c0835763fe04e40d5c82220ce864423e489e648e408a84f54dc4f3", |
||||
|
"options": [ |
||||
|
"MCL_INSTALL OFF" |
||||
|
] |
||||
|
}, |
||||
|
"unordered-dense": { |
||||
|
"package": "unordered_dense", |
||||
|
"repo": "Lizzie841/unordered_dense", |
||||
|
"sha": "e59d30b7b1", |
||||
|
"hash": "71eff7bd9ba4b9226967bacd56a8ff000946f8813167cb5664bb01e96fb79e4e220684d824fe9c59c4d1cc98c606f13aff05b7940a1ed8ab3c95d6974ee34fa0", |
||||
|
"find_args": "CONFIG", |
||||
|
"options": [ |
||||
|
"UNORDERED_DENSE_INSTALL OFF" |
||||
|
] |
||||
|
}, |
||||
|
"zycore": { |
||||
|
"package": "Zycore", |
||||
|
"repo": "zyantific/zycore-c", |
||||
|
"sha": "75a36c45ae", |
||||
|
"hash": "15aa399f39713e042c4345bc3175c82f14dca849fde2a21d4f591f62c43e227b70d868d8bb86beb5f4eb68b1d6bd3792cdd638acf89009e787e3d10ee7401924", |
||||
|
"bundled": true |
||||
|
}, |
||||
|
"zydis": { |
||||
|
"package": "Zydis", |
||||
|
"version": "4", |
||||
|
"repo": "zyantific/zydis", |
||||
|
"sha": "c2d2bab025", |
||||
|
"hash": "7b48f213ff7aab2926f8c9c65195959143bebbfb2b9a25051ffd8b8b0f1baf1670d9739781de674577d955925f91ac89376e16b476a03828c84e2fd765d45020", |
||||
|
"options": [ |
||||
|
"ZYDIS_BUILD_TOOLS OFF", |
||||
|
"ZYDIS_BUILD_EXAMPLES OFF", |
||||
|
"ZYDIS_BUILD_DOXYGEN OFF", |
||||
|
"ZYAN_SYSTEM_ZYCORE ON" |
||||
|
] |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,12 @@ |
|||||
|
{ |
||||
|
"quazip": { |
||||
|
"package": "QuaZip-Qt6", |
||||
|
"repo": "crueter/quazip-qt6", |
||||
|
"sha": "f838774d63", |
||||
|
"hash": "9f629a438699801244a106c8df6d5f8f8d19e80df54f530a89403a10c8c4e37a6e95606bbdd307f23636961e8ce34eb37a2186d589a1f227ac9c8e2c678e326e", |
||||
|
"version": "1.3", |
||||
|
"options": [ |
||||
|
"QUAZIP_INSTALL OFF" |
||||
|
] |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,10 @@ |
|||||
|
#!/bin/bash -e |
||||
|
|
||||
|
# SPDX-FileCopyrightText: 2025 Eden Emulator Project |
||||
|
# SPDX-License-Identifier: GPL-3.0-or-later |
||||
|
|
||||
|
# SPDX-FileCopyrightText: 2025 crueter |
||||
|
# SPDX-License-Identifier: GPL-3.0-or-later |
||||
|
|
||||
|
LIBS=$(find . externals externals/nx_tzdb src/yuzu/externals externals/ffmpeg src/dynarmic/externals -maxdepth 1 -name cpmfile.json -exec jq -j 'keys_unsorted | join(" ")' {} \; -printf " ") |
||||
|
tools/cpm-fetch.sh $LIBS |
||||
@ -0,0 +1,198 @@ |
|||||
|
#!/bin/bash -e |
||||
|
|
||||
|
# SPDX-FileCopyrightText: 2025 Eden Emulator Project |
||||
|
# SPDX-License-Identifier: GPL-3.0-or-later |
||||
|
|
||||
|
# SPDX-FileCopyrightText: 2025 crueter |
||||
|
# SPDX-License-Identifier: GPL-3.0-or-later |
||||
|
|
||||
|
[ -z "$CPM_SOURCE_CACHE" ] && CPM_SOURCE_CACHE=$PWD/.cache/cpm |
||||
|
|
||||
|
mkdir -p $CPM_SOURCE_CACHE |
||||
|
|
||||
|
ROOTDIR="$PWD" |
||||
|
|
||||
|
TMP=$(mktemp -d) |
||||
|
|
||||
|
download_package() { |
||||
|
FILENAME=$(basename "$DOWNLOAD") |
||||
|
|
||||
|
OUTFILE="$TMP/$FILENAME" |
||||
|
|
||||
|
LOWER_PACKAGE=$(tr '[:upper:]' '[:lower:]' <<< "$PACKAGE_NAME") |
||||
|
OUTDIR="${CPM_SOURCE_CACHE}/${LOWER_PACKAGE}/${KEY}" |
||||
|
[ -d "$OUTDIR" ] && return |
||||
|
|
||||
|
curl "$DOWNLOAD" -sS -L -o "$OUTFILE" |
||||
|
|
||||
|
ACTUAL_HASH=$(${HASH_ALGO}sum "$OUTFILE" | cut -d" " -f1) |
||||
|
[ "$ACTUAL_HASH" != "$HASH" ] && echo "$FILENAME did not match expected hash; expected $HASH but got $ACTUAL_HASH" && exit 1 |
||||
|
|
||||
|
mkdir -p "$OUTDIR" |
||||
|
|
||||
|
pushd "$OUTDIR" > /dev/null |
||||
|
|
||||
|
case "$FILENAME" in |
||||
|
(*.7z) |
||||
|
7z x "$OUTFILE" > /dev/null |
||||
|
;; |
||||
|
(*.tar*) |
||||
|
tar xf "$OUTFILE" > /dev/null |
||||
|
;; |
||||
|
(*.zip) |
||||
|
unzip "$OUTFILE" > /dev/null |
||||
|
;; |
||||
|
esac |
||||
|
|
||||
|
# basically if only one real item exists at the top we just move everything from there |
||||
|
# since github and some vendors hate me |
||||
|
DIRS=$(find -maxdepth 1 -type d -o -type f) |
||||
|
|
||||
|
# thanks gnu |
||||
|
if [ $(wc -l <<< "$DIRS") -eq 2 ]; then |
||||
|
SUBDIR=$(find . -maxdepth 1 -type d -not -name ".") |
||||
|
mv "$SUBDIR"/* . |
||||
|
mv "$SUBDIR"/.* . 2>/dev/null || true |
||||
|
rmdir "$SUBDIR" |
||||
|
fi |
||||
|
|
||||
|
if grep -e "patches" <<< "$JSON" > /dev/null; then |
||||
|
PATCHES=$(jq -r '.patches | join(" ")' <<< "$JSON") |
||||
|
for patch in $PATCHES; do |
||||
|
patch -p1 < "$ROOTDIR"/.patch/$package/$patch |
||||
|
done |
||||
|
fi |
||||
|
|
||||
|
popd > /dev/null |
||||
|
} |
||||
|
|
||||
|
ci_package() { |
||||
|
REPO=$(jq -r ".repo" <<< "$JSON") |
||||
|
EXT=$(jq -r '.extension' <<< "$JSON") |
||||
|
[ "$EXT" == null ] && EXT="tar.zst" |
||||
|
|
||||
|
VERSION=$(jq -r ".version" <<< "$JSON") |
||||
|
NAME=$(jq -r ".name | \"$package\"" <<< "$JSON") |
||||
|
PACKAGE=$(jq -r ".package | \"$package\"" <<< "$JSON") |
||||
|
|
||||
|
# TODO(crueter) |
||||
|
# DISABLED=$(jq -j '.disabled_platforms | join(" ")' <<< "$JSON") |
||||
|
|
||||
|
[ "$REPO" == null ] && echo "No repo defined for CI package $package" && return |
||||
|
|
||||
|
echo "CI package $PACKAGE" |
||||
|
|
||||
|
for platform in windows-amd64 windows-arm64 android solaris freebsd linux linux-aarch64; do |
||||
|
FILENAME="${NAME}-${platform}-${VERSION}.${EXT}" |
||||
|
DOWNLOAD="https://github.com/${REPO}/releases/download/v${VERSION}/${FILENAME}" |
||||
|
PACKAGE_NAME="$PACKAGE" |
||||
|
KEY=$platform |
||||
|
|
||||
|
echo "- platform $KEY" |
||||
|
|
||||
|
HASH_ALGO=$(jq -r ".hash_algo" <<< "$JSON") |
||||
|
[ "$HASH_ALGO" == null ] && HASH_ALGO=sha512 |
||||
|
|
||||
|
HASH_SUFFIX="${HASH_ALGO}sum" |
||||
|
HASH_URL="${DOWNLOAD}.${HASH_SUFFIX}" |
||||
|
|
||||
|
HASH=$(curl "$HASH_URL" -sS -q -L -o -) |
||||
|
|
||||
|
download_package |
||||
|
done |
||||
|
} |
||||
|
|
||||
|
for package in $@ |
||||
|
do |
||||
|
# prepare for cancer |
||||
|
JSON=$(find . externals src/yuzu/externals externals/ffmpeg src/dynarmic/externals externals/nx_tzdb -maxdepth 1 -name cpmfile.json -exec jq -r ".\"$package\" | select( . != null )" {} \;) |
||||
|
|
||||
|
[ -z "$JSON" ] && echo "No cpmfile definition for $package" && continue |
||||
|
|
||||
|
PACKAGE_NAME=$(jq -r ".package" <<< "$JSON") |
||||
|
[ "$PACKAGE_NAME" == null ] && PACKAGE_NAME="$package" |
||||
|
|
||||
|
CI=$(jq -r ".ci" <<< "$JSON") |
||||
|
if [ "$CI" != null ]; then |
||||
|
ci_package |
||||
|
continue |
||||
|
fi |
||||
|
|
||||
|
# url parsing WOOOHOOHOHOOHOHOH |
||||
|
URL=$(jq -r ".url" <<< "$JSON") |
||||
|
REPO=$(jq -r ".repo" <<< "$JSON") |
||||
|
SHA=$(jq -r ".sha" <<< "$JSON") |
||||
|
|
||||
|
if [ "$URL" != "null" ]; then |
||||
|
DOWNLOAD="$URL" |
||||
|
elif [ "$REPO" != "null" ]; then |
||||
|
GIT_URL="https://github.com/$REPO" |
||||
|
|
||||
|
TAG=$(jq -r ".tag" <<< "$JSON") |
||||
|
ARTIFACT=$(jq -r ".artifact" <<< "$JSON") |
||||
|
BRANCH=$(jq -r ".branch" <<< "$JSON") |
||||
|
|
||||
|
if [ "$TAG" != "null" ]; then |
||||
|
if [ "$ARTIFACT" != "null" ]; then |
||||
|
DOWNLOAD="${GIT_URL}/releases/download/${TAG}/${ARTIFACT}" |
||||
|
else |
||||
|
DOWNLOAD="${GIT_URL}/archive/refs/tags/${TAG}.tar.gz" |
||||
|
fi |
||||
|
elif [ "$SHA" != "null" ]; then |
||||
|
DOWNLOAD="${GIT_URL}/archive/${SHA}.zip" |
||||
|
else |
||||
|
if [ "$BRANCH" == null ]; then |
||||
|
BRANCH=master |
||||
|
fi |
||||
|
|
||||
|
DOWNLOAD="${GIT_URL}/archive/refs/heads/${BRANCH}.zip" |
||||
|
fi |
||||
|
else |
||||
|
echo "No repo or URL defined for $package" |
||||
|
continue |
||||
|
fi |
||||
|
|
||||
|
# key parsing |
||||
|
KEY=$(jq -r ".key" <<< "$JSON") |
||||
|
|
||||
|
if [ "$KEY" == null ]; then |
||||
|
VERSION=$(jq -r ".version" <<< "$JSON") |
||||
|
GIT_VERSION=$(jq -r ".git_version" <<< "$JSON") |
||||
|
|
||||
|
if [ "$SHA" != null ]; then |
||||
|
KEY=$(cut -c1-4 - <<< "$SHA") |
||||
|
elif [ "$GIT_VERSION" != null ]; then |
||||
|
KEY="$GIT_VERSION" |
||||
|
elif [ "$VERSION" != null ]; then |
||||
|
KEY="$VERSION" |
||||
|
else |
||||
|
echo "No valid key could be determined for $package. Must define one of: key, sha, version, git_version" |
||||
|
continue |
||||
|
fi |
||||
|
fi |
||||
|
|
||||
|
echo $KEY |
||||
|
|
||||
|
echo "Downloading regular package $package, with key $KEY, from $DOWNLOAD" |
||||
|
|
||||
|
# hash parsing |
||||
|
HASH_ALGO=$(jq -r ".hash_algo" <<< "$JSON") |
||||
|
[ "$HASH_ALGO" == null ] && HASH_ALGO=sha512 |
||||
|
|
||||
|
HASH=$(jq -r ".hash" <<< "$JSON") |
||||
|
|
||||
|
if [ "$HASH" == null ]; then |
||||
|
HASH_SUFFIX="${HASH_ALGO}sum" |
||||
|
HASH_URL=$(jq -r ".hash_url" <<< "$JSON") |
||||
|
|
||||
|
if [ "$HASH_URL" == null ]; then |
||||
|
HASH_URL="${DOWNLOAD}.${HASH_SUFFIX}" |
||||
|
fi |
||||
|
|
||||
|
HASH=$(curl "$HASH_URL" -L -o -) |
||||
|
fi |
||||
|
|
||||
|
download_package |
||||
|
done |
||||
|
|
||||
|
rm -rf $TMP |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue