Supporting new target_cpu build in GN

14 views
Skip to first unread message

Jay Vega

unread,
Dec 1, 2021, 11:27:11 PM12/1/21
to gn-dev
I'm trying to build my GN project with a new target_cpu configuration.

To support the new target_cpu, I need to do the following 3 steps

cl.exe set_of_flags_1 main.cpp -> compile first obj
cl.exe set_of_flags_2 main.cpp -> compiles second obj
link.exe set_of_linker_flags  obj1\main.obj obj2\main.obj -> build my executable


the same source is compiled twice (different compiler flags) and call the linker once with both obj files.

I need to implement this in my GN build system

Thanks



Brett Wilson

unread,
Dec 3, 2021, 11:12:56 PM12/3/21
to Jay Vega, gn-dev
If you're asking how to implement this scheme in GN, I would write a template. The template would generate two source sets, one for the first configuration and one for the second configuration. Then it would generate a group that depended on each source set.

Anything that depends on the target would get the group which would forward to both of the source sets and you should get all the object files in the final link.

Brett
Reply all
Reply to author
Forward
0 new messages