Questions about adding a new compiler or toolset, and choosing it from the command line

111 views
Skip to first unread message

Jason Heeris

unread,
Sep 5, 2019, 6:59:12 PM9/5/19
to Premake Development
I'm using Premake5 to build a C project that compiles to a static lib and console app with GCC or Clang. It can also compile to a static lib or executable firmware that runs on a TI microprocessor, but at the moment I use a separate project in Code Composer to do this. I'd like to move some of this over to Premake as well.

I don't plan to start with a full module covering all of TI's toolchain options. My first step is simply to get Premake to use the compiler invocation that's necessary for my project as part of its gmake or gmake2 action. But I'm struggling with exactly how to get Premake to use it.

I was thinking that I need to create a new toolset, like the ones in src/tools, since I just want to generate the same kind of makefiles but with TI's compiler being called. But if I do this, I have no idea how to actually tell Premake to use it instead of GCC or Clang. At the moment I can switch between those two with --cc. My reading of the source indicates that this option is declared in _premake_init.lua and is eventually used in the selected action eg. gmake2 to select a toolset. So ideally I'd just have something that lets me do "premake --cc=ti gmake2". But as far as I can tell, there's no way to "add" options to command line flags declared with newoption.

Other than that, the only other methods I can see are convoluted (eg. a newoption that partially collides with --cc) or annoying (eg. copy/paste my existing projects and add a "toolchain" call and live with the duplication). Is there some other way to do this that I'm missing?

Thanks,
Jason
Reply all
Reply to author
Forward
0 new messages