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
- 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
-`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)