Commit graph

11 commits

Author SHA1 Message Date
Vincent Ambo
f4f72bcf21 test(3p/nix): Set up scaffolding & fix up tests for value-to-{json|xml}
Configures the CMake build to load & run the GoogleTest tests.

I (grfn) also updated this to get the tests running as part of the nix
derivation, which required defining our own manual configurePhase and
installCheckPhase, rather than depending on the one provided by stdenv.
Not doing this would cause cmake to attempt to *run* the tests as part
of the buildPhase, which wouldn't work because the dynamic libraries
hadn't been put into a place where the test executables knew where to
find them. We're not sure *why* this fixes it, and for some reason
fixing this also breaks the automatic behavior of nixpkgs of passing
-j$NIX_BUILD_CORES -l$NIX_BUILD_CORES to make, but that's eaasy enough
to fix manually in a preBuild

Paired-With: Griffin Smith <grfn@gws.fyi>
Change-Id: I79d61854a3ff47301cdce8a40c76820a97bdf901
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1240
Tested-by: BuildkiteCI
Reviewed-by: glittershark <grfn@gws.fyi>
2020-07-18 00:01:53 +00:00
Vincent Ambo
0064e55486 feat(3p/nix): Add protobuf & gRPC dependencies and generate sources
Adds dependencies on the gRPC & protobuf libraries, and implements Nix
code to generate the C++ sources from the included proto definitions.

This is theoretically supported via CMake, but practically doesn't
work and I don't care to debug why.

Doing it like this lets us instead add a CMake library target for our
proto definitions based on the sources generated by Nix.

Pros:
  * no need to deal with the gRPC CMake mess
  * it works!

Cons: * iteration requires nix-shell restart
Change-Id: Ie1fe9807fc96c49cb8f7161ba59d093456062b15
Reviewed-on: https://cl.tvl.fyi/c/depot/+/927
Tested-by: BuildkiteCI
Reviewed-by: isomer <isomer@tvl.fyi>
2020-07-05 19:17:12 +00:00
Vincent Ambo
7e8a48c82c fix(3p/nix): Link to glog built by Nix
Same as cl/921, it seems that the trick to making this work is indeed
overriding the C++ standard used in the dependency.

Change-Id: I3c5984d71014d774c161ecc283844f504fd44719
Reviewed-on: https://cl.tvl.fyi/c/depot/+/922
Tested-by: BuildkiteCI
Reviewed-by: lukegb <lukegb@tvl.fyi>
2020-07-05 16:54:12 +00:00
Vincent Ambo
5cb6e6ee21 fix(3p/nix): Link to Abseil built by Nix
This didn't work previously ... but now it does. I think setting the
standard explicitly is what did the trick, but it's slightly unclear
to me why.

Either way this means that Abseil is no longer constantly getting
recompiled when building Nix, which is nice.

Change-Id: I377f7b68bf1ef9045df6a2eee8fdd0c92f243547
Reviewed-on: https://cl.tvl.fyi/c/depot/+/921
Tested-by: BuildkiteCI
Reviewed-by: lukegb <lukegb@tvl.fyi>
2020-07-05 16:54:12 +00:00
Luke Granger-Brown
4de63f784c fix(3p/nix): propagate dependencies which are needed by people linking in nix
This includes absl, which we install into the output, and boost and the boehm GC,
which are moved to propagated deps.

Change-Id: I8f9f9795ff92e26b2320359064241d7fd59c2d33
Reviewed-on: https://cl.tvl.fyi/c/depot/+/549
Reviewed-by: tazjin <mail@tazj.in>
2020-06-21 23:49:19 +00:00
Luke Granger-Brown
b99829f142 fix(3p/nix): install nix_config.h and config.nix
This also installs the rest of corepkgs as a side-effect.

Change-Id: I67a42d45793d5e8fdad51c1f306eebf63e9c2868
Reviewed-on: https://cl.tvl.fyi/c/depot/+/548
Reviewed-by: tazjin <mail@tazj.in>
2020-06-21 23:49:19 +00:00
Luke Granger-Brown
8b83e0f31b feat(3p/nix): install pkgconfig files for libexpr, libmain and libstore
Also fixes the pkgconfig files to use the corresponding CMake variables.

Change-Id: I8095b8aff39ad91e592f3edc95555c9f1f1f153d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/545
Reviewed-by: tazjin <mail@tazj.in>
2020-06-21 20:42:28 +00:00
Luke Granger-Brown
739a45f9e4 chore(3p/nix): use GNUInstallDirs to determine output directory names
This ensures that we install both glog's .a and all the .so files we
generate into a single consistent output lib path (which is, err,
lib64, but whatever).

Change-Id: Ib6ac6eacf5f56e4b719cfb586db731efc122c31b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/544
Reviewed-by: tazjin <mail@tazj.in>
2020-06-21 20:42:28 +00:00
Vincent Ambo
91ddc7603d feat(3p/nix): Configure CMake to generate compile commands 2020-05-29 22:31:07 +01:00
Vincent Ambo
e494a347b5 fix(3p/nix): Build glog as included CMake project 2020-05-29 22:04:06 +01:00
Vincent Ambo
25393d8080 refactor(3p/nix): Introduce CMake as the build system for Nix
Completes the switch from Meson to CMake for the core build system in
Nix.

Meson was added originally because someone else had already done the
work for integrating it in Nix and it was an upgrade from the previous
setup.

However over time it became clear that Meson is not quite mature
enough for projects like Nix that have occasionally peculiar
configuration constraints.

Some issues encountered with Meson (some of these are due to the Meson
setup in Nix):

* Difficulty with generating correct compile_commands.json for
  external tools like clangd
* Difficulty linking to libc++ when using clang
* Ugly shell invocations for certain parts of the build system (I want
  these to be gone!!!)

This CMake setup mimics the Meson configuration, but there are some
differences (some temporary):

* headers are now included separately for each library (see a previous
  commit that changes includes appropriately)
* autoheaders-style configuration is currently hardcoded. Before
  blindly copying this I want to evaluate how much of it actually exists
  for portability concerns that I don't have (such as support for OS
  X).
* Nix is built with libc++ by default.
* [libstore] SQL schema is now inlined via a generated header, not an
  included string literal

Abseil is still built as part of this build, rather than an external
dependency, because it chokes on differently configured compiler
invocations.

Note that because of the move to libc++ an unwanted behaviour is
introduced: glog log messages no longer have a body. I have yet to
debug what is going on there.
2020-05-28 00:11:25 +01:00