Rename the SixtyFPS CMake interface

This commit is contained in:
Simon Hausmann 2022-02-02 09:52:37 +01:00
parent c333b4de2b
commit b1a70f9e58
31 changed files with 161 additions and 152 deletions

View file

@ -16,7 +16,7 @@ jobs:
# for which the stable alternative is not yet available
RUSTFLAGS: -D warnings -W deprecated
RUSTDOCFLAGS: --html-in-header=/home/runner/work/sixtyfps/sixtyfps/docs/resources/sixtyfps-docs-preview.html --html-in-header=/home/runner/work/sixtyfps/sixtyfps/docs/resources/sixtyfps-docs-highlight.html -D warnings -W deprecated
SIXTYFPS_NO_QT: 1
SLINT_NO_QT: 1
CARGO_INCREMENTAL: false
MDBOOK_VERSION: 0.4.10
MDBOOK_LINKCHECK_VERSION: 0.7.4

View file

@ -50,7 +50,7 @@ jobs:
if: matrix.os == 'windows-latest'
run: |
echo "SIXTYFPS_STYLE=fluent" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "SIXTYFPS_NO_QT=1" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "SLINT_NO_QT=1" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Setup Node.js
uses: actions/setup-node@v1
with:
@ -127,7 +127,7 @@ jobs:
if: matrix.os == 'windows-latest'
run: |
echo "SIXTYFPS_STYLE=fluent" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "SIXTYFPS_NO_QT=1" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "SLINT_NO_QT=1" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Cache cargo registry
uses: actions/cache@v2
with:
@ -241,7 +241,7 @@ jobs:
with:
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeListsTxtPath: CMakeLists.txt
cmakeAppendedArgs: '-DBUILD_TESTING=ON -DSIXTYFPS_BUILD_EXAMPLES=ON -DCMAKE_BUILD_TYPE=Debug'
cmakeAppendedArgs: '-DBUILD_TESTING=ON -DSLINT_BUILD_EXAMPLES=ON -DCMAKE_BUILD_TYPE=Debug'
buildDirectory: ${{ runner.workspace }}/cppbuild
buildWithCMakeArgs: '--config Debug'
- name: ctest
@ -254,7 +254,7 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: cpp_bin-${{ matrix.os }}
path: ${{ runner.workspace }}/cppbuild/SixtyFPS-cpp-*
path: ${{ runner.workspace }}/cppbuild/Slint-cpp-*
cpp_package_test:
needs: [cpp_cmake]
@ -287,14 +287,14 @@ jobs:
- name: unpack package
run: |
mkdir package
tar xvf cpp-package/SixtyFPS-cpp-*.tar.gz -C package --strip-components=1
tar xvf cpp-package/Slint-cpp-*.tar.gz -C package --strip-components=1
echo "CMAKE_PREFIX_PATH=`pwd`/package" >> $GITHUB_ENV
- name: Build examples
uses: lukka/run-cmake@v3.4
with:
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeListsTxtPath: examples/CMakeLists.txt
cmakeAppendedArgs: '-DCMAKE_BUILD_TYPE=Debug -DSIXTYFPS_FEATURE_INTERPRETER=1 -DSIXTYFPS_FEATURE_BACKEND_QT=1'
cmakeAppendedArgs: '-DCMAKE_BUILD_TYPE=Debug -DSLINT_FEATURE_INTERPRETER=1 -DSLINT_FEATURE_BACKEND_QT=1'
buildDirectory: ${{ runner.workspace }}/examples/build
buildWithCMakeArgs: '--config Debug'
@ -311,7 +311,7 @@ jobs:
# and check that it worked with the interpreter test.
updater_test:
env:
SIXTYFPS_NO_QT: 1
SLINT_NO_QT: 1
CARGO_INCREMENTAL: false
# There were binding loops with layout in our demo, so ignore theses errors
# Also ignore errors that were warnings before

View file

@ -72,7 +72,7 @@ jobs:
with:
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeListsTxtPath: CMakeLists.txt
cmakeAppendedArgs: '-DCMAKE_BUILD_TYPE=RelWithDebInfo -DSIXTYFPS_PACKAGE_BUNDLE_QT=ON'
cmakeAppendedArgs: '-DCMAKE_BUILD_TYPE=RelWithDebInfo -DSLINT_PACKAGE_BUNDLE_QT=ON'
buildDirectory: ${{ runner.workspace }}/cppbuild
buildWithCMakeArgs: '--config Release'
- name: cpack
@ -82,4 +82,4 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: cpp_bin
path: ${{ runner.workspace }}/cppbuild/SixtyFPS-cpp-*
path: ${{ runner.workspace }}/cppbuild/Slint-cpp-*

View file

@ -12,7 +12,7 @@ on:
jobs:
crater:
env:
SIXTYFPS_NO_QT: 1
SLINT_NO_QT: 1
CARGO_INCREMENTAL: false
RUST_BACKTRACE: 1
strategy:

View file

@ -16,7 +16,7 @@ jobs:
- aarch64-unknown-linux-gnu
- riscv64gc-unknown-linux-gnu
env:
SIXTYFPS_NO_QT: 1
SLINT_NO_QT: 1
SIXTYFPS_STYLE: fluent
steps:
- uses: actions/checkout@v2

View file

@ -41,7 +41,7 @@ jobs:
build_vscode_lsp_linux_windows:
env:
SIXTYFPS_NO_QT: 1
SLINT_NO_QT: 1
strategy:
matrix:
include:
@ -85,7 +85,7 @@ jobs:
build_vscode_lsp_macos_x86_64:
env:
SIXTYFPS_NO_QT: 1
SLINT_NO_QT: 1
runs-on: macOS-11
steps:
- uses: actions/checkout@v2
@ -112,7 +112,7 @@ jobs:
build_vscode_lsp_macos_aarch64:
env:
SIXTYFPS_NO_QT: 1
SLINT_NO_QT: 1
runs-on: macOS-11
steps:
- uses: actions/checkout@v2
@ -162,7 +162,7 @@ jobs:
build_vscode_cross_linux_lsp:
env:
SIXTYFPS_NO_QT: 1
SLINT_NO_QT: 1
strategy:
matrix:
target:

View file

@ -16,10 +16,10 @@ include(CTest)
add_subdirectory(api/cpp/)
option(SIXTYFPS_BUILD_EXAMPLES "Build SixtyFPS Examples" OFF)
add_feature_info(SIXTYFPS_BUILD_EXAMPLES SIXTYFPS_BUILD_EXAMPLES "configure whether to build the examples")
option(SLINT_BUILD_EXAMPLES "Build SixtyFPS Examples" OFF)
add_feature_info(SLINT_BUILD_EXAMPLES SLINT_BUILD_EXAMPLES "configure whether to build the examples")
if(SIXTYFPS_BUILD_EXAMPLES)
if(SLINT_BUILD_EXAMPLES)
# Place all compiled examples into the same bin directory
# on Windows, where we'll also put the dll
if (WIN32)

View file

@ -10,7 +10,7 @@ image = "ghcr.io/sixtyfpsui/sixtyfps/riscv64gc-unknown-linux-gnu"
[build.env]
passthrough = [
"SIXTYFPS_NO_QT",
"SLINT_NO_QT",
"SIXTYFPS_STYLE",
"SIXTYFPS_TEST_FILTER",
"SIXTYFPS_INTERPRETER_ERROR_WHITELIST",

View file

@ -25,7 +25,7 @@ set_property(
TARGET slint-cpp
APPEND
PROPERTY CORROSION_ENVIRONMENT_VARIABLES
SIXTYFPS_GENERATED_INCLUDE_DIR="${CMAKE_CURRENT_BINARY_DIR}/generated_include/"
SLINT_GENERATED_INCLUDE_DIR="${CMAKE_CURRENT_BINARY_DIR}/generated_include/"
)
set_property(
@ -33,16 +33,16 @@ set_property(
PROPERTY CORROSION_USE_HOST_BUILD 1
)
add_library(SixtyFPS INTERFACE)
add_library(SixtyFPS::SixtyFPS ALIAS SixtyFPS)
target_link_libraries(SixtyFPS INTERFACE slint-cpp)
target_compile_features(SixtyFPS INTERFACE cxx_std_20)
add_library(Slint INTERFACE)
add_library(Slint::Slint ALIAS Slint)
target_link_libraries(Slint INTERFACE slint-cpp)
target_compile_features(Slint INTERFACE cxx_std_20)
function(define_cargo_feature cargo-feature description default)
# turn foo-bar into SIXTYFPS_FEATURE_FOO_BAR
# turn foo-bar into SLINT_FEATURE_FOO_BAR
string(TOUPPER "${cargo-feature}" cmake_option)
string(REPLACE "-" "_" cmake_option "${cmake_option}")
set(cmake_option "SIXTYFPS_FEATURE_${cmake_option}")
set(cmake_option "SLINT_FEATURE_${cmake_option}")
option("${cmake_option}" "${description}" ${default})
if(${cmake_option})
list(APPEND features ${cargo-feature})
@ -52,10 +52,10 @@ function(define_cargo_feature cargo-feature description default)
endfunction()
function(define_cargo_dependent_feature cargo-feature description default depends_condition)
# turn foo-bar into SIXTYFPS_FEATURE_FOO_BAR
# turn foo-bar into SLINT_FEATURE_FOO_BAR
string(TOUPPER "${cargo-feature}" cmake_option)
string(REPLACE "-" "_" cmake_option "${cmake_option}")
set(cmake_option "SIXTYFPS_FEATURE_${cmake_option}")
set(cmake_option "SLINT_FEATURE_${cmake_option}")
cmake_dependent_option("${cmake_option}" "${description}" ${default} ${depends_condition} OFF)
if(${cmake_option})
list(APPEND features ${cargo-feature})
@ -66,11 +66,11 @@ endfunction()
# Features that are mapped to features in the Rust crate. These and their
# defaults need to be kept in sync with the Rust bit.
define_cargo_feature(interpreter "Enable support for the SixtyFPS interpeter to load .60 files at run-time" ON)
define_cargo_feature(interpreter "Enable support for the Slint interpeter to load .60 files at run-time" ON)
define_cargo_feature(backend-gl "Enable OpenGL ES 2.0 based rendering backend" ON)
define_cargo_dependent_feature(x11 "Enable X11 support when using GL backend" ON SIXTYFPS_FEATURE_BACKEND_GL OFF)
define_cargo_dependent_feature(wayland "Enable Wayland support when using the GL backend" OFF SIXTYFPS_FEATURE_BACKEND_GL OFF)
define_cargo_dependent_feature(x11 "Enable X11 support when using GL backend" ON SLINT_FEATURE_BACKEND_GL OFF)
define_cargo_dependent_feature(wayland "Enable Wayland support when using the GL backend" OFF SLINT_FEATURE_BACKEND_GL OFF)
define_cargo_feature(backend-qt "Enable Qt based rendering backend" ON)
@ -86,14 +86,14 @@ set_property(
)
if (SIXTYFPS_FEATURE_BACKEND_QT)
if (SLINT_FEATURE_BACKEND_QT)
# For the CMake build don't rely on qmake being in PATH but use CMake to locate Qt. This
# means usually CMAKE_PREFIX_PATH is set.
find_package(Qt6 6.0 QUIET COMPONENTS Core Widgets)
if (NOT TARGET Qt::qmake)
find_package(Qt5 5.15 QUIET COMPONENTS Core Widgets)
endif()
endif (SIXTYFPS_FEATURE_BACKEND_QT)
endif (SLINT_FEATURE_BACKEND_QT)
if (TARGET Qt::qmake)
set_property(
TARGET slint-cpp
@ -101,24 +101,24 @@ if (TARGET Qt::qmake)
PROPERTY CORROSION_ENVIRONMENT_VARIABLES
QMAKE=$<TARGET_PROPERTY:Qt::qmake,LOCATION>
)
set(SIXTYFPS_STYLE_DEFAULT "native")
set(SLINT_STYLE_DEFAULT "native")
else()
set_property(
TARGET slint-cpp
APPEND
PROPERTY CORROSION_ENVIRONMENT_VARIABLES
SIXTYFPS_NO_QT=1
SLINT_NO_QT=1
)
set(SIXTYFPS_STYLE_DEFAULT "fluent")
set(SLINT_STYLE_DEFAULT "fluent")
endif()
set(SIXTYFPS_STYLE ${SIXTYFPS_STYLE_DEFAULT} CACHE STRING "The SixtyFPS widget style" FORCE)
set(SLINT_STYLE ${SLINT_STYLE_DEFAULT} CACHE STRING "The Slint widget style" FORCE)
file(GLOB api_headers RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/include/"
"${CMAKE_CURRENT_SOURCE_DIR}/include/*.h")
foreach(header IN LISTS api_headers)
set_property(TARGET SixtyFPS APPEND PROPERTY PUBLIC_HEADER include/${header})
set_property(TARGET Slint APPEND PROPERTY PUBLIC_HEADER include/${header})
endforeach()
set(generated_headers
@ -138,23 +138,23 @@ set(generated_headers
)
foreach(header IN LISTS generated_headers)
set_property(TARGET SixtyFPS APPEND PROPERTY PUBLIC_HEADER ${header})
set_property(TARGET Slint APPEND PROPERTY PUBLIC_HEADER ${header})
endforeach()
target_include_directories(SixtyFPS INTERFACE
target_include_directories(Slint INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/generated_include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include/sixtyfps>
$<INSTALL_INTERFACE:include/slint>
)
add_executable(SixtyFPS::slint-compiler ALIAS slint-compiler)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/SixtyFPSMacro.cmake)
add_executable(Slint::slint-compiler ALIAS slint-compiler)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/SlintMacro.cmake)
export(TARGETS SixtyFPS slint-cpp
NAMESPACE SixtyFPS:: FILE "${CMAKE_BINARY_DIR}/lib/cmake/SixtyFPS/SixtyFPSTargets.cmake")
install(EXPORT SixtyFPSTargets NAMESPACE SixtyFPS:: DESTINATION lib/cmake/SixtyFPS)
install(TARGETS SixtyFPS slint-cpp
EXPORT SixtyFPSTargets LIBRARY DESTINATION lib PUBLIC_HEADER DESTINATION include/sixtyfps)
export(TARGETS Slint slint-cpp
NAMESPACE Slint:: FILE "${CMAKE_BINARY_DIR}/lib/cmake/Slint/SlintTargets.cmake")
install(EXPORT SlintTargets NAMESPACE Slint:: DESTINATION lib/cmake/Slint)
install(TARGETS Slint slint-cpp
EXPORT SlintTargets LIBRARY DESTINATION lib PUBLIC_HEADER DESTINATION include/slint)
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
@ -168,7 +168,7 @@ if(WIN32)
if(GENERATOR_IS_MULTI_CONFIG)
set(config_subdir_genex "$<CONFIG>/")
endif()
add_custom_target(SixtyFPS_dll_convenience ALL DEPENDS slint-cpp-shared
add_custom_target(Slint_dll_convenience ALL DEPENDS slint-cpp-shared
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:slint-cpp-shared>
${CMAKE_BINARY_DIR}/bin/${config_subdir_genex}$<TARGET_FILE_NAME:slint-cpp-shared>)
@ -176,7 +176,7 @@ endif()
install(PROGRAMS $<TARGET_FILE:slint-compiler> TYPE BIN)
set(SIXTYFPS_LIB_PROPERTIES "")
set(SLINT_LIB_PROPERTIES "")
foreach(prop
IMPORTED_LOCATION IMPORTED_LOCATION_DEBUG IMPORTED_LOCATION_RELEASE
IMPORTED_LOCATION_RELWITHDEBINFO IMPORTED_LOCATION_MINSIZEREL
@ -185,29 +185,29 @@ foreach(prop
get_target_property(value slint-cpp-shared ${prop})
if(value)
get_filename_component(value ${value} NAME)
list(APPEND SIXTYFPS_LIB_PROPERTIES ${prop} "\${_IMPORT_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${value}")
list(APPEND SLINT_LIB_PROPERTIES ${prop} "\${_IMPORT_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${value}")
endif()
endforeach()
configure_package_config_file("cmake/SixtyFPSConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/SixtyFPS/SixtyFPSConfig.cmake" INSTALL_DESTINATION lib/cmake/SixtyFPS)
configure_package_config_file("cmake/SlintConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/Slint/SlintConfig.cmake" INSTALL_DESTINATION lib/cmake/Slint)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/SixtyFPS/SixtyFPSConfigVersion.cmake
${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/Slint/SlintConfigVersion.cmake
VERSION 0.2.0
COMPATIBILITY SameMinorVersion
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/SixtyFPS/SixtyFPSConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/SixtyFPS/SixtyFPSConfigVersion.cmake"
"${CMAKE_CURRENT_LIST_DIR}/cmake/SixtyFPSMacro.cmake"
DESTINATION lib/cmake/SixtyFPS
"${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/Slint/SlintConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/lib/cmake/Slint/SlintConfigVersion.cmake"
"${CMAKE_CURRENT_LIST_DIR}/cmake/SlintMacro.cmake"
DESTINATION lib/cmake/Slint
)
option(SIXTYFPS_PACKAGE_BUNDLE_QT "Internal setting to install Qt binary in the packages" OFF)
if(SIXTYFPS_PACKAGE_BUNDLE_QT)
option(SLINT_PACKAGE_BUNDLE_QT "Internal setting to install Qt binary in the packages" OFF)
if(SLINT_PACKAGE_BUNDLE_QT)
if(WIN32)
find_package(Qt6 6.0 COMPONENTS Core Gui Widgets Svg)
install(
@ -234,9 +234,9 @@ if(SIXTYFPS_PACKAGE_BUNDLE_QT)
include(InstallRequiredSystemLibraries)
install(FILES ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} TYPE LIB)
endif()
endif(SIXTYFPS_PACKAGE_BUNDLE_QT)
endif(SLINT_PACKAGE_BUNDLE_QT)
set(CPACK_PACKAGE_NAME "SixtyFPS-cpp")
set(CPACK_PACKAGE_NAME "Slint-cpp")
set(CPACK_PACKAGE_VENDOR "SixtyFPS")
set(CPACK_VERBATIM_VARIABLES true)
set(CPACK_PACKAGE_VERSION_MAJOR 0)
@ -264,9 +264,9 @@ if(BUILD_TESTING)
find_package(Threads REQUIRED)
macro(sixtyfps_test NAME)
macro(slint_test NAME)
add_executable(test_${NAME} tests/${NAME}.cpp)
target_link_libraries(test_${NAME} PRIVATE SixtyFPS Catch2::Catch2)
target_link_libraries(test_${NAME} PRIVATE Slint Catch2::Catch2)
target_compile_definitions(test_${NAME} PRIVATE
SOURCE_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/\"
)
@ -286,11 +286,11 @@ if(BUILD_TESTING)
target_compile_options(test_${NAME} PRIVATE -Wno-maybe-uninitialized)
endif()
endmacro(sixtyfps_test)
sixtyfps_test(datastructures)
if(SIXTYFPS_FEATURE_INTERPRETER)
sixtyfps_test(interpreter)
endmacro(slint_test)
slint_test(datastructures)
if(SLINT_FEATURE_INTERPRETER)
slint_test(interpreter)
endif()
sixtyfps_test(eventloop)
slint_test(eventloop)
target_link_libraries(test_eventloop PRIVATE Threads::Threads)
endif()

View file

@ -43,7 +43,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`.
#### Cross-compiling
@ -96,7 +96,7 @@ You can download one of our pre-built binaries for Linux or Windows on x86-64 ar
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.
## Usage via CMake
@ -106,7 +106,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, if you prefer the package
# Note: Use find_package(Slint) instead of the following three commands, if you prefer the package
# approach.
include(FetchContent)
FetchContent_Declare(
@ -118,12 +118,12 @@ FetchContent_Declare(
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)
target_link_libraries(my_application PRIVATE Slint::Slint)
slint_target_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.
The `slint_target_sources` cmake command allows you to add .60 files to your build. Finally it is
necessary to link your executable or library against the `Slint::Slint` target.
## Tutorial
@ -182,7 +182,7 @@ slint-compiler my_application_ui.60 > my_application_ui.h
```
Note: You would usually not type this command yourself, this is done automatically by the build system.
(that's what the `sixtyfps_target_60_sources` cmake function does)
(that's what the `slint_target_sources` cmake function does)
This will generate a `my_application_ui.h` header file. It basically contains the following code
(edited for brevity)

View file

@ -13,7 +13,7 @@ fn main() -> Result<(), anyhow::Error> {
manifest_dir.to_string_lossy()
));
let output_dir = std::env::var_os("SIXTYFPS_GENERATED_INCLUDE_DIR").unwrap_or_else(|| {
let output_dir = std::env::var_os("SLINT_GENERATED_INCLUDE_DIR").unwrap_or_else(|| {
Path::new(&std::env::var_os("OUT_DIR").unwrap()).join("generated_include").into()
});
let output_dir = Path::new(&output_dir);

View file

@ -12,14 +12,14 @@ if(_IMPORT_PREFIX STREQUAL "/")
endif()
add_library(slint-cpp-shared SHARED IMPORTED)
set_target_properties(slint-cpp-shared PROPERTIES @SIXTYFPS_LIB_PROPERTIES@)
set_target_properties(slint-cpp-shared PROPERTIES @SLINT_LIB_PROPERTIES@)
add_executable(SixtyFPS::slint-compiler IMPORTED GLOBAL)
set_target_properties(SixtyFPS::slint-compiler PROPERTIES IMPORTED_LOCATION "${_IMPORT_PREFIX}/@CMAKE_INSTALL_BINDIR@/slint-compiler${CMAKE_EXECUTABLE_SUFFIX}")
add_executable(Slint::slint-compiler IMPORTED GLOBAL)
set_target_properties(Slint::slint-compiler PROPERTIES IMPORTED_LOCATION "${_IMPORT_PREFIX}/@CMAKE_INSTALL_BINDIR@/slint-compiler${CMAKE_EXECUTABLE_SUFFIX}")
set(_IMPORT_PREFIX)
include("${CMAKE_CURRENT_LIST_DIR}/SixtyFPSTargets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/SixtyFPSMacro.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/SlintTargets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/SlintMacro.cmake")
set(SIXTYFPS_STYLE @SIXTYFPS_STYLE_DEFAULT@ CACHE STRING "The SixtyFPS widget style")
set(SLINT_STYLE @SLINT_STYLE_DEFAULT@ CACHE STRING "The Slint widget style")

View file

@ -1,7 +1,7 @@
# Copyright © SixtyFPS GmbH <info@sixtyfps.io>
# SPDX-License-Identifier: (GPL-3.0-only OR LicenseRef-SixtyFPS-commercial)
function(SIXTYFPS_TARGET_60_SOURCES target)
function(SLINT_TARGET_SOURCES target)
foreach (it IN ITEMS ${ARGN})
get_filename_component(_60_BASE_NAME ${it} NAME_WE)
get_filename_component(_60_ABSOLUTE ${it} REALPATH BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
@ -14,10 +14,10 @@ function(SIXTYFPS_TARGET_60_SOURCES target)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_60_BASE_NAME}.h
COMMAND SixtyFPS::slint-compiler ${_60_ABSOLUTE}
COMMAND Slint::slint-compiler ${_60_ABSOLUTE}
-o ${_60_BASE_NAME_REL}.h --depfile ${_60_BASE_NAME_REL}.d
--style ${SIXTYFPS_STYLE}
DEPENDS SixtyFPS::slint-compiler ${_60_ABSOLUTE}
--style ${SLINT_STYLE}
DEPENDS Slint::slint-compiler ${_60_ABSOLUTE}
COMMENT "Generating ${_60_BASE_NAME}.h"
DEPFILE ${CMAKE_CURRENT_BINARY_DIR}/${_60_BASE_NAME}.d
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
@ -27,10 +27,10 @@ function(SIXTYFPS_TARGET_60_SOURCES target)
file(GLOB ALL_60S "${_60_DIR}/*.60")
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_60_BASE_NAME}.h
COMMAND SixtyFPS::slint-compiler ${_60_ABSOLUTE}
COMMAND Slint::slint-compiler ${_60_ABSOLUTE}
-o ${CMAKE_CURRENT_BINARY_DIR}/${_60_BASE_NAME}.h
--style ${SIXTYFPS_STYLE}
DEPENDS SixtyFPS::slint-compiler ${_60_ABSOLUTE} ${ALL_60S}
--style ${SLINT_STYLE}
DEPENDS Slint::slint-compiler ${_60_ABSOLUTE} ${ALL_60S}
COMMENT "Generating ${_60_BASE_NAME}.h"
)
endif(CMAKE_GENERATOR STREQUAL "Ninja")

View file

@ -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.

View file

@ -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`.

View file

@ -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:

View file

@ -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`.

View file

@ -1,7 +1,7 @@
# Install Qt
TLDR; If you are redirected to this document because of a link in the warning that Qt was not found and
you want to silence the warning without installing Qt, you can set this environment variable: `SIXTYFPS_NO_QT=1`
you want to silence the warning without installing Qt, you can set this environment variable: `SLINT_NO_QT=1`
## Do I need Qt to use SixtyFPS?
@ -47,5 +47,5 @@ environment variable, in order for the build system to locate `qmake` and to fin
## How To Disable the Qt Backend
By setting the `SIXTYFPS_NO_QT` environment variable when building SixtyFPS, the Qt backend will not be compiled and
By setting the `SLINT_NO_QT` environment variable when building SixtyFPS, the Qt backend will not be compiled and
no attempt will be made to find Qt on the system. This will also disable the warning stating that Qt was not found.

View file

@ -3,18 +3,18 @@
cmake_minimum_required(VERSION 3.14)
if (NOT TARGET SixtyFPS::SixtyFPS)
find_package(SixtyFPS REQUIRED)
if (NOT TARGET Slint::Slint)
find_package(Slint REQUIRED)
endif()
add_executable(memory_tutorial_initial main_initial.cpp)
target_link_libraries(memory_tutorial_initial PRIVATE SixtyFPS::SixtyFPS)
sixtyfps_target_60_sources(memory_tutorial_initial memory.60)
target_link_libraries(memory_tutorial_initial PRIVATE Slint::Slint)
slint_target_sources(memory_tutorial_initial memory.60)
add_executable(memory_tutorial_tiles_from_cpp main_tiles_from_cpp.cpp)
target_link_libraries(memory_tutorial_tiles_from_cpp PRIVATE SixtyFPS::SixtyFPS)
sixtyfps_target_60_sources(memory_tutorial_tiles_from_cpp memory_tiles_from_cpp.60)
target_link_libraries(memory_tutorial_tiles_from_cpp PRIVATE Slint::Slint)
slint_target_sources(memory_tutorial_tiles_from_cpp memory_tiles_from_cpp.60)
add_executable(memory_tutorial_game_logic main_game_logic.cpp)
target_link_libraries(memory_tutorial_game_logic PRIVATE SixtyFPS::SixtyFPS)
sixtyfps_target_60_sources(memory_tutorial_game_logic memory_game_logic.60)
target_link_libraries(memory_tutorial_game_logic PRIVATE Slint::Slint)
slint_target_sources(memory_tutorial_game_logic memory_game_logic.60)

View file

@ -27,13 +27,13 @@ FetchContent_Declare(
FetchContent_MakeAvailable(SixtyFPS)
add_executable(memory_game main.cpp)
target_link_libraries(memory_game PRIVATE SixtyFPS::SixtyFPS)
sixtyfps_target_60_sources(memory_game memory.60)
target_link_libraries(memory_game PRIVATE Slint::Slint)
slint_target_sources(memory_game memory.60)
```
This should look familiar to people familiar with CMake. We see that this CMakeLists.txt
references a `main.cpp`, which we will add later, and it also has a line
`sixtyfps_target_60_sources(memory_game memory.60)`, which is a SixtyFPS function used to
`slint_target_sources(memory_game memory.60)`, which is a SixtyFPS function used to
add the `memory.60` file to the target. We must then create, in the same directory,
the `memory.60` file. Let's just fill it with a hello world for now:

View file

@ -3,22 +3,22 @@
cmake_minimum_required(VERSION 3.19)
project(SixtyFPSExamples LANGUAGES CXX)
if (NOT TARGET SixtyFPS::SixtyFPS)
find_package(SixtyFPS REQUIRED)
if (NOT TARGET Slint::Slint)
find_package(Slint REQUIRED)
include(FetchContent)
endif()
add_subdirectory(printerdemo/cpp/)
if (SIXTYFPS_FEATURE_INTERPRETER)
if (SLINT_FEATURE_INTERPRETER)
add_subdirectory(printerdemo/cpp_interpreted/)
endif()
add_subdirectory(printerdemo_old/cpp/)
add_subdirectory(todo/cpp/)
add_subdirectory(gallery/)
add_subdirectory(memory/)
if (SIXTYFPS_FEATURE_INTERPRETER AND SIXTYFPS_FEATURE_BACKEND_QT)
if (SLINT_FEATURE_INTERPRETER AND SLINT_FEATURE_BACKEND_QT)
add_subdirectory(qt_viewer/)
endif()
if (SIXTYFPS_FEATURE_INTERPRETER)
if (SLINT_FEATURE_INTERPRETER)
add_subdirectory(iot-dashboard/)
endif()

View file

@ -4,10 +4,10 @@
cmake_minimum_required(VERSION 3.14)
project(sixtyfps_cpp_gallery LANGUAGES CXX)
if (NOT TARGET SixtyFPS::SixtyFPS)
find_package(SixtyFPS REQUIRED)
if (NOT TARGET Slint::Slint)
find_package(Slint REQUIRED)
endif()
add_executable(gallery main.cpp)
target_link_libraries(gallery PRIVATE SixtyFPS::SixtyFPS)
sixtyfps_target_60_sources(gallery gallery.60)
target_link_libraries(gallery PRIVATE Slint::Slint)
slint_target_sources(gallery gallery.60)

View file

@ -4,8 +4,8 @@
cmake_minimum_required(VERSION 3.14)
project(sixtyfps_cpp_iot_dashboard LANGUAGES CXX)
if (NOT TARGET SixtyFPS::SixtyFPS)
find_package(SixtyFPS REQUIRED)
if (NOT TARGET Slint::Slint)
find_package(Slint REQUIRED)
include(FetchContent)
endif()
@ -19,4 +19,4 @@ add_executable(iot_dashboard main.cpp dashboard.cpp)
target_compile_definitions(iot_dashboard PRIVATE
SOURCE_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"
)
target_link_libraries(iot_dashboard PRIVATE SixtyFPS::SixtyFPS fmt::fmt )
target_link_libraries(iot_dashboard PRIVATE Slint::Slint fmt::fmt )

View file

@ -4,12 +4,12 @@
cmake_minimum_required(VERSION 3.19)
project(memory LANGUAGES CXX)
if (NOT TARGET SixtyFPS::SixtyFPS)
find_package(SixtyFPS REQUIRED)
if (NOT TARGET Slint::Slint)
find_package(Slint REQUIRED)
endif()
# Note, we can't name it simply "memory" because there is a C++ standard header with the same name
# so `#include<memory>` includes the generated binary when it exists
add_executable(memory_game memory.cpp)
target_link_libraries(memory_game PRIVATE SixtyFPS::SixtyFPS)
sixtyfps_target_60_sources(memory_game memory.60)
target_link_libraries(memory_game PRIVATE Slint::Slint)
slint_target_sources(memory_game memory.60)

View file

@ -4,13 +4,13 @@
cmake_minimum_required(VERSION 3.14)
project(sixtyfps_cpp_printer_demo LANGUAGES CXX)
if (NOT TARGET SixtyFPS::SixtyFPS)
find_package(SixtyFPS REQUIRED)
if (NOT TARGET Slint::Slint)
find_package(Slint REQUIRED)
endif()
add_executable(printerdemo main.cpp)
if (MSVC)
target_compile_options(printerdemo PRIVATE /bigobj)
endif()
target_link_libraries(printerdemo PRIVATE SixtyFPS::SixtyFPS)
sixtyfps_target_60_sources(printerdemo ../ui/printerdemo.60)
target_link_libraries(printerdemo PRIVATE Slint::Slint)
slint_target_sources(printerdemo ../ui/printerdemo.60)

View file

@ -4,8 +4,8 @@
cmake_minimum_required(VERSION 3.14)
project(sixtyfps_cpp_interpreter_printer_demo LANGUAGES CXX)
if (NOT TARGET SixtyFPS::SixtyFPS)
find_package(SixtyFPS REQUIRED)
if (NOT TARGET Slint::Slint)
find_package(Slint REQUIRED)
endif()
add_executable(printerdemo_interpreted main.cpp)
@ -15,4 +15,4 @@ target_compile_definitions(printerdemo_interpreted PRIVATE
if (MSVC)
target_compile_options(printerdemo_interpreted PRIVATE /bigobj)
endif()
target_link_libraries(printerdemo_interpreted PRIVATE SixtyFPS::SixtyFPS)
target_link_libraries(printerdemo_interpreted PRIVATE Slint::Slint)

View file

@ -3,10 +3,10 @@
cmake_minimum_required(VERSION 3.14)
if (NOT TARGET SixtyFPS::SixtyFPS)
find_package(SixtyFPS REQUIRED)
if (NOT TARGET Slint::Slint)
find_package(Slint REQUIRED)
endif()
add_executable(printerdemo_old main.cpp)
target_link_libraries(printerdemo_old PRIVATE SixtyFPS::SixtyFPS)
sixtyfps_target_60_sources(printerdemo_old ../ui/printerdemo.60)
target_link_libraries(printerdemo_old PRIVATE Slint::Slint)
slint_target_sources(printerdemo_old ../ui/printerdemo.60)

View file

@ -4,8 +4,8 @@
cmake_minimum_required(VERSION 3.14)
project(qt_viewer LANGUAGES CXX)
if (NOT TARGET SixtyFPS::SixtyFPS)
find_package(SixtyFPS REQUIRED)
if (NOT TARGET Slint::Slint)
find_package(Slint REQUIRED)
endif()
find_package(Qt6 6.0 COMPONENTS Core Widgets QUIET)
@ -16,5 +16,5 @@ endif()
if (TARGET Qt::Widgets)
set(CMAKE_AUTOUIC ON)
add_executable(qt_viewer qt_viewer.cpp)
target_link_libraries(qt_viewer PRIVATE SixtyFPS::SixtyFPS Qt::Core Qt::Widgets)
target_link_libraries(qt_viewer PRIVATE Slint::Slint Qt::Core Qt::Widgets)
endif()

View file

@ -4,10 +4,10 @@
cmake_minimum_required(VERSION 3.14)
project(sixtyfps_cpp_todo LANGUAGES CXX)
if (NOT TARGET SixtyFPS::SixtyFPS)
find_package(SixtyFPS REQUIRED)
if (NOT TARGET Slint::Slint)
find_package(Slint REQUIRED)
endif()
add_executable(todo main.cpp)
target_link_libraries(todo PRIVATE SixtyFPS::SixtyFPS)
sixtyfps_target_60_sources(todo ../ui/todo.60)
target_link_libraries(todo PRIVATE Slint::Slint)
slint_target_sources(todo ../ui/todo.60)

View file

@ -2,9 +2,9 @@
// SPDX-License-Identifier: (GPL-3.0-only OR LicenseRef-SixtyFPS-commercial)
fn main() {
println!("cargo:rerun-if-env-changed=SIXTYFPS_NO_QT");
println!("cargo:rerun-if-env-changed=SLINT_NO_QT");
if std::env::var("TARGET").map_or(false, |t| t.starts_with("wasm"))
|| std::env::var("SIXTYFPS_NO_QT").is_ok()
|| std::env::var("SLINT_NO_QT").is_ok()
{
println!("cargo:rustc-cfg=no_qt");
return;

View file

@ -10,7 +10,7 @@ fn main() {
// The way this work is this
// 1. `qttypes`' crate's build script already detects Qt and set the DEP_QT_VERSION
// 2. The qt rendering backend's build script will check if the qttype crates found Qt and
// look at the SIXTYFPS_NO_QT env variable, and sets the DEP_slint_backend_qt_internal_SUPPORTS_NATIVE_STYLE
// look at the SLINT_NO_QT env variable, and sets the DEP_slint_backend_qt_internal_SUPPORTS_NATIVE_STYLE
// env variable so that the default rendering backend can know if Qt was there.
// 3. here, in the default rendering backend, we know if we depends on the qt backend and if it
// has set the DEP_slint_backend_qt_internal_SUPPORTS_NATIVE_STYLE env variable.