# pycmake **Repository Path**: yhyu13/pycmake ## Basic Information - **Project Name**: pycmake - **Description**: python cmake interface to generate cmake files based only .cmake.py files - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-02-09 - **Last Updated**: 2025-07-10 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # PyCMake : OOP CMake wrapper in python ## Overview pycamke is a simple wrapper for cmake that helps describe cmake objects in a object oriented manner. Required Python>=3.7 ## Install ### Local install To be able to debug the code, you can install the package in editable mode. ``` pip uninstall pycamke pip install -e . ``` ### Wheel install To build a wheel, run the following command: ``` pip uninstall pycamke pip install build wheel rm -rf ./dist python -m build --wheel . pip install ./dist/*.whl ``` or simply run `./install_wheel.sh` ### Release on gitee PyCmake is available to install from gitee release https://gitee.com/yhyu13/pycmake.git ## Project Initiative The problem with using CMake scripts (IMO): In CMake, you can write add_compilation_definitions() for global compile macros, and target_compilation_definitions() for compile macros for specific targets. So you need to remember to not overlaop global and target compile macros. This is an example of a potential erroneous scope management. And for the above task, you kind of want to use procedural language to manage the relationship between different object (object oriented programming, specifically). But CMake is declarative. It is just a Domain Specific Markup language that cope with the complexity of building software packages. And markup languages are not good desgined describing the flow of execution, they just give a meaningful strcuture for plain text, just like XML, HTML, YAML, etc. So my goal is to bound CMake by enforcing user to use a procedural language to manage the flow of underlying CMake in a object orientated way. That's why I use Python to write a CMake wrapper that describe `Project`, `Module`, `Packages`, etc and their relationships. And the python package only describe a handy subset of CMake commands. ## Features - Function - Project - Module - Fetch content - Find Package ## Usage Examples: 1. https://github.com/yhyu13/HLVM-Engine 2. [GenerateProject.sh](https://github.com/yhyu13/HLVM-Engine/blob/c163c623a360cf214fe1ef8c0bee5a4a1691b39f/GenerateCMakeProjects.sh) 3. [.cmake.py](https://github.com/yhyu13/HLVM-Engine/blob/c163c623a360cf214fe1ef8c0bee5a4a1691b39f/Engine/Source/Common/Common.cmake.py)