DEV Community

Rudy Chung
Rudy Chung

Posted on

OSD600 Lab 10

The first try

I originally planned to use build2, but I found it to be much more complex than I expected. There was plenty of documentation to read for build2. The main documentation was all about the setup process, but there were also documentation pages for building, testing, and package management.

The second try

As a result, I decided to use Conan instead. I installed Conan through pip, which requires Python. After installing Python, I ran

pip install conan
Enter fullscreen mode Exit fullscreen mode

This installed Conan for use in the command-line terminal. After installing Conan, I had to add a conanfile.py file.

conan new SauSaGe/1.0.0
Enter fullscreen mode Exit fullscreen mode

The file has a bunch of fields with dummy info that need to be filled in. The next step requires a CMakeLists.txt file as well as CMake, of which how to create is a process of its own.

The next step is building the package.

conan create . SauSaGe/beta
Enter fullscreen mode Exit fullscreen mode

This will build the package in ~/.conan/data directory, which will contain the source code as well as the executable file.

Releasing

I used GitLab for this step, which requires a GitLab account. I set up an account and created a project. After that, go to the project's page to obtain the project id. Now you can add your remote to your list of remotes in Conan run

conan remote add <remote-name> https://gitlab.com/api/v4/projects/<project-id>/packages/conan
Enter fullscreen mode Exit fullscreen mode

You also need to log in to to upload your package, this requires an access token, which can be found on GitLab in Edit Profile -> Access Tokens. After you create your access token, you can run this

conan user <gitlab-user> -r gitlab -p <access-token>
Enter fullscreen mode Exit fullscreen mode

With the remote in your list, and your GitLab account logged into, you can finally upload your package.

conan upload SauSaGe/1.0.0@SauSaGe/beta --all
Enter fullscreen mode Exit fullscreen mode

Released

My package is here, after a few hours of research.
To install using this package registry, create a SauSaGe directory containing a conanfile.txt file, the contents of which are

[requires]
SauSaGe/1.0.0@SauSaGe/beta

[generators]
make
Enter fullscreen mode Exit fullscreen mode

Then, install the package

 conan install SauSaGe --remote=<remote-name>
Enter fullscreen mode Exit fullscreen mode

I did not have to change much about my code to set it up for the package registry. Although I did need to install a variety of tools to go through the process. The whole process only added 2 files to my project.

Testing

I had a classmate test test the code through the package registry. There were some struggles due to having to install Python, Conan and CMake. There were also some issues with adding the applications to PATH environment variable in order to run all these tools through the command-line terminal. But overall, it went smoothly.

Top comments (0)