Metadata-Version: 2.1
Name: ccpm
Version: 0.0.1
Summary: Custom Cmake Package Manager - Trying to bring 'npm' and 'pip' vibes to C++ (or any cmake project)
Author-email: Daniel Brétema <byBretema@gmail.com>
License: M.IT License
        
        Copyright (c) 2024 Daniel Brétema
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Repository, https://github.com/byBretema/ccpm.git
Keywords: cmake,cpp,c++,package,manager,package-manager
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Build Tools
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: toml

# 📦 CCPM - Custom Cmake Package Manager

![CCPM Logo](https://i.imgur.com/A2KPcdK.jpeg)

🧑‍💻 Are you tired of watching time fade away as CMake recompiles Assimp for the sixth time today just because you had to do a rebuild of your own code?

🖖 Do you have your CMakeLists.txt full of `add_subdirectory` for code that is not yours?

```cmake
add_subdirectory(third_party/fmt)
find_package(fmt REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt)
```

⚡ **No worries, we’ve got the solution right here!**


## 🌊 Flow

### 🚀 Install the tool

```bash
pip install ccpm
```

### 📃 Define your dependencies

> The below example will install fmt, glfw and glm with custom defines.

Create a simple `ccpm.toml` ***in the same folder*** of main 'CMakeLists.txt' similar to this one:

```toml
[[git]]
repo_url = "https://github.com/fmtlib/fmt"
tag = "11.0.2"
defines = ["FMT_TEST=OFF", "FMT_DOC=OFF"]

[[git]]
repo_url = "https://github.com/glfw/glfw"
tag = "3.4"
defines = ["GLFW_BUILD_DOCS=OFF", "GLFW_BUILD_TESTS=OFF", "GLFW_BUILD_EXAMPLES=OFF"]

[[git]]
repo_url = "https://github.com/g-truc/glm"
tag = "1.0.1"
defines = ["GLM_BUILD_TESTS=OFF", "GLM_ENABLE_CXX_20=ON"]
```

### ✍️ On your CMake

```cmake
include(${CMAKE_SOURCE_DIR}/.ccpm/ccpm.cmake)  # This resolves modulepaths
add_executable(${AWESOME_TARGET} main.cpp)

# I'm working on simplify this stage but there is many differences between some packages
find_packge(fmt REQUIRED)
target_link_libraries(${AWESOME_TARGET} PRIVATE fmt::fmt)

# Goal syntax
include(${CMAKE_SOURCE_DIR}/.ccpm/ccpm.cmake)  # This will include the 'find_packge(fmt REQUIRED)'
target_link_libraries(${AWESOME_TARGET} PRIVATE ${CCPM_LINK_LIBRARIES})  # To include all of them
target_link_libraries(${AWESOME_TARGET} PRIVATE ${CCPM_LIB_fmt})         # For more granularity
```

### 🛠️ Donwload, Build and Install packages

```bash
ccpm -i   # To run download+build+install process (only needed if you change the .toml file)
ccpm -b   # Builds the main 'CMakeLists.txt' (by default in debug, add -r for release)
```


## 📝 Notes

#### This script assumes that you have the following commands installed:

- cmake
- git

#### In the roadmap:

- [x] Other *git* providers [^1]
- [ ] Add option to choose CMake Generator
- [ ] Automatic lib name and target gathering [^2]
- [ ] Zip files
- [ ] Others VCS like *SVN* or *Hg*

#### Lectures / Inspiration:

- [It's Time To Do CMake Right](https://pabloariasal.github.io/2018/02/19/its-time-to-do-cmake-right/)

- [CPM.cmake](https://github.com/cpm-cmake/CPM.cmake)

- [Bootstrap](https://github.com/corporateshark/bootstrapping)


[^1]: The first iteration was github only.
[^2]: For cases like glfw where its **find_package** is `glfw3` and its **link_library** is just `glfw` instead of `glfw::glfw` like the vast majority of the packages.

