summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-12-20 15:33:23 +0800
committerGitHub <[email protected]>2024-12-20 15:33:23 +0800
commit3e03bbf046350a30c07cfe3b3f0bf95fe947bc65 (patch)
tree6ede901f2365853d239b28a8bbfb55528e33c28e
parentf1934a9f8f6ef24ed8d554135c0c1360c1ba0491 (diff)
parent08d49c4e6f53b91382825e8634a67890d962372c (diff)
Merge pull request #5995 from xq114/master
add profile support for windows
-rw-r--r--xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua8
-rw-r--r--xmake/rules/mode/xmake.lua13
2 files changed, 17 insertions, 4 deletions
diff --git a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua
index 21d4c6881..b69826694 100644
--- a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua
+++ b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua
@@ -816,6 +816,9 @@ function _make_common_item(vcxprojfile, vsinfo, target, targetinfo)
-- save subsystem
local subsystem = "Console"
+ -- save profile
+ local profile = false
+
-- make linker flags
local flags = {}
local excludes = {
@@ -836,6 +839,8 @@ function _make_common_item(vcxprojfile, vsinfo, target, targetinfo)
elseif flag_lower:find("[^%-/].+%.lib") then
-- link file
table.insert(links, flag)
+ elseif flag_lower:find("[%-/]profile") then
+ profile = true
else
local excluded = false
for _, exclude in ipairs(excludes) do
@@ -870,6 +875,9 @@ function _make_common_item(vcxprojfile, vsinfo, target, targetinfo)
-- generate debug infomation?
if linkerkinds[targetinfo.targetkind] == "Link" then
+ -- enable profile?
+ vcxprojfile:print("<Profile>%s</Profile>", tostring(profile))
+
-- enable debug infomation?
local debug = false
for _, symbol in ipairs(targetinfo.symbols) do
diff --git a/xmake/rules/mode/xmake.lua b/xmake/rules/mode/xmake.lua
index 308dec90f..06aeffdcb 100644
--- a/xmake/rules/mode/xmake.lua
+++ b/xmake/rules/mode/xmake.lua
@@ -156,10 +156,15 @@ rule("mode.profile")
end
end
- -- enable gprof
- target:add("cxflags", "-pg")
- target:add("mxflags", "-pg")
- target:add("ldflags", "-pg")
+ if target:is_plat("windows") then
+ -- enable vs profile
+ target:add("ldflags", "/profile")
+ else
+ -- enable gprof
+ target:add("cxflags", "-pg")
+ target:add("mxflags", "-pg")
+ target:add("ldflags", "-pg")
+ end
-- enable NDEBUG macros to disables standard-C assertions
target:add("cxflags", "-DNDEBUG")