mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-31 07:37:24 +00:00
Rename the SixtyFPS CMake interface
This commit is contained in:
parent
c333b4de2b
commit
b1a70f9e58
31 changed files with 161 additions and 152 deletions
|
@ -18,7 +18,7 @@ You can download one of our pre-built binaries for Linux or Windows on x86-64 ar
|
|||
or `sixtyfps-cpp-XXX-win64.exe` for a Windows installer. ("XXX" refers to the version of the latest release)
|
||||
4. Uncompress the downloaded archive or run the installer.
|
||||
|
||||
After extracting the artifact or running the installer, you can place the `lib` sub-directory into your `CMAKE_PREFIX_PATH` and `find_package(SixtyFPS)` should succeed in locating the package.
|
||||
After extracting the artifact or running the installer, you can place the `lib` sub-directory into your `CMAKE_PREFIX_PATH` and `find_package(Slint)` should succeed in locating the package.
|
||||
|
||||
In the next section you will learn how to use the installed library in your application
|
||||
and load `.60` UI files.
|
||||
|
@ -50,7 +50,7 @@ FetchContent_MakeAvailable(SixtyFPS)
|
|||
```
|
||||
|
||||
If you prefer to treat SixtyFPS as an external CMake package, then you can also build SixtyFPS from source like a regular
|
||||
CMake project, install it into a prefix directory of your choice and use `find_package(SixtyFPS)` in your `CMakeLists.txt`.
|
||||
CMake project, install it into a prefix directory of your choice and use `find_package(Slint)` in your `CMakeLists.txt`.
|
||||
|
||||
### Features
|
||||
|
||||
|
@ -58,11 +58,11 @@ The SixtyFPS run-time library supports different features that can be toggled. Y
|
|||
not enabled by default but that is revelant for you, or you may want to disable a feature that you know you do not need and
|
||||
therefore reduce the size of the resulting library.
|
||||
|
||||
The CMake configure step offers CMake options for various feature that are all prefixed with `SIXTYFPS_FEATURE_`. For example
|
||||
you can enable support for the Wayland windowing system on Linux by enabling the `SIXTYFPS_FEATURE_WAYLAND` feature. There are
|
||||
The CMake configure step offers CMake options for various feature that are all prefixed with `SLINT_FEATURE_`. For example
|
||||
you can enable support for the Wayland windowing system on Linux by enabling the `SLINT_FEATURE_WAYLAND` feature. There are
|
||||
different ways of toggling CMake options. For example on the command line using the `-D` parameter:
|
||||
|
||||
`cmake -DSIXTYFPS_FEATURE_WAYLAND=ON ...`
|
||||
`cmake -DSLINT_FEATURE_WAYLAND=ON ...`
|
||||
|
||||
Alternatively, after the configure step you can use `cmake-gui` or `ccmake` on the build directory for a list of all features
|
||||
and their description.
|
||||
|
|
|
@ -58,3 +58,12 @@ instance->invoke_callback("foo", args);
|
|||
#### Models
|
||||
|
||||
The `Value::Type::Array` has been replaced by `Value::Type::Model`
|
||||
|
||||
|
||||
### CMake Interface
|
||||
|
||||
The CMake interface has changed mostly in terms of renaming `SixtyFPS` to `Slint`:
|
||||
|
||||
* `find_package(SixtyFPS)` becomes `find_package(Slint)`.
|
||||
* The `SixtyFPS::SixtyFPS` CMake target was renamed to `Slint::Slint`.
|
||||
* The `sixtyfps_target_60_sources` CMake command was renamed to `slint_target_sources`.
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
Once SixtyFPS is built, you can use it in your CMake application or library target in two steps:
|
||||
|
||||
1. Associate the `.60` files that you'd like to use by calling the `sixtyfps_target_60_sources` cmake command. The first parameter is
|
||||
1. Associate the `.60` files that you'd like to use by calling the `slint_target_sources` cmake command. The first parameter is
|
||||
your application (or library) CMake target, and the parameters following are the names of the `.60` files. This will result in the
|
||||
`.60` files to be compiled into C++ source code.
|
||||
2. The generated C++ source code also needs the SixtyFPS run-time library. This dependency is satisfied by linking `SixtyFPS::SixtyFPS`
|
||||
2. The generated C++ source code also needs the SixtyFPS run-time library. This dependency is satisfied by linking `Slint::Slint`
|
||||
into your target with the `target_link_libraries` command.
|
||||
|
||||
A typical example looks like this:
|
||||
|
@ -14,7 +14,7 @@ A typical example looks like this:
|
|||
cmake_minimum_required(VERSION 3.19)
|
||||
project(my_application LANGUAGES CXX)
|
||||
|
||||
# Note: Use find_package(SixtyFPS) instead of the following three commands,
|
||||
# Note: Use find_package(Slint) instead of the following three commands,
|
||||
# if you prefer the package approach.
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
|
@ -26,8 +26,8 @@ FetchContent_Declare(
|
|||
FetchContent_MakeAvailable(SixtyFPS)
|
||||
|
||||
add_executable(my_application main.cpp)
|
||||
sixtyfps_target_60_sources(my_application my_application_ui.60)
|
||||
target_link_libraries(my_application PRIVATE SixtyFPS::SixtyFPS)
|
||||
slint_target_sources(my_application my_application_ui.60)
|
||||
target_link_libraries(my_application PRIVATE Slint::Slint)
|
||||
```
|
||||
|
||||
Suppose `my_application_ui.60` was a "Hello World" like this:
|
||||
|
|
|
@ -17,7 +17,7 @@ data models or setting up callbacks that are invoked when the user activates cer
|
|||
You can choose to compile a `.60` file to C++, which provides the best performance
|
||||
and lowest memory consumption.
|
||||
|
||||
The `sixtyfps_target_60_sources` cmake command makes the translation automatic
|
||||
The `slint_target_sources` cmake command makes the translation automatic
|
||||
and [generated code](generated_code.md) has an API that allows setting and getting
|
||||
property values, etc. That API will use types from the {ref}`sixtyfps <namespace_sixtyfps>`
|
||||
namespace, for example {cpp:class}`sixtyfps::SharedString` or {cpp:class}`sixtyfps::Color`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue