How to export a definition-scope function for use elsewhere? #3272
Unanswered
davidchisnall
asked this question in
Q&A
Replies: 1 comment 1 reply
-
common/xmake.lua function set_common()
add_defines("TEST")
add_defines("TEST2")
-- ...
end xmake.lua add_rules("mode.debug", "mode.release")
includes("common")
target("testdef")
set_kind("binary")
add_files("src/*.cpp")
set_common() |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a set of helper functions that are defined at definition scope in an xmake.lua file that happened to be at the top level of a directory tree. I have now moved them to another location so that they can be used more easily from things that are not in the same project but now I cannot access them via
includes(...)
. They were previously included withincludes("../..")
for some examples, but moving the examples to a directory parallel with the SDK rather than under it meant that they cannot be used there either.How do I export a function into the scope of the files that
includes
them? Ideally, I would like to be able to export everything in this file, including things like the results ofset_policy
calls. I initially missed the coupling of scope and filesystem hierarchy initially, which is probably the root cause of a lot of my confusion with xmake. The SDK's xmake.lua file is calling a lot ofset_*
functions, but these are not always propagated into things that include it. When it is not in a parent directory of the including file, none of them are propagated, which is at least consistent.Beta Was this translation helpful? Give feedback.
All reactions