SlideShare a Scribd company logo
Conan a C/C++ package manager
@uilian
Conan
The barbarian
Just a
code ...
// main.cpp
#include <iostream>
#include "Poco/Net/NetworkInterface.h"
static void print_interfaces() {
using Poco::Net::NetworkInterface;
const auto interfaces =
NetworkInterface::map(false, false);
for (const auto& it : interfaces) {
std::cout << it.second.name() << ‘n’;
}
}
int main() {
print_interfaces();
}
Problem
External
dependencies
15 minutes to build!
History
Biicode
Biicode: C/C++
Dependency Manager
github.com/biicode
Conan
Features
● Free Software and Open Source;
● MIT License;
● GIT style, decentralized -
distributed;
● Handle sources and binaries;
● Generates VS, CMake, qmake, ...
foobar@khomp ~ $ sudo pip install conan
foobar@khomp ~ $ conan user
It seems to be the first time you run conan
Auto detecting your dev setup to initialize conan.conf
Found gcc 6.2
Default conan.conf settings
os=Linux
arch=x86_64
compiler=gcc
compiler.version=6.2
build_type=Release
*** You can change them in ~/.conan/conan.conf ***
*** Or override with -s compiler='other' -s ...s***
Install
Using pip
Package
Naming
Package structure:
name/version@user/channel
Example:
Poco/1.7.5@khomp/stable
Poco/1.7.5@khomp/testing
Poco/1.7.5@khomp/ci
// main.cpp
#include <iostream>
#include "Poco/Net/NetworkInterface.h"
static void print_interfaces() {
using Poco::Net::NetworkInterface;
const auto interfaces =
NetworkInterface::map(false, false);
for (const auto& it : interfaces) {
std::cout << it.second.name() << ‘n’;
}
}
int main() {
print_interfaces();
}
Example
Using Poco Network
Example
Using Poco Network
# CMakeLists.txt
project(network-interfaces CXX)
cmake_minimum_required(VERSION 2.8)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.
cmake)
conan_basic_setup()
add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${PROJECT_NAME}
${CONAN_LIBS})
Example
Using Poco Network
# conanfile.txt
[requires]
Poco/1.7.5@lasote/stable
[generators]
cmake
foobar@khomp ~ $ mkdir build && cd build
foobar@khomp ~/build $ conan install ..
foobar@khomp ~/build $ cmake .. && cmake --build .
foobar@khomp ~/build $ bin/network-interfaces
lo
enp1s0
enp2s0
docker0
Example
Using Poco Network
Question
Package
Cached
package
Local cache
Package
How to create
from source
Conan Example
gitlab.khomp.corp/uilian/conan-example
Asciinema
https://asciinema.org/a/102922
conanfile.py
class ExampleConan(ConanFile):
name = "conan-example"
version = "0.1.0"
settings = "os", "arch", "compiler", "build_type"
generators = "cmake"
exports = "*"
requires = "Poco/1.7.5@lasote/stable"
def build(self):
cmake = CMake(self.settings)
self.run('cmake %s %s' % (self.conanfile_directory,
cmake.command_line))
self.run("cmake --build . %s" % cmake.build_config)
def package(self):
self.copy("*.a", dst='lib', src='lib')
self.copy("*.hpp", dst='include', src='src')
def package_info(self):
self.cpp_info.libs = ["example"]
Package
How to create
from source
Package
How to test
Package
How to test
Project structure
Package
How to test
class TestExampleConan(ConanFile):
name = "TestExampleConan"
version = "0.1.0"
settings = "os", "compiler", "build_type", "arch"
requires = "conan-example/0.1.0@uilian/testing",
"gtest/1.8.0@lasote/stable"
generators = "cmake"
def build(self):
cmake = CMake(self.settings)
self.run('cmake %s %s' % (self.conanfile_directory,
cmake.command_line))
self.run("cmake --build . %s" % cmake.build_config)
def imports(self):
self.copy(pattern="*.a", dst="lib", src="lib")
self.copy(pattern="*.hpp", dst="include", src="include")
def test(self):
self.run("cmake --build . --target test")
foobar@khomp ~ $ conan test
● Build project
● Export sources
● Cache package
● Build test
● Import project package from cache
● Execute all tests
Example
Using Poco Network
Remote
Decentralized
Scenario: multiple remotes
Package Tools
Generate multiples
packages
Scenario: Khomp
GCC-4.8
GCC-5.4
GCC-6.2
conan-example/
0.1.0@uilian/testing
Package
How to test
# build.py
from conan.packager import ConanMultiPackager
if __name__ == "__main__":
builder =
ConanMultiPackager(username="myuser")
builder.add_common_builds()
builder.run()
OFFICIAL
https://www.conan.io/
PROJECT
https://github.com/conan-io/conan
CPPCON 2016
https://youtu.be/xvqH_ck-5Q8
https://goo.gl/zG3729
CPPCAST
https://goo.gl/
Package
Tools
Generate multiples
packages
Conan a C/C++ Package Manager

More Related Content

PDF
Conan.io - The C/C++ package manager for Developers
PDF
Git, CMake, Conan - How to ship and reuse our C++ projects?
PDF
Linux Profiling at Netflix
PDF
Meet cute-between-ebpf-and-tracing
PPTX
Staring into the eBPF Abyss
PDF
Faster packet processing in Linux: XDP
PDF
Linux cgroups and namespaces
PDF
eBPF - Rethinking the Linux Kernel
Conan.io - The C/C++ package manager for Developers
Git, CMake, Conan - How to ship and reuse our C++ projects?
Linux Profiling at Netflix
Meet cute-between-ebpf-and-tracing
Staring into the eBPF Abyss
Faster packet processing in Linux: XDP
Linux cgroups and namespaces
eBPF - Rethinking the Linux Kernel

What's hot (20)

PDF
Go Concurrency
PDF
Introduzione a Git (ITA - 2017)
PDF
Linux Networking Explained
PDF
CMake best practices
PDF
eBPF/XDP
PDF
Git Introduction Tutorial
PDF
Pwning in c++ (basic)
PDF
Golang Project Layout and Practice
ODP
eBPF maps 101
PDF
Faster Container Image Distribution on a Variety of Tools with Lazy Pulling
PDF
Introduction to eBPF
PPTX
Introduction git
PPTX
Basic Git Intro
PPTX
Git - Basic Crash Course
PDF
Introduction To Linux Kernel Modules
PDF
syzkaller: the next gen kernel fuzzer
PDF
Velocity 2015 linux perf tools
PDF
How to Prepare for CKA Exam
PDF
Control your service resources with systemd
PDF
Scheduling in Android
Go Concurrency
Introduzione a Git (ITA - 2017)
Linux Networking Explained
CMake best practices
eBPF/XDP
Git Introduction Tutorial
Pwning in c++ (basic)
Golang Project Layout and Practice
eBPF maps 101
Faster Container Image Distribution on a Variety of Tools with Lazy Pulling
Introduction to eBPF
Introduction git
Basic Git Intro
Git - Basic Crash Course
Introduction To Linux Kernel Modules
syzkaller: the next gen kernel fuzzer
Velocity 2015 linux perf tools
How to Prepare for CKA Exam
Control your service resources with systemd
Scheduling in Android
Ad

Similar to Conan a C/C++ Package Manager (20)

PDF
Meetup C++ Floripa - Conan.io
PDF
Павел Филонов, Разделяй и управляй вместе с Conan.io
PDF
Gitlab - Creating C++ applications with Gitlab CI
PDF
Whats_new_Conan 2_0_MeetingC++7557.pdf
PPTX
C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...
PDF
Optimization of the build times using Conan
PDF
Dependency Management in C++ (NDC TechTown 2021)
PDF
SECCOM 2017 - Conan.io o gerente de pacote para C e C++
PDF
Effective CMake
PDF
cmake.pdf
PDF
Dependencies Managers in C/C++. Using stdcpp 2014
PDF
Packaging is the Worst Way to Distribute Software, Except for Everything Else
PDF
Software Bill of Materials (SBOMs) for C applications [FOSDEM 2025]
PPTX
short_intro_to_CMake_(inria_REVES_team)
PDF
How we scaled git lab for a 30k employee company
PDF
Introduction to CMake
PDF
An Introduction to CMake
 
PDF
Writing a Python C extension
PDF
Meterpreter in Metasploit User Guide
PDF
CMake - Introduction and best practices
Meetup C++ Floripa - Conan.io
Павел Филонов, Разделяй и управляй вместе с Conan.io
Gitlab - Creating C++ applications with Gitlab CI
Whats_new_Conan 2_0_MeetingC++7557.pdf
C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...
Optimization of the build times using Conan
Dependency Management in C++ (NDC TechTown 2021)
SECCOM 2017 - Conan.io o gerente de pacote para C e C++
Effective CMake
cmake.pdf
Dependencies Managers in C/C++. Using stdcpp 2014
Packaging is the Worst Way to Distribute Software, Except for Everything Else
Software Bill of Materials (SBOMs) for C applications [FOSDEM 2025]
short_intro_to_CMake_(inria_REVES_team)
How we scaled git lab for a 30k employee company
Introduction to CMake
An Introduction to CMake
 
Writing a Python C extension
Meterpreter in Metasploit User Guide
CMake - Introduction and best practices
Ad

More from Uilian Ries (7)

PDF
Git Workflow
PDF
BDD em Ação
PDF
Poco Bibliotecas C++
PDF
Software Development Tools for C/C++
PDF
Testes Unitários com GTest e Catch
PPTX
Elements of C++11
PPT
Unisinos - Proposta TCC 2015
Git Workflow
BDD em Ação
Poco Bibliotecas C++
Software Development Tools for C/C++
Testes Unitários com GTest e Catch
Elements of C++11
Unisinos - Proposta TCC 2015

Recently uploaded (20)

PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
Essential Infomation Tech presentation.pptx
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
ai tools demonstartion for schools and inter college
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
System and Network Administration Chapter 2
PDF
PTS Company Brochure 2025 (1).pdf.......
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
System and Network Administraation Chapter 3
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PPTX
L1 - Introduction to python Backend.pptx
Adobe Illustrator 28.6 Crack My Vision of Vector Design
wealthsignaloriginal-com-DS-text-... (1).pdf
Wondershare Filmora 15 Crack With Activation Key [2025
Essential Infomation Tech presentation.pptx
Navsoft: AI-Powered Business Solutions & Custom Software Development
Upgrade and Innovation Strategies for SAP ERP Customers
ai tools demonstartion for schools and inter college
Design an Analysis of Algorithms II-SECS-1021-03
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
System and Network Administration Chapter 2
PTS Company Brochure 2025 (1).pdf.......
Reimagine Home Health with the Power of Agentic AI​
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
System and Network Administraation Chapter 3
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
L1 - Introduction to python Backend.pptx

Conan a C/C++ Package Manager