Fixes compilation issues of glslang and spirv-tools under debug mode msvc (#2036)

* Fix compilation issue of debug build

* Fix build error of parallelized debug build
pull/2041/head
libreliu 2 years ago committed by GitHub
parent c6bb7c2c4f
commit 28f4a6fcd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      packages/g/glslang/xmake.lua
  2. 4
      packages/s/spirv-tools/xmake.lua

@ -46,6 +46,10 @@ package("glslang")
io.replace("SPIRV/CMakeLists.txt", "target_link_libraries(SPIRV PRIVATE MachineIndependent SPIRV-Tools-opt)", [[
target_link_libraries(SPIRV PRIVATE MachineIndependent SPIRV-Tools-opt SPIRV-Tools-link SPIRV-Tools-reduce SPIRV-Tools)
]], {plain = true})
-- glslang will add a debug lib postfix for win32 platform, disable this to fix compilation issues under windows
io.replace("CMakeLists.txt", 'set(CMAKE_DEBUG_POSTFIX "d")', [[
message(WARNING "Disabled CMake Debug Postfix for xmake package generation")
]], {plain = true})
if package:is_plat("wasm") then
-- wasm-ld doesn't support --no-undefined
io.replace("CMakeLists.txt", [[add_link_options("-Wl,--no-undefined")]], "", {plain = true})
@ -54,6 +58,9 @@ package("glslang")
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
if package:is_plat("windows") then
table.insert(configs, "-DBUILD_SHARED_LIBS=OFF")
if package:debug() then
table.insert(configs, "-DCMAKE_COMPILE_PDB_OUTPUT_DIRECTORY=''")
end
else
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
end

@ -44,6 +44,10 @@ package("spirv-tools")
on_install(function (package)
package:addenv("PATH", "bin")
local configs = {"-DSPIRV_SKIP_TESTS=ON", "-DSPIRV_WERROR=OFF"}
-- walkaround for potential conflict with parallel build & debug pdb generation
if package:debug() then
table.insert(configs, "-DCMAKE_COMPILE_PDB_OUTPUT_DIRECTORY=''")
end
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
local spirv = package:dep("spirv-headers")

Loading…
Cancel
Save