Skip to content

Commit

Permalink
Merge branch 'next' of https://github.com/defiantnerd/clap-wrapper in…
Browse files Browse the repository at this point in the history
…to next
  • Loading branch information
defiantnerd committed Sep 11, 2023
2 parents d49abf4 + cefb565 commit 5af82c1
Show file tree
Hide file tree
Showing 42 changed files with 3,764 additions and 3,079 deletions.
36 changes: 36 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
UseTab: Never
---
Language: Cpp
AlignAfterOpenBracket: BAS_Align
ConstructorInitializerIndentWidth: 2
SpaceBeforeParens: ControlStatements
ColumnLimit: 105
BasedOnStyle: Google
IndentWidth: 2
AlignAfterOpenBracket: Align
ConstructorInitializerAllOnOneLineOrOnePerLine: true
BreakConstructorInitializers: BeforeComma
BreakBeforeBraces: Allman
ColumnLimit: 105
SortIncludes: false
NamespaceIndentation: None
ReflowComments: false
AllowShortFunctionsOnASingleLine: None
---
Language: ObjC
BasedOnStyle: Google
AlignAfterOpenBracket: BAS_Align
ConstructorInitializerIndentWidth: 2
SpaceBeforeParens: ControlStatements
IndentWidth: 2
AlignAfterOpenBracket: Align
ConstructorInitializerAllOnOneLineOrOnePerLine: true
BreakConstructorInitializers: BeforeComma
BreakBeforeBraces: Allman
ColumnLimit: 105
SortIncludes: false
NamespaceIndentation: None
ReflowComments: false
AllowShortFunctionsOnASingleLine: None
...
21 changes: 21 additions & 0 deletions .github/workflows/code-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Clap Wrapper Format and Code Checks
on: [pull_request]

defaults:
run:
shell: bash

jobs:
build-code-checks:
name: code-checks
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Run Code Checks
run: |
cmake -Bbuild -DCLAP_WRAPPER_CODE_CHECKS_ONLY=TRUE
cmake --build build --target clap-wrapper-code-checks
31 changes: 29 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ option(CLAP_WRAPPER_WINDOWS_SINGLE_FILE "Build a single fine (rather than folder

project(clap-wrapper
LANGUAGES C CXX
VERSION 0.0.4
VERSION 0.5.0
DESCRIPTION "CLAP-as-X wrappers"
)

Expand All @@ -55,7 +55,11 @@ set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
# defines functions relative to this, so needs a cache
# variable with the source dir
set(CLAP_WRAPPER_CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE STRING "Clap Wrapper Source Location")
include(cmake/enable_sdks.cmake)
if (DEFINED CLAP_WRAPPER_CODE_CHECKS_ONLY)
message(STATUS "clap-wrapper: code checks only; skipping enable sdks")
else()
include(cmake/enable_sdks.cmake)
endif()

# automatically build the wrapper only if this is the top level project
set(skipbuild FALSE)
Expand All @@ -64,6 +68,9 @@ if (NOT PROJECT_IS_TOP_LEVEL)
set(skipbuild TRUE)
endif()
endif()
if (DEFINED CLAP_WRAPPER_CODE_CHECKS_ONLY)
set(skipbuild ${CLAP_WRAPPER_CODE_CHECKS_ONLY})
endif()

if (${skipbuild})
message(STATUS "clap-wrapper: Skipping clap wrapper target ejection")
Expand Down Expand Up @@ -106,3 +113,23 @@ else()
endif()
endif()
endif()


add_custom_target(clap-wrapper-code-checks)

# Clang Format checks
find_program(CLANG_FORMAT_EXE NAMES clang-format)
set(CLANG_FORMAT_DIRS src)
set(CLANG_FORMAT_EXTS cpp h)
foreach(dir ${CLANG_FORMAT_DIRS})
foreach(ext ${CLANG_FORMAT_EXTS})
list(APPEND CLANG_FORMAT_GLOBS "':(glob)${dir}/**/*.${ext}'")
endforeach()
endforeach()
add_custom_command(TARGET clap-wrapper-code-checks
POST_BUILD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} -E echo About to check clang-format using ${CLANG_FORMAT_EXE}
COMMAND git ls-files -- ${CLANG_FORMAT_GLOBS} | xargs ${CLANG_FORMAT_EXE} --dry-run --Werror
)
# }}}
Loading

0 comments on commit 5af82c1

Please sign in to comment.