Pulls the C/C++ library linking flags from Conan dependencies

Overview

conan2-rs

Introduction

conan2-rs is a Cargo build script wrapper of the Conan C/C++ package manager (version 2.0 only).

It automatically pulls the C/C++ library linking flags from Conan dependencies and passes them to rustc.

Adding C/C++ dependencies using Conan

The simplest way to add C/C++ dependencies to a Rust project using Conan is to add a plain conanfile.txt file as follows:

[requires]
libxml2/2.11.4
openssl/3.1.3
zlib/1.3

Example usage

Add conan2 to the Cargo.toml build dependencies section:

[build-dependencies]
conan2 = "0.1"

Add the following lines to the project build.rs script to invoke conan install and pass the Conan dependency information to Cargo automatically:

use conan2::ConanInstall;

fn main() {
    ConanInstall::new().run().parse().emit();
}

The most commonly used build_type Conan setting will be defined automatically depending on the current Cargo build profile: Debug or Release.

The Conan executable is assumed to be named conan unless the CONAN environment variable is set to override.

An example Rust crate using conan2-rs to link Conan dependencies can also be found in the project repository.

Advanced usage

Using custom Conan profiles with names derived from the Cargo target information:

use conan2::ConanInstall;

fn main() {
    let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap();
    let target_arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap();
    let conan_profile = format!("{}-{}", target_os, target_arch);

    ConanInstall::new()
        .profile(&conan_profile)
        .build("missing")
        .run()
        .parse()
        .emit();
}
You might also like...
An Interpreter for Brainfuck programming language implemented in the Rust programming language with zero dependencies.

Brainfuck Hello, Visitor! Hey there, welcome to my project showcase website! It's great to have you here. I hope you're ready to check out some awesom

Inspect dynamic dependencies of Mach-O binaries recursively

dylibtree dylibtree is a tool for inspecting the dynamic dependencies of a Mach-O binary recursively. It can be useful to understand what library load

Convert your .NET dependencies to the Directory.Packages.props format

directory-packages-props-converter Converts your projects to use Central Package Management. PackageReference dependencies have their Version remove

Rust low-level minimalist APNG writer and PNG reader with just a few dependencies with all possible formats coverage (including HDR).

project Wiki https://github.com/js29a/micro_png/wiki at glance use micro_png::*; fn main() { // load an image let image = read_png("tmp/test.

Rust Imaging Library's Python binding: A performant and high-level image processing library for Python written in Rust

ril-py Rust Imaging Library for Python: Python bindings for ril, a performant and high-level image processing library written in Rust. What's this? Th

This library provides a convenient derive macro for the standard library's std::error::Error trait.

derive(Error) This library provides a convenient derive macro for the standard library's std::error::Error trait. [dependencies] therror = "1.0" Compi

A readline-like library in Rust.

liner A Rust library offering readline-like functionality. CONTRIBUTING.md Featues Autosuggestions Emacs and Vi keybindings Multi-line editing History

a Rust library for running child processes

duct.rs Duct is a library for running child processes. Duct makes it easy to build pipelines and redirect IO like a shell. At the same time, Duct help

A command line progress reporting library for Rust
A command line progress reporting library for Rust

indicatif Documentation A Rust library for indicating progress in command line applications to users. This currently primarily provides progress bars

Owner
Sergey Kvachonok
EE/SE/Undecided
Sergey Kvachonok
Pure-Rust rewrite of the Linux fontconfig library (no system dependencies) - using ttf-parser and allsorts

rust-fontconfig Pure-Rust rewrite of the Linux fontconfig library (no system dependencies) - using allsorts as a font parser in order to parse .woff,

Felix Schütt 28 Oct 29, 2022
Rust library to convert RGB 24-bit colors into ANSI 256 (8-bit) color codes with zero dependencies and at compile-time.

rgb2ansi256 rgb2ansi256 is a small Rust library to convert RGB 24-bit colors into ANSI 256 (8-bit) color codes with zero dependencies and const fn. Th

Linda_pp 7 Nov 17, 2022
A simple Rust library for OpenAI API, free from complex async operations and redundant dependencies.

OpenAI API for Rust A community-maintained library provides a simple and convenient way to interact with the OpenAI API. No complex async and redundan

null 6 Apr 4, 2023
A CLI tool that allow you to create a temporary new rust project using cargo with already installed dependencies

cargo-temp A CLI tool that allow you to create a new rust project in a temporary directory with already installed dependencies. Install Requires Rust

Yohan Boogaert 61 Oct 31, 2022
A utility for managing cargo dependencies from the command line.

cargo edit This tool extends Cargo to allow you to add, remove, and upgrade dependencies by modifying your Cargo.toml file from the command line. Curr

Pascal Hertleif 2.7k Jan 6, 2023
This utility traverses through your filesystem looking for open-source dependencies that are seeking donations by parsing README.md and FUNDING.yml files

This utility traverses through your filesystem looking for open-source dependencies that are seeking donations by parsing README.md and FUNDING.yml files

Mufeed VH 38 Dec 30, 2022
Cucumber testing framework for Rust. Fully native, no external test runners or dependencies.

Cucumber testing framework for Rust An implementation of the Cucumber testing framework for Rust. Fully native, no external test runners or dependenci

Cucumber Rust 393 Dec 31, 2022
A complete imgui-rs example using dependencies only from crates.io.

Dear imgui-rs, hello. This is a fairly basic, but complete and standalone example application for the Rust version of dear imgui (https://github.com/o

null 0 Nov 30, 2022
Utility to inherit dependencies from workspace file if it occurs 'n' or more times throughout the project.

Cargo Workspace Dependency Inheritor Utility that inherits dependencies from the main workspace if they occur n or more times in the workspace. Worksp

Timon 9 Oct 14, 2022
Cargo subcommand for running cargo without dev-dependencies.

cargo-no-dev-deps Cargo subcommand for running cargo without dev-dependencies. This is an extraction of the --no-dev-deps flag of cargo-hack to be use

Taiki Endo 5 Jan 12, 2023