summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-12-17 00:55:21 +0800
committerruki <[email protected]>2021-12-17 00:55:21 +0800
commit0fdd42e56f478591a4876866af833273f2cc244f (patch)
treea3600c55c3372d5cb7a420b3e8dc756f91008867
parent0644c09d6c75a669f976f8d4bf67041c83c3f1d4 (diff)
add vcpkg tests
-rw-r--r--tests/projects/package/vcpkg/.gitignore8
-rw-r--r--tests/projects/package/vcpkg/src/main.cpp9
-rw-r--r--tests/projects/package/vcpkg/xmake.lua8
-rw-r--r--xmake/modules/package/manager/vcpkg/find_package.lua4
4 files changed, 27 insertions, 2 deletions
diff --git a/tests/projects/package/vcpkg/.gitignore b/tests/projects/package/vcpkg/.gitignore
new file mode 100644
index 000000000..152105761
--- /dev/null
+++ b/tests/projects/package/vcpkg/.gitignore
@@ -0,0 +1,8 @@
+# Xmake cache
+.xmake/
+build/
+
+# MacOS Cache
+.DS_Store
+
+
diff --git a/tests/projects/package/vcpkg/src/main.cpp b/tests/projects/package/vcpkg/src/main.cpp
new file mode 100644
index 000000000..7c435d251
--- /dev/null
+++ b/tests/projects/package/vcpkg/src/main.cpp
@@ -0,0 +1,9 @@
+#include <iostream>
+
+using namespace std;
+
+int main(int argc, char** argv)
+{
+ cout << "hello world!" << endl;
+ return 0;
+}
diff --git a/tests/projects/package/vcpkg/xmake.lua b/tests/projects/package/vcpkg/xmake.lua
new file mode 100644
index 000000000..3f5dbcf55
--- /dev/null
+++ b/tests/projects/package/vcpkg/xmake.lua
@@ -0,0 +1,8 @@
+add_requires("vcpkg::zlib", "vcpkg::pcre2")
+add_requires("vcpkg::boost[core]", {alias = "boost"})
+
+target("test")
+ set_kind("binary")
+ add_files("src/*.cpp")
+ add_packages("vcpkg::zlib", "vcpkg::pcre2", "boost")
+
diff --git a/xmake/modules/package/manager/vcpkg/find_package.lua b/xmake/modules/package/manager/vcpkg/find_package.lua
index 1547da40a..24500cc2a 100644
--- a/xmake/modules/package/manager/vcpkg/find_package.lua
+++ b/xmake/modules/package/manager/vcpkg/find_package.lua
@@ -82,8 +82,8 @@ function main(name, opt)
-- find the package info file, e.g. zlib_1.2.11-3_x86-windows[-static].list
local triplet = arch .. "-" .. plat
- local configs = opt.configs
- if plat == "windows" and configs and configs.shared ~= true then
+ local configs = opt.configs or {}
+ if plat == "windows" and configs.shared ~= true then
triplet = triplet .. "-static"
if configs.vs_runtime and configs.vs_runtime:startswith("MD") then
triplet = triplet .. "-md"