Skip to content

Commit 2f8decd

Browse files
authored
Merge branch 'dev' into unitybuild
2 parents bfef847 + 2b88ba3 commit 2f8decd

File tree

36 files changed

+301
-76
lines changed

36 files changed

+301
-76
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
print("Hello, world!")
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
add_rules("mode.debug", "mode.release")
2+
add_requires("python 3.x")
3+
4+
target("example")
5+
add_rules("python.cython")
6+
add_files("src/*.py")
7+
add_packages("python")

tests/projects/pybind/example_with_soabi/xmake.lua renamed to tests/projects/python/pybind/example/xmake.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ add_rules("mode.release", "mode.debug")
22
add_requires("pybind11")
33

44
target("example")
5-
add_rules("python.library", {soabi = true})
5+
add_rules("python.module", {soabi = false})
66
add_files("src/*.cpp")
77
add_packages("pybind11")
88
set_languages("c++11")

tests/projects/pybind/example/xmake.lua renamed to tests/projects/python/pybind/example_with_soabi/xmake.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ add_rules("mode.release", "mode.debug")
22
add_requires("pybind11")
33

44
target("example")
5-
add_rules("python.library")
5+
add_rules("python.module")
66
add_files("src/*.cpp")
77
add_packages("pybind11")
88
set_languages("c++11")

xmake/core/base/interpreter.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1793,7 +1793,7 @@ function interpreter:api_builtin_includes(...)
17931793
files = os.files(subpath)
17941794
else
17951795
-- @see https://github.com/xmake-io/xmake/issues/6026
1796-
files = os.files(path.join(subpath, path.filename(curfile)))
1796+
files = os.files(path.join(subpath, "xmake.lua"))
17971797
end
17981798
if files and #files > 0 then
17991799
table.join2(subpaths_matched, files)

xmake/core/base/profiler.lua

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,20 @@ function profiler:stop()
182182
return a.totaltime > b.totaltime
183183
end)
184184

185-
-- show reports
185+
-- show and save reports
186+
local report_lines = ""
187+
local outfile = path.join(os.tmpdir(), "perf-call-" .. os.date("%d-%m-%y-%S-%M-%H") .. ".log")
186188
for _, report in ipairs(reports) do
187189
local percent = (report.totaltime / totaltime) * 100
188190
if percent < 1 then
189191
break
190192
end
191-
utils.print("%6.3f, %6.2f%%, %7d, %s", report.totaltime, percent, report.callcount, self:_func_title(report.funcinfo))
193+
local report_line = string.format("%6.3f, %6.2f%%, %7d, %s", report.totaltime, percent, report.callcount, self:_func_title(report.funcinfo))
194+
report_lines = report_lines .. report_line .. "\n"
195+
utils.print(report_line)
192196
end
197+
utils.print("full log written to %s", outfile)
198+
io.writefile(outfile, report_lines)
193199
elseif self:is_perf("tag") then
194200

195201
-- sort reports, topN
@@ -201,16 +207,27 @@ function profiler:stop()
201207
h:push(report)
202208
end
203209

204-
-- show reports
210+
-- show and save reports
205211
local count = 0
206-
while count < 64 and h:length() > 0 do
212+
local max_count = 64
213+
local outfile = path.join(os.tmpdir(), "perf-tag-" .. os.date("%d-%m-%y-%S-%M-%H") .. ".log")
214+
local report_lines = ""
215+
while h:length() > 0 do
207216
local report = h:pop()
208-
utils.print("%6.3f, %7d, %s", report.totaltime, report.callcount, self:_tag_title(report.name, report.argv))
217+
local report_line = string.format("%6.3f, %7d, %s", report.totaltime, report.callcount, self:_tag_title(report.name, report.argv))
218+
report_lines = report_lines .. report_line .. "\n"
209219
count = count + 1
210220
end
211-
if h:length() > 0 then
221+
if count <= max_count then
222+
utils.print(report_lines)
223+
elseif count > max_count then
224+
local max_count_lines = {table.unpack(report_lines:split("\n"), 1, max_count)}
225+
utils.print(table.concat(max_count_lines, "\n"))
212226
utils.print("...")
227+
count = count + 1
213228
end
229+
utils.print("full log written to %s", outfile)
230+
io.writefile(outfile, report_lines)
214231
end
215232
end
216233

xmake/modules/detect/sdks/find_qt.lua

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,13 @@ function _find_sdkdir(sdkdir, sdkver)
141141
-- @see https://github.com/xmake-io/xmake/issues/4881
142142
if sdkver then
143143
local major = sdkver:sub(1, 1)
144-
qmake = find_file("qmake" .. major, paths, {suffixes = subdirs})
144+
local suffixes = {major, "-" .. major, "-qt" .. major, ""}
145+
for _, suffix in ipairs(suffixes) do
146+
qmake = find_file("qmake" .. suffix, paths, {suffixes = subdirs})
147+
if qmake then
148+
break
149+
end
150+
end
145151
end
146152
if not qmake then
147153
qmake = find_file("qmake", paths, {suffixes = subdirs})
@@ -167,18 +173,25 @@ function _find_qmake(sdkdir, sdkver)
167173
if sdkver then
168174
sdkver = semver.try_parse(sdkver)
169175
if sdkver then
170-
local cachekey = "qmake-" .. sdkver:major()
171-
qmake = find_tool("qmake", {program = "qmake" .. sdkver:major(), cachekey = cachekey, paths = sdkdir and path.join(sdkdir, "bin")})
176+
local major = sdkver:major()
177+
local suffixes = {major, "-" .. major, "-qt" .. major}
178+
for _, suffix in ipairs(suffixes) do
179+
local cachekey = "qmake" .. suffix
180+
qmake = find_tool("qmake", {program = cachekey, cachekey = cachekey, paths = sdkdir and path.join(sdkdir, "bin")})
181+
if qmake then
182+
break
183+
end
184+
end
172185
end
173186
end
174187

175188
-- we need to find the default qmake in current system
176189
-- maybe we only installed qmake6
177190
if not qmake then
178-
local suffixes = {"", "6", "-qt5"}
191+
local suffixes = {"", "6", "-6", "-qt6", "5", "-5", "-qt5"}
179192
for _, suffix in ipairs(suffixes) do
180-
local cachekey = "qmake-" .. suffix
181-
qmake = find_tool("qmake", {program = "qmake" .. suffix, cachekey = cachekey, paths = sdkdir and path.join(sdkdir, "bin")})
193+
local cachekey = "qmake" .. suffix
194+
qmake = find_tool("qmake", {program = cachekey, cachekey = cachekey, paths = sdkdir and path.join(sdkdir, "bin")})
182195
if qmake then
183196
break
184197
end

xmake/modules/detect/sdks/find_vstudio.lua

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,9 @@ function find_build_tools(opt)
109109
end
110110

111111
local variables = {}
112-
local VCToolsVersion
113-
local vs_toolset = opt.vs_toolset
114-
if vs_toolset and os.isdir(path.join(sdkdir, "VC/Tools/MSVC", vs_toolset)) then
115-
VCToolsVersion = vs_toolset
116-
else
112+
local VCInstallDir = path.join(sdkdir, "VC")
113+
local VCToolsVersion = opt.vs_toolset
114+
if not VCToolsVersion or not os.isdir(path.join(VCInstallDir, "Tools/MSVC", VCToolsVersion)) then
117115
-- https://github.com/xmake-io/xmake/issues/6159
118116
local latest_toolset
119117
for _, dir in ipairs(os.dirs(path.join(sdkdir, "VC/Tools/MSVC/*"))) do
@@ -128,8 +126,9 @@ function find_build_tools(opt)
128126
return
129127
end
130128
end
129+
variables.VCInstallDir = VCInstallDir
131130
variables.VCToolsVersion = VCToolsVersion
132-
variables.VCToolsInstallDir = path.join(sdkdir, "VC/Tools/MSVC", VCToolsVersion)
131+
variables.VCToolsInstallDir = path.join(VCInstallDir, "Tools/MSVC", VCToolsVersion)
133132

134133
local WindowsSDKVersion
135134
local vs_sdkver = opt.vs_sdkver
@@ -145,10 +144,15 @@ function find_build_tools(opt)
145144
end
146145
variables.WindowsSDKVersion = WindowsSDKVersion
147146
variables.WindowsSdkDir = path.join(sdkdir, "Windows Kits/10")
147+
variables.WindowsSdkBinPath = path.join(variables.WindowsSdkDir, "bin")
148+
variables.WindowsSdkVerBinPath = path.join(variables.WindowsSdkBinPath, WindowsSDKVersion)
149+
variables.ExtensionSdkDir = path.join(variables.WindowsSdkDir, "ExtensionSdkDir")
150+
variables.UCRTVersion = WindowsSDKVersion
151+
variables.UniversalCRTSdkDir = variables.WindowsSdkDir
148152

149153
local includedirs = {
150154
path.join(variables.VCToolsInstallDir, "include"),
151-
path.join(variables.VCToolsInstallDir, "atlmfc/include"),
155+
path.join(variables.VCToolsInstallDir, "atlmfc", "include"),
152156
path.join(variables.WindowsSdkDir, "Include", WindowsSDKVersion, "ucrt"),
153157
path.join(variables.WindowsSdkDir, "Include", WindowsSDKVersion, "shared"),
154158
path.join(variables.WindowsSdkDir, "Include", WindowsSDKVersion, "um"),
@@ -158,8 +162,10 @@ function find_build_tools(opt)
158162

159163
local linkdirs = {
160164
path.join(variables.VCToolsInstallDir, "lib"),
165+
path.join(variables.VCToolsInstallDir, "atlmfc", "lib"),
161166
path.join(variables.WindowsSdkDir, "Lib", WindowsSDKVersion, "ucrt"),
162167
path.join(variables.WindowsSdkDir, "Lib", WindowsSDKVersion, "um"),
168+
path.join(variables.WindowsSdkDir, "Lib", WindowsSDKVersion, "km"),
163169
}
164170

165171
local archs = {
@@ -182,32 +188,42 @@ function find_build_tools(opt)
182188
if #lib ~= 0 then
183189
local vcvars = {
184190
BUILD_TOOLS_ROOT = sdkdir,
191+
VSInstallDir = sdkdir,
185192

186193
-- vs runs in a windows ctx, so the envsep is always ";"
187194
INCLUDE = path.joinenv(includedirs, ';'),
188195
LIB = path.joinenv(lib, ';'),
189196

190-
WindowsSdkDir = variables.WindowsSdkDir,
191-
WindowsSDKVersion = WindowsSDKVersion,
192-
VCToolsInstallDir = variables.VCToolsInstallDir,
193197
VSCMD_ARG_HOST_ARCH = "x64",
198+
199+
VCInstallDir = variables.VCInstallDir,
200+
VCToolsVersion = variables.VCToolsVersion,
201+
VCToolsInstallDir = variables.VCToolsInstallDir,
202+
203+
WindowsSDKVersion = variables.WindowsSDKVersion,
204+
WindowsSdkDir = variables.WindowsSdkDir,
205+
WindowsSdkBinPath = variables.WindowsSdkBinPath,
206+
WindowsSdkVerBinPath = variables.WindowsSdkVerBinPath,
207+
ExtensionSdkDir = variables.ExtensionSdkDir,
208+
UCRTVersion = variables.UCRTVersion,
209+
UniversalCRTSdkDir = variables.UniversalCRTSdkDir,
194210
}
195211

196-
local buidl_tools_bin = {}
212+
local build_tools_bin = {}
197213
local host_dir = "Host" .. vcvars.VSCMD_ARG_HOST_ARCH
198214
if is_host("windows") then
199-
table.insert(buidl_tools_bin, path.join(vcvars.VCToolsInstallDir, "bin", host_dir, target_arch))
200-
table.insert(buidl_tools_bin, path.join(vcvars.WindowsSdkDir, "bin", WindowsSDKVersion))
201-
table.insert(buidl_tools_bin, path.join(vcvars.WindowsSdkDir, "bin", WindowsSDKVersion, "ucrt"))
215+
table.insert(build_tools_bin, path.join(vcvars.VCToolsInstallDir, "bin", host_dir, target_arch))
216+
table.insert(build_tools_bin, path.join(vcvars.WindowsSdkDir, "bin", WindowsSDKVersion))
217+
table.insert(build_tools_bin, path.join(vcvars.WindowsSdkDir, "bin", WindowsSDKVersion, "ucrt"))
202218
elseif is_host("linux") then
203219
-- for msvc-wine
204-
table.insert(buidl_tools_bin, path.join(sdkdir, "bin", target_arch))
220+
table.insert(build_tools_bin, path.join(sdkdir, "bin", target_arch))
205221
end
206222

207223
vcvars.VSCMD_ARG_TGT_ARCH = target_arch
208-
vcvars.BUILD_TOOLS_BIN = path.joinenv(buidl_tools_bin)
224+
vcvars.BUILD_TOOLS_BIN = path.joinenv(build_tools_bin)
209225

210-
local PATH = buidl_tools_bin
226+
local PATH = build_tools_bin
211227
table.join2(PATH, path.splitenv(os.getenv("PATH")))
212228
vcvars.PATH = path.joinenv(PATH)
213229

0 commit comments

Comments
 (0)