Easy to use, fast, git sourced based, C/C++ package manager.

Overview

Yet Another C/C++ Package Manager

Easy to use, fast, git sourced based, C/C++ package manager.

Features

  • No need to install a program, just include the cmake file
  • Can specify other libraries not in default package remote
  • Package code is in project directory making it easily accessible
  • Only fetches required files (using git sparse-checkout) which takes less time and bandwidth to get packages (unlike git submodules)

Requirements

  • Python >= 3.5
  • Cmake >= 3.12
  • Git >= 2.27

Usage

See example for a full example.

In the project directory create a yacpm.json file and add the required packages in there in the packages field as an object with the key being the library name and value being the version (commit hash/tag/branch of repository) or an object having the version field:

{
    "packages": {
        "glfw": "3.3.4",
        "entt": "master",
        "imgui": {
            "version": "c58fb464113435fdb7d122fde87cef4920b3d2c6"
        }
    }
}

If a branch is specified, it will be automatically converted to a commit hash (to prevent code from suddenly breaking) unless there's a + at the front. For example, master will be converted to 3f786850e387550fdab836ed7e6dc881de23001b but not +master. If no version is specified at all (empty string), it will use the default branch of the repository which will then be converted a commit and saved to yacpm.json. Using + will use the default branch and saved to yacpm.json (unless ++ is used) but it will not convert it to a commit.

Now add this to the top level CMakeLists.txt:

if(NOT EXISTS "${CMAKE_BINARY_DIR}/yacpm.cmake")
    # uses v1 of yacpm, replace the v1 with v2, v3, etc. to use a different version. See https://github.com/Calbabreaker/yacpm#branches
    file(DOWNLOAD "https://github.com/Calbabreaker/yacpm/raw/v1/yacpm.cmake" "${CMAKE_BINARY_DIR}/yacpm.cmake")
endif()

include(${CMAKE_BINARY_DIR}/yacpm.cmake)

Now use the library in the project (all libraries names are snake_case) as a target (include directories are automatically set):

# all of them in yacpm.json
target_link_libraries(${PROJECT_NAME} ${YACPM_PKGS})

# only specific ones
target_link_libraries(${PROJECT_NAME} glfw imgui)

Then run cmake:

mkdir build
cd build
cmake ..

Yacpm will download the yacpkg.json file for the library, the files and directories specified in yacpkg.json and the necessary CMakeLists.txt putting it all into a directory named the package name in the yacpkgs directory.

You can also include or disinclude other folders (array or string) to be fetched (in gitignore syntax):

{
    "packages": {
        "imgui": {
            "version": "docking",
            "include": ["/backends", "!/backends/imgui_impl_dx9.*"]
        }
    }
}

If the library doesn't exist in the remote then specify a repository and a CMakeLists.txt (file relative to yacpm.json or a url) that makes a target with the name matching the package name for that library like so:

{
    "packages": {
        "weird-library": {
            "version": "c8fed00eb2e87f1cee8e90ebbe870c190ac3848c",
            "repository": "https://github.com/RandomUser/weird-library",
            "cmake": "lib/weird-library.cmake",
            "include": ["/src", "/include"]
        }
    }
}

You can also configure the package by setting cmake variables (uses CACHE FORCE) by having a variables object like this (this is how you configure glad):

{
    "packages": {
        "glad": {
            "version": "71b2aa61f1f0ae94be5f2a7674275966aa15f8ad",
            "variables": { "GLAD_PROFILE": "core", "GLAD_API": "gl=3.2" }
        }
    }
}

Setting BUILD_SHARED_LIBS variable to true will link the library dynamically or setting it globally will link all the libraries libraries dynamically. Note you might have to remove build/CMakeCache.txt in order for it to actually work.

There might also be a README.md in the packages remote directory that contains notes on the package.

Additional Options

You can log everything by setting verbose to true in yacpm.json:

{
    "verbose": true
}

You can set a different package repository (default is packages) as either a url or local directory to download from by setting remote in yacpm.json. This can be an array or string (yacpm will try to use first ones first) and DEFAULT_REMOTE can be use as alias to the default remote:

{
    "remote": ["https://example.com/packages", "./packages", "DEFAULT_REMOTE"]
}

There is also a yacpm_extended.cmake file that contains nice cmake utilities that you can use by doing:

include(${CMAKE_BINARY_DIR}/yacpm.cmake)
yacpm_use_extended() # run after including yacpm.cmake

This contains a yacpm_target_warnings(target visibility) function that takes in a target and a visibility (PUBLIC, PRIVATE, INTERFACE) and sets strict warnings for that target. It also enables ccache or sccache, exports compile_commands.json (for language servers), and puts executables into build/bin.

Testing

Run the run_tests.py to run tests in the tests folder (specified by cli args) or all of them by default. Run python3 tests/run_test.py -h for more information. This will also be ran with github-actions. Each tests are like integration tests that tests features in yacpm to make sure nothing breaks for users.

Adding a new package

Create a new directory in packages directory with the name being the package name. This name must be in snake_case. Make a yacpkg.json file with the repository of the package and directories to fetch from the repository. The repository can be any git repository but it has to support sparse-checkout and filter fetches which github does.

{
    "repository": "https://github.com/ocornut/imgui",
    "include": ["/*.cpp", "/*.h"]
}

Now make a CMakeLists.txt in that directory. The file should be versatile as possible (work on as many versions) meaning add_subdirectory should be used (unless it's simple like glm) and all files should be globed. If the library target name is not in snake_case, do add_library(library_name ALIAS LibaryName). It doesn't have to work on very old versions, just at least 2 years. Also use system headers for include directories to avoid compiler warnings from the library header.

Example for GLFW:

set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_INSTALL OFF CACHE BOOL "" FORCE)

add_subdirectory(repository)

Example for spdlog:

file(GLOB_RECURSE SPDLOG_SOURCES repository/src/*.cpp repository/include/*.h)
add_library(spdlog ${SPDLOG_SOURCES})

# system headers like this
target_include_directories(spdlog SYSTEM PUBLIC repository/include)
target_compile_definitions(spdlog PRIVATE SPDLOG_COMPILED_LIB)

Now add the package to tests/all_packages/yacpm.json to test if the package was configured correctly. Put package the package in tests/all_packages_other/yacpm.json if the package conflicts with other ones in yacpm. Then include the package header file and function call that's statically linked (if not package is not header only) in the corresponding main.cpp file. Make sure the package in yacpm.json and function call is in alphabetical order.

After everything has been tested, submit a pull request to the main branch to have the package be in the default remote.

Branches

The main branch contains the most recent commits where the latest potentially breaking changes come in so it shouldn't be used. The vN (v1, v2, etc.) branches are stable and should be used. Every time there is change that is incompatible with previous yacpm.json specifications the version number will be incremented.

Issues
  • Doesn't work for environments where Python is installed as `python`

    Doesn't work for environments where Python is installed as `python`

    On Windows, Python is referred to as python and python3 is not found. Can you please change this so I can use what should be a cross-platform tool. Just add a check to see if python3 is defined and if not try python.

    bug 
    opened by That-Cool-Coder 1
  • Fix subprocess running

    Fix subprocess running

    Running the subprocess for printing should work fine, even with paths containing spaces.

    opened by That-Cool-Coder 1
  • Add raylib-cpp

    Add raylib-cpp

    Read the title

    enhancement 
    opened by That-Cool-Coder 1
  • V1

    V1

    null

    opened by Calbabreaker 0
  • Clean up yacpm.py

    Clean up yacpm.py

    The code should still function the same way but the file is more readable

    opened by That-Cool-Coder 0
  • Add thor and aurora

    Add thor and aurora

    Added these two libs.

    Thor is an SFML extension.

    Not sure what Aurora is but it's a dependency of Thor so ok.

    opened by That-Cool-Coder 0
Owner
I am a programmer and stuff.
null
Package manager based on libdnf and libsolv. Replaces YUM.

Dandified YUM Dandified YUM (DNF) is the next upcoming major version of YUM. It does package management using RPM, libsolv and hawkey libraries. For m

null 923 Nov 28, 2021
OS-agnostic, system-level binary package manager and ecosystem

Conda is a cross-platform, language-agnostic binary package manager. It is the package manager used by Anaconda installations, but it may be used for

Conda 4.4k Nov 24, 2021
OS-agnostic, system-level binary package manager and ecosystem

Conda is a cross-platform, language-agnostic binary package manager. It is the package manager used by Anaconda installations, but it may be used for

Conda 4.4k Nov 26, 2021
Conan - The open-source C/C++ package manager

Conan Decentralized, open-source (MIT), C/C++ package manager. Homepage: https://conan.io/ Github: https://github.com/conan-io/conan Docs: https://doc

Conan.io 5.4k Dec 2, 2021
A flexible package manager that supports multiple versions, configurations, platforms, and compilers.

Spack Spack is a multi-platform package manager that builds and installs multiple versions and configurations of software. It works on Linux, macOS, a

Spack 2.4k Nov 24, 2021
[DEPRECATED] YUM package manager

⛔ This project is deprecated. Please use DNF, the successor of YUM. YUM Yum is an automatic updater and installer for rpm-based systems. Included prog

null 97 Nov 11, 2021
The delightful package manager for AppImages

⚡️ Zap The delightful package manager for AppImages Report bug · Request feature Looking for the older Zap v1 (Python) implementation? Head over to v1

Srevin Saju 148 Nov 29, 2021
:package: :fire: Python project management. Manage packages: convert between formats, lock, install, resolve, isolate, test, build graph, show outdated, audit. Manage venvs, build package, bump version.

THE PROJECT IS ARCHIVED Forks: https://github.com/orsinium/forks DepHell -- project management for Python. Why it is better than all other tools: Form

DepHell 1.7k Nov 17, 2021
Python dependency management and packaging made easy.

Poetry: Dependency Management for Python Poetry helps you declare, manage and install dependencies of Python projects, ensuring you have the right sta

Poetry 17.2k Nov 23, 2021
Python dependency management and packaging made easy.

Poetry: Dependency Management for Python Poetry helps you declare, manage and install dependencies of Python projects, ensuring you have the right sta

Poetry 17.3k Dec 2, 2021
The Python Package Index

Warehouse Warehouse is the software that powers PyPI. See our development roadmap, documentation, and architectural overview. Getting Started You can

Python Packaging Authority 2.8k Nov 26, 2021
The Python package installer

pip - The Python Package Installer pip is the package installer for Python. You can use pip to install packages from the Python Package Index and othe

Python Packaging Authority 7.6k Dec 1, 2021
A Poetry plugin for dynamically extracting the package version.

Poetry Version Plugin A Poetry plugin for dynamically extracting the package version. It can read the version from a file __init__.py with: # __init__

Sebastián Ramírez 161 Nov 27, 2021
PokerFace is a Python package for various poker tools.

PokerFace is a Python package for various poker tools. The following features are present in PokerFace... Types for cards and their componen

Juho Kim 4 Sep 25, 2021
pipreqs - Generate pip requirements.txt file based on imports of any project. Looking for maintainers to move this project forward.

pipreqs - Generate requirements.txt file for any project based on imports Installation pip install pipreqs Usage Usage: pipreqs [options] <path>

Vadim Kravcenko 3.8k Dec 2, 2021
Tiny Git is a simplified version of Git with only the basic functionalities to gain better understanding of git internals.

Tiny Git is a simplified version of Git with only the basic functionalities to gain better understanding of git internals. Implemented Functi

Ahmed Ayman 2 Oct 15, 2021
git-partial-submodule is a command-line script for setting up and working with submodules while enabling them to use git's partial clone and sparse checkout features.

Partial Submodules for Git git-partial-submodule is a command-line script for setting up and working with submodules while enabling them to use git's

Nathan Reed 7 Oct 12, 2021
A terminal tool for git. When we use git, do you feel very uncomfortable with too long commands

PIGIT A terminal tool for git. When we use git, do you feel very uncomfortable with too long commands. For example: git status --short, this project c

Zachary 0 Nov 19, 2021
An OpenSource crowd-sourced cooking recipes website

An OpenSource crowd-sourced cooking recipes website

null 17 Nov 20, 2021
This is the main repository of open-sourced speech technology by Huawei Noah's Ark Lab.

Speech-Backbones This is the main repository of open-sourced speech technology by Huawei Noah's Ark Lab. Grad-TTS Official implementation of the Grad-

HUAWEI Noah's Ark Lab 105 Nov 23, 2021
frwk_51pwn is an open-sourced remote vulnerability testing and proof-of-concept development framework

frwk_51pwn Legal Disclaimer Usage of frwk_51pwn for attacking targets without prior mutual consent is illegal. frwk_51pwn is for security testing purp

51pwn 3 Nov 1, 2021
Installer, package manager, build wrapper and version manager for Piccolo

Piccl Installer, package manager, build wrapper and version manager for Piccolo

null 1 Nov 25, 2021
Git Plan - a better workflow for git

git plan A better workflow for git. Git plan inverts the git workflow so that you can write your commit message first, before you start writing code.

Rory Byrne 165 Nov 9, 2021
git-cola: The highly caffeinated Git GUI

git-cola: The highly caffeinated Git GUI git-cola is a powerful Git GUI with a slick and intuitive user interface. Copyright (C) 2007-2020, David Agu

git-cola 1.8k Nov 22, 2021
git git《Transformer Meets Tracker: Exploiting Temporal Context for Robust Visual Tracking》(CVPR 2021) GitHub:git2] 《Masksembles for Uncertainty Estimation》(CVPR 2021) GitHub:git3]

Transformer Meets Tracker: Exploiting Temporal Context for Robust Visual Tracking Ning Wang, Wengang Zhou, Jie Wang, and Houqiang Li Accepted by CVPR

NingWang 188 Nov 25, 2021
🤗 The largest hub of ready-to-use NLP datasets for ML models with fast, easy-to-use and efficient data manipulation tools

?? The largest hub of ready-to-use NLP datasets for ML models with fast, easy-to-use and efficient data manipulation tools

Hugging Face 11.4k Dec 2, 2021
This is a Cross-Platform Plot Manager for Chia Plotting that is simple, easy-to-use, and reliable.

Swar's Chia Plot Manager A plot manager for Chia plotting: https://www.chia.net/ Development Version: v0.0.1 This is a cross-platform Chia Plot Manage

Swar Patel 1.3k Nov 21, 2021
The Fast Cross-Platform Package Manager

The Fast Cross-Platform Package Manager part of mamba-org Package Manager mamba Package Server quetz Package Builder boa mamba Mamba is a reimplementa

Mamba 2.4k Nov 23, 2021
A fast and easy to use, moddable, Python based Minecraft server!

PyMine PyMine - The fastest, easiest to use, Python-based Minecraft Server! Features Note: This list is not always up to date, and doesn't contain all

PyMine 79 Nov 23, 2021