Skip to content

Commit

Permalink
Enable OBJC/OBJCXX for all projects if necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
fs-eire committed Oct 5, 2024
1 parent 646a744 commit da6406b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
16 changes: 16 additions & 0 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,22 @@ if (onnxruntime_BUILD_CSHARP)
endif()
endif()

if (onnxruntime_BUILD_OBJC)
check_language(OBJC)
if(CMAKE_OBJC_COMPILER)
enable_language(OBJC)
else()
message(FATAL_ERROR "Objective-C is not supported.")
endif()

check_language(OBJCXX)
if(CMAKE_OBJCXX_COMPILER)
enable_language(OBJCXX)
else()
message(FATAL_ERROR "Objective-C++ is not supported.")
endif()
endif()

if (NOT WIN32)
#TODO: On Linux we may try https://github.com/microsoft/TraceLogging.git
if (onnxruntime_ENABLE_INSTRUMENT)
Expand Down
14 changes: 0 additions & 14 deletions cmake/onnxruntime_objectivec.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,6 @@ if(NOT onnxruntime_BUILD_SHARED_LIB)
message(FATAL_ERROR "The Objective-C API requires onnxruntime_BUILD_SHARED_LIB to be enabled.")
endif()

check_language(OBJC)
if(CMAKE_OBJC_COMPILER)
enable_language(OBJC)
else()
message(FATAL_ERROR "Objective-C is not supported.")
endif()

check_language(OBJCXX)
if(CMAKE_OBJCXX_COMPILER)
enable_language(OBJCXX)
else()
message(FATAL_ERROR "Objective-C++ is not supported.")
endif()

add_compile_options(
"$<$<COMPILE_LANGUAGE:OBJC,OBJCXX>:-Wall>"
"$<$<COMPILE_LANGUAGE:OBJC,OBJCXX>:-Wextra>")
Expand Down

0 comments on commit da6406b

Please sign in to comment.