C++ docs: Move cmake usage into a separate top-level topic

... which is to be expanded further subsequently
This commit is contained in:
Simon Hausmann 2021-07-01 10:46:53 +02:00
parent 317111ef2b
commit 6b8073983f
3 changed files with 28 additions and 27 deletions

View file

@ -0,0 +1,26 @@
# Usage via CMake
A typical example looks like this:
```cmake
cmake_minimum_required(VERSION 3.16)
project(my_application LANGUAGES CXX)
# Note: Use find_package(SixtyFPS) instead of the following three commands, if you prefer the package
# approach.
include(FetchContent)
FetchContent_Declare(
SixtyFPS
GIT_REPOSITORY https://github.com/sixtyfpsui/sixtyfps.git
GIT_TAG v0.1.0
SOURCE_SUBDIR api/sixtyfps-cpp
)
FetchContent_MakeAvailable(SixtyFPS)
add_executable(my_application main.cpp)
target_link_libraries(my_application PRIVATE SixtyFPS::SixtyFPS)
sixtyfps_target_60_sources(my_application my_application_ui.60)
```
The `sixtyfps_target_60_sources` cmake command allows you to add .60 files to your build. Finally it is
necessary to link your executable or library against the `SixtyFPS::SixtyFPS` target.

View file

@ -18,6 +18,8 @@ Welcome to SixtyFPS C++'s documentation!
Introduction <intro.md>
Usage with CMake<cmake.md>
Generated Code <generated_code.md>
Type Mappings <types.md>

View file

@ -96,33 +96,6 @@ and downloading the `cpp_bin` artifact.
After extracting the artifact you can place the `lib` directory into your `CMAKE_PREFIX_PATH` and `find_package(SixtyFPS)` should succeed
in locating the package.
## Usage via CMake
A typical example looks like this:
```cmake
cmake_minimum_required(VERSION 3.16)
project(my_application LANGUAGES CXX)
# Note: Use find_package(SixtyFPS) instead of the following three commands, if you prefer the package
# approach.
include(FetchContent)
FetchContent_Declare(
SixtyFPS
GIT_REPOSITORY https://github.com/sixtyfpsui/sixtyfps.git
GIT_TAG v0.1.0
SOURCE_SUBDIR api/sixtyfps-cpp
)
FetchContent_MakeAvailable(SixtyFPS)
add_executable(my_application main.cpp)
target_link_libraries(my_application PRIVATE SixtyFPS::SixtyFPS)
sixtyfps_target_60_sources(my_application my_application_ui.60)
```
The `sixtyfps_target_60_sources` cmake command allows you to add .60 files to your build. Finally it is
necessary to link your executable or library against the `SixtyFPS::SixtyFPS` target.
## Tutorial
If you are new to SixtyFPS, then you may be interested in reading our walk-through [SixtyFPS Memory Game Tutorial Tutorial](../tutorial/cpp).