How do I get the value of system ()?

How to get the current value of system () in premake5? (and, more generally, features like architecture () or platform ())

I tried to print it, but it's a function, and when I try to print the return value of system (), I get "bad argument # 1" in "tostring" (value expected) ".

+3


source to share


1 answer


Premake doesn't work this way, there is no "current" version of the data. You must specify the context in which you want to apply the current set of filters; take a look at src / base / oven.lua to see how the final datasets are built.

If you just want to cast the system (or architecture or platform) value into an expression later in the process (and you are using Premake 5), check out tokens :

targetdir "bin/%{cfg.system}/%{cfg.architecture}"

      



Tokens can also evaluate arbitrary Lua expressions.

my_system_map = {   -- must be global, so token evaluator can find it
   windows = "Win32",
   linux = "Posix",
   macosx = "Mac"
}

targetdir "bin/%{my_system_map[cfg.system]}"

      

Helpful?

+1


source







All Articles