如何爲windows編譯啓用pdb支持

xmake默認狀況下是不會去生成pdb文件,就算是debug編譯,啓用了調試符號:git

set_symbols("debug")

也是不會生成額外的pdb文件,它會把全部調試符號內置到程序裏面,若是要獨立生成pdb文件,能夠對xmake.lua進行以下修改:github

-- 先禁用內置的調試符號開關
--set_symbols("debug")
   
-- 靜態庫目標
target("test")
    set_kind("static")

    -- 僅針對windows平臺
    if is_plat("windows") then
        -- 啓用pdb生成
        add_cxflags("-ZI", "-Fd$(buildir)\\test.pdb")
        add_ldflags("-pdb:$(buildir)\\test.pdb")
        add_arflags("-pdb:$(buildir)\\test.pdb")
    end

-- 可執行目標
target("demo")
    set_kind("binary")
    add_deps("test")
    add_links("test")

    -- 僅針對windows平臺
    if is_plat("windows") then
        -- 啓用pdb生成
        add_cxflags("-ZI", "-Fd$(buildir)\\demo.pdb")
        add_ldflags("-pdb:$(buildir)\\demo.pdb")
    end

相關文章
相關標籤/搜索