mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 18:58:36 +00:00
Rename the sixtyfps-cpp crate
This commit is contained in:
parent
7382ea1f2c
commit
c333b4de2b
9 changed files with 31 additions and 31 deletions
10
.github/workflows/ci.yaml
vendored
10
.github/workflows/ci.yaml
vendored
|
@ -154,7 +154,7 @@ jobs:
|
|||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: build
|
||||
args: --lib -p sixtyfps-cpp --features testing
|
||||
args: --lib -p slint-cpp --features testing
|
||||
- name: Run tests
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
|
@ -164,8 +164,8 @@ jobs:
|
|||
if: matrix.os == 'ubuntu-20.04'
|
||||
run: |
|
||||
du -hs target
|
||||
rm -rf target/*/*/*sixtyfps*
|
||||
rm -rf target/*/*sixtyfps*
|
||||
rm -rf target/*/*/*slint*
|
||||
rm -rf target/*/*slint*
|
||||
rm -rf target/*/*/test*
|
||||
rm -rf target/*/*test*
|
||||
du -hs target
|
||||
|
@ -174,8 +174,8 @@ jobs:
|
|||
run: |
|
||||
du -hs target
|
||||
rm -Recurse -Force target/*/incremental
|
||||
rm -Recurse -Force target/*/*/*sixtyfps*
|
||||
rm -Recurse -Force target/*/*sixtyfps*
|
||||
rm -Recurse -Force target/*/*/*slint*
|
||||
rm -Recurse -Force target/*/*slint*
|
||||
rm -Recurse -Force target/*/*/test*
|
||||
rm -Recurse -Force target/*/*test*
|
||||
du -hs target
|
||||
|
|
|
@ -19,10 +19,10 @@ list(PREPEND CMAKE_MODULE_PATH ${Corrosion_SOURCE_DIR}/cmake)
|
|||
find_package(Rust 1.56 REQUIRED MODULE)
|
||||
|
||||
corrosion_import_crate(MANIFEST_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../Cargo.toml"
|
||||
CRATES slint-compiler sixtyfps-cpp)
|
||||
CRATES slint-compiler slint-cpp)
|
||||
|
||||
set_property(
|
||||
TARGET sixtyfps-cpp
|
||||
TARGET slint-cpp
|
||||
APPEND
|
||||
PROPERTY CORROSION_ENVIRONMENT_VARIABLES
|
||||
SIXTYFPS_GENERATED_INCLUDE_DIR="${CMAKE_CURRENT_BINARY_DIR}/generated_include/"
|
||||
|
@ -35,7 +35,7 @@ set_property(
|
|||
|
||||
add_library(SixtyFPS INTERFACE)
|
||||
add_library(SixtyFPS::SixtyFPS ALIAS SixtyFPS)
|
||||
target_link_libraries(SixtyFPS INTERFACE sixtyfps-cpp)
|
||||
target_link_libraries(SixtyFPS INTERFACE slint-cpp)
|
||||
target_compile_features(SixtyFPS INTERFACE cxx_std_20)
|
||||
|
||||
function(define_cargo_feature cargo-feature description default)
|
||||
|
@ -75,12 +75,12 @@ define_cargo_dependent_feature(wayland "Enable Wayland support when using the GL
|
|||
define_cargo_feature(backend-qt "Enable Qt based rendering backend" ON)
|
||||
|
||||
set_property(
|
||||
TARGET sixtyfps-cpp
|
||||
TARGET slint-cpp
|
||||
PROPERTY CORROSION_FEATURES
|
||||
${features}
|
||||
)
|
||||
set_property(
|
||||
TARGET sixtyfps-cpp
|
||||
TARGET slint-cpp
|
||||
PROPERTY CORROSION_NO_DEFAULT_FEATURES
|
||||
${features}
|
||||
)
|
||||
|
@ -96,7 +96,7 @@ if (SIXTYFPS_FEATURE_BACKEND_QT)
|
|||
endif (SIXTYFPS_FEATURE_BACKEND_QT)
|
||||
if (TARGET Qt::qmake)
|
||||
set_property(
|
||||
TARGET sixtyfps-cpp
|
||||
TARGET slint-cpp
|
||||
APPEND
|
||||
PROPERTY CORROSION_ENVIRONMENT_VARIABLES
|
||||
QMAKE=$<TARGET_PROPERTY:Qt::qmake,LOCATION>
|
||||
|
@ -104,7 +104,7 @@ if (TARGET Qt::qmake)
|
|||
set(SIXTYFPS_STYLE_DEFAULT "native")
|
||||
else()
|
||||
set_property(
|
||||
TARGET sixtyfps-cpp
|
||||
TARGET slint-cpp
|
||||
APPEND
|
||||
PROPERTY CORROSION_ENVIRONMENT_VARIABLES
|
||||
SIXTYFPS_NO_QT=1
|
||||
|
@ -150,28 +150,28 @@ target_include_directories(SixtyFPS INTERFACE
|
|||
add_executable(SixtyFPS::slint-compiler ALIAS slint-compiler)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/cmake/SixtyFPSMacro.cmake)
|
||||
|
||||
export(TARGETS SixtyFPS sixtyfps-cpp
|
||||
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 sixtyfps-cpp
|
||||
install(TARGETS SixtyFPS slint-cpp
|
||||
EXPORT SixtyFPSTargets LIBRARY DESTINATION lib PUBLIC_HEADER DESTINATION include/sixtyfps)
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
install(FILES $<TARGET_FILE:sixtyfps-cpp-shared> TYPE LIB)
|
||||
install(FILES $<TARGET_FILE:slint-cpp-shared> TYPE LIB)
|
||||
if(WIN32)
|
||||
install(FILES $<TARGET_LINKER_FILE:sixtyfps-cpp-shared> TYPE LIB)
|
||||
install(FILES $<TARGET_LINKER_FILE:slint-cpp-shared> TYPE LIB)
|
||||
# Copy the dll to the top-level bin directory, where the examples will
|
||||
# will also be located, so that they can find the dll.
|
||||
get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||
if(GENERATOR_IS_MULTI_CONFIG)
|
||||
set(config_subdir_genex "$<CONFIG>/")
|
||||
endif()
|
||||
add_custom_target(SixtyFPS_dll_convenience ALL DEPENDS sixtyfps-cpp-shared
|
||||
add_custom_target(SixtyFPS_dll_convenience ALL DEPENDS slint-cpp-shared
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
$<TARGET_FILE:sixtyfps-cpp-shared>
|
||||
${CMAKE_BINARY_DIR}/bin/${config_subdir_genex}$<TARGET_FILE_NAME:sixtyfps-cpp-shared>)
|
||||
$<TARGET_FILE:slint-cpp-shared>
|
||||
${CMAKE_BINARY_DIR}/bin/${config_subdir_genex}$<TARGET_FILE_NAME:slint-cpp-shared>)
|
||||
endif()
|
||||
|
||||
install(PROGRAMS $<TARGET_FILE:slint-compiler> TYPE BIN)
|
||||
|
@ -182,7 +182,7 @@ foreach(prop
|
|||
IMPORTED_LOCATION_RELWITHDEBINFO IMPORTED_LOCATION_MINSIZEREL
|
||||
IMPORTED_IMPLIB IMPORTED_IMPLIB_DEBUG IMPORTED_IMPLIB_RELEASE
|
||||
IMPORTED_IMPLIB_RELWITHDEBINFO IMPORTED_IMPLIB_MINSIZEREL)
|
||||
get_target_property(value sixtyfps-cpp-shared ${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}")
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# SPDX-License-Identifier: (GPL-3.0-only OR LicenseRef-SixtyFPS-commercial)
|
||||
|
||||
[package]
|
||||
name = "sixtyfps-cpp"
|
||||
name = "slint-cpp"
|
||||
version = "0.2.0"
|
||||
authors = ["SixtyFPS <info@sixtyfps.io>"]
|
||||
edition = "2021"
|
||||
|
@ -13,7 +13,7 @@ repository = "https://github.com/sixtyfpsui/sixtyfps"
|
|||
homepage = "https://sixtyfps.io"
|
||||
publish = false
|
||||
# prefix used to convey path to generated includes to the C++ test driver
|
||||
links = "sixtyfps_cpp"
|
||||
links = "slint_cpp"
|
||||
|
||||
[lib]
|
||||
path = "lib.rs"
|
||||
|
|
|
@ -11,8 +11,8 @@ if(_IMPORT_PREFIX STREQUAL "/")
|
|||
set(_IMPORT_PREFIX "")
|
||||
endif()
|
||||
|
||||
add_library(sixtyfps-cpp-shared SHARED IMPORTED)
|
||||
set_target_properties(sixtyfps-cpp-shared PROPERTIES @SIXTYFPS_LIB_PROPERTIES@)
|
||||
add_library(slint-cpp-shared SHARED IMPORTED)
|
||||
set_target_properties(slint-cpp-shared PROPERTIES @SIXTYFPS_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}")
|
||||
|
|
|
@ -57,7 +57,7 @@ C++ tests or the nodejs tests will not find the required dynamic library otherwi
|
|||
The C++ crate are not included in the workspace's default members, so it need to be build explicitly
|
||||
|
||||
```sh
|
||||
cargo build --lib -p sixtyfps-cpp
|
||||
cargo build --lib -p slint-cpp
|
||||
cargo test --bin test-driver-cpp
|
||||
```
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ What this article omits are how we invoke cbindgen and what kind of tweaks we ap
|
|||
|
||||
The C++ library consists of four components:
|
||||
|
||||
1. The `sixtyfps-cpp` cdylib created by `cargo`/`rustc` from `api/sixtyfps-cpp`.
|
||||
1. The `slint-cpp` cdylib created by `cargo`/`rustc` from `api/sixtyfps-cpp`.
|
||||
1. The public header files in `api/cpp/include`.
|
||||
1. Internal header files generated by `cbindgen`, via `cargo xtask cbindgen`.
|
||||
1. The CMake project to tie it all together by invoking `corrosion` to call `cargo` and invoking `cbindgen`.
|
||||
|
|
|
@ -89,10 +89,10 @@ Some macro like `assert_eq` are defined to look similar o the rust equivalent.
|
|||
To run the test, you must make sure to first build the sixtyfps shared library:
|
||||
|
||||
```
|
||||
cargo build --lib -p sixtyfps-cpp --features testing && cargo test -p test-driver-cpp --
|
||||
cargo build --lib -p slint-cpp --features testing && cargo test -p test-driver-cpp --
|
||||
```
|
||||
|
||||
You can omit the first part that compiles sixtyfps-cpp if you only want to test the compiler and
|
||||
You can omit the first part that compiles slint-cpp if you only want to test the compiler and
|
||||
the runtime library is uptodate.
|
||||
|
||||
Note that there are also C++ unit tests that can be run by CMake
|
||||
|
|
|
@ -14,7 +14,7 @@ path = "main.rs"
|
|||
name = "test-driver-cpp"
|
||||
|
||||
[dependencies]
|
||||
sixtyfps-cpp = { path = "../../../api/cpp", features = ["testing"] }
|
||||
slint-cpp = { path = "../../../api/cpp", features = ["testing"] }
|
||||
|
||||
[dev-dependencies]
|
||||
slint-compiler-internal = { path = "../../../internal/compiler", features = ["cpp", "display-diagnostics"] }
|
||||
|
|
|
@ -28,8 +28,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
|
||||
println!("cargo:rustc-env=CPP_LIB_PATH={}", target_dir.display());
|
||||
|
||||
let generated_include_dir = std::env::var_os("DEP_SIXTYFPS_CPP_GENERATED_INCLUDE_DIR")
|
||||
.expect("the sixtyfps-cpp crate needs to provide the meta-data that points to the directory with the generated includes");
|
||||
let generated_include_dir = std::env::var_os("DEP_SLINT_CPP_GENERATED_INCLUDE_DIR")
|
||||
.expect("the slint-cpp crate needs to provide the meta-data that points to the directory with the generated includes");
|
||||
println!(
|
||||
"cargo:rustc-env=GENERATED_CPP_HEADERS_PATH={}",
|
||||
Path::new(&generated_include_dir).display()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue