summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxq114 <[email protected]>2021-09-24 12:10:46 +0800
committerxq114 <[email protected]>2021-09-24 12:10:46 +0800
commitef34aa0c7f5a9996ff9c3863556b426a4f1f4da5 (patch)
treee8f640f00c12c3609ed908bc077998d1ce3fd75f
parent6e5bd0a99336d5ef17e9b7c312d547b6a683d13e (diff)
fix and test quote feature
-rw-r--r--tests/apis/check_xxx/config.h.in2
-rw-r--r--tests/apis/check_xxx/main.c1
-rw-r--r--tests/apis/check_xxx/xmake.lua3
-rw-r--r--xmake/actions/config/configfiles.lua2
4 files changed, 8 insertions, 0 deletions
diff --git a/tests/apis/check_xxx/config.h.in b/tests/apis/check_xxx/config.h.in
index 617ecf864..a8baad68d 100644
--- a/tests/apis/check_xxx/config.h.in
+++ b/tests/apis/check_xxx/config.h.in
@@ -9,4 +9,6 @@ ${define HAS_CONSEXPR_AND_STATIC_ASSERT}
${define HAS_SSE2}
${define HAS_LONG_8}
${define PTR_SIZE}
+${define HAVE_VISIBILITY}
+${define CUSTOM_ASSERT}
#define HAS_WCHAR ${default HAS_WCHAR 0}
diff --git a/tests/apis/check_xxx/main.c b/tests/apis/check_xxx/main.c
index 5549c309f..5e40e6691 100644
--- a/tests/apis/check_xxx/main.c
+++ b/tests/apis/check_xxx/main.c
@@ -1,3 +1,4 @@
+#include "config.h"
int main(int argc, char** argv)
{
diff --git a/tests/apis/check_xxx/xmake.lua b/tests/apis/check_xxx/xmake.lua
index 2a9916954..ffd9f9242 100644
--- a/tests/apis/check_xxx/xmake.lua
+++ b/tests/apis/check_xxx/xmake.lua
@@ -9,6 +9,7 @@ includes("check_cincludes.lua")
target("test")
set_kind("binary")
add_files("*.c")
+ add_includedirs("$(buildir)")
add_configfiles("config.h.in")
check_ctypes("HAS_WCHAR", "wchar_t")
@@ -25,3 +26,5 @@ target("test")
configvar_check_cflags("HAS_SSE2", "-msse2")
configvar_check_csnippets("HAS_LONG_8", "return (sizeof(long) == 8)? 0 : -1;", {tryrun = true})
configvar_check_csnippets("PTR_SIZE", 'printf("%d", sizeof(void*)); return 0;', {output = true, number = true})
+ configvar_check_csnippets("HAVE_VISIBILITY", 'extern __attribute__((__visibility__("hidden"))) int hiddenvar;', {default = 0})
+ configvar_check_csnippets("CUSTOM_ASSERT=assert", 'assert(1);', {default = "", quote = false})
diff --git a/xmake/actions/config/configfiles.lua b/xmake/actions/config/configfiles.lua
index 974610a91..933ee4e66 100644
--- a/xmake/actions/config/configfiles.lua
+++ b/xmake/actions/config/configfiles.lua
@@ -178,6 +178,7 @@ function _generate_configfile(srcfile, dstfile, fileinfo, targets)
for name, value in pairs(opt:get("configvar")) do
if variables[name] == nil then
variables[name] = table.unwrap(value)
+ variables["__extraconf_" .. name] = target:extraconf("configvar." .. name, value)
end
end
end
@@ -187,6 +188,7 @@ function _generate_configfile(srcfile, dstfile, fileinfo, targets)
for name, value in pairs(pkg:get("configvar")) do
if variables[name] == nil then
variables[name] = table.unwrap(value)
+ variables["__extraconf_" .. name] = target:extraconf("configvar." .. name, value)
end
end
end