-
Hi ! For a project, I have very long absolute path to create, they look like this: local architecture = nil
if is_arch("x86") then
architecture = "x86"
elseif is_arch("x64", "x86_64")
architecture = "x64"
end
add_includedirs("$(env LIB_COMPILED)/LIB_NAME/VERSION/$(env PLATFORM)" .. architecture .. "/include/") I'm searching for a way to simplify all of this like this: add_includedirs(get_lib_compiled_path("LIB_NAME", "VERSION")) I know that I can do that in the script scope, but this is not very digest and I think this belongs more to the description scope. Is it possible to do something like this ? Thank you in advance, |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
I just found that using local function get_arch()
local path = nil
if is_arch("x86") then
path = "x86"
elseif is_arch("x64", "x86_64") then
path = "x64"
end
return path
end
target("test")
print(get_arch()) But now I'm no longer able to export my function in another file and use |
Beta Was this translation helpful? Give feedback.
-
Okay, I'm just a big idiot because this works... function get_arch()
local path = nil
if is_arch("x86") then
path = "x86"
elseif is_arch("x64", "x86_64") then
path = "x64"
end
return path
end
target("test")
print(get_arch()) I was sure I'd tried that, but I must have made a typo in the function call. |
Beta Was this translation helpful? Give feedback.
-
rule("a")
on_config(function (target)
local LIB_NAME = target:extraconf("rules", "a", "LIB_NAME")
local VERSION = target:extraconf("rules", "a", "VERSION")
target:add("includedirs", path.join("$(env LIB_COMPILED)", LIB_NAME, VERSION, "$(env PLATFORM)", architecture, "include"))
end)
rule_end()
target("b")
add_rules("a", {LIB_NAME = "xxx", VERSION = "1.0.0"}) |
Beta Was this translation helpful? Give feedback.
Okay, I'm just a big idiot because this works...
I was sure I'd tried that, but I must have made a typo in the function call.
How could I waste 2 hours looking for a simple solution?