Add CMake option to support thread-less configuration
Add `IREE_ENABLE_THREADING` CMake option to support building IREE
without thread library dependencies.
It is needed for the bare-metal build configuration.
This commit will close https://github.com/google/iree/issues/6027
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ecf7c2c..c764b18 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -43,6 +43,7 @@
option(IREE_BUILD_TENSORFLOW_COMPILER "Builds TensorFlow compiler frontend." OFF)
option(IREE_BUILD_TFLITE_COMPILER "Builds the TFLite compiler frontend." OFF)
option(IREE_BUILD_XLA_COMPILER "Builds TensorFlow XLA compiler frontend." OFF)
+option(IREE_ENABLE_THREADING "Builds IREE in with thread library support." ON)
set(IREE_HAL_DRIVERS_TO_BUILD "all"
CACHE STRING "Semicolon-separated list of HAL drivers to build, or \"all\".")
@@ -379,15 +380,17 @@
include(external_cc_library)
include(flatbuffer_c_library)
-add_subdirectory(third_party/benchmark EXCLUDE_FROM_ALL)
add_subdirectory(build_tools/third_party/cuda EXCLUDE_FROM_ALL)
add_subdirectory(build_tools/third_party/flatcc EXCLUDE_FROM_ALL)
add_subdirectory(build_tools/third_party/vulkan_memory_allocator EXCLUDE_FROM_ALL)
add_subdirectory(build_tools/third_party/stblib EXCLUDE_FROM_ALL)
-add_subdirectory(third_party/cpuinfo EXCLUDE_FROM_ALL)
add_subdirectory(third_party/googletest EXCLUDE_FROM_ALL)
-add_subdirectory(third_party/abseil-cpp EXCLUDE_FROM_ALL)
+if(${IREE_ENABLE_THREADING})
+ add_subdirectory(third_party/benchmark EXCLUDE_FROM_ALL)
+ add_subdirectory(third_party/cpuinfo EXCLUDE_FROM_ALL)
+ add_subdirectory(third_party/abseil-cpp EXCLUDE_FROM_ALL)
+endif()
add_subdirectory(third_party/flatcc EXCLUDE_FROM_ALL)
add_subdirectory(third_party/vulkan_headers EXCLUDE_FROM_ALL)