|
| 1 | +Quick Start Guide |
| 2 | +***************** |
| 3 | + |
| 4 | +hyperion::mpl supports both CMake and XMake, and incorporating it in your project is quick and |
| 5 | +easy. |
| 6 | + |
| 7 | +CMake |
| 8 | +----- |
| 9 | + |
| 10 | +hyperion::latform is easily incorporated into a raw CMake project with :cmake:`FetchContent` or |
| 11 | +other methods like :cmake:`add_subdirectory`\. Example for :cmake:`FetchContent`\: |
| 12 | + |
| 13 | +.. code-block:: cmake |
| 14 | + :caption: CMakeLists.txt |
| 15 | + :linenos: |
| 16 | +
|
| 17 | + # Include FetchContent so we can use it |
| 18 | + include(FetchContent) |
| 19 | +
|
| 20 | + # Declare the dependency on hyperion-utils and make it available for use |
| 21 | + FetchContent_Declare(hyperion_mpl |
| 22 | + GIT_REPOSITORY "https://github.com/braxtons12/hyperion_mpl" |
| 23 | + GIT_TAG "origin/main") |
| 24 | + FetchContent_MakeAvailable(hyperion_mpl) |
| 25 | +
|
| 26 | + # For this example, we create an executable target and link hyperion::mpl to it |
| 27 | + add_executable(MyExecutable "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp") |
| 28 | + target_link_libraries(MyExecutable PRIVATE hyperion::mpl) |
| 29 | +
|
| 30 | +Note that hyperion::mpl depends on |
| 31 | +`hyperion::platform <https://github.com/braxtons12/hyperion_platform>`_ for platform and feature |
| 32 | +detection macros and other core utilities, `doctest <https://github.com/doctest/doctestdoctest>`_ |
| 33 | +for testing, and optionally depends on `Tracy <https://github.com/wolfpld/tracy>`_ for the profiling |
| 34 | +macros `hyperion::platform` wraps in :cpp:`#include <hyperion/platform/def.h>`\ (set the option |
| 35 | +:cmake:`HYPERION_ENABLE_TRACY` to :cmake:`ON` to enable these). By default, it will use |
| 36 | +:cmake:`FetchContent` to obtain these dependencies, but you can disable this by setting |
| 37 | +:cmake:`HYPERION_USE_FETCH_CONTENT` to :cmake:`OFF`\, in which case you will need to make sure each |
| 38 | +package is findable via CMake's :cmake:`find_package`. |
| 39 | + |
| 40 | +XMake |
| 41 | +----- |
| 42 | + |
| 43 | +XMake is a new(er) Lua-based build system with integrated package management. It is the preferred |
| 44 | +way to use Hyperion packages. Example: |
| 45 | + |
| 46 | +.. code-block:: lua |
| 47 | + :caption: xmake.lua |
| 48 | + :linenos: |
| 49 | +
|
| 50 | + set_project("my_project") |
| 51 | +
|
| 52 | + -- add the hyperion_packages git repository as an XMake repository |
| 53 | + add_repositories("hyperion https://github.com/braxtons12/hyperion_packages.git") |
| 54 | +
|
| 55 | + -- add hyperion_mpl as a required dependency for the project |
| 56 | + add_requires("hyperion_mpl", { |
| 57 | + -- Don't verify the git commit. This is necessary because hyperion::mpl hasn't reached |
| 58 | + -- an official release yet, and thus doesn't have a stable git commit to track. |
| 59 | + -- This allows pulling directly from $HEAD |
| 60 | + verify = false, |
| 61 | + }) |
| 62 | + |
| 63 | + -- For this example, we create an executable target and link hyperion::mpl to it |
| 64 | + target("my_executable") |
| 65 | + set_kind("binary") |
| 66 | + add_packages("hyperion_mpl") |
0 commit comments