GENie icon indicating copy to clipboard operation
GENie copied to clipboard

Adding config based token replacement to paths

Open ryanjuckett opened this issue 9 years ago • 5 comments

Any plans on adding the config based token replacement support to paths that the later premake stuff started doing? This allows for things like:

targetdir "path/%{cfg.platform}"

instead of the current:

configuration "x32" targetdir "path/x32" configuration "x64" targetdir "path/x64"

ryanjuckett avatar Oct 01 '15 04:10 ryanjuckett

Not really. This is fairly trivial to setup. Check here how I'm doing it: https://github.com/bkaradzic/bx/blob/master/scripts/toolchain.lua

x32 is also completely misleading. It's 32-bit not x86. Also other platforms that have 32-bit/64-bit compilers usually split those into separate toolchains (for example: arm, aarch64).

bkaradzic avatar Oct 01 '15 04:10 bkaradzic

Aren't you just manually listing them all out in that example? Or am I missing something?

ryanjuckett avatar Oct 01 '15 04:10 ryanjuckett

Yeah, but once you setup toolchains, that's it, you just include toolchain.lua file.

Ideally I would put this toolchain.lua to be part of GENie.

Once you have bunch configurations it becomes obvious the targetdir should be something like:

<build dir>/<os>/<compiler>/<cpu>/<bitness>/<config>

or

<build dir>/<os>/<compiler>/<cpu+bitness>/<config>

bkaradzic avatar Oct 01 '15 04:10 bkaradzic

There are two issues I hit there.

  1. If you want a couple configuration based values in a path or file name (e.g. MyThing_Debug_x64.lib") the number of permutations gets large fast.

  2. Anytime you want a project organized a bit differently (or if you just want to try some new structure in an existing project) you need to recreate this giant list of every permutation.

I tend to work around this currently by just baking that info into the command line options (which are accessible at path specification) and generating some extra solutions in situations where less should suffice. That make sense?

ryanjuckett avatar Oct 01 '15 04:10 ryanjuckett

I haven't tried but I assume you can do this in lua script programmatically without changes to GENie scripts. Create function that will just fill up the configuration table with targetdirs "path/%{cfg.platform}".

bkaradzic avatar Oct 01 '15 06:10 bkaradzic