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
|
local lm = require 'luamake'
local platform = require 'bee.platform'
local exe = platform.OS == 'Windows' and ".exe" or ""
lm.bindir = "bin"
lm.EXE_DIR = ""
if platform.OS == 'macOS' then
if lm.platform == nil then
elseif lm.platform == "darwin-arm64" then
lm.target = "arm64-apple-macos11"
elseif lm.platform == "darwin-x64" then
lm.target = "x86_64-apple-macos10.12"
else
error "unknown platform"
end
elseif platform.OS == 'Windows' then
if lm.platform == nil then
elseif lm.platform == "win32-ia32" then
lm.arch = "x86"
elseif lm.platform == "win32-x64" then
lm.arch = "x86_64"
else
error "unknown platform"
end
elseif platform.OS == 'Linux' then
if lm.platform == nil then
elseif lm.platform == "linux-x64" then
elseif lm.platform == "linux-arm64" then
-- TODO: not implement
lm.compiler = "clang"
lm.target = "arm64-pc-linux-gnu"
else
error "unknown platform"
end
end
lm:import "3rd/bee.lua/make.lua"
lm:import "make/code_format.lua"
lm:source_set 'lpeglabel' {
rootdir = '3rd',
includes = "bee.lua/3rd/lua",
sources = "lpeglabel/*.c",
defines = {
'MAXRECLEVEL=1000',
},
}
lm:executable "lua-language-server" {
deps = {"lpeglabel", "source_bootstrap", "code_format"},
includes = {
"3rd/bee.lua",
"3rd/bee.lua/3rd/lua",
},
sources = "make/modules.cpp",
windows = {
sources = {
"make/lua-language-server.rc",
}
},
linux = {
crt = "static",
}
}
lm:copy "copy_bootstrap" {
input = "make/bootstrap.lua",
output = lm.bindir.."/main.lua",
}
lm:build 'copy_vcrt' {
'$luamake', 'lua', 'make/copy_vcrt.lua', lm.bindir, lm.arch,
}
lm:phony "all" {
deps = {
"lua-language-server",
"copy_bootstrap",
},
windows = {
deps = {
"copy_vcrt"
}
}
}
local function detectWindowsArch()
if os.getenv "PROCESSOR_ARCHITECTURE" == "ARM64" then
return "arm64"
end
if os.getenv "PROCESSOR_ARCHITECTURE" == "AMD64" or os.getenv "PROCESSOR_ARCHITEW6432" == "AMD64" then
return "x64"
end
return "ia32"
end
local function detectPosixArch()
local f <close> = assert(io.popen("uname -m", 'r'))
return f:read 'l':lower()
end
local function detectArch()
if platform.OS == 'Windows' then
return detectWindowsArch()
end
return detectPosixArch()
end
local function targetPlatformArch()
if lm.platform == nil then
return detectArch()
end
return lm.platform:match "^[^-]*-(.*)$"
end
local notest = platform.OS == 'macOS'
and targetPlatformArch() == "arm64"
and detectArch() == "x86_64"
if notest then
lm:default {
"all",
}
return
end
lm:build "bee-test" {
lm.bindir.."/lua-language-server"..exe, "3rd/bee.lua/test/test.lua",
pool = "console",
deps = {
"all",
}
}
lm:build 'unit-test' {
lm.bindir.."/lua-language-server"..exe, 'test.lua',
pool = "console",
deps = {
"bee-test",
}
}
lm:default {
"bee-test",
"unit-test",
}
|