{"id":15136954,"url":"https://github.com/calbabreaker/yacpm","last_synced_at":"2025-10-23T11:32:06.334Z","repository":{"id":45884796,"uuid":"407734014","full_name":"Calbabreaker/yacpm","owner":"Calbabreaker","description":"Easy to use, fast, git sourced based, C/C++ package manager.","archived":false,"fork":false,"pushed_at":"2024-12-12T04:59:01.000Z","size":352,"stargazers_count":34,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-30T18:38:07.873Z","etag":null,"topics":["c","cmake","conan","cpp","git","library","library-manager","package","package-manager","python","vcpkg","yacpm"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Calbabreaker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-18T02:29:46.000Z","updated_at":"2024-12-12T04:59:05.000Z","dependencies_parsed_at":"2024-05-13T03:26:47.706Z","dependency_job_id":"b6f178bc-6afb-4696-b191-e4c1a3f9a662","html_url":"https://github.com/Calbabreaker/yacpm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Calbabreaker%2Fyacpm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Calbabreaker%2Fyacpm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Calbabreaker%2Fyacpm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Calbabreaker%2Fyacpm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Calbabreaker","download_url":"https://codeload.github.com/Calbabreaker/yacpm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237821690,"owners_count":19371809,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","cmake","conan","cpp","git","library","library-manager","package","package-manager","python","vcpkg","yacpm"],"created_at":"2024-09-26T06:42:07.197Z","updated_at":"2025-10-23T11:32:00.991Z","avatar_url":"https://github.com/Calbabreaker.png","language":"Python","readme":"# Yet Another C/C++ Package Manager\n\nEasy to use, fast, git sourced based, C/C++ package manager.\n\n## Features\n\n-   No need to install a program, just include the cmake file\n-   Can specify other libraries not in default package remote\n-   Package code is in project directory making it easily accessible\n-   Able to specify any git tag, commit or branch of the package\n-   Only fetches required files unlike getting source which takes less time and bandwidth to get packages\n\n## Requirements\n\n-   Python \u003e= 3.6\n-   Cmake \u003e= 3.12\n-   Git \u003e= 2.27\n\n## Usage\n\nSee [example](./example/) for a full example.\n\nIn the project directory create a `yacpm.json` file and add the required\npackages in the `packages` field as an object with the key being the\npackage name and value being the version (commit hash/tag/branch of repository)\nor an object having the version field:\n\n```json\n{\n    \"packages\": {\n        \"glfw\": \"3.3.4\",\n        \"entt\": \"5b4ff74674063cdbc82a62ade4f5561061444013\",\n        \"imgui\": {\n            \"version\": \"docking\"\n        }\n    }\n}\n```\n\nIf a branch is specified, it will be automatically converted to a commit hash\n(to prevent code from suddenly breaking) unless there's a + at the front. For\nexample, `master` will be converted to\n`3f786850e387550fdab836ed7e6dc881de23001b` but not `+master`. If the version is\nan empty string yacpm will use the default branch of the repository which will\nthen be converted and saved as a commit. Setting the version to just `+` will\nwrite `+` plus the default branch and setting `++` will use the default branch\nwithout saving the default branch.\n\nNow add this to the top level CMakeLists.txt:\n\n```cmake\nif(NOT EXISTS \"${CMAKE_BINARY_DIR}/yacpm.cmake\")\n    # Uses v3 of yacpm, where each vN is a new major version\n    file(DOWNLOAD \"https://github.com/Calbabreaker/yacpm/raw/v3/yacpm.cmake\" \"${CMAKE_BINARY_DIR}/yacpm.cmake\")\nendif()\n\ninclude(${CMAKE_BINARY_DIR}/yacpm.cmake)\n```\n\nNow use the library in the project as a target (include directories are automatically set):\n\n```cmake\n# all of them in yacpm.json\ntarget_link_libraries(${PROJECT_NAME} PRIVATE ${YACPM_PACKAGES})\n\n# only specific ones\ntarget_link_libraries(${PROJECT_NAME} PRIVATE glfw imgui)\n```\n\nThen run cmake:\n\n```sh\nmkdir build\ncd build\ncmake ..\n```\n\nYacpm will download the package metadata (`yacpkg.json` and `CMakeLists.txt`)\nand the package code using git sparse-checkout putting it all into a folder named\nthe package name in `yacpkgs/`.\n\nYou can also include or ignore other folders from being fetched (as an array in gitignore syntax).\n\n```json\n{\n    \"packages\": {\n        \"imgui\": {\n            \"version\": \"docking\",\n            \"include\": [\"/backends\", \"!/backends/imgui_impl_dx9.*\"]\n        }\n    }\n}\n```\n\nSet the repository and cmake (a file relative to yacpm.json or url) fields to\noverride the repository and CMakeLists.txt in the default remote. Use both of those\nfields to use a library that doesn't exist in the default remote like so:\n\n```json\n{\n    \"packages\": {\n        \"weird-library\": {\n            \"version\": \"c8fed00eb2e87f1cee8e90ebbe870c190ac3848c\",\n            \"repository\": \"https://github.com/RandomUser/weird-library\",\n            \"cmake\": \"lib/weird-library.cmake\",\n            \"include\": [\"/src\", \"/include\"]\n        }\n    }\n}\n```\n\nYou can also configure the package by setting cmake variables (useing CACHE FORCE\nexcept for `BUILD_SHARED_LIBS` and `CMAKE_BUILD_TYPE`) by having a variables\nobject like this (this is how you configure glad):\n\n```json\n{\n    \"packages\": {\n        \"glad\": {\n            \"version\": \"71b2aa61f1f0ae94be5f2a7674275966aa15f8ad\",\n            \"variables\": { \"GLAD_PROFILE\": \"core\", \"GLAD_API\": \"gl=3.2\" }\n        }\n    }\n}\n```\n\nSetting `BUILD_SHARED_LIBS` variable to true will link the library dynamically\nand setting it globally in the top level CMakeLists.txt will link all the\nlibraries libraries dynamically. You might have to do a clean build before\nbuilding in order for it to build a dynamic link library.\n\nThe potential dependency packages that are downloaded by a yacpm package will be placed into\n(or moved from `packages`) the `dependency_packages` field so you can\nconfigure the package as needed like modifying the version in case the version\nprovived by the package is incompatible with other packages or if you\nneed to use that package with a specific configuration.\nThe `dependents` field inside the dependency package is there to show you all\nthe dependents as well as to delay fetching the dependency until all its dependents are\nfetched.\n\n```json\n{\n    \"packages\": {\n        \"yacpm_library_test\": {\n            \"version\": \"+main\",\n            \"repository\": \"https://github.com/Calbabreaker/yacpm-library-test\"\n        }\n    },\n    \"dependency_packages\": {\n        \"glm\": {\n            \"version\": \"+main\",\n            \"variables\": {\n                \"TEST\": true\n            },\n            \"dependents\": [\"yacpm_library_test\"]\n        }\n    }\n}\n```\n\n## Additional Options\n\nYou can log all commands and their output by setting verbose to true in `yacpm.json`:\n\n```json\n{\n    \"verbose\": true\n}\n```\n\nYou can set a different package repository (default is [packages](./packages))\nas either a url or local directory to download from by setting remote as an\narray in `yacpm.json`. It will try every remote starting from the first one and\nDEFAULT_REMOTE can be use as alias to the default remote:\n\n```json\n{\n    \"remotes\": [\"https://example.com/packages\", \"./packages\", \"DEFAULT_REMOTE\"]\n}\n```\n\nThere is also a [yacpm_extended.cmake](./yacpm_extended.cmake) file that\ncontains nice cmake utilities that you can use by doing:\n\n```cmake\ninclude(${CMAKE_BINARY_DIR}/yacpm.cmake)\nyacpm_use_extended() # run after including yacpm.cmake\n```\n\nThis contains a `yacpm_target_warnings(\u003ctarget_list\u003e [visibility=PRIVATE])` function\nthat sets strict warnings for a target. You can remove a warning by removing\nitems from the `YACPM_WARNINGS` list (eg. `list(REMOVE_ITEM YACPM_WARNINGS -Wshadow)`). It also enables\n[ccache](https://ccache.dev/) or [sccache](https://github.com/mozilla/sccache), exports\n`compile_commands.json` for language servers, puts executables into\n`build/bin`, and sets `CMAKE_BUILD_TYPE` to `Debug` if it's not set.\n\n## Testing\n\nRun [tests/run_tests.py](./tests/run_tests.py) to run tests in the\n[tests](./tests) folder. Run\n`python3 tests/run_tests.py -h` for more information. This will also be ran with\ngithub-actions. Each test is a like an integration test test that tests yacpm as a whole.\n\n## Adding a new package\n\nCreate a new directory in [packages](./packages) directory with the name being\nthe package name. This name must be in kebab-case. Make a `yacpkg.json`\nfile with the repository of the package and directories to fetch from the\nrepository. The repository can be any git repository but the git server has\nto support sparse-checkout and filter fetches which github does. Set the packages field\nlike in yacpm.json get any yacpm package (version should be an empty string\nmost of the time) that are needed for that package. Only use this if the\nrepository does not contain the dependency package.\n\n```json\n{\n    \"repository\": \"https://github.com/bkaradzic/bgfx\",\n    \"include\": [\"/3rdparty/webgpu\", \"/include\", \"/src\"],\n    \"packages\": { \"bimg\": \"\" }\n}\n```\n\nNow make a `CMakeLists.txt` in that directory. The file should be as versatile\nas possible (work on as many versions) meaning add_subdirectory should be used\n(unless it's simple or the CMakeListst.txt is really complex or doesn't exist)\nand all files should be globed. If the library target name is not in kebab-case, do\n`add_library(library_name ALIAS LibaryName)`. The config doesn't have to work\non very old versions. Also use system headers for include directories to avoid\ncompiler warnings from the library header.\n\n#### Example for GLFW:\n\n```cmake\nset(GLFW_BUILD_DOCS OFF CACHE BOOL \"\" FORCE)\nset(GLFW_BUILD_EXAMPLES OFF CACHE BOOL \"\" FORCE)\nset(GLFW_BUILD_TESTS OFF CACHE BOOL \"\" FORCE)\nset(GLFW_INSTALL OFF CACHE BOOL \"\" FORCE)\n\nadd_subdirectory(repository)\n```\n\n#### Example for spdlog:\n\n```cmake\nfile(GLOB_RECURSE SPDLOG_SOURCES repository/src/*.cpp repository/include/*.h)\nadd_library(spdlog ${SPDLOG_SOURCES})\n\n# system headers like this\ntarget_include_directories(spdlog SYSTEM PUBLIC repository/include)\ntarget_compile_definitions(spdlog PRIVATE SPDLOG_COMPILED_LIB)\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalbabreaker%2Fyacpm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcalbabreaker%2Fyacpm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalbabreaker%2Fyacpm/lists"}