aboutsummaryrefslogtreecommitdiff
path: root/pw_presubmit
diff options
context:
space:
mode:
authorRob Mohr <mohrr@google.com>2022-01-18 11:39:14 -0800
committerCQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-01-19 18:26:41 +0000
commit4c26987003a2cda4d4f7bdf6a1c647192b842723 (patch)
tree5ab34d8be8b31b7936ff915746f9d92c50628623 /pw_presubmit
parent6e92d78fe513102db5168d3115a13809035152eb (diff)
downloadpigweed-4c26987003a2cda4d4f7bdf6a1c647192b842723.tar.gz
pw_presubmit: Add GCC CMake "step"
This step does not yet pass. Change-Id: Ie4fcdc9829c1217779ed48ce7b0f79ecc292f950 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/79240 Reviewed-by: Ewout van Bekkum <ewout@google.com> Commit-Queue: Rob Mohr <mohrr@google.com>
Diffstat (limited to 'pw_presubmit')
-rwxr-xr-xpw_presubmit/py/pw_presubmit/pigweed_presubmit.py34
1 files changed, 27 insertions, 7 deletions
diff --git a/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py b/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py
index a8dbe933c..8a1ebc162 100755
--- a/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py
+++ b/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py
@@ -269,26 +269,44 @@ def oss_fuzz_build(ctx: PresubmitContext):
build.ninja(ctx.output_dir, "fuzzers")
-def _run_cmake(ctx: PresubmitContext) -> None:
+def _run_cmake(ctx: PresubmitContext, toolchain='host_clang') -> None:
build.install_package(ctx.package_root, 'nanopb')
- toolchain = ctx.root / 'pw_toolchain' / 'host_clang' / 'toolchain.cmake'
+ env = None
+ if 'clang' in toolchain:
+ env = build.env_with_clang_vars()
+
+ toolchain_path = ctx.root / 'pw_toolchain' / toolchain / 'toolchain.cmake'
build.cmake(ctx.root,
ctx.output_dir,
- f'-DCMAKE_TOOLCHAIN_FILE={toolchain}',
+ f'-DCMAKE_TOOLCHAIN_FILE={toolchain_path}',
'-DCMAKE_EXPORT_COMPILE_COMMANDS=1',
f'-Ddir_pw_third_party_nanopb={ctx.package_root / "nanopb"}',
'-Dpw_third_party_nanopb_ADD_SUBDIRECTORY=ON',
- env=build.env_with_clang_vars())
+ env=env)
@filter_paths(endswith=(*format_code.C_FORMAT.extensions, '.cmake',
'CMakeLists.txt'))
-def cmake_tests(ctx: PresubmitContext):
- _run_cmake(ctx)
+def cmake_clang(ctx: PresubmitContext):
+ _run_cmake(ctx, toolchain='host_clang')
build.ninja(ctx.output_dir, 'pw_apps', 'pw_run_tests.modules')
+@filter_paths(endswith=(*format_code.C_FORMAT.extensions, '.cmake',
+ 'CMakeLists.txt'))
+def cmake_gcc(ctx: PresubmitContext):
+ _run_cmake(ctx, toolchain='host_gcc')
+ build.ninja(ctx.output_dir, 'pw_apps', 'pw_run_tests.modules')
+
+
+# TODO(mohrr) Remove after removing from LUCI config.
+@filter_paths(endswith=(*format_code.C_FORMAT.extensions, '.cmake',
+ 'CMakeLists.txt'))
+def cmake_tests(ctx: PresubmitContext):
+ cmake_clang(ctx)
+
+
# TODO(pwbug/180): Slowly add modules here that work with bazel until all
# modules are added. Then replace with //...
_MODULES_THAT_BUILD_WITH_BAZEL = [
@@ -741,6 +759,8 @@ OTHER_CHECKS = (
oss_fuzz_build,
# TODO(pwbug/346): Enable all Bazel tests when they're fixed.
bazel_test,
+ cmake_clang,
+ cmake_gcc,
cmake_tests,
gn_boringssl_build,
build.gn_gen_check,
@@ -781,7 +801,7 @@ QUICK = (
# TODO(pwbug/141): Re-enable CMake and Bazel for Mac after we have fixed the
# the clang issues. The problem is that all clang++ invocations need the
# two extra flags: "-nostdc++" and "${clang_prefix}/../lib/libc++.a".
- cmake_tests if sys.platform != 'darwin' else (),
+ cmake_clang if sys.platform != 'darwin' else (),
)
FULL = (