Skip to content

Commit

Permalink
Check for uuid-dev on linux before enabling MLProgram code
Browse files Browse the repository at this point in the history
  • Loading branch information
skottmckay committed Feb 5, 2024
1 parent 776399f commit fb12245
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions cmake/onnxruntime_providers_coreml.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,22 @@ add_compile_definitions(USE_COREML=1)

# Check if we can build the coremltools code for creating an mlpackage with an mlprogram.
# The coremltools source requires std::filesystem::path which is only available from iOS 13 on.
set(_enable_ML_PROGRAM ON)
if (IOS AND CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS 13.0)
message(WARNING "CoreML ML Program is not supported on iOS < 13.0. Excluding ML Program support from build.")
else()
set(_enable_ML_PROGRAM ON)
set(_enable_ML_PROGRAM OFF)
elseif(LINUX)
# uuid-dev is required. we don't bother installing on CIs as it's really for manual developer testing.
find_library(LibUUID_LIBRARY NAMES uuid)
find_path(LibUUID_INCLUDE_DIR NAMES uuid/uuid.h)
if (NOT LibUUID_INCLUDE_DIR)
message(STATUS "uuid/uuid.h was not found as is required for ML Program support. "
"Run `sudo apt install uuid-dev` if you need to test ML Program related CoreML EP code. ")
set(_enable_ML_PROGRAM OFF)
endif()
endif()

if (_enable_ML_PROGRAM)
add_compile_definitions(COREML_ENABLE_MLPROGRAM=1)
endif()

Expand Down

0 comments on commit fb12245

Please sign in to comment.