ngscopeclient / scopehal-apps

ngscopeclient and other client applications for libscopehal.
https://www.ngscopeclient.org/
BSD 3-Clause "New" or "Revised" License
535 stars 83 forks source link

macOS: Build with Homebrew-provided Vulkan dependencies #621

Closed rgov closed 5 months ago

rgov commented 8 months ago

The build instructions for macOS call for some dependencies to be installed from Homebrew formulae and others to come from the LunarG VulkanSDK.

There are also brew formulae for many components of the VulkanSDK. Just grepping for formulae from the KhronosGroup GitHub organization:

glslang
molten-vk
opencl-clhpp-headers
opencl-headers
opencl-icd-loader
shaderc
spirv-cross
spirv-headers
spirv-llvm-translator
spirv-tools
vulkan-extensionlayer
vulkan-headers
vulkan-loader
vulkan-tools
vulkan-validationlayers

However I am unsure which VulkanSDK components are actually needed to build ngscopeclient. Could you please clarify?

Using the dependencies from Homebrew is likely a requirement to have an install formula for ngscopeclient accepted upstream.


Homebrew formula

https://github.com/ngscopeclient/homebrew-ngscopeclient/pull/1

azonenberg commented 8 months ago
d235j commented 5 months ago

I've been working on this. A change to Homebrew will be required as they are currently building shaderc without BULD_SHARED_LIBS enabled.

FindVulkan is going away upstream as well, so I'm eliminating the use of its functionality from scopehal / scopehal-apps proper; VkFFT still uses it though.

rgov commented 5 months ago

Nice. Not sure if you saw the formula I had in the expandable part of the first post, but it's a good starting point.

d235j commented 5 months ago

Fixed in https://github.com/ngscopeclient/scopehal-apps/pull/673.

rgov commented 5 months ago

I built HEAD successfully from Homebrew, after uninstalling the Vulkan SDK.

  depends_on "shaderc" => :build
  depends_on "glslang"
  depends_on "spirv-tools"
  depends_on "vulkan-headers" => :build
  depends_on "vulkan-loader"

  on_macos do
    depends_on "molten-vk"
  end

Does that look right? I'm not sure about runtime vs build time dependencies. The formula ideally works on Linux too, but I haven't tried it.

d235j commented 5 months ago

Yeah I think that looks right. I would test by unlinking the build dependencies and seeing if it runs.

We will still have to deal with #623 and #624 before this formula can be recommended to others. Also, see my comment regarding #622.

rgov commented 5 months ago

Ok, formula is working again with Homebrew dependencies after I fixed #688 by including the appropriate RPATH.

Formula includes workarounds for #623, #624 and #687.

rgov commented 5 months ago

@azonenberg At this point we can pretty much submit this to Homebrew, but I can already predict they'd prefer you tagged a release rather than always installing from HEAD.

d235j commented 5 months ago

@rgov A while ago Homebrew moved to binary-first, so we'll have to wait until there is a release before doing so. That said, we could create a tap. However, there are some issues with installation (e.g. hardcoded paths in #624 and plugin search issues in #623) that have to be fixed first.

rgov commented 5 months ago

My formula at the top of this page already patches #623 and #624 with workarounds for the Homebrew prefix, so those aren't blockers at this moment.

d235j commented 4 months ago

@rgov would you like to PR your formula to https://github.com/ngscopeclient/homebrew-ngscopeclient, or should I add it?

rgov commented 4 months ago

Ready for review: https://github.com/ngscopeclient/homebrew-ngscopeclient/pull/1