-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathbuild.rs
34 lines (31 loc) · 1.45 KB
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright Materialize, Inc. All rights reserved.
//
// Licensed 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 in the LICENSE file at the
// root of this repository, or online 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::error::Error;
fn main() -> Result<(), Box<dyn Error>> {
let install_dir = cmake::Config::new("protobuf")
.define("ABSL_PROPAGATE_CXX_STD", "ON")
.define("protobuf_BUILD_TESTS", "OFF")
.define("protobuf_DEBUG_POSTFIX", "")
.define("CMAKE_CXX_STANDARD", "14")
// CMAKE_INSTALL_LIBDIR is inferred as "lib64" on some platforms, but we
// want a stable location that we can add to the linker search path.
// Since we're not actually installing to /usr or /usr/local, there's no
// harm to always using "lib" here.
.define("CMAKE_INSTALL_LIBDIR", "lib")
.build();
println!("cargo:rustc-env=INSTALL_DIR={}", install_dir.display());
println!("cargo:CXXBRIDGE_DIR0={}/include", install_dir.display());
Ok(())
}