premake-core icon indicating copy to clipboard operation
premake-core copied to clipboard

CMake generator expression equivalent?

Open ItsSunnyMonster opened this issue 2 years ago • 2 comments

Hi all,

I have this command here that I want to run in a build rule

vendor/shader-compiling/fxc.exe /nologo /Emain /Tvs_5_0 /Od /Zi /Fo assets/shaders/hlsl/%(Filename)_vs.cso /Fd %{cfg.buildtarget.directory}/%(Filename)_vs.pdb assets/shaders/hlsl/%(Filename)_vs.hlsl

and in release mode I want to not include the /Od option. In CMake I would use a generator expression: $<$<CONFIG:Debug>:/Od>

How would I achieve the same thing in premake?

Thanks in advance.

ItsSunnyMonster avatar Jun 07 '22 08:06 ItsSunnyMonster

propertydefinition might help, something along:

propertydefinition {
  name = "ShaderOptimizationLevel",
  display = "Shader Optimization Level",
  value = false,
  switch = "/Od"}

And

buildcommand "vendor/shader-compiling/fxc.exe [ShaderOptimizationLevel] .."

and finally:

filter "configurations:Debug"
    ShaderOptimizationLevel = true
filter {}

Jarod42 avatar Jun 19 '22 19:06 Jarod42

Just wanted to poke on this and see if the suggestion does what you need it to, or if we should leave the issue open.

nickclark2016 avatar Aug 26 '22 23:08 nickclark2016