Skip to content

Commit

Permalink
Merge pull request #5995 from xq114/master
Browse files Browse the repository at this point in the history
add profile support for windows
  • Loading branch information
waruqi authored Dec 20, 2024
2 parents f1934a9 + 08d49c4 commit 3e03bbf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
8 changes: 8 additions & 0 deletions xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
13 changes: 9 additions & 4 deletions xmake/rules/mode/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 3e03bbf

Please sign in to comment.