fix the build for mobile packaging (#843)

* fix the build for mobile packaging

* update the cmake file as well

* more fixing on dlib related ops

* release the iOS cmake version constraint

* upgrade cmake in Linux CUDA build

* Update Dockerfile.ubuntu_cuda11_8_tensorrt8_6 for typo

* Update ios_packaging.yml for Azure Pipelines

* update the dlib versoin

* update all cases of cmake version

* update the comment for dlb cmake
This commit is contained in:
Wenbing Li 2024-11-17 20:09:36 -08:00 коммит произвёл GitHub
Родитель 5104bb9897
Коммит c3379ecb6b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
17 изменённых файлов: 85 добавлений и 47 удалений

Просмотреть файл

@ -851,10 +851,9 @@ stages:
architecture: 'x64'
displayName: "Use Python 3.12"
# iOS xcframework build doesn't work with CMake 3.25.1, pin to 3.25.0
- script: |
python -m pip install cmake==3.25.0
displayName: "Install CMake 3.25.0"
python -m pip install cmake
displayName: "Install CMake"
- template: templates/set-package-version-variable-step.yml
parameters:

Просмотреть файл

@ -25,10 +25,9 @@ jobs:
addToPath: true
architecture: "x64"
# iOS xcframework build doesn't work with CMake 3.25.1, pin to 3.25.0
- script: |
python -m pip install cmake==3.25.0
displayName: "Install CMake 3.25.0"
python -m pip install cmake
displayName: "Install CMake"
- template: templates/install-appcenter.yml

Просмотреть файл

@ -78,10 +78,9 @@ jobs:
addToPath: true
architecture: "x64"
# iOS xcframework build doesn't work with CMake 3.25.1, pin to 3.25.0
- script: |
python -m pip install cmake==3.25.0
displayName: "Install CMake 3.25.0"
python -m pip install cmake
displayName: "Install CMake"
- template: set-package-version-variable-step.yml
parameters:

Просмотреть файл

@ -39,7 +39,7 @@ jobs:
sudo apt-get install -y libssh-dev
displayName: Install OpenSSL for Azure custom ops
# NOTE: on arm64 machine, CMake version needs to be updated since we now require CMake 3.25 or newer.
# NOTE: on arm64 machine, CMake version needs to be updated since we now require CMake 3.28 or newer.
- ${{ if eq(parameters.OrtExtensionsArch, 'x64') }}:
- bash: |
export CFLAGS="${{parameters.OrtExtensionsCFlags}}"

Просмотреть файл

@ -38,10 +38,9 @@ jobs:
addToPath: true
architecture: "x64"
# iOS xcframework build doesn't work with CMake 3.25.1, pin to 3.25.0
- script: |
python -m pip install cmake==3.25.0
displayName: "Install CMake 3.25.0"
python -m pip install cmake
displayName: "Install CMake"
- template: set-package-version-variable-step.yml
parameters:

Просмотреть файл

@ -2,7 +2,7 @@
# Licensed under the MIT License.
# Minimum CMake required
cmake_minimum_required(VERSION 3.25)
cmake_minimum_required(VERSION 3.28)
project(onnxruntime_extensions LANGUAGES C CXX)
# set(CMAKE_VERBOSE_MAKEFILE ON)
@ -334,6 +334,20 @@ endif()
file(GLOB TARGET_SRC_NOEXCEPTION "base/*.h" "base/*.cc")
file(GLOB TARGET_SRC "operators/*.cc" "operators/*.h" "include/*.h" "include/*.hpp")
if(OCOS_ENABLE_DLIB)
set(DLIB_ISO_CPP_ONLY ON CACHE INTERNAL "")
set(DLIB_NO_GUI_SUPPORT ON CACHE INTERNAL "")
set(DLIB_USE_CUDA OFF CACHE INTERNAL "")
set(DLIB_USE_LAPACK OFF CACHE INTERNAL "")
set(DLIB_USE_BLAS OFF CACHE INTERNAL "")
include(dlib)
# Ideally, dlib should be included as file(GLOB TARGET_SRC_DLIB "${dlib_SOURCE_DIR}/dlib/all/source.cpp")
# To avoid the unintentional using some unwanted component, we only include the test_for_odr_violations.cpp
# to check if there is any violation in build configuration to ensure compiling some dlib source files correctly.
file(GLOB TARGET_SRC_DLIB "${dlib_SOURCE_DIR}/dlib/test_for_odr_violations.cpp")
endif()
if(OCOS_ENABLE_TF_STRING)
set(farmhash_SOURCE_DIR ${PROJECT_SOURCE_DIR}/cmake/externals/farmhash)
file(GLOB TARGET_SRC_KERNELS "operators/text/*.cc" "operators/text/*.h*")
@ -342,8 +356,12 @@ if(OCOS_ENABLE_TF_STRING)
endif()
if(OCOS_ENABLE_AUDIO)
if (NOT OCOS_ENABLE_DLIB)
message(FATAL_ERROR "Audio operators require DLIB to be enabled.")
endif()
include(dr_libs)
file(GLOB TARGET_SRC_AUDIO "operators/audio/*.*")
list(APPEND TARGET_SRC_AUDIO ${dlib_SOURCE_DIR}/dlib/fft/fft.cpp)
list(APPEND TARGET_SRC_NOEXCEPTION ${TARGET_SRC_AUDIO})
endif()
@ -353,20 +371,10 @@ if(OCOS_ENABLE_RE2_REGEX)
endif()
if(OCOS_ENABLE_MATH)
if(OCOS_ENABLE_DLIB)
set(DLIB_ISO_CPP_ONLY ON CACHE INTERNAL "")
set(DLIB_NO_GUI_SUPPORT ON CACHE INTERNAL "")
set(DLIB_USE_CUDA OFF CACHE INTERNAL "")
set(DLIB_USE_LAPACK OFF CACHE INTERNAL "")
set(DLIB_USE_BLAS OFF CACHE INTERNAL "")
include(dlib)
# Ideally, dlib should be included as
# file(GLOB TARGET_SRC_DLIB "${dlib_SOURCE_DIR}/dlib/all/source.cpp")
# To avoid the unintentional using some unwanted component, only include
file(GLOB TARGET_SRC_DLIB "${dlib_SOURCE_DIR}/dlib/test_for_odr_violations.cpp")
file(GLOB TARGET_SRC_INVERSE "operators/math/dlib/*.cc" "operators/math/dlib/*.h*")
if (NOT OCOS_ENABLE_DLIB)
message(FATAL_ERROR "Math operators require DLIB to be enabled.")
endif()
file(GLOB TARGET_SRC_INVERSE "operators/math/dlib/*.cc" "operators/math/dlib/*.h*")
file(GLOB TARGET_SRC_MATH "operators/math/*.cc" "operators/math/*.h*")
if(OCOS_USE_CUDA)
@ -664,6 +672,9 @@ if(OCOS_ENABLE_VISION)
set(_DEFAULT_CODEC_ENABLE ON) # libpng and libjpeg can be optional after EncodeImage with native support too.
if(_DEFAULT_CODEC_ENABLE)
if (NOT OCOS_ENABLE_DLIB)
message(FATAL_ERROR "Vision operators require DLIB to be enabled.") # for now, we need dlib for image processing
endif()
include(ext_imgcodecs)
target_include_directories(ocos_operators PUBLIC ${libPNG_SOURCE_DIR} ${libJPEG_SOURCE_DIR})
target_link_libraries(ocos_operators PUBLIC ${PNG_LIBRARY} ${JPEG_LIBRARY})

Просмотреть файл

@ -45,7 +45,7 @@ blingfire 0831265c1aca95ca02eca5bf1155e4251e545328
_____
dlib a12824d42584e292ecb3bad05c4b32c2015a7b89
dlib v19.24.6
Boost Software License - Version 1.0 - August 17th, 2003
@ -106,7 +106,7 @@ Google Inc.
Samsung Electronics
Stefano Rivera <stefano.rivera@gmail.com>
Dominic Battré <battre@chromium.org>
Dominic Battré <battre@chromium.org>
Doug Kwan <dougkwan@google.com>
Dmitriy Vyukov <dvyukov@google.com>
John Millikin <jmillikin@gmail.com>

Просмотреть файл

@ -34,7 +34,7 @@
"component": {
"type": "git",
"git": {
"commitHash": "a12824d42584e292ecb3bad05c4b32c2015a7b89",
"commitHash": "v19.24.6",
"repositoryUrl": "https://github.com/davisking/dlib.git"
}
}
@ -87,6 +87,38 @@
"comments": "v3.10.5"
}
},
{
"component": {
"type": "other",
"other": {
"name": "libjpeg",
"version": "release 9e of 16-Jan-2022",
"downloadUrl": "https://github.com/davisking/dlib/tree/v19.24.6/dlib/external/libjpeg"
},
"comments": "for vision domain"
}
},
{
"component": {
"type": "other",
"other": {
"name": "libpng",
"version": "1.6.37",
"downloadUrl": "https://github.com/davisking/dlib/tree/v19.24.6/dlib/external/libpng"
},
"comments": "for vision domain"
}
},
{
"component": {
"other": {
"name": "zlib",
"version": "1.2.11",
"downloadUrl": "https://github.com/davisking/dlib/tree/v19.24.6/dlib/external/zlib"
},
"comments": "for vision domain"
}
},
{
"component": {
"type": "git",

10
cmake/externals/dlib.cmake поставляемый
Просмотреть файл

@ -1,8 +1,8 @@
FetchContent_Declare(dlib
GIT_REPOSITORY https://github.com/davisking/dlib.git
# there is non an official tag which supports STFT,
# choose a relatively stable commit id for that.
GIT_TAG a12824d42584e292ecb3bad05c4b32c2015a7b89
FetchContent_Declare(
dlib
URL https://github.com/davisking/dlib/archive/refs/tags/v19.24.6.zip
URL_HASH SHA1=59b1fb4e9909697c646e4f74e94871dacf49f0bf
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
SOURCE_SUBDIR not_set
)

Просмотреть файл

@ -6,7 +6,6 @@
typedef OrtxObject OrtxFeatureExtractor;
typedef OrtxObject OrtxRawAudios;
typedef OrtxObject OrtxTensorResult;
#ifdef __cplusplus
extern "C" {

Просмотреть файл

@ -101,10 +101,9 @@ jobs:
addToPath: true
architecture: "x64"
# iOS xcframework build doesn't work with CMake 3.25.1, pin to 3.25.0
- script: |
python -m pip install cmake==3.25.0
displayName: "Install CMake 3.25.0"
python -m pip install cmake
displayName: "Install CMake"
- template: set-package-version-variable-step.yml
parameters:

Просмотреть файл

@ -49,7 +49,7 @@ jobs:
sudo apt-get install -y libssh-dev
displayName: Install OpenSSL for Azure custom ops
# NOTE: on arm64 machine, CMake version needs to be updated since we now require CMake 3.25 or newer.
# NOTE: on arm64 machine, CMake version needs to be updated since we now require CMake 3.28 or newer.
- ${{ if eq(parameters.OrtExtensionsArch, 'x64') }}:
- bash: |
export CFLAGS="${{parameters.OrtExtensionsCFlags}}"

Просмотреть файл

@ -45,10 +45,9 @@ jobs:
addToPath: true
architecture: "x64"
# iOS xcframework build doesn't work with CMake 3.25.1, pin to 3.25.0
- script: |
python -m pip install cmake==3.25.0
displayName: "Install CMake 3.25.0"
python -m pip install cmake
displayName: "Install CMake"
- template: set-package-version-variable-step.yml
parameters:

Просмотреть файл

@ -23,7 +23,7 @@ RUN dnf install -y \
RUN pip3 install --upgrade pip
RUN pip3 install setuptools>=68.2.2
RUN pip3 install cmake==3.27.2
RUN pip3 install cmake==3.28.4
# Install TensorRT
RUN dnf install -y libnvinfer8 libnvonnxparsers8 libnvparsers8 libnvinfer-plugin8 libnvinfer-lean8 libnvinfer-vc-plugin8 libnvinfer-dispatch8

Просмотреть файл

@ -27,7 +27,7 @@ RUN apt-get install -y --no-install-recommends \
RUN pip install --upgrade pip
RUN pip install setuptools>=68.2.2
RUN pip3 install cmake==3.27.2
RUN pip3 install cmake==3.28.4
# Install TensorRT
RUN v="8.6.1.6-1+cuda11.8" &&\

Просмотреть файл

@ -74,7 +74,9 @@ CMAKE_FLAG_TO_OPS = {
],
"OCOS_ENABLE_DLIB": [
"Inverse",
"StftNorm"
"StftNorm",
"DecodeImage",
"EncodeImage"
],
"OCOS_ENABLE_TRIE_TOKENIZER": [
"TrieTokenizer",

Просмотреть файл

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.25)
cmake_minimum_required(VERSION 3.28)
project(ortx_api_test)