How to define a new platform and target kind? #2763
Unanswered
davidchisnall
asked this question in
Q&A
Replies: 1 comment 4 replies
-
You can't define them directly, but you can use any platform name. if is_plat("myplat") then
add_defines("xxx")
end xmake f -p myplat
xmake you can also use custom rule. rule("myplat")
on_load(function (target)
if target:is_plat("myplat") then
target:add("defines", "xxx")
end
end)
rule_end()
target("test")
add_rules("myplat")
-- ... xmake f -p myplat
xmake and you can put your platform rules to |
Beta Was this translation helpful? Give feedback.
4 replies
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.
Uh oh!
There was an error while loading. Please reload this page.
-
The docs on defining a new toolchain are very clear but even after spending a morning reading the code I'm not clear how to define:
I've tried using
platform("my platform name")
but this errors out thatplatform
is nil. I can useset_kind("any string")
in the target definition but I can't then see how to define rules for this kind of target (for example, inheriting the existing C/C++ compile rules but providing a different link step).Edit: I have found the undocumented top-level
add_platformdirs
command and now my platform is being loaded. It appears thatset_os
is required here, because link steps are silently fail to run if it is not called.Beta Was this translation helpful? Give feedback.
All reactions