-
-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathxmake.lua
More file actions
113 lines (96 loc) · 2.69 KB
/
xmake.lua
File metadata and controls
113 lines (96 loc) · 2.69 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
add_rules("mode.debug", "mode.release")
add_rules("utils.install.cmake_importfiles")
add_rules("utils.install.pkgconfig_importfiles")
set_version("4.6.1", {soname = "4.6"})
set_languages("cxx23")
set_warnings("all")
option("avx2")
set_default(true)
set_showmenu(true)
after_check(function (option)
import("core.base.cpu")
option:enable(cpu.has_feature("avx2"))
end)
option_end()
option("imgui")
set_default(true)
set_showmenu(true)
option_end()
option("examples")
set_default(true)
set_showmenu(true)
option_end()
option("tests")
set_default(true)
set_showmenu(true)
option_end()
if has_config("avx2") then
add_defines("OMATH_ENABLE_AVX2")
add_vectorexts("avx2")
end
if has_config("imgui") then
add_defines("OMATH_IMGUI_INTEGRATION")
add_requires("imgui")
add_packages("imgui")
end
if has_config("examples") then
add_requires("glew", "glfw")
end
if has_config("tests") then
add_requires("gtest")
end
target("omath")
set_kind("static")
add_files("source/**.cpp")
add_includedirs("include", {public = true})
add_headerfiles("include/(**.hpp)", {prefixdir = "omath"})
on_config(function (target)
if has_config("avx2") then
cprint("${green} ✔️ AVX2 supported")
else
cprint("${red} ❌ AVX2 not supported")
end
end)
target("example_projection_matrix_builder")
set_languages("cxx26")
set_kind("binary")
add_files("examples/example_proj_mat_builder.cpp")
add_deps("omath")
set_enabled(has_config("examples"))
target("example_signature_scan")
set_languages("cxx26")
set_kind("binary")
add_files("examples/example_signature_scan.cpp")
add_deps("omath")
set_enabled(has_config("examples"))
target("example_glfw3")
set_languages("cxx26")
set_kind("binary")
add_files("examples/example_glfw3.cpp")
add_deps("omath")
add_packages("glew", "glfw")
set_enabled(has_config("examples"))
for _, file in ipairs(os.files("tests/**.cpp")) do
local name = path.basename(file)
target(name)
set_languages("cxx23")
set_kind("binary")
add_files(file, "tests/main.cpp")
add_deps("omath")
add_packages("gtest")
add_defines("OMATH_BUILD_TESTS")
add_tests("default")
set_default(false)
set_enabled(has_config("tests"))
end
task("check")
on_run(function ()
import("core.project.task")
for _, file in ipairs(os.files("tests/**.cpp")) do
local name = path.basename(file)
task.run("run", {target = name})
end
end)
set_menu {
usage = "xmake check", description = "Run tests !", options = {}
}