-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxmake.lua
More file actions
160 lines (142 loc) · 5.4 KB
/
xmake.lua
File metadata and controls
160 lines (142 loc) · 5.4 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
includes("@builtin/xpack")
add_rules("mode.debug", "mode.release")
set_languages("c++latest", "clatest")
-- Set the header file directory
add_includedirs("lua")
add_includedirs("src")
add_includedirs("src/d3object")
add_includedirs("src/d2object")
add_includedirs("src/user_object")
add_includedirs("port/openscad")
gui = true
target("lua")
set_kind("static")
add_files("lua/*.c|onelua.c|lua.c")
target_end()
-- Compilation settings
target("lua-cad")
if is_plat("windows") then
add_deps("lua")
end
if gui then
add_cxxflags("-DQT")
add_rules("qt.widgetapp")
add_frameworks("widgets", "openglwidgets")
add_files("src/lua-cad-desktop/*.h")
add_files("src/luaRunner.h")
add_files("src/lua-cad-desktop/mainwindow.ui")
add_files("src/lua-cad-desktop/*.cpp|main.cpp")
add_files("src/*.cpp")
add_files("port/qt/*.cpp")
add_includedirs("assimp/include/")
add_includedirs("src/lua-cad-desktop")
add_includedirs("port/qt")
add_linkdirs("assimp/lib/x64/")
add_links("assimp-vc143-mt")
add_links("Qt6OpenGLWidgets")
else
add_files("src/main.c")
end
set_kind("binary")
add_files("port/openscad/*.c")
add_files("lua/*.c|onelua.c|lua.c")
add_files("src/*.c|lua-cad.c|main.c")
add_files("src/d3object/*.c")
add_files("src/d2object/*.c")
add_files("src/user_object/*.c")
target_end()
-- Generate an installation package
xpack("lua-cad")
set_version("2.0.0")
set_formats("zip", "targz")
set_title("Lua-cad($(arch)-$(host))")
set_basename("Lua-cad-v$(version)-$(arch)-$(host)")
set_homepage("https://github.com/SongZihui-sudo/lua-cad")
set_author("SongZihui-sudo")
set_maintainer("1751122876@qq.com")
set_copyright("Copyright (C) 2024 lua-cad SongZihui-sudo")
set_license("Gplv3")
set_bindir("./")
set_licensefile("./LICENSE.txt")
add_installfiles ("src/user_object/user_obj.lua")
add_installfiles ("src/chunk.lua")
add_installfiles("assimp/lib/x64/assimp-vc143-mt.dll")
add_installfiles("IMAGE/icon.ico")
add_targets("lua-cad")
-- Unit tests
function test_base()
add_files("port/openscad/*.c")
add_files("lua/*.c|onelua.c|lua.c")
add_files("src/*.c|lua-cad.c|main.c")
add_files("src/d3object/*.c")
add_files("src/d2object/*.c")
add_files("src/user_object/*.c")
set_targetdir("tests/bin")
set_kind("binary")
end
-- test circle
target("circle_test")
test_base()
add_files("tests/tests.c")
add_tests("tests", {runargs = "../test_circle.lua", plain = true, pass_outputs = {"circle(d = 10.000000);\ncircle(r = 10.000000);\n\n"}})
target_end()
-- test plolygon
target("plolygon_test")
test_base()
add_files("tests/tests.c")
add_tests("tests", {runargs = "../test_ploygon.lua", plain = true, pass_outputs = "polygon(points = [ [0.000000, 0.000000],[100.000000, 0.000000],[130.000000, 50.000000],[30.000000, 50.000000]], paths = [ [ 0,1,2,3],[ 2,3],[ 1]], convexity = 0);\n\n"})
target_end()
-- test square
target("square_test")
test_base()
add_files("tests/tests.c")
add_tests("tests", {runargs = "../test_square.lua", plain = true, pass_outputs = "square([10.000000, 10.000000], center = false);\nsquare([10.000000, 10.000000], center = true);\n\n"})
target_end()
-- test cube
target("cube_test")
test_base()
add_files("tests/tests.c")
add_tests("tests", {runargs = "../test_cube.lua", plain = true, pass_outputs = "cube([10.000000, 10.000000, 10.000000], center = false);\ncube([10.000000, 10.000000, 10.000000], center = true);\n\n"})
target_end()
-- test cylinder
target("cyliner_test")
test_base()
add_files("tests/tests.c")
add_tests("tests", {runargs = "../test_cylinder.lua", plain = true, pass_outputs = "cylinder(h = 1.000000, r = 10.000000, center = true);\ncylinder(h = 1.000000, d = 10.000000, center = false);\ncylinder(h = 1.000000, r1 = 10.000000, r2 center = true);\ncylinder(h = 1.000000, d1 = 10.000000, d2 center = false);\n\n"})
target_end()
-- test sphere
target("sphere_test")
test_base()
add_files("tests/tests.c")
add_tests("tests", {runargs = "../test_sphere.lua", plain = true, pass_outputs = "sphere(r = 10.000000);\nsphere(d = 20.000000);\n\n"})
target_end()
-- test polyhedron
target("polyhedron_test")
test_base()
add_files("tests/tests.c")
add_tests("tests", {runargs = "../test_polyhedron.lua", plain = true, pass_outputs = "polyhedron( points = [ [ 10.000000, 10.000000, 0.000000 ],[ 10.000000, -10.000000, 0.000000 ],[ -10.000000, -10.000000, 0.000000 ],[ -10.000000, 10.000000, 0.000000 ]], faces = [[ 0,1,4],[ 1,2,4],[ 2,3,4],[ 3,0,4],[ 1,0,3],[ 2,1,3]], convexity = 0);\n\n"})
target_end()
-- test user object
target("user_object_test")
test_base()
add_files("tests/tests.c")
add_tests("tests", {runargs = "../test_user_object.lua", plain = true, pass_outputs = "shoulder_screw(\"english\",1/2,length = 20);\n"})
target_end()
-- test datum
target("datum_test")
test_base()
add_files("tests/tests.c")
add_tests("tests", {runargs = "../test_datum.lua"})
target_end()
-- test transform
target("transform_test")
test_base()
add_files("tests/tests.c")
add_tests("tests", {runargs = "../test_transform.lua"})
target_end()
-- test chunk
target("chunk_test")
test_base()
add_files("tests/tests.c")
add_tests("tests", {runargs = "../test_chunk.lua", trim_output = true })
target_end()