Skip to content

Commit

Permalink
Make the doc example obey ONNX_MLIR_BUILD_TESTS (llvm#1083)
Browse files Browse the repository at this point in the history
* Make the doc example obey ONNX_MLIR_BUILD_TESTS

Currently, ONNX_MLIR_BUILD_TESTS controls EXCLUDE_FROM_ALL, however, the targets added through add_executable will always build. We follow the llvm pattern and explicitly set EXCLUDE_FROM_ALL in the add_onnx_mlir_executable function if it is set for the directory, so that add_executable targets don't always build.

Signed-off-by: Stella Stamenova <stilis@microsoft.com>
  • Loading branch information
sstamenova authored Jan 13, 2022
1 parent c3875f1 commit db92474
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 6 additions & 1 deletion MLIR.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,12 @@ function(add_onnx_mlir_executable name)
${ARGN}
)

add_executable(${name} ${ARG_UNPARSED_ARGUMENTS})
if (EXCLUDE_FROM_ALL)
add_executable(${name} EXCLUDE_FROM_ALL ${ARG_UNPARSED_ARGUMENTS})
else()
add_executable(${name} ${ARG_UNPARSED_ARGUMENTS})
endif()

llvm_update_compile_flags(${name})

if (ARG_DEPENDS)
Expand Down
1 change: 0 additions & 1 deletion docs/doc_example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ if (WIN32)
)
endif()


if (WIN32)
set(OMRuntimeTestModelLibraryFiles ${CMAKE_CURRENT_BINARY_DIR}/add${CMAKE_SHARED_LIBRARY_SUFFIX})
list(APPEND OMRuntimeTestModelLibraryFiles ${CMAKE_CURRENT_BINARY_DIR}/add${CMAKE_LINK_LIBRARY_SUFFIX})
Expand Down

0 comments on commit db92474

Please sign in to comment.