slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
16.19k stars 536 forks source link

macOs binaries #4240

Open ogoffart opened 6 months ago

ogoffart commented 6 months ago

We currently provide binaries for Linux and Windows for in our release tags in https://github.com/slint-ui/slint/releases for slint-viewer, slint-lsp and the C++ SDK

We should add support for macOS.

This is especially important for the neovim lsp plugin that can't work on macOS without that. See dicussion in https://github.com/slint-ui/slint/discussions/2715 and https://github.com/mason-org/mason-registry/pull/3740 Edit: Mason circumvents the quarantine and our unsigned binaries work now also on macOS.

ogoffart commented 6 months ago

The package for Linux and Windows are build by the nightly job and copied over to the release as part of prepare-release job https://github.com/slint-ui/slint/blob/01e6429bfabd2a7a1acb291b2156a530e5faf1e1/.github/workflows/nightly_snapshot.yaml#L375

Note that the nightly snapshot already build the macOS binaries, but they are not copied over to the release job because they are not working out of the box. (Missing signature?)

tronical commented 6 months ago

Yes, there are two aspects about macos binaries:

  1. we should create universal binaries (aarch64 and x86-64), with lipo.
  2. If binaries are unsigned, macos will quarantine the files with an xattr that needs removing (unless tooling installs by hand). Users can’t be expected to remove them. The remedy is to acquire a paid dev license, retrieve a certificate, and set up the CI to sign the binaries with said certificate.

My guts feeling is that the upper bound is a person week of work for the C++ package and the other program binaries.

duvenagep commented 6 months ago

Hi @tronical

I just tried installing the slint-lsp via :LspInstall slint_lsp on mac and got the Unsupported platform error. I found this thread and can see it is very recent.

I realise that I may be a bit early but just curious when you expect the lsp to support aarch64?

Screenshot 2024-01-05 at 23 13 08
tronical commented 6 months ago

Since we’re already building universal binaries, a few days ago I published the ones for the most recent release (added to the GitHub release) and suggested to try this:

https://github.com/mason-org/mason-registry/pull/3740#discussion_r1441838757

Do you know of a way of testing this?

duvenagep commented 6 months ago

@tronical So I ran cargo install slint-lsp and it compiled and installed normally! I also manually downloaded the latest -macos.tar.gz! After manually approving it, I can run it.

Are there any additional configurations that I would need in my config files since it was not installed via williamboman/nvim-lsp-installer?

duvenagep commented 6 months ago

Hi @tronical

So I spent some time getting my Neovim LSP configured on aarch64 with the new Binaries and I thought I should put it here in case someone else needs it.

I chose to use rust for my projects thus I already have it installed so my setup is specific to rust, although if anyone uses a different setup I imagine the setup would be quite similar.

Setup Easy

Basically, follow the exact steps provided by Slint here: The only unclear thing was how to configure the LSP using Lua.

Below code snippet is all you need to get LSP working. I have linked to my dotfiles if anyone needs this configuration.

    {
        "neovim/nvim-lspconfig",
        config = function()
            local lspconfig = require("lspconfig")
            vim.cmd([[ autocmd BufRead,BufNewFile *.slint set filetype=slint ]])
            lspconfig.slint_lsp.setup({})
        end,
    },

If you don't have rust installed then download one of these binaries. Extract the zip and place the binary where you need it (most likely in PATH)

tronical commented 6 months ago

Thank you for your help. I was able to reproduce it. The binaries mason installs are not quarantined on macOS but work out of the box.

duvenagep commented 6 months ago

@tronical Just checked in via :LspInstall. slint-lsp and it worked as expected! 👍

tronical commented 5 months ago

It might be that we don't need this dance for the SDK if our slint_cpp in the CMake package was an archive (.a) instead of a dynamic library (.dylib).