How do you create a custom build target

31 views
Skip to first unread message

Nikola Janevski

unread,
Jun 9, 2017, 3:45:55 PM6/9/17
to gyp-developer
Hi, 

I am trying to figure out how to create a custom build target. Currently the documentation for this is in status TODO.

Can anybody point me to a source code that uses custom build target or give me an example here?

Thank You,
Nikola

Dirk Pranke

unread,
Jun 9, 2017, 4:01:37 PM6/9/17
to Nikola Janevski, gyp-developer
I think it's kinda vague as to what a "custom build target" means, which is probably why that doc is marked as "todo".

If you just want to be able to run a script that does some stuff, that's what actions are for. 

Do you have something else in mind?

-- Dirk

--

---
You received this message because you are subscribed to the Google Groups "gyp-developer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gyp-developer+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nikola Janevski

unread,
Jun 9, 2017, 4:48:13 PM6/9/17
to gyp-developer, njan...@google.com
I want to get these integration tests to compile with clang instead of msvc:


On Friday, June 9, 2017 at 4:01:37 PM UTC-4, Dirk Pranke wrote:
I think it's kinda vague as to what a "custom build target" means, which is probably why that doc is marked as "todo".

If you just want to be able to run a script that does some stuff, that's what actions are for. 

Do you have something else in mind?

-- Dirk
On Fri, Jun 9, 2017 at 12:45 PM, 'Nikola Janevski' via gyp-developer <gyp-de...@googlegroups.com> wrote:
Hi, 

I am trying to figure out how to create a custom build target. Currently the documentation for this is in status TODO.

Can anybody point me to a source code that uses custom build target or give me an example here?

Thank You,
Nikola

--

---
You received this message because you are subscribed to the Google Groups "gyp-developer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gyp-develope...@googlegroups.com.

Sébastien Marchand

unread,
Jun 9, 2017, 5:48:43 PM6/9/17
to gyp-developer, njan...@google.com
Here's more context of what Nikola's trying to do:

The goal of Nikola's project is to get a Clang-Asan build of Chrome that uses the SyzyAsan runtime to perform all the access checks and the error reporting (rather than the typical Asan runtime library), the (long term) goal of this is to be able to ship a Clang-Asan build of Chrome to Chrome's Canary channel and drop the Syzygy instrumentation pipeline (which only work on the MSVC compiled binaries). There's a bunch of reason for this but this is beyond the scope of this email :).

In Syzygy we have some integration tests to ensure that the SyzyAsan runtime detects all the kind of error that we want to catch (use-after-free, heap-buffer-overflow...) are reported properly (to make sure that these crashes get reported to the Crash server with all the useful information). We'd like to also build these tests with Clang with the Asan instrumentation turned on to make sure that we have some good coverage of the integration between Clang-Asan and the SyzyAsan runtime library. 

So what we really want in our project is:
- Compile all the projects with MSVS like we're currently doing...
- ... except for the 'integration_tests_clang' target, which should be built with Clang.

I think that supporting an hybrid toolchain in Gyp will be quite complex, and our integration test targets is a rather simple target (only a few .cc files), so the idea was to use a "custom" build target that run a somewhat hardcoded command (e.g. "clang-cl.exe /all_the_needed_flags integration_tests.cc"), we have something similar quite similar in Syzygy so I think that Nikola can just look at this as an example: https://github.com/google/syzygy/blob/master/syzygy/test_data/test_data.gyp#L63 (a target with type='none' and some custom actions).

Dirk Pranke

unread,
Jun 9, 2017, 6:30:44 PM6/9/17
to Sébastien Marchand, gyp-developer, Nikola Janevski
I see, I understand now, thanks :).

Sébastien, you are most likely correct in that trying to set up things so that most stuff is compiled with one toolchain but some things with another *really* isn't what you want to use GYP for.

In fact, we didn't use GYP for that with the NaCl builds for exactly this reason, and instead NaCl was compiled by an action that called out to a different script that did everything.

So, I'd probably hand-roll a build file for the few files you need, although you could also consider calling out to something that called out to GN, and then porting just that target to GN.

-- Dirk

To unsubscribe from this group and stop receiving emails from it, send an email to gyp-developer+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages