• Stars
    star
    159
  • Rank 235,916 (Top 5 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created about 5 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

πŸ’… Stylize your code! Automatic clang-format and cmake-format targets for CMake.

Actions Status Actions Status

Format.cmake

clang-format and cmake-format for CMake

About

Format.cmake adds three additional targets to your CMake project.

  • format Shows which files are affected by clang-format
  • check-format Errors if files are affected by clang-format (for CI integration)
  • fix-format Applies clang-format to all affected files

To run the targets, invoke CMake with cmake --build <build directory> --target <target name>.

To disable using cmake_format to format CMake files, set the cmake option FORMAT_SKIP_CMAKE to a truthy value, e.g. by invoking CMake with -DFORMAT_SKIP_CMAKE=YES, or enabling the option when adding the dependency (recommended).

Demo

How to integrate

Using CPM.cmake (recommended)

Basic configuration

After adding CPM.cmake, add the following line to the project's CMakeLists.txt after calling project(...).

include(cmake/CPM.cmake)
CPMAddPackage("gh:TheLartians/[email protected]")

Advanced configuration

This package supports optional parameters that you can specify in the CPM.cmake OPTIONS argument.

CPMAddPackage(
  NAME Format.cmake
  VERSION 1.7.3
  GITHUB_REPOSITORY TheLartians/Format.cmake
  OPTIONS 
      # set to yes skip cmake formatting
      "FORMAT_SKIP_CMAKE NO"
      # path to exclude (optional, supports regular expressions)
      "CMAKE_FORMAT_EXCLUDE cmake/CPM.cmake"
)

Using git submodules (not suited for libraries)

Run the following from the project's root directory.

git submodule add https://github.com/TheLartians/Format.cmake

In add the following lines to the project's CMakeLists.txt after calling project(...).

add_subdirectory(Format.cmake)

Dependencies

Format.cmake requires CMake, clang-format, python 2.7 or python 3, and cmake-format (optional).

More Repositories

1

ModernCppStarter

πŸš€ Kick-start your C++! A template for modern C++ projects using CMake, CI, code coverage, clang-format, reproducible dependency management and much more.
CMake
4,417
star
2

PEGParser

πŸ’‘ Build your own programming language! A C++17 PEG parser generator supporting parser combination, memoization, left-recursion and context-dependent grammars.
C++
240
star
3

modern-wasm-starter

πŸ›Έ Run C++ code on web and create blazingly fast websites! A starter template to easily create WebAssembly packages using type-safe C++ bindings with automatic TypeScript declarations.
TypeScript
239
star
4

EasyIterator

πŸƒ Iterators made easy! Zero cost abstractions for designing and using C++ iterators.
C++
138
star
5

Observe

πŸ“£ Hey listen! A simple general-purpose event-listener system for C++17.
CMake
126
star
6

PackageProject.cmake

πŸ›οΈ Help other developers use your project. A CMake script for packaging C/C++ projects for simple project installation while employing best-practices for maximum compatibility.
CMake
103
star
7

MiniCppStarter

🧸 A tiny single-file version of the ModernCppStarter project for exploring libraries or playing with C++ code. Reproducible dependency management included, so the code will work the same everywhere.
CMake
75
star
8

StaticTypeInfo

πŸ€ Up your type-game. A small C++ library for compile-time type names and type indices.
CMake
70
star
9

Ccache.cmake

πŸš… Compile faster with Ccache! A Ccache integration for CMake with Xcode support.
CMake
58
star
10

Glue

⛓️ Bindings that stick. A simple and generic API for C++ to other language bindings supporting bidirectional communication, inheritance and automatic declarations.
C++
56
star
11

TypeScriptXX

🧷 Stay safe! Type-safe scripting for C++ using TypeScriptToLua and CMake with auto-generated declarations.
CMake
40
star
12

GroupSourcesByFolder.cmake

Automatically group sources by folder structure for Visual Studio/Xcode generators
CMake
32
star
13

BitLens

πŸ”Ž Have your bits and eat them too! A C++17 bit lens container for vector types.
C++
21
star
14

EmGlue

πŸ•ΈοΈ Glue C++ to your browser! Universal bindings for JavaScript/Wasm using Glue and Embind.
C++
21
star
15

StaticHash

Constexpr hash functions for C++
C++
18
star
16

substitute

🍿Enjoy the the big screen! Watch and synchronise subtitles externally in any browser. On mobile and desktop.
TypeScript
16
star
17

TypeScript2Python

πŸšƒ Transpile TypeScript types to Python! A TypeScript to Python type transpiler.
TypeScript
15
star
18

Revisited

πŸ§‘β€πŸ€β€πŸ§‘ The visitor pattern revisited. An inheritance-aware acyclic visitor template, any and any-function templates.
C++
15
star
19

react-native-simple-transition

🌠 An easy to use transition component for React Native
Java
13
star
20

Generator

A generator class emulating coroutines' yield functionality through std::thread
C++
9
star
21

PyPropagate

A paraxial wave propagation framework for python
Jupyter Notebook
5
star
22

NDArray

[legacy project] A fast n-dimensional array template for C++
C++
5
star
23

LuaGlue

Lua bindings for the Glue library
C++
4
star
24

LHC

[legacy project] Some single-header helper libraries I use in some projects
C++
4
star
25

IndexSet

A class for manipulating large sets of indices with optimal performance and memory use
CMake
3
star
26

denon-cli

A simple command line interface for controlling Denon AVR receivers.
JavaScript
2
star
27

Presentations

https://thelartians.github.io/Presentations
JavaScript
2
star
28

Saphira

Our submission for the #WirVsVirus Hackathron: https://youtu.be/OWfDj2fOfVk | https://thelartians.github.io/Saphira/
TypeScript
2
star
29

NDArrayOld

A fast n-dimensional array template for c++
C++
2
star
30

Lars

A cmake enabled git-submodule collection of my C++ toolbox
C++
1
star
31

advent-of-code-2020

β˜ƒοΈπŸŽ„πŸ‘¨β€πŸ’» Solving Advent of Code 2020 in Rust πŸ¦€
Rust
1
star