$ xmake f -vD -c
checking for platform ... windows
checking for architecture ... x64
checking for vswhere.exe ... C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe
checking for cl.exe ... C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\bin\HostX64\x64\cl.exe
checking for Microsoft Visual Studio (x64) version ... 2022
checkinfo: cannot runv(dmd.exe --version), No such file or directory
checking for dmd ... no
checkinfo: cannot runv(ldc2.exe --version), No such file or directory
checking for ldc2 ... no
checkinfo: cannot runv(gdc.exe --version), No such file or directory
checking for gdc ... no
checkinfo: cannot runv(zig.exe version), No such file or directory
checking for zig ... no
checkinfo: cannot runv(zig.exe version), No such file or directory
checking for zig ... no
checkinfo: cannot runv(unzip.exe -v), No such file or directory
checking for unzip ... no
checking for 7z ... C:\Users\xq114\xmake\winenv\bin\7z
checking for git ... ok
checkinfo: cannot runv(gzip.exe --version), No such file or directory
checking for gzip ... no
finding cuda_samples from vcpkg ..
checkinfo: vcpkg root directory not found, maybe you need set $VCPKG_ROOT!
finding cuda_samples from conan ..
finding cuda_samples from pkgconfig ..
checkinfo: cannot runv(pkg-config.exe --version), No such file or directory
checking for pkg-config ... no
checkinfo: cannot runv(pkgconf.exe --version), No such file or directory
checking for pkgconf ... no
finding cuda_samples from system ..
checking for cuda_samples ... no
checking for link.exe ... C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\bin\HostX64\x64\link.exe
checking for the linker (ld) ... link.exe
configure
{
ccache = true
proxy_pac = nil
theme = default
ndk_stdcxx = true
mode = release
host = windows
vs = 2022
network = public
kind = static
arch = x64
pkg_searchdirs = C:/Users/xq114/Downloads
plat = windows
clean = true
buildir = build
}
可见这里cuda_samples并没有成功fetch到,但xmake还是正常返回没有报错。
fetch成功时输出
$ xmake f -vD -c
checking for platform ... windows
checking for architecture ... x64
checking for vswhere.exe ... C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe
checking for cl.exe ... C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\bin\HostX64\x64\cl.exe
checking for Microsoft Visual Studio (x64) version ... 2022
checkinfo: cannot runv(dmd.exe --version), No such file or directory
checking for dmd ... no
checkinfo: cannot runv(ldc2.exe --version), No such file or directory
checking for ldc2 ... no
checkinfo: cannot runv(gdc.exe --version), No such file or directory
checking for gdc ... no
checkinfo: cannot runv(zig.exe version), No such file or directory
checking for zig ... no
checkinfo: cannot runv(zig.exe version), No such file or directory
checking for zig ... no
checkinfo: cannot runv(unzip.exe -v), No such file or directory
checking for unzip ... no
checking for 7z ... C:\Users\xq114\xmake\winenv\bin\7z
checking for git ... ok
checkinfo: cannot runv(gzip.exe --version), No such file or directory
checking for gzip ... no
CUDA Samples Found: C:\ProgramData\NVIDIA Corporation\CUDA Samples\v11.5\common
checking for ::cuda_samples ... cuda_samples
checking for link.exe ... C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\bin\HostX64\x64\link.exe
checking for the linker (ld) ... link.exe
configure
{
proxy_pac = nil
vs = 2022
pkg_searchdirs = C:/Users/xq114/Downloads
network = public
host = windows
buildir = build
theme = default
ccache = true
ndk_stdcxx = true
mode = release
plat = windows
clean = true
arch = x64
kind = static
}
相关环境
请提供编译和运行环境信息,下面是一些必须填写的基础信息,便于我们针对性排查问题:
xmake版本:2.6.3 dev
xmake运行平台:windows
xmake目标平台:windows
其他信息
xmake.lua
package("cuda_samples")
set_homepage("https://github.com/NVIDIA/cuda-samples")
set_description("CUDA Sample Utility Code")
add_urls("https://github.com/NVIDIA/cuda-samples/archive/refs/tags/$(version).tar.gz",
"https://github.com/NVIDIA/cuda-samples.git")
add_versions("v11.6", "9b5542747bc0aa66371b29043e46b3438266586332637001f2184d75415b920d")
on_fetch(function (package, opt)
if opt.system then
import("lib.detect.find_path")
local paths = {
"C:\\ProgramData\\NVIDIA Corporation\\CUDA Samples\\v*\\common"
-- add your custom path here
}
local headerpath = find_path("helper_cuda.h", paths, {suffixes = {"inc"}})
if headerpath then
vprint("CUDA Samples Found: " .. path.directory(headerpath))
return {includedirs = {headerpath}}
end
end
end)
add_includedirs("include/Common")
on_install(function (package)
os.cp("Common", package:installdir("include"))
end)
on_test(function (package)
assert(os.isfile(path.join(package:installdir("include"), "Common", "helper_cuda.h")))
end)
package_end()
add_rules("mode.debug", "mode.release")
add_requires("cuda_samples", {system = true})
target("main")
add_files("main.cpp")
add_packages("cuda_samples")
描述问题
当local package带有on_fetch时,如果被标记为system=true,xmake在fetch local package失败时会略过错误而不是报错
期待的结果
对local package与remote package同样处理,仅在标记为optional的时候才略过报错
错误信息
可见这里cuda_samples并没有成功fetch到,但xmake还是正常返回没有报错。
fetch成功时输出
相关环境
请提供编译和运行环境信息,下面是一些必须填写的基础信息,便于我们针对性排查问题:
其他信息
xmake.lua
main.cpp