Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,8 @@ jobs:
modules_support_needed: true
coroutine_support_needed: true
secrets: inherit

tests:
name: ✅ Testing w/ Clang-Tidy enabled
uses: libhal/ci/.github/workflows/tests.yml@5.x.y
secrets: inherit
20 changes: 11 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,20 @@ project(async_context LANGUAGES CXX)

if(CMAKE_CROSSCOMPILING)
message(STATUS "Cross compiling, skipping clang-tidy")
else()
if(USE_CLANG_TIDY)
find_program(CLANG_TIDY_EXE NAMES clang-tidy)
if(CLANG_TIDY_EXE)
message(STATUS "Clang-tidy found: ${CLANG_TIDY_EXE}")
set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_EXE};--config-file=${CMAKE_CURRENT_SOURCE_DIR}/.clang-tidy;--fix")
else()
message(STATUS "Clang-tidy not found - continuing without clang-tidy")
elseif(LIBHAL_ENABLE_CLANG_TIDY)
find_program(CLANG_TIDY_EXE NAMES clang-tidy)
if(CLANG_TIDY_EXE)
message(STATUS "Clang-tidy found: ${CLANG_TIDY_EXE}")
set(CLANG_TIDY_CMD "${CLANG_TIDY_EXE};--config-file=${CMAKE_CURRENT_SOURCE_DIR}/.clang-tidy")
if(LIBHAL_CLANG_TIDY_FIX)
list(APPEND CLANG_TIDY_CMD "--fix")
endif()
set(CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY_CMD})
else()
message(WARNING "Clang-tidy checks disabled")
message(STATUS "Clang-tidy not found - continuing without clang-tidy")
endif()
else()
message(STATUS "Clang-tidy checks disabled (use -o enable_clang_tidy=True to enable)")
endif()

# ==============================================================================
Expand Down
10 changes: 10 additions & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ class async_context_conan(ConanFile):
exports_sources = "modules/*", "benchmarks/*", "tests/*", "CMakeLists.txt", "LICENSE", ".clang-tidy"
package_type = "static-library"
shared = False
options = {
"enable_clang_tidy": [True, False],
"clang_tidy_fix": [True, False],
}
default_options = {
"enable_clang_tidy": False,
"clang_tidy_fix": False,
}

@property
def _min_cppstd(self):
Expand Down Expand Up @@ -104,6 +112,8 @@ def layout(self):
def generate(self):
tc = CMakeToolchain(self)
tc.generator = "Ninja"
tc.variables["LIBHAL_ENABLE_CLANG_TIDY"] = self.options.enable_clang_tidy
tc.variables["LIBHAL_CLANG_TIDY_FIX"] = self.options.clang_tidy_fix
tc.generate()

deps = CMakeDeps(self)
Expand Down