This is the begining of cpm!

What is this?

cpm is short for C[++] Package Manager. Bellow I will describe why it is usefull and what this is all about.

Why should I care?

Right now it is kinda hard to ensure reproducible builds across various machines. There are many issues that prevent this:

  1. Dependencies
  2. Dependencies
  3. Platform-specific Issues

You might ask yourself why dependencies is listed twice? It’s because there are actually two dependencie issues here:

  1. Compilation
  2. Runtime

The first seems easy to solve with the tools we have today, like apt. The issue is that there are many different package managers across many different operating systems and distros. Each will serve a different or even modified version of a curtain library.

The second issue is even worse. While languages like go allow you to bundle everything in a singe executable, C/C++ does not do this automaticaly. I know, you will argue, that C/C++ allow static linking which solves this issue but you still need to get the libraries somewhere.

How will this solve any problems?

To solve any problem, we need to view cpm in two perspectives:

1. Build System

The current solutions (GNU Autotools or CMake) are great, don’t get me wrong here. But I think a modern build system should follow a few rules which are missing in the existing solutions (or are not that easy to do). So for cpm, there are the following general rules:

  1. Clean Source Tree: The source of your project should remain as clean as possible to make it easier to work with and to distribute it. All generated files should be stored in build/. For Example object files could be placed in build/obj/ while binaries could be stored in build/bin/ and so on.

  2. Multi Project Repositories: Unlike languages like PHP it is common in C/C++ that a repository contains multiple ‘projects’. This could mean a library and a cli utility to access the library.

  3. Incremental Builds: Object files should only be compiled if a dependency changes. This ensures higher build speeds for large projects. (You should note, that this feature is basically available in every build system out there)

  4. Local Dependencies: If your repository contains a binary project and a library project it should be easy to use the library in the binary project.

  5. System Checks: You should be able to define some stuff that you need from the system and/or the compiler (e.g. C++11).

  6. Basic Packaging Support: Distributing your package via package managers like apt or rpm or pacman requires the same work for every project. It would be nice if your build system would be able to do this for you!

2. Dependency Manager

The idea behind the package manager aspect of cpm is similar to the one from npm. There should be many small packages for curtain tasks so that you can include what you need. To fulfill the goals and solve the issues stated above it needs to follow these core rules:

  1. Reproducible: This means, that as soon as dependencies are resolved they will be written to a lock file which can be committed as well. If you install dependencies with cpm it should only perform the actions defined in the lock file. This ensures that you will get the exact same packages everywhere!

  2. Easy Integration: cpm should handle all packages automatically, this includes building them but does also mean that it will provide them in the same way as local packages.

  3. Clean Source Tree: Again it is important, that cpm will only ever download stuff into the vendor/ directory to ensure a clean source tree.

  4. Allow CLI Apps: It could be handy to distribute an binary project with your library (e.g. a cli client for you database). cpm should copy flagged projects to a special vendor/bin path.

What about Licenses/Costs?

cpm is open source and released under the MIT License which allows you to use cpm in almost every situation. If you have any issues with this License, please open an Issue, because it is our number one priority that cpm can be used everywhere!

Can I help?

Sure! And if you have some spare time and interest, please do so! Just take a look at out GitHub page!

Got any Questions?

Ask! Just open an Issue at GitHub or send me an E-Mail.