diff options
| author | ruki <[email protected]> | 2019-03-09 22:49:25 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-03-09 22:49:25 +0800 |
| commit | d6e56921c1970ec45525c19f3bf1c3b752ce689b (patch) | |
| tree | 5c4d70ac5aebc17668f3b62d7a2dfa9a851ee1a8 | |
| parent | ccad5dc61f0798b0c96303ddca2848fdbce9a113 (diff) | |
mark add_headerdirs as deprecated
| -rw-r--r-- | CHANGELOG.md | 2 | ||||
| -rw-r--r-- | core/src/tbox/src/tbox/micro.lua | 8 | ||||
| -rw-r--r-- | core/src/tbox/src/tbox/xmake.lua | 8 | ||||
| -rw-r--r-- | xmake/core/project/deprecated/project.lua | 18 | ||||
| -rw-r--r-- | xmake/plugins/project/cmake/cmakelists.lua | 9 |
5 files changed, 33 insertions, 12 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index e8e6052a6..d587c7526 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ * [#320](https://github.com/xmake-io/xmake/issues/320): Add template configuration files and replace all variables before building * [#179](https://github.com/xmake-io/xmake/issues/179): Generate CMakelist.txt file for `xmake project` plugin * [#361](https://github.com/xmake-io/xmake/issues/361): Support vs2019 preview +* [#368](https://github.com/xmake-io/xmake/issues/368): Support `private, public, interface` to improve dependency inheritance like cmake ### Changes @@ -570,6 +571,7 @@ * [#320](https://github.com/xmake-io/xmake/issues/320): 添加模板配置文件相关接口,`add_configfiles`和`set_configvar` * [#179](https://github.com/xmake-io/xmake/issues/179): 扩展`xmake project`插件,新增CMakelist.txt生成支持 * [#361](https://github.com/xmake-io/xmake/issues/361): 增加对vs2019 preview的支持 +* [#368](https://github.com/xmake-io/xmake/issues/368): 支持`private, public, interface`属性设置去继承target配置 ### 改进 diff --git a/core/src/tbox/src/tbox/micro.lua b/core/src/tbox/src/tbox/micro.lua index 93a41652d..317bfd474 100644 --- a/core/src/tbox/src/tbox/micro.lua +++ b/core/src/tbox/src/tbox/micro.lua @@ -12,12 +12,8 @@ target("tbox") add_configfiles("tbox.config.h.in") -- add include directories - add_includedirs("..") - add_includedirs("$(buildir)/$(plat)/$(arch)/$(mode)") - - -- add public header directories - add_headerdirs("..") - add_headerdirs("$(buildir)/$(plat)/$(arch)/$(mode)") + add_includedirs("..", {public = true}) + add_includedirs("$(buildir)/$(plat)/$(arch)/$(mode)", {public = true}) -- add the header files for installing add_headerfiles("../(tbox/**.h)|**/impl/**.h") diff --git a/core/src/tbox/src/tbox/xmake.lua b/core/src/tbox/src/tbox/xmake.lua index d358a1991..7276240e4 100644 --- a/core/src/tbox/src/tbox/xmake.lua +++ b/core/src/tbox/src/tbox/xmake.lua @@ -12,12 +12,8 @@ target("tbox") add_configfiles("tbox.config.h.in") -- add include directories - add_includedirs("..") - add_includedirs("$(buildir)/$(plat)/$(arch)/$(mode)") - - -- add public header directories - add_headerdirs("..") - add_headerdirs("$(buildir)/$(plat)/$(arch)/$(mode)") + add_includedirs("..", {public = true}) + add_includedirs("$(buildir)/$(plat)/$(arch)/$(mode)", {public = true}) -- add the header files for installing add_headerfiles("../(tbox/**.h)|**/impl/**.h") diff --git a/xmake/core/project/deprecated/project.lua b/xmake/core/project/deprecated/project.lua index 45353098b..dcebd308f 100644 --- a/xmake/core/project/deprecated/project.lua +++ b/xmake/core/project/deprecated/project.lua @@ -155,6 +155,23 @@ function deprecated_project._api_target_add_headers(interp) end) end +-- add_headerdirs for target +function deprecated_project._api_target_add_headerdirs(interp) + + -- get api function + local apifunc = interp:_api_within_scope("target", "add_headerdirs") + assert(apifunc) + + -- register api + interp:_api_within_scope_set("target", "add_headerdirs", function (value, ...) + + -- deprecated + deprecated.add("add_includedirs(%s, {public|interface = true})", "add_headerdirs(%s)", tostring(value)) + + -- dispatch it + apifunc(value, ...) + end) +end -- add_defines_h for target function deprecated_project._api_target_add_defines_h(interp) @@ -271,6 +288,7 @@ function deprecated_project.api_register(interp) -- register api: add_headers() to target deprecated_project._api_target_add_headers(interp) + deprecated_project._api_target_add_headerdirs(interp) -- register api: add_defines_h()/set_config_header() to option/target deprecated_project._api_option_add_defines_h(interp) diff --git a/xmake/plugins/project/cmake/cmakelists.lua b/xmake/plugins/project/cmake/cmakelists.lua index e8644f7c2..914ef4376 100644 --- a/xmake/plugins/project/cmake/cmakelists.lua +++ b/xmake/plugins/project/cmake/cmakelists.lua @@ -113,6 +113,7 @@ function _add_target_include_directories(cmakelists, target) end cmakelists:print(")") end + -- TODO deprecated local headerdirs = target:get("headerdirs") if headerdirs then cmakelists:print("target_include_directories(%s PUBLIC", target:name()) @@ -121,6 +122,14 @@ function _add_target_include_directories(cmakelists, target) end cmakelists:print(")") end + local includedirs_interface = target:get("includedirs", {interface = true}) + if includedirs_interface then + cmakelists:print("target_include_directories(%s INTERFACE", target:name()) + for _, headerdir in ipairs(includedirs_interface) do + cmakelists:print(" " .. _get_unix_path(headerdir)) + end + cmakelists:print(")") + end -- export config header directory (deprecated) local configheader = target:configheader() if configheader then |
