Replies: 1 comment 7 replies
-
function (target)
local msvc = target:toolchain("msvc")
local runenvs = msvc:runenvs()
local cl = target:tool("cc")
local fxc = cl:gsub("cl%.exe", "fxc.exe")
os.execv(fxc, {}, {envs = runenvs})
end |
Beta Was this translation helpful? Give feedback.
7 replies
Answer selected by
JX-Master
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
需求:我需要在构建应用程序的时候使用
fxc.exe
编译部分着色器代码。目前我是在应用程序的before_build
函数中调用os.exec("fxc ....")
实现的。程序在尝试调用时会提示找不到fxc可执行文件。经过排查,原因在于os.exec()
使用的是和普通cmd/shell的环境,因此不包括类似cl
、fxc
等vs prompt中才有的命令。我想知道是否有一种方法可以让
os.exec
的执行环境和vs prompt一致,以便我们能够正确调用这些只有在vs prompt中才能使用的命令。如果是需要设置查找路径,那么是否有一种方法可以获取当前Windows SDK的路径(类似C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\%arch%
),以便设置程序的查找路径。目前尝试使用detect.find_program("fxc")
会返回nil
。谢谢。
Beta Was this translation helpful? Give feedback.
All reactions