Reputation: 392
I am using a custom build command to run the nasm assembler on a .asm
file in my C++ project. I am using %idef
s in the assembler code to only compile the code I need. I am checking for the same #define
s as in the C++-Code and use define()
in Premake 5 to set those, but additionally I need to pass them to nasm on its command line invocation in my Custom Build Command. What I am looking for is a way to concatenate or string replace the Premake internal list of #define
s into the command line invocation string of the buildcommands()
call. Is there a Premake Token or a way to introspect the lua variables and generate a list from that?
Note that my command line invocation specifically is
buildcommands "nasm.exe -f win32 -o %{cfg.objdir}%{file.basename}.lib %{file.abspath} -DNDEBUG"
Suppose I set defines { "FEAT_A", "FEAT_B" }
in my premake5.lua
. I then would like to to add -DFEAT_A -DFEAT_B
automatically to that build command similar to the -DNDEBUG
so I cannot simply insert a simple token. I guess I do have to do something like this (lua pseudo code as I don't really know the syntax):
define_flags = wks.defines.join(" -D")
buildcoommands("nasm.exe [...]"..define_flags)
Do you know if something like this is possible?
Upvotes: 1
Views: 595
Reputation: 4276
How about something like this?
buildcommands('nasm.exe [...] %{table.implode(cfg.defines, "-D", "", " ")} [...]')
Upvotes: 1