-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxmake.lua
More file actions
52 lines (45 loc) · 2.3 KB
/
xmake.lua
File metadata and controls
52 lines (45 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
-- Specify available build configurations
add_rules("mode.release", "mode.debug")
-- Specify compile commands output directory and LSP to analyze C++ code files and highlight IntelliSense
add_rules("plugin.compile_commands.autoupdate", {outputdir = ".vscode", lsp = "clangd"})
-- Specify C++ standard to use, as AUI uses C++20 by default
set_languages("c++20")
-- CI_PROJECT_VERSION
set_version("0.0.16")
-- Download aui package to use for targets later
add_requires("aui 7.1.2")
includes("xmake/aui_tests.lua")
target("example_app")
set_kind("binary")
-- Adjust AUI_PP_STRINGIZE(AUI_CMAKE_PROJECT_VERSION) value
add_defines("AUI_CMAKE_PROJECT_VERSION=7.1.2")
-- Add source code and headers to target
add_files("src/*.cpp")
add_headerfiles("src/*.h")
-- Add AUI package to target while linking only required components
add_packages("aui", {components = {"core", "image", "views", "xml"}})
-- Resolve linking by grouping AUI components into link groups
add_linkgroups("aui.views", "aui.xml", "aui.image", "aui.core", {whole = true})
-- Pack assets before building the target
on_prepare(function(target)
import("xmake.aui", {alias = "aui"})
aui.assets(target)
-- Workaround for clang-cl toolchain bug where /WHOLEARCHIVE is ignored in shared library linking
if is_plat("windows") then
import("core.tool.toolchain")
local host_toolchain
host_toolchain = toolchain.load("clang-cl", {plat = "windows", arch = os.arch()})
if host_toolchain:check() then
target:add("ldflags", "/WHOLEARCHIVE:aui.views.lib", { force = true })
target:add("ldflags", "/WHOLEARCHIVE:aui.xml.lib", { force = true })
target:add("ldflags", "/WHOLEARCHIVE:aui.image.lib", { force = true })
target:add("ldflags", "/WHOLEARCHIVE:aui.core.lib", { force = true })
target:add("shflags", "/WHOLEARCHIVE:aui.views.lib", { force = true })
target:add("shflags", "/WHOLEARCHIVE:aui.xml.lib", { force = true })
target:add("shflags", "/WHOLEARCHIVE:aui.image.lib", { force = true })
target:add("shflags", "/WHOLEARCHIVE:aui.core.lib", { force = true })
end
end
end)
target_end()
aui.enable_tests("example_app")