From 1d9996b7e85074692e3d7544d99c24d2a35e1e88 Mon Sep 17 00:00:00 2001 From: Nicholas Smith Date: Thu, 6 Mar 2025 15:02:23 -0600 Subject: [PATCH] Add cmake support for code coverage build type --- cmake/modules/TTMLIRBuildTypes.cmake | 14 ++++++++++++++ test/ttmlir/Translate/LLVM/dylib.mlir | 1 + 2 files changed, 15 insertions(+) diff --git a/cmake/modules/TTMLIRBuildTypes.cmake b/cmake/modules/TTMLIRBuildTypes.cmake index dc57e4fc81..9dde1604ed 100644 --- a/cmake/modules/TTMLIRBuildTypes.cmake +++ b/cmake/modules/TTMLIRBuildTypes.cmake @@ -12,6 +12,20 @@ set(CMAKE_SHARED_LINKER_FLAGS_ASAN "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=address -shared-libasan" CACHE STRING "Linker lags to be used to create shared libraries for Asan build type." FORCE) +# Code coverage build type +set(CMAKE_C_FLAGS_COVERAGE + "${CMAKE_C_FLAGS_DEBUG} --coverage" CACHE STRING + "Flags used by the C compiler for code coverage build type or configuration." FORCE) +set(CMAKE_CXX_FLAGS_COVERAGE + "${CMAKE_CXX_FLAGS_DEBUG} --coverage" CACHE STRING + "Flags used by the C++ compiler for code coverage build type or configuration." FORCE) +set(CMAKE_EXE_LINKER_FLAGS_COVERAGE + "${CMAKE_EXE_LINKER_FLAGS_DEBUG} --coverage" CACHE STRING + "Linker flags to be used to create executables for code coverage build type." FORCE) +set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE + "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} --coverage" CACHE STRING + "Linker lags to be used to create shared libraries for code coverage build type." FORCE) + # Assert build type set(CMAKE_C_FLAGS_ASSERT "${CMAKE_C_FLAGS_RELEASE}" CACHE STRING diff --git a/test/ttmlir/Translate/LLVM/dylib.mlir b/test/ttmlir/Translate/LLVM/dylib.mlir index 0f6436e582..38bf6cf5cc 100644 --- a/test/ttmlir/Translate/LLVM/dylib.mlir +++ b/test/ttmlir/Translate/LLVM/dylib.mlir @@ -1,4 +1,5 @@ // RUN: ttmlir-translate --llvm-to-dylib %s | llvm-nm -g - | FileCheck %s +// UNSUPPORTED: system-darwin module attributes {ttir.cpu_module} { llvm.func @memrefCopy(i64, !llvm.ptr, !llvm.ptr)