blob: c0c37fb6d22d36176b3c3073c6a7564456edee12 [file]
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
use std::env;
use std::path::PathBuf;
fn main() {
let crate_dir = env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR must be set");
let out_dir = PathBuf::from(env::var("OUT_DIR").expect("OUT_DIR must be set"));
let header_path = out_dir.join("paimon_lance_ffi.h");
let config = cbindgen::Config::from_file(PathBuf::from(&crate_dir).join("cbindgen.toml"))
.expect("cbindgen.toml must exist at crate root");
cbindgen::Builder::new()
.with_crate(&crate_dir)
.with_config(config)
.generate()
.expect("generate paimon_lance_ffi.h")
.write_to_file(&header_path);
println!("cargo:include={}", out_dir.display());
println!("cargo:rerun-if-changed=src");
println!("cargo:rerun-if-changed=cbindgen.toml");
}