Skip to content

Commit b83e226

Browse files
committed
Refactor aui.toolbox detection for macOS and remove aui-toolbox dependency
1 parent 6c15140 commit b83e226

2 files changed

Lines changed: 9 additions & 22 deletions

File tree

xmake.lua

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ set_version("0.0.14")
1212

1313
-- Download aui package to use for targets later
1414
add_requires("aui 7.1.2")
15-
-- aui.toolbox is bundled inside the aui package on Linux/Windows but the cmake
16-
-- build omits it on macOS; aui-toolbox builds it separately via xmake as a fallback.
17-
add_requires("aui-toolbox 7.1.2")
1815

1916
includes("xmake/aui_tests.lua")
2017

@@ -27,8 +24,6 @@ target("example_app")
2724
add_headerfiles("src/*.h")
2825
-- Add AUI package to target while linking only required components
2926
add_packages("aui", {components = {"core", "image", "views", "xml"}})
30-
-- Expose aui-toolbox install dir so on_prepare can locate the binary on macOS
31-
add_packages("aui-toolbox")
3227
-- Resolve linking by grouping AUI components into link groups
3328
add_linkgroups("aui.views", "aui.xml", "aui.image", "aui.core", {whole = true})
3429
-- Pack assets before building the target

xmake/aui.lua

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,19 @@ function _get_aui_package(target)
1414
return nil
1515
end
1616

17-
-- Locate aui.toolbox binary. Checks the aui package bin dir first, then the
18-
-- aui-toolbox package (needed on macOS where the cmake build omits the binary),
19-
-- and finally falls back to PATH.
20-
function _find_toolbox(aui_installdir, target)
17+
-- Locate aui.toolbox binary. On macOS the AUI cmake build wraps every
18+
-- executable in a MACOSX_BUNDLE, so the binary lives inside an .app bundle.
19+
function _find_toolbox(aui_installdir)
20+
-- Linux / Windows
2121
local p = path.join(aui_installdir, "bin", "aui.toolbox")
2222
if os.isfile(p) then return p end
2323

2424
p = path.join(aui_installdir, "bin", "aui.toolbox.exe")
2525
if os.isfile(p) then return p end
2626

27-
-- aui-toolbox is a separate package that builds the toolbox via xmake;
28-
-- required as a fallback when the aui cmake build does not install it.
29-
for _, pkg in pairs(target:pkgs()) do
30-
if pkg:name() == "aui-toolbox" then
31-
local suffix = is_host("windows") and ".exe" or ""
32-
p = path.join(pkg:installdir(), "bin", "aui.toolbox" .. suffix)
33-
if os.isfile(p) then return p end
34-
end
35-
end
27+
-- macOS: cmake installs the .app bundle, so the real binary is inside it
28+
p = path.join(aui_installdir, "bin", "aui.toolbox.app", "Contents", "MacOS", "aui.toolbox")
29+
if os.isfile(p) then return p end
3630

3731
return find_program("aui.toolbox")
3832
end
@@ -56,11 +50,9 @@ function assets(target)
5650
local aui_installdir = aui_pkg:installdir()
5751
wprint("AUI package install directory: " .. aui_installdir)
5852

59-
local toolbox_path = _find_toolbox(aui_installdir, target)
53+
local toolbox_path = _find_toolbox(aui_installdir)
6054
if not toolbox_path then
61-
raise("aui.toolbox not found. Checked: "
62-
.. aui_installdir .. "/bin/, the aui-toolbox package, and PATH. "
63-
.. "Ensure add_requires('aui-toolbox 7.1.2') is in xmake.lua.")
55+
raise("aui.toolbox not found. Checked bin/, bin/aui.toolbox.app/Contents/MacOS/, and PATH under " .. aui_installdir)
6456
end
6557

6658
local assets_dir = path.join(path.absolute(target:scriptdir()), "assets")

0 commit comments

Comments
 (0)