Quick Start Guide#
hyperion::mpl supports both CMake and XMake, and incorporating it in your project is quick and easy.
CMake#
hyperion::mpl is easily incorporated into a raw CMake project with FetchContent
or
other methods like add_subdirectory
. Example for FetchContent
:
1# Include FetchContent so we can use it
2include(FetchContent)
3
4# Declare the dependency on hyperion-utils and make it available for use
5FetchContent_Declare(hyperion_mpl
6 GIT_REPOSITORY "https://github.com/braxtons12/hyperion_mpl"
7 GIT_TAG "v0.8.0")
8FetchContent_MakeAvailable(hyperion_mpl)
9
10# For this example, we create an executable target and link hyperion::mpl to it
11add_executable(MyExecutable "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp")
12target_link_libraries(MyExecutable PRIVATE hyperion::mpl)
Note that hyperion::mpl depends on hyperion::platform for platform and feature detection macros and other core utilities. hyperion::platform has several optional features with optional dependencies, and hyperion::mpl exposes those settings to its users as well (see the hyperion::platform documentation for how to enable these).
By default, FetchContent
will be used to obtain these dependencies, but you can disable
this by setting HYPERION_USE_FETCH_CONTENT
to OFF
, in which case you will need to
make sure each package is findable via CMake’s find_package
.
XMake#
XMake is a new(er) Lua-based build system with integrated package management. It is the preferred way to use Hyperion packages. Example:
1set_project("my_project")
2
3-- add the hyperion_packages git repository as an XMake package repository/registry
4add_repositories("hyperion https://github.com/braxtons12/hyperion_packages.git")
5
6-- add hyperion_mpl as a required dependency for the project
7add_requires("hyperion_mpl", {
8 system = false,
9 external = true,
10})
11
12-- For this example, we create an executable target and link hyperion::mpl to it
13target("my_executable", function()
14 set_kind("binary")
15 add_packages("hyperion_mpl")
16end)
Note that with XMake, hyperion::mpl requires the same dependencies as with the CMake build system. Third-party dependencies will be pulled from xmake-repo, the package repository/registry for XMake, and dependencies on other hyperion libraries will be pulled from github via the hyperion package repository/registry for xmake.