onnxruntime/objectivec/cxx_api.h
Vrajang Parikh fd8ad9b950
Enable iOS packaging for training (#16525)
### Description
Enable support for building iOS packages/CocoaPods with training API

- Add `Training` Package variant and config files in current iOS
packaging utilities to enable creation of training packages

### Motivation and Context
This PR introduces new `Training` variant in
`build_and_assemble_ios_pods.py` script which allows creating pods for
iOS with training API enabled.

The sample script to build training pods:

```
python3 tools/ci_build/github/apple/build_and_assemble_ios_pods.py --variant Training \
--build-settings-file  tools/ci_build/github/apple/default_full_ios_training_framework_build_settings.json \ 
-b=-- path_to_protoc_exe=<path/to/protoc>
``` 

Note: build settings file should have `--enable_training` as a build
parameter.


Simply adding training packaging increases the duration of the Azure
pipeline for packaging by 70 minutes. To address this issue, we need to
parallelize pod creation. In order not to further strain the pipeline,
the changes for training packaging will be added in another PR, which
optimizes the packaging pipeline.

---------

Co-authored-by: Edward Chen <18449977+edgchen1@users.noreply.github.com>
2023-07-05 13:27:59 -07:00

40 lines
1.3 KiB
C

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// wrapper for ORT C/C++ API headers
#if defined(__clang__)
#pragma clang diagnostic push
// ignore clang documentation-related warnings
// instead, we will rely on Doxygen warnings for the C/C++ API headers
#pragma clang diagnostic ignored "-Wdocumentation"
#endif // defined(__clang__)
// paths are different when building the Swift Package Manager package as the headers come from the iOS pod archive
// clang-format off
#define STRINGIFY(x) #x
#ifdef SPM_BUILD
#define ORT_C_CXX_HEADER_FILE_PATH(x) STRINGIFY(onnxruntime/x)
#else
#define ORT_C_CXX_HEADER_FILE_PATH(x) STRINGIFY(x)
#endif
// clang-format on
#if __has_include(ORT_C_CXX_HEADER_FILE_PATH(onnxruntime_training_c_api.h))
#include ORT_C_CXX_HEADER_FILE_PATH(onnxruntime_training_c_api.h)
#include ORT_C_CXX_HEADER_FILE_PATH(onnxruntime_training_cxx_api.h)
#else
#include ORT_C_CXX_HEADER_FILE_PATH(onnxruntime_c_api.h)
#include ORT_C_CXX_HEADER_FILE_PATH(onnxruntime_cxx_api.h)
#endif
#if __has_include(ORT_C_CXX_HEADER_FILE_PATH(coreml_provider_factory.h))
#define ORT_OBJC_API_COREML_EP_AVAILABLE 1
#include ORT_C_CXX_HEADER_FILE_PATH(coreml_provider_factory.h)
#else
#define ORT_OBJC_API_COREML_EP_AVAILABLE 0
#endif
#if defined(__clang__)
#pragma clang diagnostic pop
#endif // defined(__clang__)