diff options
| author | ruki <[email protected]> | 2016-09-16 19:06:22 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-09-16 19:06:22 +0800 |
| commit | 727855fecf738d9c24532970b6a21db9a3d8da4c (patch) | |
| tree | 0534bec386dcad3be6dec81b0b81cab3c91f8795 | |
| parent | 252f501054ab2058320319a1cb9f749858b6776c (diff) | |
add scriptdir for scope and target
| -rw-r--r-- | xmake/core/base/interpreter.lua | 12 | ||||
| -rw-r--r-- | xmake/core/project/target.lua | 5 |
2 files changed, 12 insertions, 5 deletions
diff --git a/xmake/core/base/interpreter.lua b/xmake/core/base/interpreter.lua index 35acb59ef..3b8f930b2 100644 --- a/xmake/core/base/interpreter.lua +++ b/xmake/core/base/interpreter.lua @@ -453,12 +453,10 @@ function interpreter:_make(scope_kind, remove_repeat, enable_filter) -- add this scope results[scope_name] = self:_handle(scope_values, remove_repeat, enable_filter) end - else -- only uses the root scope kind results = self:_handle(scopes._ROOT["__rootkind"], remove_repeat, enable_filter) - end -- ok? @@ -732,7 +730,7 @@ end -- -- "scope_name2" <-- _SCOPES._CURRENT -- { --- +-- __scriptdir = "" (the directory of xmake.lua) -- } -- } -- } @@ -754,10 +752,14 @@ function interpreter:api_register_scope(...) if scope_name ~= nil then -- init scope for name - scope_for_kind[scope_name] = scope_for_kind[scope_name] or {} + local scope = scope_for_kind[scope_name] or {} + scope_for_kind[scope_name] = scope -- save the current scope - scopes._CURRENT = scope_for_kind[scope_name] + scopes._CURRENT = scope + + -- save script directory of scope when enter this scope first + scope.__scriptdir = scope.__scriptdir or self:scriptdir() else -- enter root scope diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index 50d018038..1e687b8f2 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -137,6 +137,11 @@ function target:symbolfile() return path.join(targetdir, filename) end +-- get the script directory of xmake.lua +function target:scriptdir() + return self:get("__scriptdir") +end + -- get the config header files function target:configheader(outputdir) |
