summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2016-02-22 20:46:43 +0800
committerruki <[email protected]>2016-02-22 20:46:43 +0800
commit11149495cb7747d6074890f5d44198a29a3d831d (patch)
treec6adf8960c3abeb3f5142f46bd10989c5cf300ec
parentc50639da01bb4e03f933e68eb308910a67974632 (diff)
fix add_files() for static library
-rwxr-xr-xtests/merge_static_library/xmake.lua2
-rwxr-xr-xtests/tests17
-rw-r--r--xmake/core/base/rule.lua2
3 files changed, 11 insertions, 10 deletions
diff --git a/tests/merge_static_library/xmake.lua b/tests/merge_static_library/xmake.lua
index 88ecdd304..d51e3c6ef 100755
--- a/tests/merge_static_library/xmake.lua
+++ b/tests/merge_static_library/xmake.lua
@@ -28,7 +28,7 @@ target("merge_static_library")
set_kind("static")
-- add files
- add_files("../static_library_c/build/*.a")
+ add_files("../static_library_c/build/static_library_c.pkg/lib/release/$(plat)/$(arch)/*.a")
-- add target
target("test")
diff --git a/tests/tests b/tests/tests
index 48d826fd3..e27376c95 100755
--- a/tests/tests
+++ b/tests/tests
@@ -22,26 +22,27 @@ function build()
echo "build $1"
cd $1
- # build
- exec "xmake -r"
-# exec "xmake p"
-
# build for macosx
if [ $host = "macosx" ]; then
exec "xmake f -p iphoneos"
exec "xmake -r"
-# exec "xmake p"
+ exec "xmake p"
exec "xmake f -p iphoneos -a arm64"
exec "xmake -r"
-# exec "xmake p -a \"armv7, arm64\""
+ exec "xmake p -a \"armv7, arm64\""
exec "xmake f -p iphonesimulator"
exec "xmake -r"
-# exec "xmake p"
+ exec "xmake p"
fi
+ # build
+ exec "xmake f -c"
+ exec "xmake -r"
+ exec "xmake p"
+
# leave project
cd -
}
@@ -57,7 +58,7 @@ build "./tests/static_library_c++"
build "./tests/shared_library_c++"
# merge static library
-#build "./tests/merge_static_library"
+build "./tests/merge_static_library"
# build for macosx
if [ $host = "macosx" ]; then
diff --git a/xmake/core/base/rule.lua b/xmake/core/base/rule.lua
index a74113b4f..1e94c142d 100644
--- a/xmake/core/base/rule.lua
+++ b/xmake/core/base/rule.lua
@@ -157,7 +157,7 @@ function rule.objectfiles(target_name, target, sourcefiles, buildir)
for _, sourcefile in ipairs(sourcefiles) do
-- translate: [lib]xxx*.[a|lib] => xxx/*.[o|obj] object file
- sourcefile = sourcefile:gsub(rule.filename("(%w+)", "static"):gsub("%.", "%%.") .. "$", "%1/*")
+ sourcefile = sourcefile:gsub(rule.filename("([%w_]+)", "static"):gsub("%.", "%%.") .. "$", "%1/*")
-- make object file
local objectfile = string.format("%s/%s/%s/%s", objectdir, target_name, path.directory(sourcefile), rule.filename(path.basename(sourcefile), "object"))