-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 87de9ef
Showing
25 changed files
with
5,618 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
# SPDX-License-Identifier: MIT | ||
# | ||
# Copyright (c) 2023 Intercreate, Inc. | ||
# Author: J.P. Hutchins <[email protected]> | ||
# | ||
# Python(black)-inspired .clang-format for C repositories | ||
# | ||
# Includes Zephyr and Arm macro compatibility | ||
|
||
--- | ||
BasedOnStyle: Google | ||
|
||
AlignAfterOpenBracket: BlockIndent | ||
AlignEscapedNewlines: DontAlign | ||
AlignTrailingComments: false | ||
AllowAllArgumentsOnNextLine: true | ||
AllowAllParametersOfDeclarationOnNextLine: true | ||
AllowShortBlocksOnASingleLine: Never | ||
AllowShortCaseLabelsOnASingleLine: false | ||
AllowShortEnumsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: Empty | ||
AllowShortIfStatementsOnASingleLine: Never | ||
AllowShortLoopsOnASingleLine: false | ||
AttributeMacros: | ||
- __aligned | ||
- __deprecated | ||
- __packed | ||
- __printf_like | ||
- __syscall | ||
- __syscall_always_inline | ||
- __subsystem | ||
BinPackArguments: false | ||
BinPackParameters: false | ||
BraceWrapping: | ||
AfterCaseLabel: false | ||
AfterClass: false | ||
AfterControlStatement: MultiLine | ||
AfterEnum: false | ||
AfterFunction: false | ||
AfterNamespace: false | ||
AfterObjCDeclaration: false | ||
AfterStruct: false | ||
AfterUnion: false | ||
AfterExternBlock: false | ||
BeforeCatch: false | ||
BeforeElse: false | ||
IndentBraces: false | ||
SplitEmptyFunction: false | ||
SplitEmptyRecord: false | ||
SplitEmptyNamespace: false | ||
BeforeLambdaBody: false | ||
BeforeWhile: false | ||
BitFieldColonSpacing: After | ||
BreakBeforeBinaryOperators: NonAssignment | ||
BreakBeforeBraces: Custom | ||
BreakStringLiterals: true | ||
ColumnLimit: 100 | ||
DerivePointerAlignment: false | ||
ForEachMacros: | ||
- 'FOR_EACH' | ||
- 'FOR_EACH_FIXED_ARG' | ||
- 'FOR_EACH_IDX' | ||
- 'FOR_EACH_IDX_FIXED_ARG' | ||
- 'FOR_EACH_NONEMPTY_TERM' | ||
- 'RB_FOR_EACH' | ||
- 'RB_FOR_EACH_CONTAINER' | ||
- 'SYS_DLIST_FOR_EACH_CONTAINER' | ||
- 'SYS_DLIST_FOR_EACH_CONTAINER_SAFE' | ||
- 'SYS_DLIST_FOR_EACH_NODE' | ||
- 'SYS_DLIST_FOR_EACH_NODE_SAFE' | ||
- 'SYS_SFLIST_FOR_EACH_CONTAINER' | ||
- 'SYS_SFLIST_FOR_EACH_CONTAINER_SAFE' | ||
- 'SYS_SFLIST_FOR_EACH_NODE' | ||
- 'SYS_SFLIST_FOR_EACH_NODE_SAFE' | ||
- 'SYS_SLIST_FOR_EACH_CONTAINER' | ||
- 'SYS_SLIST_FOR_EACH_CONTAINER_SAFE' | ||
- 'SYS_SLIST_FOR_EACH_NODE' | ||
- 'SYS_SLIST_FOR_EACH_NODE_SAFE' | ||
- '_WAIT_Q_FOR_EACH' | ||
- 'Z_FOR_EACH' | ||
- 'Z_FOR_EACH_ENGINE' | ||
- 'Z_FOR_EACH_EXEC' | ||
- 'Z_FOR_EACH_FIXED_ARG' | ||
- 'Z_FOR_EACH_FIXED_ARG_EXEC' | ||
- 'Z_FOR_EACH_IDX' | ||
- 'Z_FOR_EACH_IDX_EXEC' | ||
- 'Z_FOR_EACH_IDX_FIXED_ARG' | ||
- 'Z_FOR_EACH_IDX_FIXED_ARG_EXEC' | ||
- 'Z_GENLIST_FOR_EACH_CONTAINER' | ||
- 'Z_GENLIST_FOR_EACH_CONTAINER_SAFE' | ||
- 'Z_GENLIST_FOR_EACH_NODE' | ||
- 'Z_GENLIST_FOR_EACH_NODE_SAFE' | ||
- 'STRUCT_SECTION_FOREACH' | ||
- 'TYPE_SECTION_FOREACH' | ||
IfMacros: | ||
- 'CHECKIF' | ||
- '_IC_M_IF' | ||
- '_IC_M_IF_ELSE' | ||
IndentCaseBlocks: true | ||
IndentCaseLabels: false | ||
IndentWidth: 4 | ||
MacroBlockBegin: '(_IC_M_IF|_IC_M_IF_ELSE)' | ||
MaxEmptyLinesToKeep: 2 | ||
PointerAlignment: Middle | ||
SortIncludes: CaseSensitive | ||
SpaceBeforeParens: ControlStatementsExceptControlMacros | ||
UseTab: Never | ||
WhitespaceSensitiveMacros: | ||
- STRINGIFY | ||
- Z_STRINGIFY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Lint | ||
|
||
on: | ||
push: | ||
branches: [ main, develop ] | ||
pull_request: | ||
branches: [ main, develop ] | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install clang-format-17 | ||
run: | | ||
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy main' | ||
sudo apt update | ||
wget https://apt.llvm.org/llvm-snapshot.gpg.key | ||
sudo apt-key add llvm-snapshot.gpg.key | ||
sudo apt update | ||
sudo apt install clang-format-17 | ||
- name: Run clang-format | ||
run: cmake -P lint.cmake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Release | ||
permissions: | ||
contents: write | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Create build environment | ||
run: cmake -E make_directory build | ||
|
||
- name: Configure | ||
working-directory: build/ | ||
run: cmake $GITHUB_WORKSPACE | ||
|
||
- name: Package source code | ||
working-directory: build/ | ||
run: cmake --build . --target package | ||
|
||
- name: Add packaged source code to release | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: build/ic_macro_magic.zip | ||
tag: ${{ github.ref }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: [ main, develop ] | ||
pull_request: | ||
branches: [ main, develop ] | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Run tests | ||
run: cmake -P tests/test.cmake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# Copyright (c) 2023 Intercreate, Inc. | ||
# Author: J.P. Hutchins <[email protected]> | ||
|
||
cmake_minimum_required(VERSION 3.20) | ||
|
||
# declare ic_macro_magic | ||
project(ic_macro_magic LANGUAGES C CXX) | ||
|
||
# add the headers to the library | ||
add_library(${PROJECT_NAME} INTERFACE) | ||
target_include_directories(${PROJECT_NAME} INTERFACE include) | ||
|
||
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) | ||
# We're in the root, define additional targets for developers. | ||
|
||
# generate a package for distribution | ||
# reference: https://www.foonathan.net/2022/06/cmake-fetchcontent/ | ||
set(package_files include/ CMakeLists.txt LICENSE) | ||
add_custom_command( | ||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.zip | ||
COMMAND ${CMAKE_COMMAND} -E tar | ||
c ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.zip | ||
--format=zip | ||
-- ${package_files} | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
DEPENDS ${package_files} | ||
) | ||
add_custom_target(package | ||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.zip | ||
) | ||
endif() |
Oops, something went wrong.