Skip to content

Commit

Permalink
Fix nix build
Browse files Browse the repository at this point in the history
  • Loading branch information
HKalbasi committed Nov 29, 2023
1 parent ba4b1f5 commit d5a59de
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
10 changes: 8 additions & 2 deletions c2rust-ast-exporter/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,14 @@ fn build_native(llvm_info: &LLVMInfo) {
// Build libclangAstExporter.a with cmake
let dst = Config::new("src")
// Where to find LLVM/Clang CMake files
.define("LLVM_DIR", &format!("{}/cmake/llvm", llvm_lib_dir))
.define("Clang_DIR", &format!("{}/cmake/clang", llvm_lib_dir))
.define(
"LLVM_DIR",
&env::var("CMAKE_LLVM_DIR").unwrap_or(format!("{}/cmake/llvm", llvm_lib_dir)),
)
.define(
"Clang_DIR",
&env::var("CMAKE_CLANG_DIR").unwrap_or(format!("{}/cmake/clang", llvm_lib_dir)),
)
// What to build
.build_target("clangAstExporter")
.build();
Expand Down
7 changes: 5 additions & 2 deletions shell.nix → default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
let
nixpkgs = import <nixpkgs> {};
nixpkgs = import <nixpkgs> { };
inherit (nixpkgs) pkgs llvmPackages;
stdenv = pkgs.clangStdenv;
in
Expand All @@ -9,11 +9,14 @@ stdenv.mkDerivation {
pkgs.clang
pkgs.cmake
pkgs.llvm
pkgs.libllvm
pkgs.openssl
pkgs.pkgconfig
pkgs.python3
pkgs.rustup
pkgs.zlib
];
LIBCLANG_PATH="${llvmPackages.libclang}/lib";
LIBCLANG_PATH = "${pkgs.libclang.lib}/lib";
CMAKE_LLVM_DIR = "${llvmPackages.libllvm.dev}/lib/cmake/llvm";
CMAKE_CLANG_DIR = "${llvmPackages.libclang.dev}/lib/cmake/clang";
}

0 comments on commit d5a59de

Please sign in to comment.