From the Command Line, to Make, to CMake, to Conan @ C++ San Diego Meetup

June 23, 2022

2 min read

From the Command Line, to Make, to CMake, to Conan @ the C++ San Diego Meetup

Abstract:
This session examines the layers of tooling used to produce C/C++ applications and make developers’ lives easier. Surveys say a major pain point facing C/C++ developers is long build times. One way to save time is to only re-build an artifact when a change occurs. Although the command line offers the precision of specifying what to build, doing this and tracking changes manually can quickly become a daunting and error-prone proposition. Make as a build system allows developers to specify and execute command-line statements depending on what file changes are detected. However, these statements may be particular to one compiler or operating system. CMake provides the missing flexibility for a makefile file. One CMake file can generate what’s needed for a variety of build systems, compilers, and operating systems. Another major pain point facing C/C++ developers is managing all the libraries needed by an application. Libraries provide the functionality programs need. But it gets tricky when libraries depend on other libraries that depend on other libraries in a spaghetti-like formation. The goal of Conan as a package manager is to alleviate this burden. ConanCenter, for example, features over 1000 recipes. The promise of a recipe is to untangle the spaghetti and list the dependencies for a given library.

Bio:
Nick started in the video games industry, developing titles for console and mobile. Disappointed by the oppressive corporate feel of traditional technical training, Nick’s passion is to create more engaging and powerful learning experiences through game-based learning and other playful techniques. As a Curriculum Developer at Oracle, he focused on Java programming and certification. As a Developer Advocate at JFrog, his focus is on C++, Conan, and other JFrog technologies.

View Slides Here

Speakers

Nick Ristuccia

    Nick Ristuccia

    Developer Advovate at JFrog

    Nick started in the video games industry, developing titles for console and mobile. Disappointed by the oppressive corporate feel of traditional technical training, Nick's passion is to create more engaging and powerful learning experiences through game-based learning and other playful techniques. As a Curriculum Developer at Oracle, he focused on Java programming and certification. As a Developer Advocate at JFrog, his focus is on C++, Conan, and other JFrog technologies.

    Video Transcript

    special guest today a special company uh probably all and you already know about
    it because there is the agenda and the speaker so there’s already a spoiler
    uh before we go and introduce the speaker and agenda i just would like to thank qualcomm uh the
    wireless research software department which is sponsoring this event uh thank you qualcomm for uh paying uh
    the meetup fees especially uh my vp charles vernon which is uh supporting
    this meetup just quickly we have our dropbox where we place
    a presentations and material we do have slack channel we do have discord that you can you can join if you don’t
    have access please let me know we upload uh the san diego zipper pass meetup
    recording which i hope it’s recorded right now my machine doesn’t act on me uh we have
    a hdcpp meetup youtube channel and i i usually upload that within 24
    hours or less we have recent sessions uh in the channel so feel free to browse
    it if you are interested we have a twitter handle sdcpp meetup
    which i’m managing my specific meetup sorry my specific twitter handle is kobe
    underscore ca and i tweet about simplesplash obviously conan
    software engineering python rust and everything in between
    um i’m also sometimes blogging in
    martin’s blog pages and also uploading uh links to
    the meetup uh after the after the session so uh we we
    basically uh published the meetup in various channels including martin’s uh blog post
    so again today we have a special guest speaker
    from a special company jfrog uh you i’m not gonna talk about the whole agenda uh kind of
    the the uh the abstract because you had it uh in the in the meetup page
    uh just the just the title uh from the command line to nade to cmake to conan
    by nick i’ll just uh quickly nick if i may i’ll
    just talk about your bio nick started in the video games industry developing titles for consoles
    and mobile disappointed by the oppressive corporate feel of traditional
    technical training nick’s passion is to create more engaging and powerful learning
    experiences through game-based learning and other playful techniques as a curriculum
    developer at oracle he focused on java programming and certifications as a developer advocate at jfog
    his focus is on cbs fast conan and other jfk technologies welcome nick well thank
    you yeah i’m glad to be here thank you for having me yeah so before we start with your uh
    presentation we have something special from arie so ari you can go ahead i’ll
    stop sharing and you can go ahead and share awesome thank you so much kobe hi
    everybody i’m ari waller and i have the pleasure of being the meetup event manager for jfrog which is the home of
    conan the open source decentralized multi-platform package for c package manager for c plus c and c
    plus plus which you’re going to hear about tonight uh we’re very excited to be here with you i’ve always been an
    admirer of kobe and his commitment to not only the c plus community but the
    several other communities that he supports as well it’s not an easy job sometimes it seems like a thankless job
    i know but i can tell that everyone here really appreciates all the efforts that he puts in there
    to keep the san diego community up to date on c plus plus i know you are all here to hear nick
    tonight talk about command line to cmake to conan
    and i want to just share very shortly um one of the reasons i love working for
    jprog so much is because we have a core value which is community happiness and
    in that spirit i’m going to go ahead and share my screen really quick jfrog would like to do a raffle
    for a amazon echo show uh this is not the small one this is the
    amazon echo show eight it’s really cool and my kids fight about it all the time they prefer to watch this than their
    television ship i can’t figure it out but they do um you can enter um the
    raffle for the with the qr code and um kobe is going to go ahead and drop the bitly link
    that i sent him in the chat um now due to corporate compliance reasons i can’t do live drawings over the internet
    however a winner is going to be randomly selected within three business days and once i contact them
    and they claim the prize formally we’re going to share their name with the entire meetup communities but the best
    part is there’s no loser tonight um because everyone that enters the raffle i’m gonna email you so i can mail you a
    conan t-shirt now kobe is modeling that t-shirt for us i wear mine too often and
    i wasn’t able to get mine on tonight i have a different component t-shirt on tonight but uh the one we’re going to be
    sending you is conan the frogarian um so we would love to get those out to all of you to enjoy just for being here tonight
    and entering the raffle and so forth so i hope everyone um is here and will enjoy the talk tonight
    i know we have uh people from the cloning team here tonight to answer some questions in the chat as well we have
    diego which is an awesome uh honor for him to be there if you have questions as well so uh we’re excited so kobe i’m
    going to turn this back over to you and thank you so much for everything that you do thank you ari thanks uh for their uh
    warm boards uh i um a big advocate of uh package managers
    specifically conan people know people that work with me know that a lot how much i push that jim jim would that
    would uh probably uh yeah so um i also had the pleasure to uh
    attend the swap up uh in carlsbad uh a few weeks ago which i had a blast uh i
    although i i am a surprise uh developer i really like the whole in
    front i think jfrog is in the uh basically controlling everything i
    in my opinion that is ready to infra and uh cicd and containers and everything
    that you can think about so uh that’s uh that’s it from me i think nick this is
    this is your show go ahead and start okay great um let me just go ahead and
    start sharing my screen
    are you able to see my screen okay
    yes yep works fine yeah okay great actually let me just double check to
    make sure that i had i didn’t so i have to check a box here for include system audio because i have
    a video that i can uh show that i’ll demonstrate uh a tinker forge piano an infrared piano um just
    want to make sure you could all hear the beautiful tones all right yeah so let me just go ahead
    and get the presentation started
    all right yeah um so i’m nick rostuccia i’m a conan developer advocate at jfrog
    glad to be here thank you for having me and i want to present about uh my experience of going from the
    command line to make to cmake to conan a little bit more about myself
    so my background’s in there’s a bit of robotics and there’s a lot of game design type work i just wanted to focus in on maybe some
    products that you might find might find interesting so for robotics uh the work that i did
    there was uh programmed in interactive c so it’s c
    c syntax so you have custom functions for the effectors like your motors and your
    servos and uh just various sensors like there’s an infrared distance
    sensor there’s a sonar there’s a camera beam brake sensor for an encoder
    you can measure some back emf the controllers for that would be fred martin’s handy board and charmed labs
    xbc charm last is still around what i found really cool about this was you have the game boy advanced as part of it
    from nintendo so that would act as the interface it would also access the processor on the game boy advance so
    yeah that’s pretty cool um as far as games yeah i’ve developed games for
    various consoles from microsoft sony nintendo ios android and web and they’ve
    been done in various languages so that could be action scripting lua javafx c-sharp
    sql that’d be for access to a database and one part one project that uh might
    be particularly interesting here was the game power gig this is for ps3 at the
    time was working uh as quality assurance on the team but it’s you know in the same vein as a rock band or guitar hero
    where it’s a beat matching game but the studio wanted to actually have a
    game with six a six string guitar and it seems like this would be a really
    good use case for c plus plus um considering that c plus c plus has
    like the most performant access to hardware in games any any little bit of
    lag even like just approaching on the order of 100 milliseconds is enough to draw the player nuts so if you want to
    have a peripheral that has like as minimized an amount of leg as possible it seems like that’s a good
    good candidate for the peripheral the way it would work is you have a small current going through each
    each wire and then when the player presses it down that would make contact with the metal bar between each fret and
    that would complete a circuit so you’d be able to tell um what notes are being pressed that way
    um also we’re doing a developing java training certification from oracle which
    oracle sometimes has this uh yeah just like a a corporate kind of feel to it i very much want to try and
    get away from that so last last big gaming project that i worked on was a
    game to teach gender programming concepts object-oriented thinking class design inheritance lambda expressions
    and multi-threading also able to showcase data visualization by connecting to the oracle autonomous
    database but now that i’m at jfrog my focus is on
    uh jframe technologies conan c plus plus
    so a couple projects that i’m working on there’s a c plus library card game so this is like
    if you ever played the card game apples to apples it’s like that had a baby with the tv show shark tank so you’ll have a
    various c plus plus technology cards or libraries and each player has to pitch
    why they believe their library is good at fulfilling the scenario that the judge has but the
    judge is going to have these like science fiction type scenarios so it’s up to you to figure out okay how can
    today’s technology power the starbase how can we mine the crystal asteroid how can we do all this great science fiction
    type stuff i definitely want to go in that sci-fi direction because i feel like that’s great at just getting you to
    have this sense of wonder and thinking critically about how the world came to be and the just the possibilities of
    technology another thing i’m working on is a cmake course
    so the idea here is that say you have someone who’s learned a little bit of c plus through university or they do it as
    a hobbyist learning cmake would be that next logical step as far as growing your
    expertise and building up your ability to handle more complex projects and that was that was originally the impetus for
    what this presentation was supposed to be but i get the sense that there’s a lot uh definitely a lot of expertise
    that uh comes to these meetings so i i want to focus more on
    on the conan side of things and not so much on say the command line hello world side of things but i wanted to use the
    uh the c plus plus infrared piano as a backdrop
    to uh and just to contextualize everything
    um so the piano itself was a really uh it’s a really fun way to just get myself reacquainted with c plus plus and
    transfer uh what i had been learning about c make and the c ma
    i hear that c make practices have been evolving over the past few years and and this project was just another an
    opportunity to to you know from the get-go learn the modern uh c
    make uh approaches so as far as how the cam how the infrared piano actually works i have
    a video uh that’ll speak to that effect let’s see if i can just get that pulled
    up these are sensors and devices from
    tinker forge an air quality sensor analog joystick
    linear potentiometer speaker lcd screen infrared rangefinder and
    there are many more we’ve used some of these devices to create an infrared piano
    two ir sensors detect where you place your hand over two sets of keys
    the speaker beeps at a frequency matching the note for that key
    the lcd screen prints the distance detected by each ir sensor
    and the linear potentiometer controls volume the software to do this is written in c
    it uses the c tanker forge bindings which are available from conan center
    and can easily be retrieved using the conan c c plus plus package manager
    along with many other libraries that you may feel inspired to use as part of your own projects
    i’m going to assume the audio worked because no one said no one said otherwise did you hear that
    okay it worked well yeah fantastic um
    great so okay let’s get back to
    see yeah just uh just an overview of what that piano is all about so a lot of the hardware came from all the
    hard work except for the connects uh came from tinker forge so tinker forge is a german company and they provide
    various sensors and devices for these maker type projects they support a
    variety of languages and this would include bindings for c and c plus plus
    and quick they’re quickly available from uh conan center so how to go about using
    it just like the the video had shown just a quick matter of retrieving those
    from conan and then within the actual source code go ahead and include whatever headers that i would need and
    then i’m free to call whatever functions that i would need from the library within
    thememakelist.txt this is where i could use find package
    to find what i need and then i’ll create the executable and then use target link libraries to
    link that library to the executable and then from there it’s just a matter of from
    the command line we’ll call cmake create our make file then call make to compile and we are
    free to run the program but there’s some there’s a lot of ideas that i had just
    thrown out there there’s there’s conan there’s cmake the command line there’s make and as someone who is new to this
    uh you know trying to wrap my head around all this was a bit of a bit of a process so i definitely want to
    take a step back and try and contextualize all that and show how something like this was
    can be put together with a relative ease a project like this so yeah so that’s uh that’s where the
    name of the talk came from we have the command line make cmake and conan so as a whole
    these help development go pretty quickly i was able to get a hello world
    program going within a day and this is just me getting the lcd screen to print
    something and the actual piano was honed and treble shot and completed within
    about one to two weeks and it was a real pleasant change of pace compared to other technologies that
    um you know i hear about a technology that’ll come down the pipeline i’m curious to try it out but for whatever
    reason it’s tough to get it to work and maybe something doesn’t work as advertised if at all maybe there’s like
    additional dependencies that i need to hunt down and prepare or lots of settings to fill it with that maybe
    or may not be properly documented see i definitely have someone new to to
    this um not having a clue how to get started or feeling that you know progress is always
    out of reach that’s a dif i was thankful to not be put in that
    type of position because everything seemed to work as smoothly as it did um but yeah just that perspective as like
    as a game designer there’s like no worse feeling to create within a player you’re feeling like your
    progress has been robbed for you or no matter what you do you you can’t move you can’t move forward definitely want
    to to avoid avoid that um
    so yeah let’s as far as like each individual layer though um yeah these could represent
    their own separate mystery as far as what are these layers and how do they work with each other what benefits do
    they provide to developers and just what i like to do with the curriculum that i develop is find what it is that
    clued me in and then try to reproduce that for other developers to help them learn more smoothly and avoid any sort
    of dead ends or you know unnecessary banging your head against the wall not that you know there’s there definitely
    is value and struggle but um have the struggle to be a bit more like smooth and uh
    lead to better learning results so uh let’s start with c c plus plus time to
    get myself reacquainted with the language and so my frame of reference was java
    and just starting with uh starting with fact about c plus plus what was different was here we have a platform
    dependent language which means that the instructions that would be written for one machine like windows wouldn’t be meant to run on
    a machine like linux okay but this also means that the artifacts could be optimized for their respective
    platforms and so it makes sense when i was researching that why for a long time c and c plus plus had
    been the choice for the most performant access to hardware
    java by comparison would be platform independent where the code and the assets are supposed to be written once
    and then can run anywhere there is a jvm a java virtual machine and so then the challenge that comes for the languages
    author is how to how do we prepare a jvm for an array of platforms and of course
    suns and oracle’s solution for this to ensure performant access uh to the hardware for the gabm was to
    go to reddit in c and c plus plus uh specifically they wrote it in they
    say they wrote it in c using c plus plus libraries um the compiler itself is
    written in java but the jre java runtime environment that’s c and that’s the that’s the layer that is necessary to
    interact with the hardware so so java would be an example of a large c plus plus project
    and just to get a sense of scale maybe also a comparison against javascript so there’s an article here that says
    that a huge javascript project is 18 000 lines uh what would you define as a huge
    project in c plus plus i think there there might be a poll for this would we
    be able to throw that up or should we just shout it out or put it in chat no paul and unfortunately i couldn’t i
    couldn’t make it so maybe people can either shout it out or put it in the chat
    18 very small c plus plus project [Laughter]
    being closer to a million yeah millions that’s gonna be probably
    yeah yeah um so so we did this um survey i think it was a couple years back and
    that’s exactly what we found that the majority of people said it was over a million lines and a good number
    of those people would say it’s actually closer to 10 million lines
    and so so this seems like this would present a challenge right that you know if you want to have the most performant
    access to hardware well you may encounter some long build times given that you’re going to have on the order
    of a million or millions of lines of code and this is also the finding from the 2022 annual c plus plus developer
    survey from iso cpp uh top point top pain point long
    build times so i feel like it would be good to keep that in mind as i’m learning how do i
    avoid situations like that so getting myself reacquainted with c c
    plus first thing i wanted to do was just create a simple hello world type program so we’ll have our
    our source code greeting.cpp just a you know simple simple function printer greeting hello world
    something that was missing in java was the idea of headers where i would need to declare a function before being able
    to make use of it so there we have our greeting header and then we have our
    main function within main.cpp so there’s our source code next challenge is you know what do we do with
    this and that’s where the command line comes in so we have what’s uh cpp files and
    header files which are you know more or less human readable then the goal is let’s convert it into
    something that can be read by a machine our our object object code and then
    combine link that with platform specific libraries into a greeting executable
    done through various commands on the command line
    okay so so so that works so though i’m expecting that as projects grow to
    millions of lines across many more source code files that this manual
    process of specifying what to compile and and link it seems like this could get
    error or tedious or or slow in one way or another
    so that’s where mate comes in and i found that make could make would make a difference
    so what’s what’s one way to save time compiling uh or at least
    with the process would be to not to recompile everything only to
    recompile files that may have changed and that’s what i saw as a value of
    of make and make files so if we could automatically detect changes um then
    we’d save time by just not we’re not recompiling that and there’d be no human error if i’m
    able to automate some of that stuff as far as what what to call what to detect uh
    what’s the proper order of things um so this make file for example
    we have our targets we have our greeting we have our main.o we have our greeting.o and these are the files that
    would need to be compiled and the trigger is to do that it would depend on is the chains going to be detected in
    our main or greeting because that’s when we need to relink everything to our
    executable uh how about the green.oh well if there’s a change in the greeting or the greeting header then we would
    need to recompile and the statements to do this it’s just taking the command line statements from before so okay now i have some context
    for how how this is all how this is all fitting together now if i go ahead and run
    from the command line run make if i do it fresh so it looks like i’m going to have
    all three of these statements uh run but if i were to change the greeting afterwards to let’s say hola mundo um
    hello world in spanish uh then compile again then only the greeting uh object
    code and executable seem to recompile so main.o which was unchanged hadn’t and
    so i’m thinking okay now if i scan this up to say a million lines of code and the number of source code files
    increases proportionally so then i should be able to save a significant amount of time by not recompiling stuff
    uh one drawback though seems to be the degree of inflexibility so what i’ve
    written here manually it works for g plus plus but there’s a lot of other compilers out there so what could i do
    to get more flexibility is there any way to automate this or to not have to write
    the make file myself and so then i found out okay this is where this is where cma comes in
    uh the advantage here is that with just a couple you know simple lines in this example from the from the tinker forage
    project one cmake list.txt file was able to generate what would be
    needed for a variety of configurations so maybe that’s a make file for g plus
    plus on linux maybe that’s instead a visual studio project for msvc for
    windows great so then there’s also the ability from the cmake
    lists text file to declare artifacts would need to be generated i can use this to create my libraries my
    executables here we can see we’re adding the executable for for our piano and we’re also finding the
    package which would be the libraries that our program intends to consume
    and we also have the ability to link libraries we could include various directories and
    specify the degree of visibility between targets being public private and
    interface great and because this will pre want to go ahead from the command line call cmake this will produce that
    that make file on my behalf and it should be a lot more robust than what i had wrote manually and i don’t have to
    go back and and manually edit that make file or anything like that so so great i had
    i have some more flexibility and this is where live areas come in
    because what i want to do is i certainly want to make use of the tinker forge libraries and the millions of lines of
    code for for these projects seems to be in no small part coming from libraries which
    would make sense why reinvent the wheel when when libraries already exist to offer the project the functionality that
    i’d like to leverage so give yourself uh give yourself a
    hundred points if you know what each of these libraries are poco for example
    a modern powerful c plus libraries for building a network and internet based
    applications that run a desktop server mobile and embedded systems rt midi
    interact with digital and music devices by using the real-time midi musical
    instrument digital interface input output library podelpho would be for
    parsing modify and creating pdf files uh live mysql client interact with a my sql
    database from the c language and point cloud library would be to assemble and process many 3d spatial and
    measurements into a data set that represents a 3d object or shape
    and so great that we have that functionality available but also according to the iso cpp
    survey managing libraries tends to also be a major pain
    major pain point so okay so then what can be done about
    that and or maybe just provide a little more color what what what do we mean by that what exactly are the pain points so
    i started exploring some of these libraries and in part that was because i wanted to figure out you know what what would be a good you know library good
    candidate for the card getting working on but also just to get a you know get a sense of the ecosystem so
    so so here’s here’s kind of what i found say you have library a and it has a functionality that you think would be
    great it wasn’t as simple as just going and getting it it turns out hey library a
    also depends on library b and b happens to have its own
    you know complex or unique build system and getting it to work for the configuration that i have uh
    that may not be might may not be so easy because often uh open source libraries might be
    produced with only you know one configuration in mind so i could try try getting that to work but
    um and maybe i succeed if i do what’s my reward it turns out there’s also other libraries that we are dependent on
    and those depend on other libraries so yikes okay uh just a couple of real world examples
    what some of these might be i had mentioned point cloud library so not not only do i need to just
    get point cloud library but that library also has a dependency on boost on again
    on flan quite a few dependencies here vkt visualization toolkit
    so let’s say i want to go down the rabbit hole let’s get vkt all set up are there
    instructions for that instructions for a lot of these um
    here’s a note that i found interesting if you if you want to build a point cloud library gui tools you need to
    build vkt with qt support so obviously you need to install build and install qt
    before vkt so it just seems like i hesitate to say where does it end but
    that’s the kind of the sentiment that i’m getting so it’s a point cloud library current i don’t believe is currently
    offered um through conan uh conan center and so i actually kind of hesitate to go
    down this rabbit hole because in order to have a library offer through conan has to be certain criteria of being able
    to run on some of the most popular configurations
    so if it’s not there i’m kind of hesitant like does this mean that there’s things that that aren’t going to be supported
    am i going to spend all these hours getting this branch of dependencies to work this other branch of dependencies so we’re
    going down various rabbit holes and maybe one of them you know one of them is going to be this curveball or duh
    that’s going to be a gotcha hey turns out all that work you did uh this part here doesn’t work for your
    configuration so all that goes to waste that would be that would be
    quite disappointing after putting in all that work it kind of gets back to that feeling of one of the worst things to
    for a game player is to lose all your sense of progress um
    so yeah let’s um if we can avoid that type of scenario if we can have a lot of the stuff done man
    do it quickly or somehow automate some of this that would be you know quite the value proposition
    so this is where the c make uh sorry this is where the conan package
    manager comes in so conan recipes ended up making this
    this process a piece of cake so there’s over 1300 recipes on conan
    center and these recipes will list all the dependencies for
    a particular library it’ll list uh or to provide license information and it allows
    developers to get the libraries as binaries for a variety of configurations
    and versions and so that’s yeah that’s a big time saver i don’t need to do this stuff manually i can just
    get the binary already compiled from conan center sounds uh sounds great
    so for each of these configurations um
    there’ll be a package id so if you and your friend request the same library
    and your configuration is the same like the the architecture is the same you have the same compiler you have the same
    operating system you’ll both get the same binary with the same package id
    but if something in one configuration differs like say you want to request a shared
    library instead of a static library or you want to release instead of debug
    or you want gcc instead of the compiler any sort of variation like that is going
    to result in a different uh unique package id and and so conan will use this package
    id comes up in in various places with conan uh so for example it’s also the
    package id is also a fundamental part of the directory structure that would
    store the conan packages and i can show that in just a little bit
    so i had mentioned mentioned poco earlier and these would be all of the dependents all the
    libraries that would need to come along with poco so
    quite a few but thankfully it looks like i can get what i need from conan which is hey
    great from the command line so i’ll just go ahead and demonstrate that and then i’ll go ahead
    and break down the conan file.txt that you see on the
    screen um
    okay let’s see here okay so here i have my command
    command prompt and i’ll go ahead and pull up [Music]
    pull up the folder so you can see all these things getting populated
    and then so right here what am i requiring from codefile.txt i’m just requiring poco
    and then it should do the job of getting all of the dependencies that i need by
    just calling conan install dot meeting just the one directory back which is going to house the conan
    file.txt so go ahead and run that
    yeah we can see everything uh [Music] i’m getting everything that i seem to
    need right here
    and so there’s a nice second you’ll lay back have a little stretch and just watch it all take care of itself there’s
    not this um going down the red i’m i’m kind of thankful right now that i don’t have to go down the rabbit holes
    and hopefully everything should uh should come together as expected and and it does each time i’ve tried so that’s
    one thing i definitely appreciated about conan is that it just uh it it works quite smoothly
    yeah there we go so we so we have what we need right here if i were to drill down just a little bit let’s say i want to go down into
    oh i don’t know what would be good open ssl
    and we should see here that we have our package this looks familiar our package id
    and we have we have licenses great we have our our actual library
    and we should have what do we need to include yes we have our header files great so
    we’re getting we’re getting what we need and that was that was fast that was great um
    all right so go ahead and go back to the presentation i’ll explain a little bit more about the um
    about conan file.txt so taking a look taking a look there so
    we specified the requirement for poco um and the recipe for that would be
    retrieved from conan center as sure as we find everything that we need as far as generators go
    so so the coin should be able to accommodate any number of of generators
    and the process is pretty similar if we were to do require instead something from visual studio or auto tools we
    happen to be using c make here so c make tool chain as a generator is
    the latest way to have compatibility with c make and then cmakedeps generates the find package module needed to find
    the binaries when they’re getting referenced later from the cmakelist file
    so in fact with the binaries already compiled and in a known location they can be
    reused across multiple projects on the same machine without recompilation that’s assuming that all of my
    configuration requirements would be the same so so here maybe let’s try and throw in a little bit of a curveball
    what if i you know what if i want to mix it up a little bit what if i want to instead have some
    options like instead of a a static library i want a shared library
    so some of these configuration uh settings are are within our control some of them
    aren’t uh so for example if you’re working on a a windows machine uh what’s the sense of trying to get something for
    mac but you know options as far as like shared versus uh versus static that’s something that
    we have within our control it’s just a simple matter of specifying the options right here and then we can get what we
    need um quickly as well so i’ll take this
    file right here add the options and
    install again you know it’ll skip over some of the stuff that we already have and so we’ll
    just go about oh it retrieved it as i was talking so then we have our
    uh then we have our package which should contain the shared library and we have a different
    different package id for that yep
    okay um yeah quite smooth so let’s see now
    and sometimes if some of these things aren’t specified uh by the way it’s um the recipe will provide
    uh default values um so in this particular case the a default
    value for the library that we retrieve would have been a static library but just just at a high level what a conan
    recipe is it’s a python file and it describes how
    so here it describes how this package artifacts are built from source and some
    functions or key functions that are included would describe a source would be how to get the source build to be how
    to build from source and package would be how to start the artifacts and create
    the final package so the next the next task
    we have the tinker forge bindings that were provided from uh from that company from tinker forge for c plus plus what’s
    the process of getting those into conan so that other users can benefit from how fast it was to retrieve the stuff that
    we need and so the requirement is that is to ensure
    compatibility with major platforms that would be according to the
    specifications here on this slide
    so yeah enough binary binaries we need to be generated provided and available
    so that developers can consume them compile and link on all the platforms configurations that are
    shown here
    in the case of ticker forge this resulted in 60 uh binary packages
    available on conan center each of course with its own unique package id so if i
    were to go into conan center have a search for
    have a search for tinker forge there are the ticker forge bindings
    yeah so 60 different configurations and and these all vary
    some of them will vary by operating system they’ll vary by architecture they’ll vary by the compiler that we’re
    looking for connect center would also provide instructions on how to go about
    using these libraries and i’ll i’ll discuss
    a bit of overlap with the content on this page with the next few slides that i’ll that i’ll talk about um
    it’ll list whatever uh we also have our recipe available here and it’ll list
    whatever dependencies we have coincidentally ticker first doesn’t have any dependencies but if i were to search
    for instead of poco then you’d see that that aforementioned longer list here
    so great and if we were to just drill down to see what exactly is within that that tinker forge package it’s pretty
    similar to what we’ve seen for some of these other ones for open ssl for for poco go into tinker forge right here and
    we’ll see that we have our package there’s our package id and
    we have yeah we have our license we have our library and then we have the header
    files that we need for all the functionality for the various sensors and devices great
    if it’s okay to ask a question uh sure if you want
    um because we do an hour or until the end there’s also a chance that i might answer with the next couple slides okay
    oh wait no problem okay i’m glad you have questions though thank you um so yeah we went ahead and examined
    the the tinker forge package um so yeah just just to retrace the steps
    that we had done um i had provided this in an overview before but um yeah just
    what all we got to do to retrieve the packages that we need for conan from the we have our
    conan file.txt specifying uh the tinkerforge bindings or what
    we’re looking for we specify the generators and just uh from the command line go ahead and type in coin install
    dot dot and uh and then we should be good it’s it’s quite smooth and just as fast that we
    had seen from the poco example um in fact if i if i wanted to
    let’s say i have this uh i’m a very eager type of designer and i’m like hey wouldn’t it be great if we had something
    like rt midi that way i can recognize the notes that are being played and then i’ll have podofo for creating pdfs and
    i’ll put i’ll create a sheet and use it music based on those notes and and print that out as a pdf so this kind of uh
    yeah it becomes quite easy to to to get what you need to start developing um in in in and indulging this kind of
    uh feature creep that’s not to say that implementing the features themselves is uh is going to be trivial it’s not but at
    least you can focus on instead of the um the leg work like the getting started
    kind of stuff the focus is then instead on the actual uh development
    um so again yeah just go go ahead and include the headers within the source
    code file we have a couple of examples here the various various headers we’re including then
    we call whatever functions that we need uh then go ahead and find the package
    from our c make list it is in a known location
    and we go ahead create our executable and then using target link libraries
    we’ll link the though that libraries that we just got to our executable great
    so so yeah it’s it’s such a yeah such relief to just be able to get to work and focus on on the
    programming side of things and so take it forward actually they’re they’re quite good at providing
    documentation um i really appreciated what they had done
    so here is an example of so this is the sample code for their
    linear potentiometer so we’ll go ahead here and include the headers within the source code and we
    have our callback function so this is going to be called periodically in this case it’s just going to print
    the value of the sensor i think it’s going to be somewhere between 1 and 100
    and then within our main method go ahead create the objects for our our connection our our device
    um connect them and then ready our callback function
    um and then go ahead and set yeah set the configure set the
    configurations a bit um something of note here is going to be the 250. uh
    there’ll be the 250 millisecond delay in between when we’re getting the reading of the linear potentiometer
    and depending on the the rate of this callback that was actually pretty uh
    pretty significant in terms of how the application or how the how the piano was going to function so i have a couple of
    examples of how that all went down um just from from a design perspective
    so for example uh design considerations for this segment display originally i wanted to
    have two of these segments displays and they would each print out the distance
    that is measured by the infrared range finder as millimeters so it could be anywhere
    between a 100 and 800 and it ended up being really slow
    to update if i had a low callback rate meaning that number is very small and i
    wanted to update quite frequently the lag was huge sometimes would be like
    10 20 seconds until until the up until the proper value was
    shown on the segment display and they’re either the reason why i went low so i was thinking in terms of like
    frame rate lag or delay that’s that’s a really good way to like break that sense of immersion and frustrate players in a
    video game so i thought if i had it as small as possible that would be better to make sure that the information was as
    accurate as possible but it seems that um this particular sensor wasn’t able to accommodate
    that um at least with a low callback i could have it high which means it updates a lot
    less frequently of this risk being inaccurate though so because it was very possible to so it takes the reading you
    put your hand there you remove your hand and it never actually updates to to signify that your hand was actually
    there to give it a measurement as if it never actually happened and so yeah this was um
    i i didn’t like that say lack of uh of accuracy there um but so as as cool as i
    thought the sensor was i it has this like 80s retro feel to it that i love but um as much as i wanted to use that i
    decided let’s go with lcd display instead
    for the speaker the goal here was i wanted to yeah play a tone when the distance is detected
    and i wanted the duration of the tone to be to be very very small and and that
    way it’s like like um it may be better to describe it using the opposite let’s say
    i have a go for for one second well you’re kind of limited in terms of like the notes you’re going to play they have to be like intervals of one second so
    uh if you were to put your hand there and take it away really quickly if you want to have a really really very fast
    note or a short note it wouldn’t be able to accommodate that so i thought okay if i shrink this
    then i’m always going to have the the most accurate measurement as possible but that sounded not good so i
    it seems like the sphere could never quite warm up it wasn’t like this constant hill and it was always just like clicking or tapping sound that it
    was making because i feel like it never really got a chance to to produce that tone that i really wanted because it was
    always stopping and starting right away um and just not uh yeah not getting where i wanted it to be
    so so instead i had a little work around and this is just this is just using a bit of logic
    so i would play a tone indefinitely and then i would only stop playing that tone
    when a new distance was detected a distance that didn’t align with the start position or imposition of a
    particular piano key so then that case there was no starting and stopping it was just
    uh starting and stopping all the time it’s just you know go forever and then only stop and redo it when you have a
    new note and so that that created a much more much smoother more immersive kind of experience um
    and so i i i guess i i go into detail about some of these design considerations because even
    though it’s meant to be a more of a technical talk on say on say cmake and conan
    um i i want to just like really uh drive home that um how happy i was like this
    is the kind of challenge that i had the challenge was focusing on the development um
    instead of the uh the the getting ready and the prep work
    um and like i said before yeah that i was able to just get within within a day get a hello world going and then about
    one to two weeks to do up the code and hone everything to get to get the piano uh working
    so yeah i felt like the the code and package manager really delivered here
    we have we have these reduced build times and i’m saving time by you know not recompiling libraries i’m able to
    get what the binaries i need quickly from conan as far as managing goes i
    could quickly yeah quickly retrieve whatever dependencies they’re in a known location great and it can have this
    great sense of ability to reuse the same library binary across multiple projects
    so so who can use conan if your concern is licensing it’s uh
    as far as licensing goes conan is an open is open sourced and it’s published with
    the mit license it’s multi-platform meaning it can run on linux windows mac os
    and anywhere actually uh where python can run so having python would be a requirement for running uh conan i
    believe and uh yeah kona is designed to support all the popular the build systems for c
    and c plus plus as well as custom build systems which are you know not uncommon for enterprise
    environments uh the conan is also very active it has
    several full-time developers that sponsored that are sponsored by jfrog
    as well as a very active user community which submits dozens of pull requests each month and
    there’s a slack channel that has over i think it’s like members maybe 2150
    um it’s one of the most active channels in the c plus plus community
    uh there is free training available from jfrog academy helpful resources there
    and documentation and certainly welcome developers and library
    maintainers to take advantage of it so from the developer perspective like yeah great that um that you have
    this all this prep work and headache sort of alleviated for you that burden disappears um because of how smoothly i
    found conan was to run and then from a from the library maintainer perspective like yeah wouldn’t it be great to see
    your your work spread and help out that and be used by that that entire community
    and so yeah there you have it we have performant access to hardware and with the with tools to combat the pain points
    and that’s how all these pieces fit to how i found all these pieces fit together from
    the command line to make to simic to conan and that’s it so yeah thank you everyone
    thank you nick thanks a bunch uh i really enjoyed that it’s very pretty impressive
    um let’s let’s uh open the floor for q a
    anyone uh um i think jim you you had a you had a question yeah i had i have a question nick i was just
    wondering my first exposure to conan so this might be a new question
    um so the pack so you were showing us how the packages are arranged
    and if if you were going to put multiple packages in your requirements.txt file
    uh and let’s say there were common dependencies between multiple packages does conan take care of
    of uh organizing them so that they only occur once in your download
    yeah so so that was actually um i i believe that’s the case and i think
    that could actually be seen when i had first gotten the request for poco um it
    would it ended up getting all like it got everything i needed first and then when i ran again only two
    of them would have been different because i wanted the the shared instead of the static and so it was able to see
    oh well you already have these things so let’s just go ahead and get the new the new two that you need
    okay so even though the dependencies might exist from another package it won’t bother downloading it again
    when i add another package that has the same dependency right i think
    i think the only way that it would is if if the configuration is in one way or
    another different and then you would get a different package okay just and then just one other quick
    question where does it what’s the default location for linux for install installation
    good question i’m trying to remember but i can’t remember that offhand
    home directory that corner i usually not using my home directory uh
    just um it’s usually nfs mounted so i there is an environment variable that
    you can tell conan i want the conan home to be there like in a different directory and
    this is what i usually like so it’s it’s and we have quota on the directory and also we so it’s it’s better to i kind of
    offload it to a different directory okay thanks nick yeah thank you
    yeah and i i would like to add that uh we host content packages on artifactor
    which is another uh another product that jfk uh it’s a
    very common uh platform from jfrog and uh
    we we use it to host uh binaries obviously artifactory can host a lot of
    uh binaries uh and packages from all kinds of formats so uh uh konan is is
    one of them and regarding the uh the community that
    nick mentioned i had a pleasure to interact with them a lot uh
    i’m nagging them every time that i have questions and the super responsive and i i really appreciate that
    usually i i use github to ask questions and
    it’s it’s pretty much in within hours it’s it’s being answered and resolved so
    i’m very grateful for that
    that’s that’s great is there any other questions on uh
    i don’t think there is anything on the chat but let me just quickly check i posted the link from ahri so please go
    ahead and check it out uh oh there is a question for paul
    well do you want you want to uh ask or you want me to ask for it so
    there is a question for continuous integration other auto cleaning options for
    downloads so i think i think maybe i think what
    what paul is asking is is the cash is the current cash is going to grow
    or there is a way to eliminate or maybe clean it up i personally don’t know the answer it’s a
    good question but i don’t know an answer
    yeah so that’s that’s um that’s the layer of detail i haven’t been able to um
    uh to investigate too much um would you would you have any thoughts on
    that diego um yeah yeah nick so the thing is that
    the current cache actually stores packages without limit uh there are explicit
    commands that you can use like corner remove and then you can remove the packages that you that you don’t want
    anymore uh but i guess the typical question is if we have any like eviction uh
    policy or or some automation uh the answer is that we don’t have right now
    in the conan cache but in conan one but we have just released conan to zero
    beta we are in better stage now and the new connect to zero uh
    it has a database and database has the least recently used the uh timestamp for
    packages so it’s not used yet but the goal of this people making the nikon cache is
    exactly to implement this hey i i want to remove from my cash packages that haven’t been used
    uh in the last week for example something like that and that is an interesting feature it will not be in
    into zero most likely but it will eventually uh land into one or two two
    sometime after two zero so yeah we know this is at the moment thick um at the end of the day conan one you can
    just wipe the cast from time to time like weekly it will be a bit slow it’s a cache so you can you can remove
    everything and they start from scratch it will be a little slower the first the first iterations but then it will
    eventually be repopulated thank you by the way uh diego you had
    an excellent uh presentation in the italian civic class i remember
    where you presented the conan with all kinds of features related
    to developing corner packages while you it’s developing packages while
    they they have uh changes like frequent changes how to have uh have this option
    enabled which is really useful also for us uh so i
    do encourage people to check out it’s it’s recorded it’s in it’s on youtube not not in it’s an italian class so
    so it’s a different meetup so i i do encourage people to uh check it out
    any any other questions let me check the chat i don’t think i’ve seen anything else but uh
    okay okay so i think we can we can close
    thank you so much nick it was super useful and super interesting
    amazing i’m glad you enjoyed it yeah yeah thank you so much
    and uh again thank you for walking on that uh corner for us uh
    he’s a great he’s a great tool for us uh silvercus developers making life much much easier
    uh for me at least it’s it’s a it’s a big win when i’m using it so yeah keep
    keep up it’s a good job thanks all right yeah thank you yeah uh yeah
    thank you for having me thanks thank you everyone for attending i’ll see you next time
    thank you thanks nick thanks everyone bye have a good night
    you