xmake-io / xmake

🔥 A cross-platform build utility based on Lua
https://xmake.io
Apache License 2.0
10.08k stars 784 forks source link

C1041 when compiling project with custom rule #4974

Open Raildex opened 6 months ago

Raildex commented 6 months ago

Xmake Version

v2.8.9+HEAD.cb1b65054

Operating System Version and Architecture

Windows 11, Visual Studio 2022

Describe Bug

I have a rule that compiles shader files and transforms them into header files. It works with xmake, but does not with Visual Studio or Ninja and I have no idea how to fix it. The order of execution seems to be different. Ninja does not seem to generate the header files and tries to compile the main.cpp before that and hits a compile error. The visual studio solution error is unknown to me and seems to be an error of the xmake generation.

The rule "shadercompile.d3d11" seems to be the culprit, but since it works with xmake, I think Visual Studio solution/Ninja generation has a bug

rule("shadercompile.d3d11")
    set_extensions(".hlsl")
    before_buildcmd_file(function (target, batchcmds, sourcefile_bin, opt)
        import("core.project.project")
        import("lib.detect.find_program")
        local headerdir = path.join(target:autogendir(), "include")
        if not os.isdir(headerdir) then
            os.mkdir(headerdir)
        end
        target:add("includedirs", headerdir,{public = true})
        local config = target:fileconfig(sourcefile_bin)
        local directory = config.directory
        local profile = config.profile
        batchcmds:show_progress(opt.progress, "${color.build.object}generating.fxc Shader directory: %s", directory)

        for i,option  in ipairs(config.options) do 
            batchcmds:show_progress(opt.progress, "Compile Option #%d",i)
            batchcmds:show_progress(opt.progress, "Entry name : %s ,Variable name: %s",option.entry,option.varname)
            local varname = option.varname
            local entry = option.entry
            -- get header file
            local headerdir = path.join(target:autogendir(), "include")
            local shaderdir = path.join(headerdir,"shaders",directory)
            local shaderfile = sourcefile_bin
            local shaderfilename = path.filename(shaderfile)
            local bytecodefile = path.join(shaderdir, shaderfilename:gsub("hlsl","dxbc") .. "")
            local filebase = varname
            local filepathbase = path.join(shaderdir,filebase) .. ""
            local headerfile = filepathbase .. ".hpp"
            local sourcefile = filepathbase .. ".cpp"
            -- add commands
            batchcmds:show_progress(opt.progress, "${color.build.object}generating.fxc Shader file: %s", shaderfile)
            batchcmds:show_progress(opt.progress, "${color.build.object}generating.fxc Shader bytecode file: %s", bytecodefile)
            batchcmds:show_progress(opt.progress, "${color.build.object}generating.fxc Shader profile: %s", profile)
            batchcmds:show_progress(opt.progress, "${color.build.object}generating.fxc Shader header file: %s", headerfile)
            batchcmds:mkdir(shaderdir)

            local fxcpkg = project.required_package("fxc~host") or project.required_package("fxc")
            assert(fxcpkg,"fxc package not found!")
            local fxcdir
            if fxcpkg then
                fxcdir = path.join(fxcpkg:installdir(), "bin")
            end
            local fxc = find_program("fxc", { paths = fxcdir, check = function (program) return true end})
            assert(fxc, "fxc not found! please install fxc package")
            local compileargs
            if is_mode("debug") then
                compileargs = {"/T",profile ,"/E" ,entry ,"/WX" ,"/Zi" ,"/Zss" ,"/Ges" ,"/Gis" ,"/Od","/nologo","/Fo" , path(bytecodefile) , path(sourcefile_bin)}
            else
                compileargs = {"/T",profile ,"/E" ,entry ,"/WX" ,"/Zss" ,"/Ges" ,"/Gis" ,"/O3","/Qstrip_debug","/Qstrip_reflect","/nologo","/Fo" , path(bytecodefile) , path(sourcefile_bin)}
            end
            batchcmds:execv(fxc, compileargs)

            batchcmds:show_progress(opt.progress, "${color.build.object}generating.f2c variable name %s", varname)
            batchcmds:show_progress(opt.progress, "${color.build.object}generating.f2c filepathbase name %s", filepathbase)
            local f2cpkg = project.required_package("f2c~host") or project.required_package("f2c")
            local f2cdir
            if f2cpkg then
                f2cdir = path.join(f2cpkg:installdir(), "bin")
            end

            local f2c = find_program("f2c", { paths = f2cdir, check = function (program) return true end})
            assert(f2c, "f2c not found! please install f2c package")
            local f2cargs = {"-cpp", path(bytecodefile), varname ,path(filepathbase), "shaders::d3d11"}
            batchcmds:execv(f2c, f2cargs, {envs = {XMAKE_SKIP_HISTORY = "y"}})

            -- add deps
            batchcmds:add_depfiles(sourcefile_bin)
            batchcmds:set_depmtime(os.mtime(headerfile))
            batchcmds:set_depcache(target:dependfile(headerfile))
            batchcmds:show_progress(opt.progress,"Compile shader sourcefile %s",sourcefile)
            local objectfile = target:objectfile(sourcefile)
            table.insert(target:objectfiles(), objectfile)
            batchcmds:compile(sourcefile, objectfile)
        end
    end)
rule_end()

Expected Behavior

Compilation should work

Project Configuration

test.zip

Additional Information and Error Logs

Ninja:

[1/3] compiling.release Game/src/main.cpp
FAILED: build/.objs/Runtime/windows/x64/release/Game/src/main.cpp.obj
D:\Programme\Visual Studio 2022\VC\Tools\MSVC\14.38.33130\bin\HostX64\x64\cl.exe -showIncludes -c -nologo -W3 -WX -O2 -fp:fast -std:c++latest -IGame/src -DWIN32_LEAN_AND_MEAN -DNOMINMAX -DVC_EXTRALEAN -D_CRT_SECURE_NO_WARNINGS -DGLM_FORCE_SWIZZLE -DGLM_FORCE_ONLY_XYZW -DGLM_ENABLE_EXPERIMENTAL -DGLM_FORCE_INLINE -DWITH_D3D11 -DCEREAL_XML_STRING_VALUE=\"raidengine\" -DTOML_EXCEPTIONS=0 /EHsc -DNDEBUG Game/src/main.cpp -Fobuild/.objs/Runtime/windows/x64/release/Game/src/main.cpp.obj
Game/src/main.cpp(1): fatal error C1083: Cannot open include file: 'shaders/d3d11/room_vertex.hpp': No such file or directory
ninja: build stopped: subcommand failed.

Visual Studio:

Severity    Code    Description Project File    Line    Suppression State   Details
Error   MSB3073 The command "setlocal
if not exist "..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11" mkdir "..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11"
if %errorlevel% neq 0 goto :xmEnd
C:\Users\Raildex\AppData\Local\.xmake\packages\f\fxc\latest\02f1f56ac0004a2f9d332033b9bfe816\bin\fxc /T vs_5_0 /E main /WX /Zi /Zss /Ges /Gis /Od /nologo /Fo..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\room.vertex.dxbc ..\..\Game\shader\d3d11\room\room.vertex.hlsl
if %errorlevel% neq 0 goto :xmEnd
C:\Users\Raildex\AppData\Local\.xmake\packages\f\f2c\latest\b68750efa7e54743871e3308b2fa1473\bin\f2c -cpp ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\room.vertex.dxbc room_vertex ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\room_vertex shaders::d3d11
if %errorlevel% neq 0 goto :xmEnd
if not exist "..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11" mkdir "..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11"
if %errorlevel% neq 0 goto :xmEnd
"D:\\Programme\\Visual Studio 2022\\VC\\Tools\\MSVC\\14.38.33130\\bin\\HostX64\\x64\\cl.exe" -c -nologo -Zi -FS -Fdbuild\windows\x64\debug\compile.Runtime.pdb -W3 -WX -Od -std:c++latest -IGame\src -Ibuild\.gens\Runtime\windows\x64\debug\include -DWIN32_LEAN_AND_MEAN -DNOMINMAX -DVC_EXTRALEAN -D_CRT_SECURE_NO_WARNINGS -DGLM_FORCE_SWIZZLE -DGLM_FORCE_ONLY_XYZW -DGLM_ENABLE_EXPERIMENTAL -DGLM_FORCE_INLINE -DWITH_D3D11 -DCEREAL_XML_STRING_VALUE=\"raidengine\" -DTOML_EXCEPTIONS=0 /EHsc -Fo..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11\room_vertex.cpp.obj ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\room_vertex.cpp
if %errorlevel% neq 0 goto :xmEnd
if not exist "..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11" mkdir "..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11"
if %errorlevel% neq 0 goto :xmEnd
C:\Users\Raildex\AppData\Local\.xmake\packages\f\fxc\latest\02f1f56ac0004a2f9d332033b9bfe816\bin\fxc /T ps_5_0 /E main /WX /Zi /Zss /Ges /Gis /Od /nologo /Fo..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\room.pixel.dxbc ..\..\Game\shader\d3d11\room\room.pixel.hlsl
if %errorlevel% neq 0 goto :xmEnd
C:\Users\Raildex\AppData\Local\.xmake\packages\f\f2c\latest\b68750efa7e54743871e3308b2fa1473\bin\f2c -cpp ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\room.pixel.dxbc room_pixel_main ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\room_pixel_main shaders::d3d11
if %errorlevel% neq 0 goto :xmEnd
if not exist "..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11" mkdir "..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11"
if %errorlevel% neq 0 goto :xmEnd
"D:\\Programme\\Visual Studio 2022\\VC\\Tools\\MSVC\\14.38.33130\\bin\\HostX64\\x64\\cl.exe" -c -nologo -Zi -FS -Fdbuild\windows\x64\debug\compile.Runtime.pdb -W3 -WX -Od -std:c++latest -IGame\src -Ibuild\.gens\Runtime\windows\x64\debug\include -DWIN32_LEAN_AND_MEAN -DNOMINMAX -DVC_EXTRALEAN -D_CRT_SECURE_NO_WARNINGS -DGLM_FORCE_SWIZZLE -DGLM_FORCE_ONLY_XYZW -DGLM_ENABLE_EXPERIMENTAL -DGLM_FORCE_INLINE -DWITH_D3D11 -DCEREAL_XML_STRING_VALUE=\"raidengine\" -DTOML_EXCEPTIONS=0 /EHsc -Fo..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11\room_pixel_main.cpp.obj ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\room_pixel_main.cpp
if %errorlevel% neq 0 goto :xmEnd
if not exist "..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11" mkdir "..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11"
if %errorlevel% neq 0 goto :xmEnd
C:\Users\Raildex\AppData\Local\.xmake\packages\f\fxc\latest\02f1f56ac0004a2f9d332033b9bfe816\bin\fxc /T ps_5_0 /E pre_pass /WX /Zi /Zss /Ges /Gis /Od /nologo /Fo..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\room.pixel.dxbc ..\..\Game\shader\d3d11\room\room.pixel.hlsl
if %errorlevel% neq 0 goto :xmEnd
C:\Users\Raildex\AppData\Local\.xmake\packages\f\f2c\latest\b68750efa7e54743871e3308b2fa1473\bin\f2c -cpp ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\room.pixel.dxbc room_pixel_pre ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\room_pixel_pre shaders::d3d11
if %errorlevel% neq 0 goto :xmEnd
if not exist "..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11" mkdir "..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11"
if %errorlevel% neq 0 goto :xmEnd
"D:\\Programme\\Visual Studio 2022\\VC\\Tools\\MSVC\\14.38.33130\\bin\\HostX64\\x64\\cl.exe" -c -nologo -Zi -FS -Fdbuild\windows\x64\debug\compile.Runtime.pdb -W3 -WX -Od -std:c++latest -IGame\src -Ibuild\.gens\Runtime\windows\x64\debug\include -DWIN32_LEAN_AND_MEAN -DNOMINMAX -DVC_EXTRALEAN -D_CRT_SECURE_NO_WARNINGS -DGLM_FORCE_SWIZZLE -DGLM_FORCE_ONLY_XYZW -DGLM_ENABLE_EXPERIMENTAL -DGLM_FORCE_INLINE -DWITH_D3D11 -DCEREAL_XML_STRING_VALUE=\"raidengine\" -DTOML_EXCEPTIONS=0 /EHsc -Fo..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11\room_pixel_pre.cpp.obj ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\room_pixel_pre.cpp
if %errorlevel% neq 0 goto :xmEnd
if not exist "..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11" mkdir "..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11"
if %errorlevel% neq 0 goto :xmEnd
C:\Users\Raildex\AppData\Local\.xmake\packages\f\fxc\latest\02f1f56ac0004a2f9d332033b9bfe816\bin\fxc /T vs_5_0 /E main /WX /Zi /Zss /Ges /Gis /Od /nologo /Fo..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\fullscreen.vertex.dxbc ..\..\Game\shader\d3d11\fullscreen\fullscreen.vertex.hlsl
if %errorlevel% neq 0 goto :xmEnd
C:\Users\Raildex\AppData\Local\.xmake\packages\f\f2c\latest\b68750efa7e54743871e3308b2fa1473\bin\f2c -cpp ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\fullscreen.vertex.dxbc fullscreen_vertex ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\fullscreen_vertex shaders::d3d11
if %errorlevel% neq 0 goto :xmEnd
if not exist "..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11" mkdir "..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11"
if %errorlevel% neq 0 goto :xmEnd
"D:\\Programme\\Visual Studio 2022\\VC\\Tools\\MSVC\\14.38.33130\\bin\\HostX64\\x64\\cl.exe" -c -nologo -Zi -FS -Fdbuild\windows\x64\debug\compile.Runtime.pdb -W3 -WX -Od -std:c++latest -IGame\src -Ibuild\.gens\Runtime\windows\x64\debug\include -DWIN32_LEAN_AND_MEAN -DNOMINMAX -DVC_EXTRALEAN -D_CRT_SECURE_NO_WARNINGS -DGLM_FORCE_SWIZZLE -DGLM_FORCE_ONLY_XYZW -DGLM_ENABLE_EXPERIMENTAL -DGLM_FORCE_INLINE -DWITH_D3D11 -DCEREAL_XML_STRING_VALUE=\"raidengine\" -DTOML_EXCEPTIONS=0 /EHsc -Fo..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11\fullscreen_vertex.cpp.obj ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\fullscreen_vertex.cpp
if %errorlevel% neq 0 goto :xmEnd
if not exist "..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11" mkdir "..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11"
if %errorlevel% neq 0 goto :xmEnd
C:\Users\Raildex\AppData\Local\.xmake\packages\f\fxc\latest\02f1f56ac0004a2f9d332033b9bfe816\bin\fxc /T ps_5_0 /E main /WX /Zi /Zss /Ges /Gis /Od /nologo /Fo..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\fullscreen.pixel.dxbc ..\..\Game\shader\d3d11\fullscreen\fullscreen.pixel.hlsl
if %errorlevel% neq 0 goto :xmEnd
C:\Users\Raildex\AppData\Local\.xmake\packages\f\f2c\latest\b68750efa7e54743871e3308b2fa1473\bin\f2c -cpp ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\fullscreen.pixel.dxbc fullscreen_pixel ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\fullscreen_pixel shaders::d3d11
if %errorlevel% neq 0 goto :xmEnd
if not exist "..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11" mkdir "..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11"
if %errorlevel% neq 0 goto :xmEnd
"D:\\Programme\\Visual Studio 2022\\VC\\Tools\\MSVC\\14.38.33130\\bin\\HostX64\\x64\\cl.exe" -c -nologo -Zi -FS -Fdbuild\windows\x64\debug\compile.Runtime.pdb -W3 -WX -Od -std:c++latest -IGame\src -Ibuild\.gens\Runtime\windows\x64\debug\include -DWIN32_LEAN_AND_MEAN -DNOMINMAX -DVC_EXTRALEAN -D_CRT_SECURE_NO_WARNINGS -DGLM_FORCE_SWIZZLE -DGLM_FORCE_ONLY_XYZW -DGLM_ENABLE_EXPERIMENTAL -DGLM_FORCE_INLINE -DWITH_D3D11 -DCEREAL_XML_STRING_VALUE=\"raidengine\" -DTOML_EXCEPTIONS=0 /EHsc -Fo..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11\fullscreen_pixel.cpp.obj ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\fullscreen_pixel.cpp
if %errorlevel% neq 0 goto :xmEnd
if not exist "..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11" mkdir "..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11"
if %errorlevel% neq 0 goto :xmEnd
C:\Users\Raildex\AppData\Local\.xmake\packages\f\fxc\latest\02f1f56ac0004a2f9d332033b9bfe816\bin\fxc /T ps_5_0 /E cube_to_oct /WX /Zi /Zss /Ges /Gis /Od /nologo /Fo..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\cube_to_oct.pixel.dxbc ..\..\Game\shader\d3d11\fullscreen\cube_to_oct.pixel.hlsl
if %errorlevel% neq 0 goto :xmEnd
C:\Users\Raildex\AppData\Local\.xmake\packages\f\f2c\latest\b68750efa7e54743871e3308b2fa1473\bin\f2c -cpp ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\cube_to_oct.pixel.dxbc cube_to_oct_pixel ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\cube_to_oct_pixel shaders::d3d11
if %errorlevel% neq 0 goto :xmEnd
if not exist "..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11" mkdir "..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11"
if %errorlevel% neq 0 goto :xmEnd
"D:\\Programme\\Visual Studio 2022\\VC\\Tools\\MSVC\\14.38.33130\\bin\\HostX64\\x64\\cl.exe" -c -nologo -Zi -FS -Fdbuild\windows\x64\debug\compile.Runtime.pdb -W3 -WX -Od -std:c++latest -IGame\src -Ibuild\.gens\Runtime\windows\x64\debug\include -DWIN32_LEAN_AND_MEAN -DNOMINMAX -DVC_EXTRALEAN -D_CRT_SECURE_NO_WARNINGS -DGLM_FORCE_SWIZZLE -DGLM_FORCE_ONLY_XYZW -DGLM_ENABLE_EXPERIMENTAL -DGLM_FORCE_INLINE -DWITH_D3D11 -DCEREAL_XML_STRING_VALUE=\"raidengine\" -DTOML_EXCEPTIONS=0 /EHsc -Fo..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11\cube_to_oct_pixel.cpp.obj ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\cube_to_oct_pixel.cpp
if %errorlevel% neq 0 goto :xmEnd
if not exist "..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11" mkdir "..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11"
if %errorlevel% neq 0 goto :xmEnd
C:\Users\Raildex\AppData\Local\.xmake\packages\f\fxc\latest\02f1f56ac0004a2f9d332033b9bfe816\bin\fxc /T vs_5_0 /E main /WX /Zi /Zss /Ges /Gis /Od /nologo /Fo..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\blit.vertex.dxbc ..\..\Game\shader\d3d11\blit\blit.vertex.hlsl
if %errorlevel% neq 0 goto :xmEnd
C:\Users\Raildex\AppData\Local\.xmake\packages\f\f2c\latest\b68750efa7e54743871e3308b2fa1473\bin\f2c -cpp ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\blit.vertex.dxbc blit_vertex ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\blit_vertex shaders::d3d11
if %errorlevel% neq 0 goto :xmEnd
if not exist "..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11" mkdir "..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11"
if %errorlevel% neq 0 goto :xmEnd
"D:\\Programme\\Visual Studio 2022\\VC\\Tools\\MSVC\\14.38.33130\\bin\\HostX64\\x64\\cl.exe" -c -nologo -Zi -FS -Fdbuild\windows\x64\debug\compile.Runtime.pdb -W3 -WX -Od -std:c++latest -IGame\src -Ibuild\.gens\Runtime\windows\x64\debug\include -DWIN32_LEAN_AND_MEAN -DNOMINMAX -DVC_EXTRALEAN -D_CRT_SECURE_NO_WARNINGS -DGLM_FORCE_SWIZZLE -DGLM_FORCE_ONLY_XYZW -DGLM_ENABLE_EXPERIMENTAL -DGLM_FORCE_INLINE -DWITH_D3D11 -DCEREAL_XML_STRING_VALUE=\"raidengine\" -DTOML_EXCEPTIONS=0 /EHsc -Fo..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11\blit_vertex.cpp.obj ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\blit_vertex.cpp
if %errorlevel% neq 0 goto :xmEnd
if not exist "..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11" mkdir "..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11"
if %errorlevel% neq 0 goto :xmEnd
C:\Users\Raildex\AppData\Local\.xmake\packages\f\fxc\latest\02f1f56ac0004a2f9d332033b9bfe816\bin\fxc /T ps_5_0 /E main /WX /Zi /Zss /Ges /Gis /Od /nologo /Fo..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\blit.pixel.dxbc ..\..\Game\shader\d3d11\blit\blit.pixel.hlsl
if %errorlevel% neq 0 goto :xmEnd
C:\Users\Raildex\AppData\Local\.xmake\packages\f\f2c\latest\b68750efa7e54743871e3308b2fa1473\bin\f2c -cpp ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\blit.pixel.dxbc blit_pixel ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\blit_pixel shaders::d3d11
if %errorlevel% neq 0 goto :xmEnd
if not exist "..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11" mkdir "..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11"
if %errorlevel% neq 0 goto :xmEnd
"D:\\Programme\\Visual Studio 2022\\VC\\Tools\\MSVC\\14.38.33130\\bin\\HostX64\\x64\\cl.exe" -c -nologo -Zi -FS -Fdbuild\windows\x64\debug\compile.Runtime.pdb -W3 -WX -Od -std:c++latest -IGame\src -Ibuild\.gens\Runtime\windows\x64\debug\include -DWIN32_LEAN_AND_MEAN -DNOMINMAX -DVC_EXTRALEAN -D_CRT_SECURE_NO_WARNINGS -DGLM_FORCE_SWIZZLE -DGLM_FORCE_ONLY_XYZW -DGLM_ENABLE_EXPERIMENTAL -DGLM_FORCE_INLINE -DWITH_D3D11 -DCEREAL_XML_STRING_VALUE=\"raidengine\" -DTOML_EXCEPTIONS=0 /EHsc -Fo..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11\blit_pixel.cpp.obj ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\blit_pixel.cpp
if %errorlevel% neq 0 goto :xmEnd
if not exist "..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11" mkdir "..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11"
if %errorlevel% neq 0 goto :xmEnd
C:\Users\Raildex\AppData\Local\.xmake\packages\f\fxc\latest\02f1f56ac0004a2f9d332033b9bfe816\bin\fxc /T ps_5_0 /E main /WX /Zi /Zss /Ges /Gis /Od /nologo /Fo..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\ambient_occlusion.pixel.dxbc ..\..\Game\shader\d3d11\ambient_occlusion\ambient_occlusion.pixel.hlsl
if %errorlevel% neq 0 goto :xmEnd
C:\Users\Raildex\AppData\Local\.xmake\packages\f\f2c\latest\b68750efa7e54743871e3308b2fa1473\bin\f2c -cpp ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\ambient_occlusion.pixel.dxbc ambient_occlusion_pixel ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\ambient_occlusion_pixel shaders::d3d11
if %errorlevel% neq 0 goto :xmEnd
if not exist "..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11" mkdir "..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11"
if %errorlevel% neq 0 goto :xmEnd
"D:\\Programme\\Visual Studio 2022\\VC\\Tools\\MSVC\\14.38.33130\\bin\\HostX64\\x64\\cl.exe" -c -nologo -Zi -FS -Fdbuild\windows\x64\debug\compile.Runtime.pdb -W3 -WX -Od -std:c++latest -IGame\src -Ibuild\.gens\Runtime\windows\x64\debug\include -DWIN32_LEAN_AND_MEAN -DNOMINMAX -DVC_EXTRALEAN -D_CRT_SECURE_NO_WARNINGS -DGLM_FORCE_SWIZZLE -DGLM_FORCE_ONLY_XYZW -DGLM_ENABLE_EXPERIMENTAL -DGLM_FORCE_INLINE -DWITH_D3D11 -DCEREAL_XML_STRING_VALUE=\"raidengine\" -DTOML_EXCEPTIONS=0 /EHsc -Fo..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11\ambient_occlusion_pixel.cpp.obj ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\ambient_occlusion_pixel.cpp
if %errorlevel% neq 0 goto :xmEnd
if not exist "..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11" mkdir "..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11"
if %errorlevel% neq 0 goto :xmEnd
C:\Users\Raildex\AppData\Local\.xmake\packages\f\fxc\latest\02f1f56ac0004a2f9d332033b9bfe816\bin\fxc /T ps_5_0 /E blur_horizontal /WX /Zi /Zss /Ges /Gis /Od /nologo /Fo..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\blur.pixel.dxbc ..\..\Game\shader\d3d11\blur\blur.pixel.hlsl
if %errorlevel% neq 0 goto :xmEnd
C:\Users\Raildex\AppData\Local\.xmake\packages\f\f2c\latest\b68750efa7e54743871e3308b2fa1473\bin\f2c -cpp ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\blur.pixel.dxbc blur_horizontal_pixel ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\blur_horizontal_pixel shaders::d3d11
if %errorlevel% neq 0 goto :xmEnd
if not exist "..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11" mkdir "..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11"
if %errorlevel% neq 0 goto :xmEnd
"D:\\Programme\\Visual Studio 2022\\VC\\Tools\\MSVC\\14.38.33130\\bin\\HostX64\\x64\\cl.exe" -c -nologo -Zi -FS -Fdbuild\windows\x64\debug\compile.Runtime.pdb -W3 -WX -Od -std:c++latest -IGame\src -Ibuild\.gens\Runtime\windows\x64\debug\include -DWIN32_LEAN_AND_MEAN -DNOMINMAX -DVC_EXTRALEAN -D_CRT_SECURE_NO_WARNINGS -DGLM_FORCE_SWIZZLE -DGLM_FORCE_ONLY_XYZW -DGLM_ENABLE_EXPERIMENTAL -DGLM_FORCE_INLINE -DWITH_D3D11 -DCEREAL_XML_STRING_VALUE=\"raidengine\" -DTOML_EXCEPTIONS=0 /EHsc -Fo..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11\blur_horizontal_pixel.cpp.obj ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\blur_horizontal_pixel.cpp
if %errorlevel% neq 0 goto :xmEnd
if not exist "..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11" mkdir "..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11"
if %errorlevel% neq 0 goto :xmEnd
C:\Users\Raildex\AppData\Local\.xmake\packages\f\fxc\latest\02f1f56ac0004a2f9d332033b9bfe816\bin\fxc /T ps_5_0 /E blur_vertical /WX /Zi /Zss /Ges /Gis /Od /nologo /Fo..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\blur.pixel.dxbc ..\..\Game\shader\d3d11\blur\blur.pixel.hlsl
if %errorlevel% neq 0 goto :xmEnd
C:\Users\Raildex\AppData\Local\.xmake\packages\f\f2c\latest\b68750efa7e54743871e3308b2fa1473\bin\f2c -cpp ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\blur.pixel.dxbc blur_vertical_pixel ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\blur_vertical_pixel shaders::d3d11
if %errorlevel% neq 0 goto :xmEnd
if not exist "..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11" mkdir "..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11"
if %errorlevel% neq 0 goto :xmEnd
"D:\\Programme\\Visual Studio 2022\\VC\\Tools\\MSVC\\14.38.33130\\bin\\HostX64\\x64\\cl.exe" -c -nologo -Zi -FS -Fdbuild\windows\x64\debug\compile.Runtime.pdb -W3 -WX -Od -std:c++latest -IGame\src -Ibuild\.gens\Runtime\windows\x64\debug\include -DWIN32_LEAN_AND_MEAN -DNOMINMAX -DVC_EXTRALEAN -D_CRT_SECURE_NO_WARNINGS -DGLM_FORCE_SWIZZLE -DGLM_FORCE_ONLY_XYZW -DGLM_ENABLE_EXPERIMENTAL -DGLM_FORCE_INLINE -DWITH_D3D11 -DCEREAL_XML_STRING_VALUE=\"raidengine\" -DTOML_EXCEPTIONS=0 /EHsc -Fo..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11\blur_vertical_pixel.cpp.obj ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\blur_vertical_pixel.cpp
if %errorlevel% neq 0 goto :xmEnd
if not exist "..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11" mkdir "..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11"
if %errorlevel% neq 0 goto :xmEnd
C:\Users\Raildex\AppData\Local\.xmake\packages\f\fxc\latest\02f1f56ac0004a2f9d332033b9bfe816\bin\fxc /T vs_5_0 /E main /WX /Zi /Zss /Ges /Gis /Od /nologo /Fo..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\particle.vertex.dxbc ..\..\Game\shader\d3d11\particle\particle.vertex.hlsl
if %errorlevel% neq 0 goto :xmEnd
C:\Users\Raildex\AppData\Local\.xmake\packages\f\f2c\latest\b68750efa7e54743871e3308b2fa1473\bin\f2c -cpp ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\particle.vertex.dxbc particle_vertex ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\particle_vertex shaders::d3d11
if %errorlevel% neq 0 goto :xmEnd
if not exist "..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11" mkdir "..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11"
if %errorlevel% neq 0 goto :xmEnd
"D:\\Programme\\Visual Studio 2022\\VC\\Tools\\MSVC\\14.38.33130\\bin\\HostX64\\x64\\cl.exe" -c -nologo -Zi -FS -Fdbuild\windows\x64\debug\compile.Runtime.pdb -W3 -WX -Od -std:c++latest -IGame\src -Ibuild\.gens\Runtime\windows\x64\debug\include -DWIN32_LEAN_AND_MEAN -DNOMINMAX -DVC_EXTRALEAN -D_CRT_SECURE_NO_WARNINGS -DGLM_FORCE_SWIZZLE -DGLM_FORCE_ONLY_XYZW -DGLM_ENABLE_EXPERIMENTAL -DGLM_FORCE_INLINE -DWITH_D3D11 -DCEREAL_XML_STRING_VALUE=\"raidengine\" -DTOML_EXCEPTIONS=0 /EHsc -Fo..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11\particle_vertex.cpp.obj ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\particle_vertex.cpp
if %errorlevel% neq 0 goto :xmEnd
if not exist "..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11" mkdir "..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11"
if %errorlevel% neq 0 goto :xmEnd
C:\Users\Raildex\AppData\Local\.xmake\packages\f\fxc\latest\02f1f56ac0004a2f9d332033b9bfe816\bin\fxc /T ps_5_0 /E main /WX /Zi /Zss /Ges /Gis /Od /nologo /Fo..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\particle.pixel.dxbc ..\..\Game\shader\d3d11\particle\particle.pixel.hlsl
if %errorlevel% neq 0 goto :xmEnd
C:\Users\Raildex\AppData\Local\.xmake\packages\f\f2c\latest\b68750efa7e54743871e3308b2fa1473\bin\f2c -cpp ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\particle.pixel.dxbc particle_pixel ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\particle_pixel shaders::d3d11
if %errorlevel% neq 0 goto :xmEnd
if not exist "..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11" mkdir "..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11"
if %errorlevel% neq 0 goto :xmEnd
"D:\\Programme\\Visual Studio 2022\\VC\\Tools\\MSVC\\14.38.33130\\bin\\HostX64\\x64\\cl.exe" -c -nologo -Zi -FS -Fdbuild\windows\x64\debug\compile.Runtime.pdb -W3 -WX -Od -std:c++latest -IGame\src -Ibuild\.gens\Runtime\windows\x64\debug\include -DWIN32_LEAN_AND_MEAN -DNOMINMAX -DVC_EXTRALEAN -D_CRT_SECURE_NO_WARNINGS -DGLM_FORCE_SWIZZLE -DGLM_FORCE_ONLY_XYZW -DGLM_ENABLE_EXPERIMENTAL -DGLM_FORCE_INLINE -DWITH_D3D11 -DCEREAL_XML_STRING_VALUE=\"raidengine\" -DTOML_EXCEPTIONS=0 /EHsc -Fo..\..\build\.objs\Runtime\windows\x64\debug\gens\include\shaders\d3d11\particle_pixel.cpp.obj ..\..\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\particle_pixel.cpp
if %errorlevel% neq 0 goto :xmEnd
:xmEnd
endlocal & call :xmErrorLevel %errorlevel% & goto :xmDone
:xmErrorLevel
exit /b %1
:xmDone
if %errorlevel% neq 0 goto :VCEnd
:VCEnd" exited with code 2. Runtime D:\Programme\Visual Studio 2022\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets   156     
Severity    Code    Description Project File    Line    Suppression State   Details
Error   C1041   cannot open program database 'D:\Raildex\Desktop\test\test\vs2022\Runtime\build\windows\x64\debug\compile.Runtime.pdb'; if multiple CL.EXE write to the same .PDB file, please use /FS  Runtime D:\Raildex\Desktop\test\test\build\.gens\Runtime\windows\x64\debug\include\shaders\d3d11\room_vertex.cpp    1       
SirLynix commented 6 months ago

Did you try to add {curdir = "."} to your batchcmds:execv calls?

Raildex commented 6 months ago

Did you try to add {curdir = "."} to your batchcmds:execv calls?

Yes, with no difference. batchcmds:execv(fxc, compileargs, {curdir= "."}) batchcmds:execv(f2c, f2cargs, { curdir= ".", envs = {XMAKE_SKIP_HISTORY = "y"}})

waruqi commented 6 months ago

Currently ninja generator does not support custom script commands for rule.