diff options
author | Vincent Ambo <tazjin@google.com> | 2020-05-27T21·03+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-05-27T23·11+0100 |
commit | 25393d80806f7c7caed188130d3f7c9574e61ece (patch) | |
tree | 1b62bd0547eca920a845820c8142a7cc1962b6bb /third_party/nix/src/CMakeLists.txt | |
parent | 3d7537da7fbb37cb043eaa28acc7ffade9bec99d (diff) |
refactor(3p/nix): Introduce CMake as the build system for Nix r/868
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.
Diffstat (limited to 'third_party/nix/src/CMakeLists.txt')
-rw-r--r-- | third_party/nix/src/CMakeLists.txt | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/third_party/nix/src/CMakeLists.txt b/third_party/nix/src/CMakeLists.txt new file mode 100644 index 000000000000..37ff3b54af94 --- /dev/null +++ b/third_party/nix/src/CMakeLists.txt @@ -0,0 +1,80 @@ +# -*- mode: cmake; -*- + +# The 'nix' binary is composed of various sources below this +# directory. In the previous build system, they were all built from +# this location and this setup mimics that (with the exception of the +# various Nix libraries). + +add_subdirectory(libutil) +add_subdirectory(libstore) +add_subdirectory(libmain) +add_subdirectory(libexpr) + +add_executable(nix) +set_property(TARGET nix PROPERTY CXX_STANDARD 17) +include_directories(${PROJECT_BINARY_DIR}) +target_include_directories(nix PUBLIC "${nix_SOURCE_DIR}/src") + +target_sources(nix + PRIVATE + nix/command.hh + nix/legacy.hh + nix-env/user-env.hh + nix-store/dotgraph.hh + nix-store/graphml.hh + + nix/add-to-store.cc + nix/build.cc + nix/cat.cc + nix/command.cc + nix/copy.cc + nix/doctor.cc + nix/dump-path.cc + nix/edit.cc + nix/eval.cc + nix/hash.cc + nix/installables.cc + nix/legacy.cc + nix/log.cc + nix/ls.cc + nix/main.cc + nix/optimise-store.cc + nix/path-info.cc + nix/ping-store.cc + nix/repl.cc + nix/run.cc + nix/search.cc + nix/show-config.cc + nix/show-derivation.cc + nix/sigs.cc + nix/upgrade-nix.cc + nix/verify.cc + nix/why-depends.cc + + build-remote/build-remote.cc + nix-build/nix-build.cc + nix-channel/nix-channel.cc + nix-collect-garbage/nix-collect-garbage.cc + nix-copy-closure/nix-copy-closure.cc + nix-daemon/nix-daemon.cc + nix-env/nix-env.cc + nix-env/user-env.cc + nix-instantiate/nix-instantiate.cc + nix-prefetch-url/nix-prefetch-url.cc + nix-store/dotgraph.cc + nix-store/graphml.cc + nix-store/nix-store.cc +) + +target_link_libraries(nix + nixexpr + nixmain + nixstore + nixutil + + absl::strings + editline + glog +) + +INSTALL(TARGETS nix DESTINATION bin) |