Commit graph

126 commits

Author SHA1 Message Date
Simon Hausmann
604450da47 WIP: slint-compiler: Add support for generating Python stubs
The generated file offers the following two pieces of functionality:

- Convenient front-end to slint.load_file() by loading the .slint file
  (replaces use of auto-loader)
- More importantly: Type information for exported properties, callbacks,
  functions, and globals
2025-07-14 13:36:39 +02:00
Simon Hausmann
a9a4dfa4eb slint-compiler: Guess output format from file extension if not present
Some checks are pending
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, beta) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, stable) (push) Blocked by required conditions
CI / build_and_test (ubuntu-22.04, nightly) (push) Blocked by required conditions
CI / node_test (windows-2022) (push) Blocked by required conditions
CI / python_test (macos-14) (push) Blocked by required conditions
CI / python_test (ubuntu-22.04) (push) Blocked by required conditions
CI / python_test (windows-2022) (push) Blocked by required conditions
CI / cpp_test_driver (macos-13) (push) Blocked by required conditions
CI / cpp_test_driver (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (windows-2022) (push) Blocked by required conditions
CI / cpp_cmake (macos-14, 1.85) (push) Blocked by required conditions
CI / cpp_cmake (ubuntu-22.04, stable) (push) Blocked by required conditions
CI / cpp_cmake (windows-2022, nightly) (push) Blocked by required conditions
CI / cpp_package_test (push) Blocked by required conditions
CI / vsce_build_test (push) Blocked by required conditions
CI / mcu (pico-st7789, thumbv6m-none-eabi) (push) Blocked by required conditions
CI / mcu (pico2-st7789, thumbv8m.main-none-eabihf) (push) Blocked by required conditions
CI / mcu (stm32h735g, thumbv7em-none-eabihf) (push) Blocked by required conditions
CI / mcu-embassy (push) Blocked by required conditions
CI / ffi_32bit_build (push) Blocked by required conditions
CI / docs (push) Blocked by required conditions
CI / wasm (push) Blocked by required conditions
CI / wasm_demo (push) Blocked by required conditions
CI / tree-sitter (push) Blocked by required conditions
CI / updater_test (0.3.0) (push) Blocked by required conditions
CI / fmt_test (push) Blocked by required conditions
CI / esp-idf-quick (push) Blocked by required conditions
CI / android (push) Blocked by required conditions
CI / miri (push) Blocked by required conditions
CI / test-figma-inspector (push) Blocked by required conditions
This is more intuitive that the C++ default, especially in light of additional output languages in the future.

To be on the safe side, this also passes the explicit -f cpp on the CMake side.
2025-07-11 08:32:03 +02:00
Simon Hausmann
44a1bec608
Disable jemalloc for slint-lsp/slint-viewer/slint-compiler on aarch64… (#8136)
With jemalloc the page size is a compile time constant that results in
the process aborting on memory allocation if the compile time determined
page size does not match the kernel reported page size at run-time.

When we, or our users, compile the above programs for aarch64-linux,
there is a fair expectation that the resulting binary works on any
aarch64-linux system. As we can't determine the target page size
reliably, disable jemalloc.

Fixes #8134
2025-04-14 15:03:36 +02:00
Olivier Goffart
78a3757b7f
Remormat all the toml file again to fix npm upload
Commit cd6f2e2 reformated the .toml, but the 80 char width column is
judged too small to be practical

Add a .taplo.toml file

Also do not split feature array
2025-04-09 15:06:00 +02:00
Tobias Hunger
cd6f2e2cf2 ci: Format toml files
... using taplo with default settings

I tried this with 4 spaces indentation, but the patch is almost as
big as this one, so I went with default settings instead as that
is just easier:-)
2025-04-02 11:03:41 +02:00
Simon Hausmann
b625ad9722 Disable jemalloc on Windows
Upstream isn't even compile-testing on Windows ( https://github.com/tikv/jemallocator/blob/main/.github/workflows/main.yml ), so we should disable it as well.

This should fix the build failing with mingw.
2025-03-05 14:24:27 +01:00
Olivier Goffart
1e814c9bdc
Stabilize the sdf-fonts feature
Enable the SDF feature by default in our compiler binaries

(Still disabled by default for other users because it takes up compile
time for something they probably don't need)
2025-02-19 21:24:53 +01:00
Olivier Goffart
493de03485 slint-compiler: Improve a bit the --help 2025-02-19 11:09:02 +01:00
Yuri Astrakhan
bcb2953f00 Auto-fixed clippy::unnecessary_map_or
This is a hacky approach, but does help a lot with the tedious fixes.

See https://rust-lang.github.io/rust-clippy/master/index.html#/unnecessary_map_or

```
__CARGO_FIX_YOLO=1 cargo clippy --fix  --all-targets --workspace --exclude gstreamer-player --exclude i-slint-backend-linuxkms --exclude uefi-demo --exclude ffmpeg -- -A clippy::all -W clippy::unnecessary_map_or

cargo fmt --all
```
2025-02-07 09:02:31 +01:00
Yuri Astrakhan
61de4d56b0 Fix all format arg inlining
Ran this command:

```shell
cargo clippy --fix -- -A clippy::all -W clippy::uninlined_format_args
```
2025-02-06 10:16:20 +01:00
Simon Hausmann
67940f8ff9 Fix cross-compilation of slint-compiler in Yocto environments (or when CC, etc. are set)
Don't enable jemalloc when cross-compiling.

Fixes #7463
2025-01-29 09:05:56 +01:00
Milian Wolff
18300429c1
Use jemalloc for slint-viewer, slint-compiler, and slint-lsp
* optimize: use jemalloc for slint-viewer

The lots of allocations are slowing down slint-viewer.
By using the faster jemalloc, we get a significant time boost
on Linux at least,  where I can observe a 15% time reduction:

Before:
```
  Time (mean ± σ):     936.6 ms ±  13.5 ms    [User: 688.8 ms, System: 191.1 ms]
  Range (min … max):   918.9 ms … 955.6 ms    10 runs
```

After:
```
  Time (mean ± σ):     794.8 ms ±  16.2 ms    [User: 645.4 ms, System: 99.2 ms]
  Range (min … max):   755.0 ms … 810.7 ms    10 runs
```

* optimize: also use jemalloc for slint-compiler

As with the slint-viewer, we can observe a drastic time improvement
of around 13% when using jemalloc for slint-compiler:

Before:
```
  Time (mean ± σ):     772.8 ms ±   9.2 ms    [User: 633.5 ms, System: 136.5 ms]
  Range (min … max):   763.3 ms … 787.8 ms    10 runs
```

After:
```
  Time (mean ± σ):     672.5 ms ±  13.5 ms    [User: 610.4 ms, System: 60.1 ms]
  Range (min … max):   655.1 ms … 700.7 ms    10 runs
```

* optimize: also use jemalloc for slint-lsp

The impact here was not measured, but it should be in a similar
ballpark to the slint-compiler and slint-viewer, and thus quite
noticeable in practice.
2025-01-25 17:40:33 +01:00
Tasuku Suzuki
346d1c2df3 Fix typos
Ran `typos .` and fixed all typos that do make sense.
https://crates.io/crates/typos
2025-01-13 08:35:20 +01:00
Olivier Goffart
014b58c81a
C++: allow to configure bundled translation 2024-11-18 15:57:08 +01:00
Olivier Goffart
e7cf28531d slint-compiler: Don't use signed distance fields by default 2024-11-18 13:24:59 +01:00
Simon Hausmann
18f645f814 WIP: Being adding support for generating SDF glyphs 2024-10-23 09:12:30 +02:00
Simon Hausmann
c25a03d6f7 C++: Make it possible to split up the C++ code generated for a .slint file
Add a COMPILATION_UNITS argument to slint_target_sources that defines into how many .cpp files to split up a .slint file. The new default is now one.
2024-08-20 15:53:24 +02:00
Simon Hausmann
a727d87796 CMake: Make it possible to override the scale factor
Co-Authored-By: Olivier Goffart <olivier.goffart@slint.dev>
2024-08-14 11:00:50 +02:00
Olivier Goffart
5dfa8d56dc API review of the slint interpreter Compiler api
Closes #5466
2024-07-05 17:20:08 +02:00
Olivier Goffart
2fd8744cfc compiler: Move embedded_file_resources from the root Component to the Document 2024-06-20 12:03:38 +02:00
Simon Hausmann
a52fe6bbfc Make element debug information configurable
The `SLINT_EMIT_DEBUG_INFO` environment variable needs to be set for Rust and C++ builds. For the interpreter it's always enabled, since ... we have it.
2024-06-05 01:29:58 -07:00
Tobias Hunger
d9224cd58f janitor: Use more workspace dependencies 2024-06-04 14:58:29 +02:00
Aurindam Jana
3523e86359
Simplify commercial license (#3063)
Base the commercial license on the Royalty-free license adding clauses pertaining to the fees.
2024-05-31 14:06:17 +02:00
Aurindam Jana
9a3aa265d5
Update Royalty-free license (#5257)
Add clarification that Application may not expose Slint APIs.
2024-05-31 10:53:19 +02:00
Aurindam Jana
0cfeec1a31
Update Slint Community License (#4994)
Updated the version from 1.1 to 1.2 
Renamed the header to "Slint Royalty-free Desktop, Mobile, and Web Applications License"
Added definition of "Mobile Application" and grant of right
Moved "Limitations" to 3rd section and "License Conditions - Attributions" to 2nd section
Added flexibility to choose between showing "MadeWithSlint" as a dialog/splash screen or on a public webpage
Moved the para on copyright notices to section under "Limitations"
2024-04-15 15:18:55 +02:00
Wilston Oreo
bef532b5fc
Optional C++ namespaces (#4759)
Co-authored-by: Michael Winkelmann <michael@winkelmann.site>
2024-03-06 19:43:11 +01:00
Tobias Hunger
06b04e71b5 compiler: Return the TypeLoader from compile_syntax_node 2024-02-29 19:35:52 +01:00
Carter Hunt Fogelman
ff27bc79ae Wrap all non-test uses of in a BufWriter/BufReader for efficiency 2023-12-27 09:15:53 +01:00
J-P Nurmi
c5248c005e Allow specifying paths for @library imports 2023-10-20 16:47:00 +02:00
Tobias Hunger
85e1c6020b janitor: Use workspace dependnecies for the slint crates
This moves most of the version information we need to update into one
place.

Note that the workplace dependency features are in *addition* to any
feature set when using the workspace dependency. So we have all
workspace dependencies defined with `no-default-features = true`.
2023-09-25 16:34:16 +02:00
Tobias Hunger
d6695c55cb Janitor: Use cargo workspace package data more 2023-09-25 16:34:16 +02:00
tronical
b8b9db4e42 Bump version number to 1.3.0 2023-09-05 15:46:36 +02:00
Olivier Goffart
de0836d1a0 C++: Fix ninja always rebuilding the .slint file
two bugs:
 - If the .slint file did not contain any import, the depfile would have
   no dependencies, and as a result, ninja would consider that it is
   always dirty.
 - In case the binary dir is a sub directory, the dependencies were
   relative to the wrong directory. Thgis is because the behavior
   changed in some version of cmake (see https://cmake.org/cmake/help/latest/policy/CMP0116.html)
   to avoid any problem, use the absolute paths

Fixes #3261
2023-08-30 09:54:03 +02:00
ogoffart
aebaa7d6c9 Bump version number to 1.2.0 2023-07-25 10:44:53 +00:00
Olivier Goffart
03bca95bef compiler: add a software-renderer feature
We aldready document in cmake.md that a valid value for
`SLINT_EMBED_RESOURCES` is `embed-for-software-renderer`, but this
doesn't work since it expect a `software-renderer` feature that don't
exist. So create this feature.

This feature brings on all the image and font loading machinery in the
compiler. But I still enable it by default since it is a documented
cmake option.
2023-07-12 16:02:47 +02:00
Aurindam Jana
5a4a7fee63
Update royalty free license to 1.1 (#2994) 2023-07-10 10:12:11 +02:00
ogoffart
c8c9496722 Bump version number to 1.1.1 2023-06-26 12:50:02 +00:00
Olivier Goffart
11dea135f7 Domain: slint-ui.com -> slint.dev 2023-06-16 10:55:08 +02:00
Tobias Hunger
04d1229685 Fix licnese information using xtask 2023-06-16 09:14:20 +02:00
ogoffart
641cab0e75 Bump version number to 1.1.0 2023-06-15 16:01:28 +00:00
Aurindam Jana
039e54a5de
Add royalty free license to files except examples and docs (#2888) 2023-06-15 11:20:50 +02:00
Olivier Goffart
ce25fb65a6 Pass the translation domain to the runtime
For rust, it uses the crate name, for others, it needs to be passed in
the comment line
2023-06-05 16:34:59 +02:00
ogoffart
dfd5fc38b3 Bump version number to 1.0.3 2023-04-26 14:04:08 +00:00
ogoffart
53cce5bf44 Bump version number to 1.0.2 2023-04-26 11:33:16 +02:00
ogoffart
bd63218412 Bump version number to 1.0.1 2023-04-18 14:56:40 +00:00
Tobias Hunger
c5ecade881 Rename embed-resources parameters fro the Slint compiler 2023-03-27 09:27:44 +02:00
Tobias Hunger
94e86b72a4 Add an optional --embed-resources switch to the compiler 2023-03-27 09:27:44 +02:00
Tobias Hunger
3ac01c3f07 clippy: Fix clippy warnings 2023-03-09 09:35:29 +01:00
ogoffart
e7f48512ee Bump version number to 1.0.0 2023-02-03 11:07:15 +01:00
ogoffart
ce07d078ce Bump version number to 0.3.4 2022-12-16 09:36:15 +00:00