From 5dba31860c53d079d40e11e425cad01c3f470dbb Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 24 Jun 2016 18:25:25 +0800 Subject: fix check function bug --- CHANGELOG.md | 2 ++ xmake/core/project/option.lua | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b331a11ca..ee109f361 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * [#9](https://github.com/waruqi/xmake/issues/9): Support clang with c++11 * Fix api scope leaks bug * Fix path bug for windows +* Fix check function bug ## v2.0.1 @@ -105,6 +106,7 @@ * [#9](https://github.com/waruqi/xmake/issues/9): 修复clang不支持c++11的问题 * 修复api作用域泄露问题 * 修复在windows上的一些路径问题 +* 修复检测宏函数失败问题 ## v2.0.1 diff --git a/xmake/core/project/option.lua b/xmake/core/project/option.lua index 192660d74..6d1b86f06 100644 --- a/xmake/core/project/option.lua +++ b/xmake/core/project/option.lua @@ -138,7 +138,9 @@ function option:_check_function(interface, srcpath, objpath) srcfile:print("{") -- make interfaces - srcfile:print(" volatile void* p%s = (void*)&%s;\n", interface, interface) + srcfile:print("#ifndef %s\n", interface) + srcfile:print(" volatile void* p%s = (void*)&%s;", interface, interface) + srcfile:print("#endif") -- make the main function tailer srcfile:print(" return 0;") @@ -192,7 +194,7 @@ function option:_check_typedef(typedef, srcpath, objpath) srcfile:print("{") -- make interfaces - srcfile:print(" typedef %s __type_xxx;\n", typedef) + srcfile:print(" typedef %s __type_xxx;", typedef) -- make the main function tailer srcfile:print(" return 0;") -- cgit v1.3.1