Improve dependency management (#13523)
## Description 1. Convert some git submodules to cmake external projects 2. Update nsync from [1.23.0](https://github.com/google/nsync/releases/tag/1.23.0) to [1.25.0](https://github.com/google/nsync/releases/tag/1.25.0) 3. Update re2 from 2021-06-01 to 2022-06-01 4. Update wil from an old commit to 1.0.220914.1 tag 5. Update gtest to a newer commit so that it can optionally leverage absl/re2 for parsing command line flags. The following git submodules are deleted: 1. FP16 2. safeint 3. XNNPACK 4. cxxopts 5. dlpack 7. flatbuffers 8. googlebenchmark 9. json 10. mimalloc 11. mp11 12. pthreadpool More will come. ## Motivation and Context There are 3 ways of integrating 3rd party C/C++ libraries into ONNX Runtime: 1. Install them to a system location, then use cmake's find_package module to locate them. 2. Use git submodules 6. Use cmake's external projects(externalproject_add). At first when this project was just started, we considered both option 2 and option 3. We preferred option 2 because: 1. It's easier to handle authentication. At first this project was not open source, and it had some other non-public dependencies. If we use git submodule, ADO will handle authentication smoothly. Otherwise we need to manually pass tokens around and be very careful on not exposing them in build logs. 2. At that time, cmake fetched dependencies after "cmake" finished generating vcprojects/makefiles. So it was very difficult to make cflags consistent. Since cmake 3.11, it has a new command: FetchContent, which fetches dependencies when it generates vcprojects/makefiles just before add_subdirectories, so the parent project's variables/settings can be easily passed to the child projects. And when the project went on, we had some new concerns: 1. As we started to have more and more EPs and build configs, the number of submodules grew quickly. For more developers, most ORT submodules are not relevant to them. They shouldn't need to download all of them. 2. It is impossible to let two different build configs use two different versions of the same dependency. For example, right now we have protobuf 3.18.3 in the submodules. Then every EP must use the same version. Whenever we have a need to upgrade protobuf, we need to coordinate across the whole team and many external developers. I can't manage it anymore. 3. Some projects want to manage the dependencies in a different way, either because of their preference or because of compliance requirements. For example, some Microsoft teams want to use vcpkg, but we don't want to force every user of onnxruntime using vcpkg. 7. Someone wants to dynamically link to protobuf, but our build script only does static link. 8. Hard to handle security vulnerabilities. For example, whenever protobuf has a security patch, we have a lot of things to do. But if we allowed people to build ORT with a different version of protobuf without changing ORT"s source code, the customer who build ORT from source will be able to act on such things in a quicker way. They will not need to wait ORT having a patch release. 9. Every time we do a release, github will also publish a source file zip file and a source file tarball for us. But they are not usable, because they miss submodules. ### New features After this change, users will be able to: 1. Build the dependencies in the way they want, then install them to somewhere(for example, /usr or a temp folder). 2. Or download the dependencies by using cmake commands from these dependencies official website 3. Similar to the above, but use your private mirrors to migrate supply chain risks. 4. Use different versions of the dependencies, as long as our source code is compatible with them. For example, you may use you can't use protobuf 3.20.x as they need code changes in ONNX Runtime. 6. Only download the things the current build needs. 10. Avoid building external dependencies again and again in every build. ### Breaking change The onnxruntime_PREFER_SYSTEM_LIB build option is removed you could think from now it is default ON. If you don't like the new behavior, you can set FETCHCONTENT_TRY_FIND_PACKAGE_MODE to NEVER. Besides, for who relied on the onnxruntime_PREFER_SYSTEM_LIB build option, please be aware that this PR will change find_package calls from Module mode to Config mode. For example, in the past if you have installed protobuf from apt-get from ubuntu 20.04's official repo, find_package can find it and use it. But after this PR, it won't. This is because that protobuf version provided by Ubuntu 20.04 is too old to support the "config mode". It can be resolved by getting a newer version of protobuf from somewhere.
This commit is contained in:
Родитель
e9b92fdf33
Коммит
04900f96c1
|
@ -4,9 +4,6 @@
|
|||
[submodule "cmake/external/googletest"]
|
||||
path = cmake/external/googletest
|
||||
url = https://github.com/google/googletest.git
|
||||
[submodule "cmake/external/googlebenchmark"]
|
||||
path = cmake/external/googlebenchmark
|
||||
url = https://github.com/google/benchmark.git
|
||||
[submodule "cmake/external/onnx"]
|
||||
path = cmake/external/onnx
|
||||
url = https://github.com/onnx/onnx.git
|
||||
|
@ -22,36 +19,15 @@
|
|||
[submodule "cmake/external/eigen"]
|
||||
path = cmake/external/eigen
|
||||
url = https://gitlab.com/libeigen/eigen.git
|
||||
[submodule "cmake/external/cxxopts"]
|
||||
path = cmake/external/cxxopts
|
||||
url = https://github.com/jarro2783/cxxopts.git
|
||||
[submodule "cmake/external/tensorboard"]
|
||||
path = cmake/external/tensorboard
|
||||
url = https://github.com/tensorflow/tensorboard.git
|
||||
[submodule "cmake/external/mimalloc"]
|
||||
path = cmake/external/mimalloc
|
||||
url = https://github.com/microsoft/mimalloc.git
|
||||
[submodule "cmake/external/wil"]
|
||||
path = cmake/external/wil
|
||||
url = https://github.com/microsoft/wil.git
|
||||
[submodule "cmake/external/json"]
|
||||
path = cmake/external/json
|
||||
url = https://github.com/nlohmann/json.git
|
||||
[submodule "cmake/external/libprotobuf-mutator"]
|
||||
path = cmake/external/libprotobuf-mutator
|
||||
url = https://github.com/google/libprotobuf-mutator.git
|
||||
[submodule "cmake/external/flatbuffers"]
|
||||
path = cmake/external/flatbuffers
|
||||
url = https://github.com/google/flatbuffers.git
|
||||
[submodule "cmake/external/SafeInt/safeint"]
|
||||
path = cmake/external/SafeInt/safeint
|
||||
url = https://github.com/dcleblanc/SafeInt.git
|
||||
[submodule "cmake/external/mp11"]
|
||||
path = cmake/external/mp11
|
||||
url = https://github.com/boostorg/mp11.git
|
||||
[submodule "cmake/external/dlpack"]
|
||||
path = cmake/external/dlpack
|
||||
url = https://github.com/dmlc/dlpack.git
|
||||
[submodule "cmake/external/emsdk"]
|
||||
path = cmake/external/emsdk
|
||||
url = https://github.com/emscripten-core/emsdk.git
|
||||
|
@ -66,13 +42,3 @@
|
|||
path = cmake/external/onnx-tensorrt
|
||||
url = https://github.com/onnx/onnx-tensorrt.git
|
||||
branch = 8.4-GA
|
||||
[submodule "cmake/external/pthreadpool"]
|
||||
path = cmake/external/pthreadpool
|
||||
url = https://github.com/Maratyszcza/pthreadpool.git
|
||||
[submodule "cmake/external/FP16"]
|
||||
path = cmake/external/FP16
|
||||
url = https://github.com/Maratyszcza/FP16.git
|
||||
[submodule "cmake/external/XNNPACK"]
|
||||
path = cmake/external/XNNPACK
|
||||
url = https://github.com/google/XNNPACK.git
|
||||
ignore = dirty
|
||||
|
|
|
@ -8,6 +8,7 @@ This file contains generated CGManifest entries.
|
|||
It covers these dependencies:
|
||||
- git submodules
|
||||
- dependencies from the Dockerfile `tools/ci_build/github/linux/docker/Dockerfile.manylinux2014_cuda11`
|
||||
- the entries in [../cmake/deps.txt](../cmake/deps.txt)
|
||||
|
||||
If any of these dependencies change, this file should be updated.
|
||||
**When updating, please regenerate instead of editing manually.**
|
||||
|
@ -20,8 +21,10 @@ If any of these dependencies change, this file should be updated.
|
|||
```
|
||||
3. Run the generator script:
|
||||
```
|
||||
$ python cgmanifests/generate_cgmanifest.py
|
||||
$ python cgmanifests/generate_cgmanifest.py --username <xxx> --token <your_access_token>
|
||||
```
|
||||
|
||||
Please supply your github username and access token to the script. If you don't have a token, you can generate one at https://github.com/settings/tokens. This is for authenticating with Github REST API so that you would not hit the rate limit.
|
||||
|
||||
## `cgmanifests/cgmanifest.json`
|
||||
This file contains non-generated CGManifest entries. Please edit directly as needed.
|
||||
|
|
|
@ -23,16 +23,7 @@
|
|||
"maven": { "GroupId": "com.google.protobuf", "ArtifactId": "protobuf-java", "Version": "3.21.7" },
|
||||
"DevelopmentDependency": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "a3534567187d2edc428efd3f13466ff75fe5805c",
|
||||
"repositoryUrl": "https://github.com/microsoft/gsl.git"
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
|
@ -324,26 +315,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"git": {
|
||||
"commitHash": "cc4bed2d74f7c8717e31f9579214ab52a9c9c610",
|
||||
"repositoryUrl": "https://github.com/abseil/abseil-cpp"
|
||||
},
|
||||
"type": "git",
|
||||
"comments": "used by onnxruntime server"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "256be563447a315f2a7993ec669460ba475fa86a",
|
||||
"repositoryUrl": "https://github.com/abseil/abseil-cpp"
|
||||
},
|
||||
"comments": "used by onnxruntime"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"Type": "other",
|
||||
|
@ -564,17 +535,7 @@
|
|||
"DownloadUrl": "http://security.ubuntu.com/ubuntu/pool/main/s/sqlite3/libsqlite3-dev_3.22.0-1ubuntu0.4_amd64.deb"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "512d44b9aa22690fd7d7e665fcab9bdcb590f118",
|
||||
"repositoryUrl": "https://github.com/google/XNNPACK.git"
|
||||
},
|
||||
"comments": "xnnpack"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"Version": 1
|
||||
}
|
||||
|
|
|
@ -1,10 +1,28 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import csv
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
from dataclasses import dataclass
|
||||
from pathlib import PurePosixPath
|
||||
from urllib.parse import urlparse
|
||||
|
||||
import requests
|
||||
|
||||
|
||||
def parse_arguments():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--username", required=True, help="Github username")
|
||||
parser.add_argument("--token", required=True, help="Github access token")
|
||||
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
args = parse_arguments()
|
||||
|
||||
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
|
||||
REPO_DIR = os.path.normpath(os.path.join(SCRIPT_DIR, ".."))
|
||||
|
@ -15,6 +33,61 @@ package_url = None
|
|||
|
||||
registrations = []
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class GitDep:
|
||||
commit: str
|
||||
url: str
|
||||
|
||||
|
||||
git_deps = {}
|
||||
|
||||
|
||||
def add_github_dep(name, parsed_url):
|
||||
segments = parsed_url.path.split("/")
|
||||
org_name = segments[1]
|
||||
repo_name = segments[2]
|
||||
if segments[3] != "archive":
|
||||
print("unrecognized github url path:" + parsed_url.path)
|
||||
return
|
||||
git_repo_url = "https://github.com/%s/%s.git" % (org_name, repo_name)
|
||||
# For example, the path might be like '/myorg/myrepo/archive/5a5f8a5935762397aa68429b5493084ff970f774.zip'
|
||||
# The last segment, segments[4], is '5a5f8a5935762397aa68429b5493084ff970f774.zip'
|
||||
if len(segments) == 5 and re.match(r"[0-9a-f]{40}", PurePosixPath(segments[4]).stem):
|
||||
commit = PurePosixPath(segments[4]).stem
|
||||
dep = GitDep(commit, git_repo_url)
|
||||
if dep not in git_deps:
|
||||
git_deps[dep] = name
|
||||
else:
|
||||
if len(segments) == 5:
|
||||
tag = PurePosixPath(segments[4]).stem
|
||||
if tag.endswith(".tar"):
|
||||
tag = PurePosixPath(tag).stem
|
||||
elif segments[4] == "refs" and segments[5] == "tags":
|
||||
tag = PurePosixPath(segments[6]).stem
|
||||
if tag.endswith(".tar"):
|
||||
tag = PurePosixPath(tag).stem
|
||||
else:
|
||||
print("unrecognized github url path:" + parsed_url.path)
|
||||
return
|
||||
# Make a REST call to convert to tag to a git commit
|
||||
url = "https://api.github.com/repos/%s/%s/git/refs/tags/%s" % (org_name, repo_name, tag)
|
||||
res = requests.get(url, auth=(args.username, args.token))
|
||||
response_json = res.json()
|
||||
tag_object = response_json["object"]
|
||||
if tag_object["type"] == "commit":
|
||||
commit = tag_object["sha"]
|
||||
elif tag_object["type"] == "tag":
|
||||
res = requests.get(tag_object["url"], auth=(args.username, args.token))
|
||||
commit = res.json()["object"]["sha"]
|
||||
else:
|
||||
print("unrecognized github url path:" + parsed_url.path)
|
||||
return
|
||||
dep = GitDep(commit, git_repo_url)
|
||||
if dep not in git_deps:
|
||||
git_deps[dep] = name
|
||||
|
||||
|
||||
with open(
|
||||
os.path.join(REPO_DIR, "tools", "ci_build", "github", "linux", "docker", "Dockerfile.manylinux2014_cuda11"),
|
||||
mode="r",
|
||||
|
@ -44,18 +117,22 @@ with open(
|
|||
package_url = m.group(2) + "/v" + package_filename + "/cmake-" + package_filename + ".tar.gz"
|
||||
else:
|
||||
package_url = m.group(2) + "/" + package_filename + ".tar.gz"
|
||||
registration = {
|
||||
"Component": {
|
||||
"Type": "other",
|
||||
"other": {
|
||||
"Name": package_name.lower(),
|
||||
"Version": package_filename.split("-")[-1],
|
||||
"DownloadUrl": package_url,
|
||||
},
|
||||
"comments": "manylinux dependency",
|
||||
parsed_url = urlparse(package_url)
|
||||
if parsed_url.hostname == "github.com":
|
||||
add_github_dep("manylinux dependency " + package_name, parsed_url)
|
||||
else:
|
||||
registration = {
|
||||
"Component": {
|
||||
"Type": "other",
|
||||
"other": {
|
||||
"Name": package_name.lower(),
|
||||
"Version": package_filename.split("-")[-1],
|
||||
"DownloadUrl": package_url,
|
||||
},
|
||||
"comments": "manylinux dependency",
|
||||
}
|
||||
}
|
||||
}
|
||||
registrations.append(registration)
|
||||
registrations.append(registration)
|
||||
package_name = None
|
||||
package_filename = None
|
||||
package_url = None
|
||||
|
@ -88,16 +165,36 @@ proc = subprocess.run(
|
|||
submodule_lines = proc.stdout.splitlines()
|
||||
for submodule_line in submodule_lines:
|
||||
(absolute_path, url, commit) = submodule_line.split(" ")
|
||||
git_deps[GitDep(commit, url)] = "git submodule at {}".format(
|
||||
normalize_path_separators(os.path.relpath(absolute_path, REPO_DIR))
|
||||
)
|
||||
|
||||
with open(os.path.join(SCRIPT_DIR, "..", "cmake", "deps.txt")) as f:
|
||||
depfile_reader = csv.reader(f, delimiter=";")
|
||||
for row in depfile_reader:
|
||||
if len(row) < 3:
|
||||
continue
|
||||
name = row[0]
|
||||
# Lines start with "#" are comments
|
||||
if name.startswith("#"):
|
||||
continue
|
||||
url = row[1]
|
||||
parsed_url = urlparse(url)
|
||||
# TODO: add support for gitlab
|
||||
if parsed_url.hostname == "github.com":
|
||||
add_github_dep(name, parsed_url)
|
||||
else:
|
||||
print("unrecognized url:" + url)
|
||||
|
||||
for git_dep, comment in git_deps.items():
|
||||
registration = {
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": commit,
|
||||
"repositoryUrl": url,
|
||||
"commitHash": git_dep.commit,
|
||||
"repositoryUrl": git_dep.url,
|
||||
},
|
||||
"comments": "git submodule at {}".format(
|
||||
normalize_path_separators(os.path.relpath(absolute_path, REPO_DIR))
|
||||
),
|
||||
"comments": comment,
|
||||
}
|
||||
}
|
||||
registrations.append(registration)
|
||||
|
|
|
@ -35,17 +35,6 @@
|
|||
"comments": "manylinux dependency"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Component": {
|
||||
"Type": "other",
|
||||
"other": {
|
||||
"Name": "libxcrypt",
|
||||
"Version": "4.4.28",
|
||||
"DownloadUrl": "https://github.com/besser82/libxcrypt/archive/v4.4.28.tar.gz"
|
||||
},
|
||||
"comments": "manylinux dependency"
|
||||
}
|
||||
},
|
||||
{
|
||||
"Component": {
|
||||
"Type": "other",
|
||||
|
@ -83,30 +72,20 @@
|
|||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "0a92994d729ff76a58f692d3028ca1b64b145d91",
|
||||
"repositoryUrl": "https://github.com/Maratyszcza/FP16.git"
|
||||
"commitHash": "50cf2b6dd4fdf04309445f2eec8de7051d953abf",
|
||||
"repositoryUrl": "https://github.com/besser82/libxcrypt.git"
|
||||
},
|
||||
"comments": "git submodule at cmake/external/FP16"
|
||||
"comments": "manylinux dependency LIBXCRYPT"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "ff15c6ada150a5018c5ef2172401cb4529eac9c0",
|
||||
"repositoryUrl": "https://github.com/dcleblanc/SafeInt.git"
|
||||
"commitHash": "215105818dfde3174fe799600bb0f3cae233d0bf",
|
||||
"repositoryUrl": "https://github.com/abseil/abseil-cpp.git"
|
||||
},
|
||||
"comments": "git submodule at cmake/external/SafeInt/safeint"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "003c580e696a774afdc984996ee909b7c8d8128c",
|
||||
"repositoryUrl": "https://github.com/google/XNNPACK.git"
|
||||
},
|
||||
"comments": "git submodule at cmake/external/XNNPACK"
|
||||
"comments": "abseil_cpp"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -116,7 +95,7 @@
|
|||
"commitHash": "3c73d91c0b04e2b59462f0a741be8c07024c1bc0",
|
||||
"repositoryUrl": "https://github.com/jarro2783/cxxopts.git"
|
||||
},
|
||||
"comments": "git submodule at cmake/external/cxxopts"
|
||||
"comments": "cxxopts"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -126,7 +105,7 @@
|
|||
"commitHash": "e7e1482087f58913b80a20b04d5c58d9d6d90155",
|
||||
"repositoryUrl": "https://github.com/HowardHinnant/date.git"
|
||||
},
|
||||
"comments": "git submodule at cmake/external/date"
|
||||
"comments": "date"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -136,27 +115,7 @@
|
|||
"commitHash": "277508879878e0a5b5b43599b1bea11f66eb3c6c",
|
||||
"repositoryUrl": "https://github.com/dmlc/dlpack.git"
|
||||
},
|
||||
"comments": "git submodule at cmake/external/dlpack"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "d10b27fe37736d2944630ecd7557cefa95cf87c9",
|
||||
"repositoryUrl": "https://gitlab.com/libeigen/eigen.git"
|
||||
},
|
||||
"comments": "git submodule at cmake/external/eigen"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "c220895fd1163c01f0a8b44229fb9e4fe0ae0958",
|
||||
"repositoryUrl": "https://github.com/emscripten-core/emsdk.git"
|
||||
},
|
||||
"comments": "git submodule at cmake/external/emsdk"
|
||||
"comments": "dlpack"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -166,67 +125,37 @@
|
|||
"commitHash": "6df40a2471737b27271bdd9b900ab5f3aec746c7",
|
||||
"repositoryUrl": "https://github.com/google/flatbuffers.git"
|
||||
},
|
||||
"comments": "git submodule at cmake/external/flatbuffers"
|
||||
"comments": "flatbuffers"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "7d0d9061d83b663ce05d9de5da3d5865a3845b79",
|
||||
"commitHash": "0a92994d729ff76a58f692d3028ca1b64b145d91",
|
||||
"repositoryUrl": "https://github.com/Maratyszcza/FP16.git"
|
||||
},
|
||||
"comments": "fp16"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "63058eff77e11aa15bf531df5dd34395ec3017c8",
|
||||
"repositoryUrl": "https://github.com/Maratyszcza/FXdiv.git"
|
||||
},
|
||||
"comments": "fxdiv"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "361e8d1cfe0c6c36d30b39f1b61302ece5507320",
|
||||
"repositoryUrl": "https://github.com/google/benchmark.git"
|
||||
},
|
||||
"comments": "git submodule at cmake/external/googlebenchmark"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "58d77fa8070e8cec2dc1ed015d66b454c8d78850",
|
||||
"repositoryUrl": "https://github.com/google/googletest.git"
|
||||
},
|
||||
"comments": "git submodule at cmake/external/googletest"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "b5364faf9d732052506cefc933d3f4e4f04513a5",
|
||||
"repositoryUrl": "https://github.com/nlohmann/json.git"
|
||||
},
|
||||
"comments": "git submodule at cmake/external/json"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "7a2ed51a6b682a83e345ff49fc4cfd7ca47550db",
|
||||
"repositoryUrl": "https://github.com/google/libprotobuf-mutator.git"
|
||||
},
|
||||
"comments": "git submodule at cmake/external/libprotobuf-mutator"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "f412df7a2b64421e1f1d61fde6055a6ea288e8f5",
|
||||
"repositoryUrl": "https://github.com/microsoft/mimalloc.git"
|
||||
},
|
||||
"comments": "git submodule at cmake/external/mimalloc"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "21cace4e574180ba64d9307a5e4ea9e5e94d3e8d",
|
||||
"repositoryUrl": "https://github.com/boostorg/mp11.git"
|
||||
},
|
||||
"comments": "git submodule at cmake/external/mp11"
|
||||
"comments": "google_benchmark"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -236,7 +165,77 @@
|
|||
"commitHash": "436617053d0f39a1019a371c3a9aa599b3cb2cea",
|
||||
"repositoryUrl": "https://github.com/google/nsync.git"
|
||||
},
|
||||
"comments": "git submodule at cmake/external/nsync"
|
||||
"comments": "google_nsync"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "519beb0e52c842729b4b53731d27c0e0c32ab4a2",
|
||||
"repositoryUrl": "https://github.com/google/googletest.git"
|
||||
},
|
||||
"comments": "googletest"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "003c580e696a774afdc984996ee909b7c8d8128c",
|
||||
"repositoryUrl": "https://github.com/google/XNNPACK.git"
|
||||
},
|
||||
"comments": "googlexnnpack"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "4f8fba14066156b73f1189a2b8bd568bde5284c5",
|
||||
"repositoryUrl": "https://github.com/nlohmann/json.git"
|
||||
},
|
||||
"comments": "json"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "a3534567187d2edc428efd3f13466ff75fe5805c",
|
||||
"repositoryUrl": "https://github.com/microsoft/GSL.git"
|
||||
},
|
||||
"comments": "microsoft_gsl"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "5f4caba4e7a9017816e47becdd918fcc872039ba",
|
||||
"repositoryUrl": "https://github.com/microsoft/wil.git"
|
||||
},
|
||||
"comments": "microsoft_wil"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "f412df7a2b64421e1f1d61fde6055a6ea288e8f5",
|
||||
"repositoryUrl": "https://github.com/microsoft/mimalloc.git"
|
||||
},
|
||||
"comments": "mimalloc"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "7bc4e1ae9b36ec8ee635c3629b59ec525bbe82b9",
|
||||
"repositoryUrl": "https://github.com/boostorg/mp11.git"
|
||||
},
|
||||
"comments": "mp11"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -246,27 +245,7 @@
|
|||
"commitHash": "5a5f8a5935762397aa68429b5493084ff970f774",
|
||||
"repositoryUrl": "https://github.com/onnx/onnx.git"
|
||||
},
|
||||
"comments": "git submodule at cmake/external/onnx"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "0d98dba29d66e93259db7daa53a9327df767a415",
|
||||
"repositoryUrl": "https://github.com/google/benchmark.git"
|
||||
},
|
||||
"comments": "git submodule at cmake/external/onnx/third_party/benchmark"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "ffa346860b306c9bbfb341aed9c14c067751feb8",
|
||||
"repositoryUrl": "https://github.com/pybind/pybind11.git"
|
||||
},
|
||||
"comments": "git submodule at cmake/external/onnx/third_party/pybind11"
|
||||
"comments": "onnx"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -276,57 +255,7 @@
|
|||
"commitHash": "87c7a70688fd98fb355b8976f41425b40e4fe52f",
|
||||
"repositoryUrl": "https://github.com/onnx/onnx-tensorrt.git"
|
||||
},
|
||||
"comments": "git submodule at cmake/external/onnx-tensorrt"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "553df22c67bee5f0fe6599cff60f1afc6748c635",
|
||||
"repositoryUrl": "https://github.com/onnx/onnx.git"
|
||||
},
|
||||
"comments": "git submodule at cmake/external/onnx-tensorrt/third_party/onnx"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "e776aa0275e293707b6a0901e0e8d8a8a3679508",
|
||||
"repositoryUrl": "https://github.com/google/benchmark.git"
|
||||
},
|
||||
"comments": "git submodule at cmake/external/onnx-tensorrt/third_party/onnx/third_party/benchmark"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "09f082940113661256310e3f4811aa7261a9fa05",
|
||||
"repositoryUrl": "https://github.com/pybind/pybind11.git"
|
||||
},
|
||||
"comments": "git submodule at cmake/external/onnx-tensorrt/third_party/onnx/third_party/pybind11"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "6a00cbc4a9b8e68b71caf7f774b3f9c753ae84d5",
|
||||
"repositoryUrl": "https://github.com/wjakob/clang-cindex-python3"
|
||||
},
|
||||
"comments": "git submodule at cmake/external/onnx-tensorrt/third_party/onnx/third_party/pybind11/tools/clang"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "d4b2aff0c890ae38bad87c20f5731333db2a2cc1",
|
||||
"repositoryUrl": "https://github.com/microsoft/onnxruntime-extensions.git"
|
||||
},
|
||||
"comments": "git submodule at cmake/external/onnxruntime-extensions"
|
||||
"comments": "onnx_tensorrt"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -336,27 +265,17 @@
|
|||
"commitHash": "a902b39270841beafc307dfa709610aa1cac2f06",
|
||||
"repositoryUrl": "https://github.com/protocolbuffers/protobuf.git"
|
||||
},
|
||||
"comments": "git submodule at cmake/external/protobuf"
|
||||
"comments": "protobuf"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "5b7683f49e1e9223cf9927b24f6fd3d6bd82e3f8",
|
||||
"repositoryUrl": "https://github.com/google/benchmark.git"
|
||||
"commitHash": "072586a71b55b7f8c584153d223e95687148a900",
|
||||
"repositoryUrl": "https://github.com/Maratyszcza/psimd.git"
|
||||
},
|
||||
"comments": "git submodule at cmake/external/protobuf/third_party/benchmark"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "5ec7f0c4a113e2f18ac2c6cc7df51ad6afc24081",
|
||||
"repositoryUrl": "https://github.com/google/googletest.git"
|
||||
},
|
||||
"comments": "git submodule at cmake/external/protobuf/third_party/googletest"
|
||||
"comments": "psimd"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -366,7 +285,17 @@
|
|||
"commitHash": "1787867f6183f056420e532eec640cba25efafea",
|
||||
"repositoryUrl": "https://github.com/Maratyszcza/pthreadpool.git"
|
||||
},
|
||||
"comments": "git submodule at cmake/external/pthreadpool"
|
||||
"comments": "pthreadpool"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "8de7772cc72daca8e947b79b83fea46214931604",
|
||||
"repositoryUrl": "https://github.com/pybind/pybind11.git"
|
||||
},
|
||||
"comments": "pybind11"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -376,17 +305,27 @@
|
|||
"commitHash": "5916273f79a21551890fd3d56fc5375a78d1598d",
|
||||
"repositoryUrl": "https://github.com/pytorch/cpuinfo.git"
|
||||
},
|
||||
"comments": "git submodule at cmake/external/pytorch_cpuinfo"
|
||||
"comments": "pytorch_cpuinfo"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "4244cd1cb492fa1d10986ec67f862964c073f844",
|
||||
"commitHash": "5723bb8950318135ed9cf4fc76bed988a087f536",
|
||||
"repositoryUrl": "https://github.com/google/re2.git"
|
||||
},
|
||||
"comments": "git submodule at cmake/external/re2"
|
||||
"comments": "re2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "ff15c6ada150a5018c5ef2172401cb4529eac9c0",
|
||||
"repositoryUrl": "https://github.com/dcleblanc/SafeInt.git"
|
||||
},
|
||||
"comments": "safeint"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -396,17 +335,7 @@
|
|||
"commitHash": "373eb09e4c5d2b3cc2493f0949dc4be6b6a45e81",
|
||||
"repositoryUrl": "https://github.com/tensorflow/tensorboard.git"
|
||||
},
|
||||
"comments": "git submodule at cmake/external/tensorboard"
|
||||
}
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
"type": "git",
|
||||
"git": {
|
||||
"commitHash": "e8c599bca6c56c44b6730ad93f6abbc9ecd60fc1",
|
||||
"repositoryUrl": "https://github.com/microsoft/wil.git"
|
||||
},
|
||||
"comments": "git submodule at cmake/external/wil"
|
||||
"comments": "tensorboard"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
1046
cmake/CMakeLists.txt
1046
cmake/CMakeLists.txt
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,371 @@
|
|||
# work around Android NDK bug which doesn't include -O flag for Release configuration
|
||||
# https://github.com/android/ndk/issues/1740
|
||||
# TODO: remove this when the NDK version(s) we support get fixed
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||
# NB: attempting to match the effects of this fix: https://android-review.googlesource.com/c/platform/ndk/+/2168845
|
||||
string(APPEND CMAKE_C_FLAGS_RELEASE " -O3")
|
||||
string(APPEND CMAKE_CXX_FLAGS_RELEASE " -O3")
|
||||
string(APPEND CMAKE_ASM_FLAGS_RELEASE " -O3")
|
||||
endif()
|
||||
|
||||
# Enable space optimization for gcc/clang
|
||||
# Cannot use "-ffunction-sections -fdata-sections" if we enable bitcode (iOS)
|
||||
if (NOT MSVC AND NOT onnxruntime_ENABLE_BITCODE)
|
||||
string(APPEND CMAKE_CXX_FLAGS " -ffunction-sections -fdata-sections")
|
||||
string(APPEND CMAKE_C_FLAGS " -ffunction-sections -fdata-sections")
|
||||
endif()
|
||||
|
||||
if (onnxruntime_ENABLE_EAGER_MODE)
|
||||
string(APPEND CMAKE_CXX_FLAGS " -D_GLIBCXX_USE_CXX11_ABI=${_GLIBCXX_USE_CXX11_ABI}")
|
||||
endif()
|
||||
|
||||
if (onnxruntime_BUILD_WEBASSEMBLY)
|
||||
# Enable LTO for release single-thread build
|
||||
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
# NOTES:
|
||||
# (1) LTO does not work for WebAssembly multi-thread. (segment fault in worker)
|
||||
# (2) "-flto=thin" does not work correctly for wasm-ld.
|
||||
# we don't set onnxruntime_ENABLE_LTO because it appends flag "-flto=thin"
|
||||
# instead, we manually set CMAKE_CXX_FLAGS "-flto"
|
||||
string(APPEND CMAKE_C_FLAGS " -flto")
|
||||
string(APPEND CMAKE_CXX_FLAGS " -flto")
|
||||
endif()
|
||||
|
||||
if (onnxruntime_ENABLE_WEBASSEMBLY_DEBUG_INFO)
|
||||
# "-g3" generates DWARF format debug info.
|
||||
# NOTE: With debug info enabled, web assembly artifacts will be very huge (>1GB). So we offer an option to build without debug info.
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-g3")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-g2")
|
||||
endif()
|
||||
|
||||
if (onnxruntime_ENABLE_WEBASSEMBLY_SIMD)
|
||||
string(APPEND CMAKE_C_FLAGS " -msimd128")
|
||||
string(APPEND CMAKE_CXX_FLAGS " -msimd128")
|
||||
endif()
|
||||
|
||||
if (onnxruntime_ENABLE_WEBASSEMBLY_EXCEPTION_CATCHING)
|
||||
string(APPEND CMAKE_C_FLAGS " -s DISABLE_EXCEPTION_CATCHING=0")
|
||||
string(APPEND CMAKE_CXX_FLAGS " -s DISABLE_EXCEPTION_CATCHING=0")
|
||||
endif()
|
||||
|
||||
# Build WebAssembly with multi-threads support.
|
||||
if (onnxruntime_ENABLE_WEBASSEMBLY_THREADS)
|
||||
string(APPEND CMAKE_C_FLAGS " -pthread")
|
||||
string(APPEND CMAKE_CXX_FLAGS " -pthread")
|
||||
string(APPEND CMAKE_C_FLAGS " -s USE_PTHREADS=1 -Wno-pthreads-mem-growth")
|
||||
string(APPEND CMAKE_CXX_FLAGS " -s USE_PTHREADS=1 -Wno-pthreads-mem-growth")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (onnxruntime_EXTERNAL_TRANSFORMER_SRC_PATH)
|
||||
add_definitions(-DORT_TRAINING_EXTERNAL_GRAPH_TRANSFORMERS=1)
|
||||
endif()
|
||||
|
||||
# ORT build with as much excluded as possible. Supports ORT flatbuffers models only.
|
||||
if (onnxruntime_MINIMAL_BUILD)
|
||||
add_compile_definitions(ORT_MINIMAL_BUILD)
|
||||
|
||||
if (onnxruntime_EXTENDED_MINIMAL_BUILD)
|
||||
# enable EPs that compile kernels at runtime
|
||||
add_compile_definitions(ORT_EXTENDED_MINIMAL_BUILD)
|
||||
endif()
|
||||
|
||||
if (onnxruntime_MINIMAL_BUILD_CUSTOM_OPS)
|
||||
add_compile_definitions(ORT_MINIMAL_BUILD_CUSTOM_OPS)
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
# turn on LTO (which adds some compiler flags and turns on LTCG) unless it's a Debug build to minimize binary size
|
||||
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(onnxruntime_ENABLE_LTO ON)
|
||||
endif()
|
||||
|
||||
# undocumented internal flag to allow analysis of a minimal build binary size
|
||||
if (ADD_DEBUG_INFO_TO_MINIMAL_BUILD)
|
||||
string(APPEND CMAKE_CXX_FLAGS " /Zi")
|
||||
string(APPEND CMAKE_C_FLAGS " /Zi")
|
||||
string(APPEND CMAKE_SHARED_LINKER_FLAGS " /debug")
|
||||
endif()
|
||||
else()
|
||||
if (CMAKE_HOST_SYSTEM MATCHES "Darwin")
|
||||
add_link_options(-Wl, -dead_strip)
|
||||
else()
|
||||
add_link_options(-Wl,--gc-sections)
|
||||
endif()
|
||||
|
||||
if (ADD_DEBUG_INFO_TO_MINIMAL_BUILD)
|
||||
string(APPEND CMAKE_CXX_FLAGS " -g")
|
||||
string(APPEND CMAKE_C_FLAGS " -g")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (onnxruntime_ENABLE_LTO)
|
||||
include(CheckIPOSupported)
|
||||
check_ipo_supported(RESULT ipo_enabled OUTPUT ipo_output)
|
||||
if (NOT ipo_enabled)
|
||||
message(WARNING "IPO is not supported by this compiler")
|
||||
set(onnxruntime_ENABLE_LTO OFF)
|
||||
else()
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (onnxruntime_REDUCED_OPS_BUILD)
|
||||
add_compile_definitions(REDUCED_OPS_BUILD)
|
||||
endif()
|
||||
|
||||
if (onnxruntime_DISABLE_EXTERNAL_INITIALIZERS)
|
||||
add_definitions(-DDISABLE_EXTERNAL_INITIALIZERS=1)
|
||||
endif()
|
||||
|
||||
if (onnxruntime_DISABLE_RTTI)
|
||||
add_compile_definitions(ORT_NO_RTTI)
|
||||
if (MSVC)
|
||||
# Disable RTTI and turn usage of dynamic_cast and typeid into errors
|
||||
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:/GR->" "$<$<COMPILE_LANGUAGE:CXX>:/we4541>")
|
||||
else()
|
||||
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>")
|
||||
endif()
|
||||
else()
|
||||
#MSVC RTTI flag /GR is not added to CMAKE_CXX_FLAGS by default. But, anyway VC++2019 treats "/GR" default on.
|
||||
#So we don't need the following three lines. But it's better to make it more explicit.
|
||||
if (MSVC)
|
||||
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:/GR>")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# If this is only enabled in an onnxruntime_ORT_MODEL_FORMAT_ONLY build we don't need ONNX changes
|
||||
# as we (currently) only pull in data_type_utils.cc/h which doesn't throw
|
||||
if (onnxruntime_DISABLE_EXCEPTIONS)
|
||||
if (NOT onnxruntime_MINIMAL_BUILD)
|
||||
message(FATAL_ERROR "onnxruntime_MINIMAL_BUILD required for onnxruntime_DISABLE_EXCEPTIONS")
|
||||
endif()
|
||||
|
||||
if (onnxruntime_ENABLE_PYTHON)
|
||||
# pybind11 highly depends on C++ exceptions.
|
||||
message(FATAL_ERROR "onnxruntime_ENABLE_PYTHON must be disabled for onnxruntime_DISABLE_EXCEPTIONS")
|
||||
endif()
|
||||
add_compile_definitions("ORT_NO_EXCEPTIONS")
|
||||
add_compile_definitions("MLAS_NO_EXCEPTION")
|
||||
add_compile_definitions("ONNX_NO_EXCEPTIONS")
|
||||
add_compile_definitions("JSON_NOEXCEPTION") # https://json.nlohmann.me/api/macros/json_noexception/
|
||||
|
||||
if (MSVC)
|
||||
string(REGEX REPLACE "/EHsc" "/EHs-c-" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
# Eigen throw_std_bad_alloc calls 'new' instead of throwing which results in a nodiscard warning.
|
||||
# It also has unreachable code as there's no good way to avoid EIGEN_EXCEPTIONS being set in macros.h
|
||||
# TODO: see if we can limit the code this is disabled for.
|
||||
string(APPEND CMAKE_CXX_FLAGS " /wd4834 /wd4702")
|
||||
add_compile_definitions("_HAS_EXCEPTIONS=0")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# Guarantee that the Eigen code that you are #including is licensed
|
||||
# under the MPL2 and possibly more permissive licenses (like BSD).
|
||||
add_definitions(-DEIGEN_MPL2_ONLY)
|
||||
if (MSVC)
|
||||
add_definitions(-DEIGEN_HAS_CONSTEXPR -DEIGEN_HAS_VARIADIC_TEMPLATES -DEIGEN_HAS_CXX11_MATH -DEIGEN_HAS_CXX11_ATOMIC
|
||||
-DEIGEN_STRONG_INLINE=inline)
|
||||
endif()
|
||||
|
||||
if ( onnxruntime_DONT_VECTORIZE )
|
||||
add_definitions(-DEIGEN_DONT_VECTORIZE=1)
|
||||
endif()
|
||||
|
||||
if (onnxruntime_CROSS_COMPILING)
|
||||
set(CMAKE_CROSSCOMPILING ON)
|
||||
check_cxx_compiler_flag(-Wno-error HAS_NOERROR)
|
||||
if (HAS_NOERROR)
|
||||
string(APPEND CMAKE_CXX_FLAGS " -Wno-error=attributes")
|
||||
string(APPEND CMAKE_C_FLAGS " -Wno-error=attributes")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
|
||||
check_cxx_compiler_flag(-Wno-error HAS_NOERROR)
|
||||
if (HAS_NOERROR)
|
||||
string(APPEND CMAKE_CXX_FLAGS " -Wno-error=attributes")
|
||||
string(APPEND CMAKE_C_FLAGS " -Wno-error=attributes")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Mark symbols to be invisible, for macOS/iOS target only
|
||||
# Due to many dependencies have different symbol visibility settings, set global compile flags here.
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin|iOS")
|
||||
foreach(flags CMAKE_CXX_FLAGS CMAKE_OBJC_FLAGS CMAKE_OBJCXX_FLAGS)
|
||||
string(APPEND ${flags} " -fvisibility=hidden -fvisibility-inlines-hidden")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
|
||||
macro(check_nvcc_compiler_flag _FLAG _RESULT)
|
||||
execute_process(COMMAND ${onnxruntime_CUDA_HOME}/bin/nvcc "${_FLAG}" RESULT_VARIABLE NVCC_OUT ERROR_VARIABLE NVCC_ERROR)
|
||||
message("NVCC_ERROR = ${NVCC_ERROR}")
|
||||
message("NVCC_OUT = ${NVCC_OUT}")
|
||||
if ("${NVCC_OUT}" MATCHES "0")
|
||||
set(${_RESULT} 1)
|
||||
else()
|
||||
set(${_RESULT} 0)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
#Set global compile flags for all the source code(including third_party code like protobuf)
|
||||
#This section must be before any add_subdirectory, otherwise build may fail because /MD,/MT mismatch
|
||||
if (MSVC)
|
||||
enable_language(ASM_MASM)
|
||||
if (CMAKE_GENERATOR_PLATFORM)
|
||||
# Multi-platform generator
|
||||
set(onnxruntime_target_platform ${CMAKE_GENERATOR_PLATFORM})
|
||||
else()
|
||||
set(onnxruntime_target_platform ${CMAKE_SYSTEM_PROCESSOR})
|
||||
endif()
|
||||
if (onnxruntime_target_platform STREQUAL "ARM64")
|
||||
set(onnxruntime_target_platform "ARM64")
|
||||
elseif (onnxruntime_target_platform STREQUAL "ARM64EC")
|
||||
set(onnxruntime_target_platform "ARM64EC")
|
||||
elseif (onnxruntime_target_platform STREQUAL "ARM" OR CMAKE_GENERATOR MATCHES "ARM")
|
||||
set(onnxruntime_target_platform "ARM")
|
||||
elseif (onnxruntime_target_platform STREQUAL "x64" OR onnxruntime_target_platform STREQUAL "x86_64" OR onnxruntime_target_platform STREQUAL "AMD64" OR CMAKE_GENERATOR MATCHES "Win64")
|
||||
set(onnxruntime_target_platform "x64")
|
||||
elseif (onnxruntime_target_platform STREQUAL "Win32" OR onnxruntime_target_platform STREQUAL "x86" OR onnxruntime_target_platform STREQUAL "i386" OR onnxruntime_target_platform STREQUAL "i686")
|
||||
set(onnxruntime_target_platform "x86")
|
||||
if (NOT onnxruntime_BUILD_WEBASSEMBLY)
|
||||
message("Enabling SAFESEH for x86 build")
|
||||
set(CMAKE_ASM_MASM_FLAGS "${CMAKE_ASM_MASM_FLAGS} /safeseh")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
#Always enable exception handling, even for Windows ARM
|
||||
if (NOT onnxruntime_DISABLE_EXCEPTIONS)
|
||||
string(APPEND CMAKE_CXX_FLAGS " /EHsc")
|
||||
string(APPEND CMAKE_C_FLAGS " /EHsc")
|
||||
|
||||
string(APPEND CMAKE_CXX_FLAGS " /wd26812")
|
||||
string(APPEND CMAKE_C_FLAGS " /wd26812")
|
||||
# warning C4805: '|': unsafe mix of type 'uintptr_t' and type 'bool' in operation (from c10/core/TensorImpl.h)
|
||||
if (onnxruntime_ENABLE_EAGER_MODE)
|
||||
string(APPEND CMAKE_CXX_FLAGS " /wd4805")
|
||||
endif()
|
||||
endif()
|
||||
# We do not treat 3rd-party libraries' warnings as errors. In order to do that, we need to add their header files locations to /external:I.
|
||||
# However, if a 3rd-party library was installed to a non-standard location and cmake find it and use it from there, you may see build errors
|
||||
# like: "error C2220: the following warning is treated as an error"
|
||||
string(APPEND CMAKE_CXX_FLAGS " /experimental:external /external:W0 /external:templates- /external:I ${CMAKE_CURRENT_SOURCE_DIR} /external:I ${CMAKE_CURRENT_BINARY_DIR}")
|
||||
if (onnxruntime_USE_AVX)
|
||||
string(APPEND CMAKE_CXX_FLAGS " /arch:AVX")
|
||||
string(APPEND CMAKE_C_FLAGS " /arch:AVX")
|
||||
elseif (onnxruntime_USE_AVX2)
|
||||
string(APPEND CMAKE_CXX_FLAGS " /arch:AVX2")
|
||||
string(APPEND CMAKE_C_FLAGS " /arch:AVX2")
|
||||
elseif (onnxruntime_USE_AVX512)
|
||||
string(APPEND CMAKE_CXX_FLAGS " /arch:AVX512")
|
||||
string(APPEND CMAKE_C_FLAGS " /arch:AVX512")
|
||||
endif()
|
||||
|
||||
if (NOT GDK_PLATFORM)
|
||||
add_compile_definitions(WINAPI_FAMILY=100) # Desktop app
|
||||
if (onnxruntime_USE_WINML OR NOT CMAKE_CXX_STANDARD_LIBRARIES MATCHES kernel32.lib)
|
||||
message("Building ONNX Runtime for Windows 8 and newer")
|
||||
add_compile_definitions(WINVER=0x0602 _WIN32_WINNT=0x0602 NTDDI_VERSION=0x06020000) # Support Windows 8 and newer
|
||||
else()
|
||||
message("Building ONNX Runtime for Windows 7 and newer")
|
||||
# For people who build ONNX Runtime from source, the result binary may still support Windows 7
|
||||
# Windows 7 doesn't have OneCore. So if CMAKE_CXX_STANDARD_LIBRARIES is for OneCore, the build won't come here
|
||||
add_compile_definitions(WINVER=0x0601 _WIN32_WINNT=0x0601 NTDDI_VERSION=0x06010000) # Support Windows 7 and newer
|
||||
endif()
|
||||
endif()
|
||||
if (onnxruntime_ENABLE_LTO AND NOT onnxruntime_USE_CUDA)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Gw /GL")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Gw /GL")
|
||||
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /Gw /GL")
|
||||
endif()
|
||||
|
||||
# The WinML build tool chain builds ARM/ARM64, and the internal tool chain does not have folders for spectre mitigation libs.
|
||||
# WinML performs spectre mitigation differently.
|
||||
if (NOT DEFINED onnxruntime_DISABLE_QSPECTRE_CHECK)
|
||||
check_cxx_compiler_flag(-Qspectre HAS_QSPECTRE)
|
||||
if (HAS_QSPECTRE)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Qspectre")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Qspectre")
|
||||
endif()
|
||||
endif()
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DYNAMICBASE")
|
||||
check_cxx_compiler_flag(-guard:cf HAS_GUARD_CF)
|
||||
if (HAS_GUARD_CF)
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /guard:cf")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /guard:cf")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /guard:cf")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /guard:cf")
|
||||
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} /guard:cf")
|
||||
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /guard:cf")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /guard:cf")
|
||||
endif()
|
||||
else()
|
||||
if (NOT APPLE)
|
||||
set(onnxruntime_target_platform ${CMAKE_SYSTEM_PROCESSOR})
|
||||
endif()
|
||||
if (onnxruntime_BUILD_FOR_NATIVE_MACHINE)
|
||||
string(APPEND CMAKE_CXX_FLAGS " -march=native -mtune=native")
|
||||
string(APPEND CMAKE_C_FLAGS " -march=native -mtune=native")
|
||||
elseif (onnxruntime_USE_AVX)
|
||||
string(APPEND CMAKE_CXX_FLAGS " -mavx")
|
||||
string(APPEND CMAKE_C_FLAGS " -mavx")
|
||||
elseif (onnxruntime_USE_AVX2)
|
||||
string(APPEND CMAKE_CXX_FLAGS " -mavx2")
|
||||
string(APPEND CMAKE_C_FLAGS " -mavx2")
|
||||
elseif (onnxruntime_USE_AVX512)
|
||||
string(APPEND CMAKE_CXX_FLAGS " -mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl")
|
||||
string(APPEND CMAKE_C_FLAGS " -mavx512f -mavx512cd -mavx512bw -mavx512dq -mavx512vl")
|
||||
endif()
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Android" AND Onnxruntime_GCOV_COVERAGE)
|
||||
string(APPEND CMAKE_CXX_FLAGS " -g -O0 --coverage ")
|
||||
string(APPEND CMAKE_C_FLAGS " -g -O0 --coverage ")
|
||||
endif()
|
||||
# Check support for AVX and f16c.
|
||||
include(CheckCXXCompilerFlag)
|
||||
check_cxx_compiler_flag("-mf16c" COMPILER_SUPPORT_MF16C)
|
||||
if (NOT COMPILER_SUPPORT_MF16C)
|
||||
message("F16C instruction set is not supported.")
|
||||
endif()
|
||||
|
||||
check_cxx_compiler_flag("-mfma" COMPILER_SUPPORT_FMA)
|
||||
if (NOT COMPILER_SUPPORT_FMA)
|
||||
message("FMA instruction set is not supported.")
|
||||
endif()
|
||||
|
||||
check_cxx_compiler_flag("-mavx" COMPILER_SUPPORT_AVX)
|
||||
if (NOT COMPILER_SUPPORT_AVX)
|
||||
message("AVX instruction set is not supported.")
|
||||
endif()
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Android" AND onnxruntime_ENABLE_TRAINING_ON_DEVICE)
|
||||
message("F16C, FMA and AVX flags are not supported on Android for on-device training.")
|
||||
endif()
|
||||
|
||||
if (NOT (COMPILER_SUPPORT_MF16C AND COMPILER_SUPPORT_FMA AND COMPILER_SUPPORT_AVX) OR
|
||||
(CMAKE_SYSTEM_NAME STREQUAL "Android" AND onnxruntime_ENABLE_TRAINING_ON_DEVICE))
|
||||
message("One or more AVX/F16C instruction flags are not supported. ")
|
||||
set(onnxruntime_ENABLE_CPU_FP16_OPS FALSE)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
#For Mac compliance
|
||||
message("Adding flags for Mac builds")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector-strong")
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
# parallel build
|
||||
# These compiler opitions cannot be forwarded to NVCC, so cannot use add_compiler_options
|
||||
string(APPEND CMAKE_CXX_FLAGS " /MP")
|
||||
# required to be set explicitly to enable Eigen-Unsupported SpecialFunctions
|
||||
string(APPEND CMAKE_CXX_FLAGS " -DEIGEN_HAS_C99_MATH")
|
||||
endif()
|
|
@ -8,6 +8,28 @@
|
|||
#since the file contains a version string: "lts_20211102". However, the file is for debugging purposes only and would
|
||||
#not affect built binaries.
|
||||
abseil_cpp;https://github.com/abseil/abseil-cpp/archive/refs/tags/20211102.0.zip;ce61532df974d00025b1220408ce1c900d81baf2
|
||||
cxxopts;https://github.com/jarro2783/cxxopts/archive/3c73d91c0b04e2b59462f0a741be8c07024c1bc0.zip;6c6ca7f8480b26c8d00476e0e24b7184717fe4f0
|
||||
date;https://github.com/HowardHinnant/date/archive/refs/tags/v2.4.1.zip;ea99f021262b1d804a872735c658860a6a13cc98
|
||||
dlpack;https://github.com/dmlc/dlpack/archive/refs/tags/v0.6.zip;4d565dd2e5b31321e5549591d78aa7f377173445
|
||||
flatbuffers;https://github.com/google/flatbuffers/archive/refs/tags/v1.12.0.zip;ba0a75fd12dbef8f6557a74e611b7a3d0c5fe7bf
|
||||
fp16;https://github.com/Maratyszcza/FP16/archive/0a92994d729ff76a58f692d3028ca1b64b145d91.zip;b985f6985a05a1c03ff1bb71190f66d8f98a1494
|
||||
fxdiv;https://github.com/Maratyszcza/FXdiv/archive/63058eff77e11aa15bf531df5dd34395ec3017c8.zip;a5658f4036402dbca7cebee32be57fb8149811e1
|
||||
google_benchmark;https://github.com/google/benchmark/archive/refs/tags/v1.7.0.zip;e97c368b176e8614e3f1bf13dd9abcf6a7ad9908
|
||||
google_nsync;https://github.com/google/nsync/archive/refs/tags/1.23.0.zip;f3233450cf7156fc0bedd1b0e884eddec264897c
|
||||
googletest;https://github.com/google/googletest/archive/519beb0e52c842729b4b53731d27c0e0c32ab4a2.zip;4b3c37972e4c1bef1185d46f702082f8772ee73f
|
||||
googlexnnpack;https://github.com/google/XNNPACK/archive/003c580e696a774afdc984996ee909b7c8d8128c.zip;9f192e3f15e1e37ae9c78d53eeea47e45c5eb31c
|
||||
json;https://github.com/nlohmann/json/archive/refs/tags/v3.10.5.zip;f257f8dc27c5b8c085dc887b40cddd18ae1f725c
|
||||
microsoft_gsl;https://github.com/microsoft/GSL/archive/refs/tags/v4.0.0.zip;cf368104cd22a87b4dd0c80228919bb2df3e2a14
|
||||
microsoft_wil;https://github.com/microsoft/wil/archive/5f4caba4e7a9017816e47becdd918fcc872039ba.zip;fd119887d0d17c37adf1fc227b054befa28158ad
|
||||
mimalloc;https://github.com/microsoft/mimalloc/archive/refs/tags/v2.0.3.zip;e4f37b93b2da78a5816c2495603a4188d316214b
|
||||
mp11;https://github.com/boostorg/mp11/archive/refs/tags/boost-1.79.0.zip;c8f04e378535ededbe5af52c8f969d2dedbe73d5
|
||||
onnx;https://github.com/onnx/onnx/archive/5a5f8a5935762397aa68429b5493084ff970f774.zip;edc8e1338c02f3ab222f3d803a24e17608c13895
|
||||
protobuf;https://github.com/protocolbuffers/protobuf/archive/refs/tags/v3.18.3.zip;b95bf7e9de9c2249b6c1f2ca556ace49999e90bd
|
||||
onnx_tensorrt;https://github.com/onnx/onnx-tensorrt/archive/87c7a70688fd98fb355b8976f41425b40e4fe52f.zip;b97d112d9d6efa180c9b94e05268f2ff3294a534
|
||||
protobuf;https://github.com/protocolbuffers/protobuf/archive/refs/tags/v3.18.3.zip;b95bf7e9de9c2249b6c1f2ca556ace49999e90bd
|
||||
psimd;https://github.com/Maratyszcza/psimd/archive/072586a71b55b7f8c584153d223e95687148a900.zip;1f5454b01f06f9656b77e4a5e2e31d7422487013
|
||||
pthreadpool;https://github.com/Maratyszcza/pthreadpool/archive/1787867f6183f056420e532eec640cba25efafea.zip;e43e80781560c5ab404a4da20f34d846f5f5d101
|
||||
pybind11;https://github.com/pybind/pybind11/archive/refs/tags/v2.6.2.zip;950b3b319384a1a36b252cc821953e5f9be14840
|
||||
pytorch_cpuinfo;https://github.com/pytorch/cpuinfo/archive/5916273f79a21551890fd3d56fc5375a78d1598d.zip;2be4d2ae321fada97cb39eaf4eeba5f8c85597cf
|
||||
re2;https://github.com/google/re2/archive/refs/tags/2022-06-01.zip;aa77313b76e91b531ee7f3e45f004c6a502a5374
|
||||
safeint;https://github.com/dcleblanc/SafeInt/archive/ff15c6ada150a5018c5ef2172401cb4529eac9c0.zip;913a4046e5274d329af2806cb53194f617d8c0ab
|
||||
tensorboard;https://github.com/tensorflow/tensorboard/archive/373eb09e4c5d2b3cc2493f0949dc4be6b6a45e81.zip;67b833913605a4f3f499894ab11528a702c2b381
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 0a92994d729ff76a58f692d3028ca1b64b145d91
|
|
@ -1 +0,0 @@
|
|||
Subproject commit ff15c6ada150a5018c5ef2172401cb4529eac9c0
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 003c580e696a774afdc984996ee909b7c8d8128c
|
|
@ -38,3 +38,9 @@ if (GDK_PLATFORM)
|
|||
# tell Abseil to pretend we're building an APP.
|
||||
target_compile_definitions(absl_symbolize PRIVATE WINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP)
|
||||
endif()
|
||||
|
||||
if(NOT onnxruntime_DISABLE_ABSEIL)
|
||||
set(ABSEIL_LIBS absl::inlined_vector absl::flat_hash_set
|
||||
absl::flat_hash_map absl::node_hash_set absl::node_hash_map absl::base absl::throw_delegate absl::raw_hash_set
|
||||
absl::hash absl::city absl::low_level_hash absl::raw_logging_internal)
|
||||
endif()
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 3c73d91c0b04e2b59462f0a741be8c07024c1bc0
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 277508879878e0a5b5b43599b1bea11f66eb3c6c
|
|
@ -1,4 +1,3 @@
|
|||
include (ExternalProject)
|
||||
|
||||
if (onnxruntime_USE_PREINSTALLED_EIGEN)
|
||||
add_library(eigen INTERFACE)
|
||||
|
@ -6,7 +5,17 @@ if (onnxruntime_USE_PREINSTALLED_EIGEN)
|
|||
target_include_directories(eigen INTERFACE ${eigen_INCLUDE_DIRS})
|
||||
else ()
|
||||
if (onnxruntime_USE_ACL)
|
||||
execute_process(COMMAND git apply --ignore-space-change --ignore-whitespace ${PROJECT_SOURCE_DIR}/patches/eigen/Fix_Eigen_Build_Break.patch WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
|
||||
FetchContent_Declare(
|
||||
eigen
|
||||
URL https://gitlab.com/libeigen/eigen/-/archive/d10b27fe37736d2944630ecd7557cefa95cf87c9/eigen-d10b27fe37736d2944630ecd7557cefa95cf87c9.zip
|
||||
PATCH_COMMAND ${Patch_EXECUTABLE} --ignore-space-change --ignore-whitespace < ${PROJECT_SOURCE_DIR}/patches/eigen/Fix_Eigen_Build_Break.patch
|
||||
)
|
||||
else()
|
||||
FetchContent_Declare(
|
||||
eigen
|
||||
URL https://gitlab.com/libeigen/eigen/-/archive/d10b27fe37736d2944630ecd7557cefa95cf87c9/eigen-d10b27fe37736d2944630ecd7557cefa95cf87c9.zip
|
||||
)
|
||||
endif()
|
||||
set(eigen_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/external/eigen")
|
||||
FetchContent_Populate(eigen)
|
||||
set(eigen_INCLUDE_DIRS "${eigen_SOURCE_DIR}")
|
||||
endif()
|
||||
|
|
|
@ -27,5 +27,5 @@ endif()
|
|||
add_subdirectory(${onnxruntime_EXTENSIONS_PATH} ${CMAKE_BINARY_DIR}/_deps/extensions-subbuild EXCLUDE_FROM_ALL)
|
||||
|
||||
# target library or executable are defined in CMakeLists.txt of onnxruntime-extensions
|
||||
target_include_directories(ocos_operators PRIVATE ${RE2_INCLUDE_DIR} external/json/include)
|
||||
target_include_directories(ocos_operators PRIVATE ${RE2_INCLUDE_DIR} ${json_SOURCE_DIR}/include)
|
||||
target_include_directories(ortcustomops PUBLIC ${onnxruntime_EXTENSIONS_PATH}/includes)
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 6df40a2471737b27271bdd9b900ab5f3aec746c7
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 7d0d9061d83b663ce05d9de5da3d5865a3845b79
|
|
@ -1,25 +0,0 @@
|
|||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
include(FetchContent)
|
||||
|
||||
if(onnxruntime_USE_CUDA)
|
||||
FetchContent_Declare(
|
||||
GSL
|
||||
URL ${DEP_URL_microsoft_gsl}
|
||||
URL_HASH SHA1=${DEP_SHA1_microsoft_gsl}
|
||||
PATCH_COMMAND ${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PROJECT_SOURCE_DIR}/patches/gsl/1064.patch
|
||||
)
|
||||
else()
|
||||
FetchContent_Declare(
|
||||
GSL
|
||||
URL ${DEP_URL_microsoft_gsl}
|
||||
URL_HASH SHA1=${DEP_SHA1_microsoft_gsl}
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
onnxruntime_fetchcontent_makeavailable(GSL)
|
||||
|
||||
set(GSL_TARGET "Microsoft.GSL::GSL")
|
||||
set(GSL_INCLUDE_DIR "$<TARGET_PROPERTY:${GSL_TARGET},INTERFACE_INCLUDE_DIRECTORIES>")
|
|
@ -1,7 +1,13 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
# This file was copied from cmake source with modifications
|
||||
# This file was copied from cmake source with modifications:
|
||||
# 1. Add the EXCLUDE_FROM_ALL keyword when this function calls add_subdirectory. It will also resolve the
|
||||
# 'make install' issue.
|
||||
# 2. Group the VC projects into the "external" folder. We can do it at there in a centralized way instead
|
||||
# of doing it one by one.
|
||||
# 3. Set the cmake property COMPILE_WARNING_AS_ERROR to OFF for these external projects.
|
||||
|
||||
macro(onnxruntime_fetchcontent_makeavailable)
|
||||
|
||||
# We must append an item, even if the variable is unset, so prefix its value.
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
include (ExternalProject)
|
||||
|
||||
set(JEMALLOC_URL https://github.com/jemalloc/jemalloc/releases/download/4.1.1/jemalloc-4.1.1.tar.bz2)
|
||||
set(JEMALLOC_BUILD ${CMAKE_CURRENT_BINARY_DIR}/jemalloc/src/jemalloc)
|
||||
set(JEMALLOC_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/jemalloc/install)
|
||||
|
||||
if(NOT WIN32)
|
||||
set(JEMALLOC_STATIC_LIBRARIES ${CMAKE_CURRENT_BINARY_DIR}/jemalloc/install/lib/libjemalloc_pic.a)
|
||||
else()
|
||||
message( FATAL_ERROR "Jemalloc is not supported on Windows." )
|
||||
endif()
|
||||
|
||||
ExternalProject_Add(jemalloc
|
||||
PREFIX jemalloc
|
||||
URL ${JEMALLOC_URL}
|
||||
INSTALL_DIR ${JEMALLOC_INSTALL}
|
||||
DOWNLOAD_DIR "${DOWNLOAD_LOCATION}"
|
||||
BUILD_COMMAND $(MAKE)
|
||||
BUILD_IN_SOURCE 1
|
||||
INSTALL_COMMAND $(MAKE) install
|
||||
CONFIGURE_COMMAND
|
||||
${CMAKE_CURRENT_BINARY_DIR}/jemalloc/src/jemalloc/configure
|
||||
--prefix=${JEMALLOC_INSTALL}
|
||||
)
|
|
@ -1 +0,0 @@
|
|||
Subproject commit b5364faf9d732052506cefc933d3f4e4f04513a5
|
|
@ -1 +0,0 @@
|
|||
Subproject commit f412df7a2b64421e1f1d61fde6055a6ea288e8f5
|
|
@ -1,15 +1,7 @@
|
|||
set(mimalloc_root_dir ${PROJECT_SOURCE_DIR}/external/mimalloc)
|
||||
|
||||
add_definitions(-DUSE_MIMALLOC)
|
||||
include_directories(${mimalloc_root_dir}/include)
|
||||
|
||||
option(MI_OVERRIDE "" OFF)
|
||||
option(MI_BUILD_TESTS "" OFF)
|
||||
option(MI_DEBUG_FULL "" OFF)
|
||||
|
||||
add_subdirectory(${mimalloc_root_dir} EXCLUDE_FROM_ALL)
|
||||
set_target_properties(mimalloc-static PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
if (WIN32)
|
||||
set_target_properties(mimalloc-static PROPERTIES COMPILE_FLAGS "/wd4389 /wd4201 /wd4244 /wd4565")
|
||||
endif()
|
||||
set(MI_OVERRIDE OFF CACHE BOOL "" FORCE)
|
||||
set(MI_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
||||
set(MI_DEBUG_FULL OFF CACHE BOOL "" FORCE)
|
||||
set(MI_BUILD_SHARED OFF CACHE BOOL "" FORCE)
|
||||
onnxruntime_fetchcontent_makeavailable(mimalloc)
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 21cace4e574180ba64d9307a5e4ea9e5e94d3e8d
|
|
@ -1 +1 @@
|
|||
Subproject commit 436617053d0f39a1019a371c3a9aa599b3cb2cea
|
||||
Subproject commit ac5489682760393fe21bd2a8e038b528442412a7
|
|
@ -12,7 +12,12 @@ endif()
|
|||
|
||||
#TODO: if protobuf is a shared lib and onnxruntime_USE_FULL_PROTOBUF is ON, then onnx_proto should be built as a shared lib instead of a static lib. Otherwise any code outside onnxruntime.dll can't use onnx protobuf definitions if they share the protobuf.dll with onnxruntime. For example, if protobuf is a shared lib and onnx_proto is a static lib then onnxruntime_perf_test won't work.
|
||||
|
||||
set(ONNX_SOURCE_ROOT ${PROJECT_SOURCE_DIR}/external/onnx)
|
||||
|
||||
|
||||
FetchContent_Populate(onnx)
|
||||
set(ONNX_SOURCE_ROOT ${onnx_SOURCE_DIR})
|
||||
|
||||
|
||||
|
||||
add_library(onnx_proto ${ONNX_SOURCE_ROOT}/onnx/onnx-ml.proto ${ONNX_SOURCE_ROOT}/onnx/onnx-operators-ml.proto ${ONNX_SOURCE_ROOT}/onnx/onnx-data.proto)
|
||||
|
||||
|
|
|
@ -0,0 +1,443 @@
|
|||
message("Loading Dependencies URLs ...")
|
||||
|
||||
include(external/helper_functions.cmake)
|
||||
|
||||
file(STRINGS deps.txt ONNXRUNTIME_DEPS_LIST)
|
||||
foreach(ONNXRUNTIME_DEP IN LISTS ONNXRUNTIME_DEPS_LIST)
|
||||
# Lines start with "#" are comments
|
||||
if(NOT ONNXRUNTIME_DEP MATCHES "^#")
|
||||
# The first column is name
|
||||
list(POP_FRONT ONNXRUNTIME_DEP ONNXRUNTIME_DEP_NAME)
|
||||
# The second column is URL
|
||||
# The URL below may be a local file path or an HTTPS URL
|
||||
list(POP_FRONT ONNXRUNTIME_DEP ONNXRUNTIME_DEP_URL)
|
||||
set(DEP_URL_${ONNXRUNTIME_DEP_NAME} ${ONNXRUNTIME_DEP_URL})
|
||||
# The third column is SHA1 hash value
|
||||
set(DEP_SHA1_${ONNXRUNTIME_DEP_NAME} ${ONNXRUNTIME_DEP})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
message("Loading Dependencies ...")
|
||||
# ABSL should be included before protobuf because protobuf may use absl
|
||||
if(NOT onnxruntime_DISABLE_ABSEIL)
|
||||
include(external/abseil-cpp.cmake)
|
||||
endif()
|
||||
|
||||
set(RE2_BUILD_TESTING OFF CACHE BOOL "" FORCE)
|
||||
FetchContent_Declare(
|
||||
re2
|
||||
URL ${DEP_URL_re2}
|
||||
URL_HASH SHA1=${DEP_SHA1_re2}
|
||||
FIND_PACKAGE_ARGS NAMES re2
|
||||
)
|
||||
|
||||
if (onnxruntime_BUILD_UNIT_TESTS)
|
||||
# WebAssembly threading support in Node.js is still an experimental feature and
|
||||
# not working properly with googletest suite.
|
||||
if (onnxruntime_BUILD_WEBASSEMBLY)
|
||||
set(gtest_disable_pthreads ON)
|
||||
endif()
|
||||
set(INSTALL_GTEST OFF CACHE BOOL "" FORCE)
|
||||
if(NOT onnxruntime_DISABLE_ABSEIL)
|
||||
# It uses both ABSL and re2
|
||||
set(GTEST_HAS_ABSL OFF CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
# gtest and gmock
|
||||
FetchContent_Declare(
|
||||
googletest
|
||||
URL ${DEP_URL_googletest}
|
||||
FIND_PACKAGE_ARGS NAMES GTest
|
||||
URL_HASH SHA1=${DEP_SHA1_googletest}
|
||||
)
|
||||
endif()
|
||||
|
||||
if (onnxruntime_BUILD_BENCHMARKS)
|
||||
# We will not need to test benchmark lib itself.
|
||||
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "Disable benchmark testing as we don't need it.")
|
||||
# We will not need to install benchmark since we link it statically.
|
||||
set(BENCHMARK_ENABLE_INSTALL OFF CACHE BOOL "Disable benchmark install to avoid overwriting vendor install.")
|
||||
|
||||
FetchContent_Declare(
|
||||
google_benchmark
|
||||
URL ${DEP_URL_google_benchmark}
|
||||
URL_HASH SHA1=${DEP_SHA1_google_benchmark}
|
||||
)
|
||||
endif()
|
||||
|
||||
if (NOT WIN32)
|
||||
FetchContent_Declare(
|
||||
google_nsync
|
||||
URL ${DEP_URL_google_nsync}
|
||||
URL_HASH SHA1=${DEP_SHA1_google_nsync}
|
||||
FIND_PACKAGE_ARGS NAMES nsync
|
||||
)
|
||||
endif()
|
||||
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/external)
|
||||
|
||||
FetchContent_Declare(
|
||||
mimalloc
|
||||
URL ${DEP_URL_mimalloc}
|
||||
URL_HASH SHA1=${DEP_SHA1_mimalloc}
|
||||
)
|
||||
|
||||
|
||||
|
||||
# Flatbuffers
|
||||
# We do not need to build flatc for iOS or Android Cross Compile
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "Android" OR onnxruntime_BUILD_WEBASSEMBLY)
|
||||
set(FLATBUFFERS_BUILD_FLATC OFF CACHE BOOL "FLATBUFFERS_BUILD_FLATC" FORCE)
|
||||
endif()
|
||||
set(FLATBUFFERS_BUILD_TESTS OFF CACHE BOOL "FLATBUFFERS_BUILD_TESTS" FORCE)
|
||||
set(FLATBUFFERS_INSTALL OFF CACHE BOOL "FLATBUFFERS_INSTALL" FORCE)
|
||||
set(FLATBUFFERS_BUILD_FLATHASH OFF CACHE BOOL "FLATBUFFERS_BUILD_FLATHASH" FORCE)
|
||||
set(FLATBUFFERS_BUILD_FLATLIB ON CACHE BOOL "FLATBUFFERS_BUILD_FLATLIB" FORCE)
|
||||
FetchContent_Declare(
|
||||
flatbuffers
|
||||
URL ${DEP_URL_flatbuffers}
|
||||
URL_HASH SHA1=${DEP_SHA1_flatbuffers}
|
||||
FIND_PACKAGE_ARGS NAMES Flatbuffers
|
||||
)
|
||||
|
||||
#Here we support two build mode:
|
||||
#1. if ONNX_CUSTOM_PROTOC_EXECUTABLE is set, build Protobuf from source, except protoc.exe. This mode is mainly
|
||||
# for cross-compiling
|
||||
#2. if ONNX_CUSTOM_PROTOC_EXECUTABLE is not set, Compile everything(including protoc) from source code.
|
||||
if(Patch_FOUND)
|
||||
set(ONNXRUNTIME_PROTOBUF_PATCH_COMMAND ${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PROJECT_SOURCE_DIR}/patches/protobuf/protobuf_cmake.patch)
|
||||
else()
|
||||
set(ONNXRUNTIME_PROTOBUF_PATCH_COMMAND "")
|
||||
endif()
|
||||
FetchContent_Declare(
|
||||
Protobuf
|
||||
URL ${DEP_URL_protobuf}
|
||||
URL_HASH SHA1=${DEP_SHA1_protobuf}
|
||||
SOURCE_SUBDIR cmake
|
||||
PATCH_COMMAND ${ONNXRUNTIME_PROTOBUF_PATCH_COMMAND}
|
||||
FIND_PACKAGE_ARGS NAMES Protobuf
|
||||
)
|
||||
set(protobuf_BUILD_TESTS OFF CACHE BOOL "Build protobuf tests" FORCE)
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||
set(protobuf_BUILD_PROTOC_BINARIES OFF CACHE BOOL "Build protobuf tests" FORCE)
|
||||
set(protobuf_WITH_ZLIB OFF CACHE BOOL "Build with zlib support" FORCE)
|
||||
endif()
|
||||
if (onnxruntime_DISABLE_RTTI)
|
||||
set(protobuf_DISABLE_RTTI ON CACHE BOOL "Remove runtime type information in the binaries" FORCE)
|
||||
endif()
|
||||
|
||||
include(protobuf_function)
|
||||
#protobuf end
|
||||
|
||||
set(ENABLE_DATE_TESTING OFF CACHE BOOL "" FORCE)
|
||||
set(USE_SYSTEM_TZ_DB ON CACHE BOOL "" FORCE)
|
||||
|
||||
FetchContent_Declare(
|
||||
date
|
||||
URL ${DEP_URL_date}
|
||||
URL_HASH SHA1=${DEP_SHA1_date}
|
||||
)
|
||||
FetchContent_Populate(date)
|
||||
add_library(date_interface INTERFACE)
|
||||
target_include_directories(date_interface INTERFACE ${date_SOURCE_DIR}/include)
|
||||
|
||||
|
||||
|
||||
FetchContent_Declare(
|
||||
mp11
|
||||
URL ${DEP_URL_mp11}
|
||||
URL_HASH SHA1=${DEP_SHA1_mp11}
|
||||
)
|
||||
|
||||
set(JSON_BuildTests OFF CACHE INTERNAL "")
|
||||
set(JSON_Install OFF CACHE INTERNAL "")
|
||||
set(JSON_BuildTests OFF CACHE INTERNAL "")
|
||||
set(JSON_Install OFF CACHE INTERNAL "")
|
||||
|
||||
FetchContent_Declare(
|
||||
nlohmann_json
|
||||
URL ${DEP_URL_json}
|
||||
URL_HASH SHA1=${DEP_SHA1_json}
|
||||
FIND_PACKAGE_ARGS 3.10 NAMES nlohmann_json
|
||||
)
|
||||
|
||||
#TODO: include clog first
|
||||
if (onnxruntime_ENABLE_CPUINFO)
|
||||
# Adding pytorch CPU info library
|
||||
# TODO!! need a better way to find out the supported architectures
|
||||
list(LENGTH CMAKE_OSX_ARCHITECTURES CMAKE_OSX_ARCHITECTURES_LEN)
|
||||
if (APPLE)
|
||||
if (CMAKE_OSX_ARCHITECTURES_LEN LESS_EQUAL 1)
|
||||
set(CPUINFO_SUPPORTED TRUE)
|
||||
elseif (onnxruntime_BUILD_APPLE_FRAMEWORK)
|
||||
# We stitch multiple static libraries together when onnxruntime_BUILD_APPLE_FRAMEWORK is true,
|
||||
# but that would not work for universal static libraries
|
||||
message(FATAL_ERROR "universal binary is not supported for apple framework")
|
||||
endif()
|
||||
else()
|
||||
# if xnnpack is enabled in a wasm build it needs clog from cpuinfo, but we won't internally use cpuinfo
|
||||
# so we don't set CPUINFO_SUPPORTED in the CXX flags below.
|
||||
if (onnxruntime_BUILD_WEBASSEMBLY AND NOT onnxruntime_USE_XNNPACK)
|
||||
set(CPUINFO_SUPPORTED FALSE)
|
||||
else()
|
||||
set(CPUINFO_SUPPORTED TRUE)
|
||||
endif()
|
||||
if (WIN32)
|
||||
# Exclude Windows ARM build and Windows Store
|
||||
if (${onnxruntime_target_platform} MATCHES "^(ARM.*|arm.*)$" )
|
||||
message(WARNING "Cpuinfo not included for compilation problems with Windows ARM.")
|
||||
set(CPUINFO_SUPPORTED FALSE)
|
||||
elseif (WIN32 AND NOT CMAKE_CXX_STANDARD_LIBRARIES MATCHES kernel32.lib)
|
||||
message(WARNING "Cpuinfo not included non-Desktop builds")
|
||||
set(CPUINFO_SUPPORTED FALSE)
|
||||
endif()
|
||||
elseif (NOT ${onnxruntime_target_platform} MATCHES "^(i[3-6]86|AMD64|x86(_64)?|armv[5-8].*|aarch64|arm64)$")
|
||||
message(WARNING
|
||||
"Target processor architecture \"${onnxruntime_target_platform}\" is not supported in cpuinfo. "
|
||||
"cpuinfo not included."
|
||||
)
|
||||
set(CPUINFO_SUPPORTED FALSE)
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
set(CPUINFO_SUPPORTED FALSE)
|
||||
endif()
|
||||
|
||||
if (CPUINFO_SUPPORTED)
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||
set(IOS ON CACHE INTERNAL "")
|
||||
set(IOS_ARCH "${CMAKE_OSX_ARCHITECTURES}" CACHE INTERNAL "")
|
||||
endif()
|
||||
|
||||
# if this is a wasm build with xnnpack (only type of wasm build where cpuinfo is involved)
|
||||
# we do not use cpuinfo in ORT code, so don't define CPUINFO_SUPPORTED.
|
||||
if (NOT onnxruntime_BUILD_WEBASSEMBLY)
|
||||
string(APPEND CMAKE_CXX_FLAGS " -DCPUINFO_SUPPORTED")
|
||||
endif()
|
||||
|
||||
|
||||
set(CPUINFO_BUILD_TOOLS OFF CACHE INTERNAL "")
|
||||
set(CPUINFO_BUILD_UNIT_TESTS OFF CACHE INTERNAL "")
|
||||
set(CPUINFO_BUILD_MOCK_TESTS OFF CACHE INTERNAL "")
|
||||
set(CPUINFO_BUILD_BENCHMARKS OFF CACHE INTERNAL "")
|
||||
|
||||
FetchContent_Declare(
|
||||
pytorch_cpuinfo
|
||||
URL ${DEP_URL_pytorch_cpuinfo}
|
||||
URL_HASH SHA1=${DEP_SHA1_pytorch_cpuinfo}
|
||||
FIND_PACKAGE_ARGS NAMES cpuinfo
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
|
||||
if (onnxruntime_BUILD_BENCHMARKS)
|
||||
onnxruntime_fetchcontent_makeavailable(google_benchmark)
|
||||
endif()
|
||||
|
||||
if (NOT WIN32)
|
||||
#nsync tests failed on Mac Build
|
||||
set(NSYNC_ENABLE_TESTS OFF CACHE BOOL "" FORCE)
|
||||
onnxruntime_fetchcontent_makeavailable(google_nsync)
|
||||
set(nsync_SOURCE_DIR ${google_nsync_SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
if(onnxruntime_USE_CUDA)
|
||||
FetchContent_Declare(
|
||||
GSL
|
||||
URL ${DEP_URL_microsoft_gsl}
|
||||
URL_HASH SHA1=${DEP_SHA1_microsoft_gsl}
|
||||
PATCH_COMMAND ${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PROJECT_SOURCE_DIR}/patches/gsl/1064.patch
|
||||
)
|
||||
else()
|
||||
FetchContent_Declare(
|
||||
GSL
|
||||
URL ${DEP_URL_microsoft_gsl}
|
||||
URL_HASH SHA1=${DEP_SHA1_microsoft_gsl}
|
||||
FIND_PACKAGE_ARGS 4.0 NAMES Microsoft.GSL
|
||||
)
|
||||
endif()
|
||||
|
||||
FetchContent_Declare(
|
||||
safeint
|
||||
URL ${DEP_URL_safeint}
|
||||
URL_HASH SHA1=${DEP_SHA1_safeint}
|
||||
)
|
||||
|
||||
# The next line will generate an error message "fatal: not a git repository", but it is ok. It is from flatbuffers
|
||||
onnxruntime_fetchcontent_makeavailable(Protobuf nlohmann_json mp11 re2 safeint GSL flatbuffers)
|
||||
if (onnxruntime_BUILD_UNIT_TESTS)
|
||||
onnxruntime_fetchcontent_makeavailable(googletest)
|
||||
endif()
|
||||
|
||||
if(Protobuf_FOUND)
|
||||
message("Protobuf version: ${Protobuf_VERSION}")
|
||||
else()
|
||||
# Adjust warning flags
|
||||
if (TARGET libprotoc)
|
||||
if (NOT MSVC)
|
||||
target_compile_options(libprotoc PRIVATE "-w")
|
||||
endif()
|
||||
endif()
|
||||
if (TARGET protoc)
|
||||
add_executable(protobuf::protoc ALIAS protoc)
|
||||
if (UNIX AND onnxruntime_ENABLE_LTO)
|
||||
#https://github.com/protocolbuffers/protobuf/issues/5923
|
||||
target_link_options(protoc PRIVATE "-Wl,--no-as-needed")
|
||||
endif()
|
||||
if (NOT MSVC)
|
||||
target_compile_options(protoc PRIVATE "-w")
|
||||
endif()
|
||||
get_target_property(PROTOC_OSX_ARCH protoc OSX_ARCHITECTURES)
|
||||
if (PROTOC_OSX_ARCH)
|
||||
if (${CMAKE_HOST_SYSTEM_PROCESSOR} IN_LIST PROTOC_OSX_ARCH)
|
||||
message("protoc can run")
|
||||
else()
|
||||
list(APPEND PROTOC_OSX_ARCH ${CMAKE_HOST_SYSTEM_PROCESSOR})
|
||||
set_target_properties(protoc PROPERTIES OSX_ARCHITECTURES "${CMAKE_HOST_SYSTEM_PROCESSOR}")
|
||||
set_target_properties(libprotoc PROPERTIES OSX_ARCHITECTURES "${PROTOC_OSX_ARCH}")
|
||||
set_target_properties(libprotobuf PROPERTIES OSX_ARCHITECTURES "${PROTOC_OSX_ARCH}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
if (TARGET libprotobuf AND NOT MSVC)
|
||||
target_compile_options(libprotobuf PRIVATE "-w")
|
||||
endif()
|
||||
if (TARGET libprotobuf-lite AND NOT MSVC)
|
||||
target_compile_options(libprotobuf-lite PRIVATE "-w")
|
||||
endif()
|
||||
endif()
|
||||
if (onnxruntime_USE_FULL_PROTOBUF)
|
||||
set(PROTOBUF_LIB protobuf::libprotobuf)
|
||||
else()
|
||||
set(PROTOBUF_LIB protobuf::libprotobuf-lite)
|
||||
endif()
|
||||
|
||||
|
||||
# ONNX
|
||||
if (NOT onnxruntime_USE_FULL_PROTOBUF)
|
||||
set(ONNX_USE_LITE_PROTO ON CACHE BOOL "" FORCE)
|
||||
else()
|
||||
set(ONNX_USE_LITE_PROTO OFF CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
|
||||
if(Patch_FOUND)
|
||||
set(ONNXRUNTIME_ONNX_PATCH_COMMAND ${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PROJECT_SOURCE_DIR}/patches/onnx/onnx.patch)
|
||||
else()
|
||||
set(ONNXRUNTIME_ONNX_PATCH_COMMAND "")
|
||||
endif()
|
||||
|
||||
FetchContent_Declare(
|
||||
onnx
|
||||
URL ${DEP_URL_onnx}
|
||||
URL_HASH SHA1=${DEP_SHA1_onnx}
|
||||
PATCH_COMMAND ${ONNXRUNTIME_ONNX_PATCH_COMMAND}
|
||||
)
|
||||
|
||||
|
||||
if (CPUINFO_SUPPORTED)
|
||||
onnxruntime_fetchcontent_makeavailable(pytorch_cpuinfo)
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
include(eigen)
|
||||
include(wil)
|
||||
|
||||
if (NOT onnxruntime_MINIMAL_BUILD)
|
||||
onnxruntime_fetchcontent_makeavailable(onnx)
|
||||
else()
|
||||
include(onnx_minimal)
|
||||
endif()
|
||||
|
||||
set(GSL_TARGET "Microsoft.GSL::GSL")
|
||||
set(GSL_INCLUDE_DIR "$<TARGET_PROPERTY:${GSL_TARGET},INTERFACE_INCLUDE_DIRECTORIES>")
|
||||
|
||||
add_library(safeint_interface INTERFACE)
|
||||
target_include_directories(safeint_interface INTERFACE ${safeint_SOURCE_DIR})
|
||||
|
||||
# XNNPACK EP
|
||||
if (onnxruntime_USE_XNNPACK)
|
||||
if (onnxruntime_DISABLE_CONTRIB_OPS)
|
||||
message(FATAL_ERROR "XNNPACK EP requires the internal NHWC contrib ops to be available "
|
||||
"but onnxruntime_DISABLE_CONTRIB_OPS is ON")
|
||||
endif()
|
||||
include(xnnpack)
|
||||
endif()
|
||||
|
||||
if (onnxruntime_USE_MIMALLOC)
|
||||
add_definitions(-DUSE_MIMALLOC)
|
||||
|
||||
set(MI_OVERRIDE OFF CACHE BOOL "" FORCE)
|
||||
set(MI_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
||||
set(MI_DEBUG_FULL OFF CACHE BOOL "" FORCE)
|
||||
set(MI_BUILD_SHARED OFF CACHE BOOL "" FORCE)
|
||||
onnxruntime_fetchcontent_makeavailable(mimalloc)
|
||||
endif()
|
||||
|
||||
#onnxruntime_EXTERNAL_LIBRARIES could contain onnx, onnx_proto,libprotobuf, cuda/cudnn,
|
||||
# dnnl/mklml, onnxruntime_codegen_tvm, tvm and pthread
|
||||
# pthread is always at the last
|
||||
set(onnxruntime_EXTERNAL_LIBRARIES ${onnxruntime_EXTERNAL_LIBRARIES_XNNPACK} WIL::WIL nlohmann_json::nlohmann_json onnx onnx_proto ${PROTOBUF_LIB} re2::re2 Boost::mp11 safeint_interface flatbuffers ${GSL_TARGET} ${ABSEIL_LIBS})
|
||||
# The source code of onnx_proto is generated, we must build this lib first before starting to compile the other source code that uses ONNX protobuf types.
|
||||
# The other libs do not have the problem. All the sources are already there. We can compile them in any order.
|
||||
set(onnxruntime_EXTERNAL_DEPENDENCIES onnx_proto)
|
||||
|
||||
target_compile_definitions(onnx PUBLIC $<TARGET_PROPERTY:onnx_proto,INTERFACE_COMPILE_DEFINITIONS> PRIVATE "__ONNX_DISABLE_STATIC_REGISTRATION")
|
||||
if (NOT onnxruntime_USE_FULL_PROTOBUF)
|
||||
target_compile_definitions(onnx PUBLIC "__ONNX_NO_DOC_STRINGS")
|
||||
endif()
|
||||
|
||||
if (onnxruntime_RUN_ONNX_TESTS)
|
||||
add_definitions(-DORT_RUN_EXTERNAL_ONNX_TESTS)
|
||||
endif()
|
||||
|
||||
|
||||
if(onnxruntime_ENABLE_ATEN)
|
||||
message("Aten fallback is enabled.")
|
||||
FetchContent_Declare(
|
||||
dlpack
|
||||
URL ${DEP_URL_dlpack}
|
||||
URL_HASH SHA1=${DEP_SHA1_dlpack}
|
||||
)
|
||||
# We can't use onnxruntime_fetchcontent_makeavailable since some part of the the dlpack code is Linux only.
|
||||
# For example, dlpackcpp.h uses posix_memalign.
|
||||
FetchContent_Populate(dlpack)
|
||||
endif()
|
||||
|
||||
if(onnxruntime_ENABLE_TRAINING)
|
||||
FetchContent_Declare(
|
||||
cxxopts
|
||||
URL ${DEP_URL_cxxopts}
|
||||
URL_HASH SHA1=${DEP_SHA1_cxxopts}
|
||||
)
|
||||
set(CXXOPTS_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||
set(CXXOPTS_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
||||
onnxruntime_fetchcontent_makeavailable(cxxopts)
|
||||
endif()
|
||||
|
||||
message("Finished fetching external dependencies")
|
||||
|
||||
|
||||
set(onnxruntime_LINK_DIRS )
|
||||
if (onnxruntime_USE_CUDA)
|
||||
#TODO: combine onnxruntime_CUDNN_HOME and onnxruntime_CUDA_HOME, assume they are the same
|
||||
if (WIN32)
|
||||
if(onnxruntime_CUDNN_HOME)
|
||||
list(APPEND onnxruntime_LINK_DIRS ${onnxruntime_CUDNN_HOME}/lib ${onnxruntime_CUDNN_HOME}/lib/x64)
|
||||
endif()
|
||||
list(APPEND onnxruntime_LINK_DIRS ${onnxruntime_CUDA_HOME}/x64/lib64)
|
||||
else()
|
||||
if(onnxruntime_CUDNN_HOME)
|
||||
list(APPEND onnxruntime_LINK_DIRS ${onnxruntime_CUDNN_HOME}/lib64)
|
||||
endif()
|
||||
list(APPEND onnxruntime_LINK_DIRS ${onnxruntime_CUDA_HOME}/lib64)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(onnxruntime_USE_SNPE)
|
||||
include(find_snpe.cmake)
|
||||
list(APPEND onnxruntime_EXTERNAL_LIBRARIES ${SNPE_NN_LIBS})
|
||||
endif()
|
||||
|
||||
FILE(TO_NATIVE_PATH ${CMAKE_BINARY_DIR} ORT_BINARY_DIR)
|
||||
FILE(TO_NATIVE_PATH ${PROJECT_SOURCE_DIR} ORT_SOURCE_DIR)
|
||||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 1787867f6183f056420e532eec640cba25efafea
|
|
@ -1,24 +1,13 @@
|
|||
FetchContent_Declare(
|
||||
pybind11_project
|
||||
URL ${DEP_URL_pybind11}
|
||||
URL_HASH SHA1=${DEP_SHA1_pybind11}
|
||||
FIND_PACKAGE_ARGS 2.6 NAMES pybind11
|
||||
)
|
||||
onnxruntime_fetchcontent_makeavailable(pybind11_project)
|
||||
|
||||
if(onnxruntime_PREFER_SYSTEM_LIB)
|
||||
find_package(pybind11)
|
||||
endif()
|
||||
|
||||
if(NOT TARGET pybind11::module)
|
||||
include(ExternalProject)
|
||||
|
||||
set(pybind11_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/pybind11/src/pybind11/include)
|
||||
set(pybind11_URL https://github.com/pybind/pybind11.git)
|
||||
set(pybind11_TAG v2.6.2)
|
||||
|
||||
ExternalProject_Add(pybind11
|
||||
PREFIX pybind11
|
||||
GIT_REPOSITORY ${pybind11_URL}
|
||||
GIT_TAG ${pybind11_TAG}
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
set(pybind11_dep pybind11)
|
||||
else()
|
||||
if(TARGET pybind11::module)
|
||||
set(pybind11_lib pybind11::module)
|
||||
else()
|
||||
set(pybind11_dep pybind11::pybind11)
|
||||
endif()
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 4244cd1cb492fa1d10986ec67f862964c073f844
|
||||
Subproject commit 5723bb8950318135ed9cf4fc76bed988a087f536
|
|
@ -1 +1 @@
|
|||
Subproject commit e8c599bca6c56c44b6730ad93f6abbc9ecd60fc1
|
||||
Subproject commit 5f4caba4e7a9017816e47becdd918fcc872039ba
|
|
@ -0,0 +1,22 @@
|
|||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License.
|
||||
set(WIL_BUILD_PACKAGING OFF CACHE BOOL "" FORCE)
|
||||
set(WIL_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
||||
|
||||
FetchContent_Declare(
|
||||
microsoft_wil
|
||||
URL ${DEP_URL_microsoft_wil}
|
||||
URL_HASH SHA1=${DEP_SHA1_microsoft_wil}
|
||||
FIND_PACKAGE_ARGS NAMES wil
|
||||
)
|
||||
#We can not use FetchContent_MakeAvailable(microsoft_wil) at here, since their cmake file
|
||||
#always executes install command without conditions.
|
||||
FetchContent_Populate(microsoft_wil)
|
||||
if(NOT wil_FOUND)
|
||||
add_library(WIL INTERFACE)
|
||||
add_library(WIL::WIL ALIAS WIL)
|
||||
|
||||
# The interface's include directory.
|
||||
target_include_directories(WIL INTERFACE
|
||||
$<BUILD_INTERFACE:${microsoft_wil_SOURCE_DIR}/include>)
|
||||
endif()
|
|
@ -1,32 +1,38 @@
|
|||
set(XNNPACK_DIR external/XNNPACK)
|
||||
set(XNNPACK_INCLUDE_DIR ${XNNPACK_DIR}/include)
|
||||
set(XNNPACK_USE_SYSTEM_LIBS ON CACHE INTERNAL "")
|
||||
set(XNNPACK_BUILD_TESTS OFF CACHE INTERNAL "")
|
||||
set(XNNPACK_BUILD_BENCHMARKS OFF CACHE INTERNAL "")
|
||||
set(FP16_BUILD_TESTS OFF CACHE INTERNAL "")
|
||||
set(FP16_BUILD_BENCHMARKS OFF CACHE INTERNAL "")
|
||||
set(CLOG_SOURCE_DIR "${PYTORCH_CPUINFO_DIR}/deps/clog")
|
||||
set(CPUINFO_SOURCE_DIR ${PYTORCH_CPUINFO_DIR})
|
||||
set(PTHREADPOOL_BUILD_TESTS OFF CACHE INTERNAL "")
|
||||
set(PTHREADPOOL_BUILD_BENCHMARKS OFF CACHE INTERNAL "")
|
||||
|
||||
# BF16 instructions cause ICE in Android NDK compiler
|
||||
if(CMAKE_ANDROID_ARCH_ABI STREQUAL armeabi-v7a)
|
||||
set(XNNPACK_ENABLE_ARM_BF16 OFF)
|
||||
ENDIF()
|
||||
|
||||
if(onnxruntime_BUILD_WEBASSEMBLY OR CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||
execute_process(COMMAND git apply --ignore-space-change --ignore-whitespace ${PROJECT_SOURCE_DIR}/patches/xnnpack/AddEmscriptenAndIosSupport.patch WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/${XNNPACK_DIR})
|
||||
endif()
|
||||
# fp16 depends on psimd
|
||||
FetchContent_Declare(psimd URL ${DEP_URL_psimd} URL_HASH SHA1=${DEP_SHA1_psimd})
|
||||
onnxruntime_fetchcontent_makeavailable(psimd)
|
||||
set(PSIMD_SOURCE_DIR ${psimd_SOURCE_DIR})
|
||||
FetchContent_Declare(fp16 URL ${DEP_URL_fp16} URL_HASH SHA1=${DEP_SHA1_fp16})
|
||||
onnxruntime_fetchcontent_makeavailable(fp16)
|
||||
|
||||
add_subdirectory(external/FP16)
|
||||
add_subdirectory(external/pthreadpool)
|
||||
add_subdirectory(external/XNNPACK)
|
||||
# pthreadpool depends on fxdiv
|
||||
FetchContent_Declare(fxdiv URL ${DEP_URL_fxdiv} URL_HASH SHA1=${DEP_SHA1_fxdiv})
|
||||
onnxruntime_fetchcontent_makeavailable(fxdiv)
|
||||
set(FXDIV_SOURCE_DIR ${fxdiv_SOURCE_DIR})
|
||||
|
||||
set_target_properties(fp16 PROPERTIES FOLDER "External/Xnnpack")
|
||||
set_target_properties(pthreadpool PROPERTIES FOLDER "External/Xnnpack")
|
||||
set_target_properties(XNNPACK PROPERTIES FOLDER "External/Xnnpack")
|
||||
FetchContent_Declare(pthreadpool URL ${DEP_URL_pthreadpool} URL_HASH SHA1=${DEP_SHA1_pthreadpool})
|
||||
onnxruntime_fetchcontent_makeavailable(pthreadpool)
|
||||
FetchContent_Declare(googlexnnpack URL ${DEP_URL_googlexnnpack} URL_HASH SHA1=${DEP_SHA1_googlexnnpack}
|
||||
PATCH_COMMAND ${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PROJECT_SOURCE_DIR}/patches/xnnpack/AddEmscriptenAndIosSupport.patch)
|
||||
|
||||
onnxruntime_fetchcontent_makeavailable(googlexnnpack)
|
||||
set(XNNPACK_DIR ${googlexnnpack_SOURCE_DIR})
|
||||
set(XNNPACK_INCLUDE_DIR ${XNNPACK_DIR}/include)
|
||||
|
||||
set(onnxruntime_EXTERNAL_LIBRARIES_XNNPACK XNNPACK pthreadpool)
|
||||
list(APPEND onnxruntime_EXTERNAL_LIBRARIES ${onnxruntime_EXTERNAL_LIBRARIES_XNNPACK})
|
||||
|
||||
# the XNNPACK CMake setup doesn't include the WASM kernels so we have to manually set those up
|
||||
if(onnxruntime_BUILD_WEBASSEMBLY)
|
||||
|
|
|
@ -19,7 +19,7 @@ source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_codegen_common_sr
|
|||
onnxruntime_add_static_library(onnxruntime_codegen_tvm ${onnxruntime_codegen_common_srcs} ${onnxruntime_codegen_tvm_srcs})
|
||||
set_target_properties(onnxruntime_codegen_tvm PROPERTIES FOLDER "ONNXRuntime")
|
||||
target_include_directories(onnxruntime_codegen_tvm PRIVATE ${ONNXRUNTIME_ROOT} ${TVM_INCLUDES} ${MKLML_INCLUDE_DIR} ${eigen_INCLUDE_DIRS})
|
||||
onnxruntime_add_include_to_target(onnxruntime_codegen_tvm onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers)
|
||||
onnxruntime_add_include_to_target(onnxruntime_codegen_tvm onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers safeint_interface Boost::mp11)
|
||||
target_compile_options(onnxruntime_codegen_tvm PRIVATE ${DISABLED_WARNINGS_FOR_TVM})
|
||||
# need onnx to build to create headers that this project includes
|
||||
add_dependencies(onnxruntime_codegen_tvm ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
||||
|
|
|
@ -90,26 +90,14 @@ onnxruntime_add_static_library(onnxruntime_common ${onnxruntime_common_src})
|
|||
if (onnxruntime_USE_TELEMETRY)
|
||||
set_target_properties(onnxruntime_common PROPERTIES COMPILE_FLAGS "/FI${ONNXRUNTIME_INCLUDE_DIR}/core/platform/windows/TraceLoggingConfigPrivate.h")
|
||||
endif()
|
||||
|
||||
if (onnxruntime_USE_MIMALLOC)
|
||||
if(NOT WIN32)
|
||||
message(FATAL_ERROR "Currently do not support MIMALLOC in GPU builds")
|
||||
endif()
|
||||
if(onnxruntime_USE_CUDA OR onnxruntime_USE_OPENVINO)
|
||||
message(WARNING "Currently do not support MIMALLOC in GPU builds")
|
||||
else()
|
||||
include(external/mimalloc.cmake)
|
||||
list(APPEND onnxruntime_EXTERNAL_LIBRARIES mimalloc-static)
|
||||
list(APPEND onnxruntime_EXTERNAL_DEPENDENCIES mimalloc-static)
|
||||
set(onnxruntime_mimalloc_shim_src "${ONNXRUNTIME_ROOT}/core/platform/windows/mimalloc/mimalloc_overloads.cc")
|
||||
add_library(onnxruntime_mimalloc_shim ${onnxruntime_mimalloc_shim_src})
|
||||
target_link_libraries(onnxruntime_mimalloc_shim mimalloc-static)
|
||||
target_link_libraries(onnxruntime_common onnxruntime_mimalloc_shim)
|
||||
endif()
|
||||
list(APPEND onnxruntime_EXTERNAL_LIBRARIES mimalloc-static)
|
||||
onnxruntime_add_static_library(onnxruntime_mimalloc_shim "${ONNXRUNTIME_ROOT}/core/platform/windows/mimalloc/mimalloc_overloads.cc")
|
||||
target_link_libraries(onnxruntime_mimalloc_shim PRIVATE mimalloc-static)
|
||||
target_link_libraries(onnxruntime_common PRIVATE onnxruntime_mimalloc_shim)
|
||||
endif()
|
||||
|
||||
if(NOT onnxruntime_DISABLE_ABSEIL)
|
||||
include(external/abseil-cpp.cmake)
|
||||
target_include_directories(onnxruntime_common PRIVATE ${ABSEIL_SOURCE_DIR})
|
||||
if (MSVC)
|
||||
set(ABSEIL_NATVIS_FILE "abseil-cpp.natvis")
|
||||
|
@ -119,18 +107,15 @@ if(NOT onnxruntime_DISABLE_ABSEIL)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
onnxruntime_add_include_to_target(onnxruntime_common date_interface wil)
|
||||
onnxruntime_add_include_to_target(onnxruntime_common date_interface WIL::WIL)
|
||||
target_include_directories(onnxruntime_common
|
||||
PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${ONNXRUNTIME_ROOT} ${eigen_INCLUDE_DIRS}
|
||||
# propagate include directories of dependencies that are part of public interface
|
||||
PUBLIC
|
||||
${OPTIONAL_LITE_INCLUDE_DIR})
|
||||
|
||||
target_link_libraries(onnxruntime_common safeint_interface Boost::mp11 ${GSL_TARGET})
|
||||
|
||||
if(NOT WIN32)
|
||||
target_include_directories(onnxruntime_common PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/external/nsync/public")
|
||||
endif()
|
||||
target_link_libraries(onnxruntime_common PUBLIC safeint_interface ${GSL_TARGET})
|
||||
|
||||
add_dependencies(onnxruntime_common ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
||||
|
||||
|
@ -138,20 +123,6 @@ install(DIRECTORY ${PROJECT_SOURCE_DIR}/../include/onnxruntime/core/common DEST
|
|||
set_target_properties(onnxruntime_common PROPERTIES LINKER_LANGUAGE CXX)
|
||||
set_target_properties(onnxruntime_common PROPERTIES FOLDER "ONNXRuntime")
|
||||
|
||||
# check if we need to link against librt on Linux
|
||||
include(CheckLibraryExists)
|
||||
include(CheckFunctionExists)
|
||||
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
|
||||
check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME)
|
||||
|
||||
if (NOT HAVE_CLOCK_GETTIME)
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES time.h)
|
||||
check_function_exists(clock_gettime HAVE_CLOCK_GETTIME)
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES)
|
||||
else()
|
||||
target_link_libraries(onnxruntime_common rt)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (onnxruntime_WINML_NAMESPACE_OVERRIDE STREQUAL "Windows")
|
||||
target_compile_definitions(onnxruntime_common PRIVATE "BUILD_INBOX=1")
|
||||
|
@ -164,7 +135,7 @@ if (onnxruntime_LINK_LIBATOMIC)
|
|||
endif()
|
||||
|
||||
if(APPLE)
|
||||
target_link_libraries(onnxruntime_common "-framework Foundation")
|
||||
target_link_libraries(onnxruntime_common PRIVATE "-framework Foundation")
|
||||
endif()
|
||||
|
||||
|
||||
|
@ -222,9 +193,8 @@ if (ARM64 OR ARM OR X86 OR X64 OR X86_64)
|
|||
# Link cpuinfo if supported
|
||||
# Using it mainly in ARM with Android.
|
||||
# Its functionality in detecting x86 cpu features are lacking, so is support for Windows.
|
||||
|
||||
if (CPUINFO_SUPPORTED)
|
||||
target_link_libraries(onnxruntime_common cpuinfo)
|
||||
onnxruntime_add_include_to_target(onnxruntime_common cpuinfo)
|
||||
list(APPEND onnxruntime_EXTERNAL_LIBRARIES cpuinfo clog)
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
@ -22,7 +22,7 @@ if(MSVC AND onnxruntime_ENABLE_EAGER_MODE)
|
|||
set_source_files_properties("${ORTTRAINING_ROOT}/orttraining/eager/ort_util.cpp" PROPERTIES COMPILE_FLAGS "/wd4100")
|
||||
endif()
|
||||
install(DIRECTORY ${PROJECT_SOURCE_DIR}/../include/onnxruntime/core/eager DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnxruntime/core)
|
||||
onnxruntime_add_include_to_target(onnxruntime_eager onnxruntime_common onnxruntime_framework onnxruntime_optimizer onnxruntime_graph onnx onnx_proto ${PROTOBUF_LIB} flatbuffers)
|
||||
onnxruntime_add_include_to_target(onnxruntime_eager onnxruntime_common onnxruntime_framework onnxruntime_optimizer onnxruntime_graph onnx onnx_proto ${PROTOBUF_LIB} flatbuffers safeint_interface Boost::mp11)
|
||||
if(onnxruntime_ENABLE_INSTRUMENT)
|
||||
target_compile_definitions(onnxruntime_eager PUBLIC ONNXRUNTIME_ENABLE_INSTRUMENT)
|
||||
endif()
|
||||
|
|
|
@ -51,19 +51,19 @@ if (onnxruntime_ENABLE_TRAINING OR onnxruntime_ENABLE_TRAINING_OPS)
|
|||
target_include_directories(onnxruntime_framework PRIVATE ${ORTTRAINING_ROOT})
|
||||
if (onnxruntime_ENABLE_TRAINING_TORCH_INTEROP)
|
||||
onnxruntime_add_include_to_target(onnxruntime_framework Python::Module)
|
||||
target_include_directories(onnxruntime_framework PRIVATE ${PROJECT_SOURCE_DIR}/external/dlpack/include)
|
||||
target_include_directories(onnxruntime_framework PRIVATE ${dlpack_SOURCE_DIR}/include)
|
||||
endif()
|
||||
if (onnxruntime_USE_NCCL OR onnxruntime_USE_MPI)
|
||||
target_include_directories(onnxruntime_framework PUBLIC ${MPI_CXX_INCLUDE_DIRS})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (onnxruntime_ENABLE_ATEN)
|
||||
# DLPack is a header-only dependency
|
||||
target_compile_definitions(onnxruntime_framework PRIVATE ENABLE_ATEN)
|
||||
set(DLPACK_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/external/dlpack/include)
|
||||
set(DLPACK_INCLUDE_DIR ${dlpack_SOURCE_DIR}/include)
|
||||
target_include_directories(onnxruntime_framework PRIVATE ${DLPACK_INCLUDE_DIR})
|
||||
endif()
|
||||
onnxruntime_add_include_to_target(onnxruntime_framework onnxruntime_common onnx onnx_proto ${PROTOBUF_LIB} flatbuffers)
|
||||
onnxruntime_add_include_to_target(onnxruntime_framework onnxruntime_common onnx onnx_proto ${PROTOBUF_LIB} flatbuffers safeint_interface Boost::mp11)
|
||||
|
||||
if (onnxruntime_USE_MIMALLOC)
|
||||
target_link_libraries(onnxruntime_framework mimalloc-static)
|
||||
|
|
|
@ -86,7 +86,7 @@ endif()
|
|||
|
||||
onnxruntime_add_static_library(onnxruntime_graph ${onnxruntime_graph_lib_src})
|
||||
add_dependencies(onnxruntime_graph onnx_proto flatbuffers)
|
||||
onnxruntime_add_include_to_target(onnxruntime_graph onnxruntime_common onnx onnx_proto ${PROTOBUF_LIB} flatbuffers)
|
||||
onnxruntime_add_include_to_target(onnxruntime_graph onnxruntime_common WIL::WIL onnx onnx_proto ${PROTOBUF_LIB} flatbuffers safeint_interface Boost::mp11)
|
||||
|
||||
if (MSVC)
|
||||
set(ONNX_PROTOBUF_NATVIS_FILE "onnx_protobuf.natvis")
|
||||
|
|
|
@ -4,5 +4,5 @@ include(onnxruntime_pyop.cmake)
|
|||
file (GLOB onnxruntime_language_interop_ops_src "${ONNXRUNTIME_ROOT}/core/language_interop_ops/language_interop_ops.cc")
|
||||
onnxruntime_add_static_library(onnxruntime_language_interop ${onnxruntime_language_interop_ops_src})
|
||||
add_dependencies(onnxruntime_language_interop onnxruntime_pyop)
|
||||
onnxruntime_add_include_to_target(onnxruntime_language_interop onnxruntime_common onnxruntime_graph onnxruntime_framework onnxruntime_pyop onnx onnx_proto ${PROTOBUF_LIB} flatbuffers)
|
||||
onnxruntime_add_include_to_target(onnxruntime_language_interop onnxruntime_common onnxruntime_graph onnxruntime_framework onnxruntime_pyop onnx onnx_proto ${PROTOBUF_LIB} flatbuffers safeint_interface Boost::mp11)
|
||||
target_include_directories(onnxruntime_language_interop PRIVATE ${ONNXRUNTIME_ROOT} ${eigen_INCLUDE_DIRS})
|
|
@ -27,10 +27,10 @@ target_compile_options(ort_opschema_lib PRIVATE -D_OPSCHEMA_LIB_=1)
|
|||
if(NOT MSVC)
|
||||
target_compile_options(ort_opschema_lib PRIVATE "-Wno-parentheses")
|
||||
endif()
|
||||
set (OPSCHEMA_LIB_DEPENDENCIES onnx onnx_proto ${PROTOBUF_LIB} flatbuffers)
|
||||
set (OPSCHEMA_LIB_DEPENDENCIES onnx onnx_proto ${PROTOBUF_LIB} flatbuffers safeint_interface Boost::mp11 safeint_interface)
|
||||
|
||||
# ${CMAKE_CURRENT_BINARY_DIR} is so that #include "onnxruntime_config.h" is found
|
||||
target_include_directories(ort_opschema_lib PRIVATE ${ONNXRUNTIME_ROOT} ${ORTTRAINING_ROOT} ${CMAKE_CURRENT_BINARY_DIR})
|
||||
onnxruntime_add_include_to_target(ort_opschema_lib onnxruntime_common onnx onnx_proto protobuf::libprotobuf flatbuffers)
|
||||
onnxruntime_add_include_to_target(ort_opschema_lib onnxruntime_common onnx onnx_proto ${PROTOBUF_LIB} flatbuffers Boost::mp11 safeint_interface)
|
||||
add_dependencies(ort_opschema_lib ${OPSCHEMA_LIB_DEPENDENCIES})
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ endif()
|
|||
onnxruntime_add_static_library(onnxruntime_optimizer ${onnxruntime_optimizer_srcs})
|
||||
|
||||
install(DIRECTORY ${PROJECT_SOURCE_DIR}/../include/onnxruntime/core/optimizer DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnxruntime/core)
|
||||
onnxruntime_add_include_to_target(onnxruntime_optimizer onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers)
|
||||
onnxruntime_add_include_to_target(onnxruntime_optimizer onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers Boost::mp11 safeint_interface)
|
||||
target_include_directories(onnxruntime_optimizer PRIVATE ${ONNXRUNTIME_ROOT})
|
||||
if (onnxruntime_ENABLE_TRAINING)
|
||||
target_include_directories(onnxruntime_optimizer PRIVATE ${ORTTRAINING_ROOT})
|
||||
|
|
|
@ -246,7 +246,7 @@ if (MSVC)
|
|||
# target_compile_options(onnxruntime_providers PRIVATE "/wd4244")
|
||||
# endif()
|
||||
endif()
|
||||
onnxruntime_add_include_to_target(onnxruntime_providers onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers)
|
||||
onnxruntime_add_include_to_target(onnxruntime_providers onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers Boost::mp11 safeint_interface)
|
||||
|
||||
if (onnxruntime_BUILD_MS_EXPERIMENTAL_OPS)
|
||||
target_compile_definitions(onnxruntime_providers PRIVATE BUILD_MS_EXPERIMENTAL_OPS=1)
|
||||
|
@ -264,8 +264,16 @@ if(HAS_DEPRECATED_COPY)
|
|||
set_source_files_properties("${ONNXRUNTIME_ROOT}/core/providers/cpu/tensor/where_op.cc" PROPERTIES COMPILE_FLAGS -Wno-deprecated-copy)
|
||||
endif()
|
||||
|
||||
target_include_directories(onnxruntime_providers PRIVATE ${ONNXRUNTIME_ROOT} ${eigen_INCLUDE_DIRS} ${RE2_INCLUDE_DIR})
|
||||
# This is enabled only for Adasum files in training mode.
|
||||
# The flags won't be applied globally since some high-precision training and inferencing ops will incur precision loss.
|
||||
if (onnxruntime_ENABLE_CPU_FP16_OPS)
|
||||
set_source_files_properties(${ORTTRAINING_SOURCE_DIR}/core/framework/adasum/adasum_mpi.cc PROPERTIES COMPILE_FLAGS " -fassociative-math -ffast-math -ftree-vectorize -funsafe-math-optimizations -mf16c -mavx -mfma ")
|
||||
set_source_files_properties(${ORTTRAINING_SOURCE_DIR}/training_ops/cpu/collective/adasum_kernels.cc PROPERTIES COMPILE_FLAGS " -fassociative-math -ffast-math -ftree-vectorize -funsafe-math-optimizations -mf16c -mavx -mfma ")
|
||||
set_source_files_properties(${ORTTRAINING_SOURCE_DIR}/training_ops/cuda/collective/adasum_kernels.cc PROPERTIES COMPILE_FLAGS " -fassociative-math -ffast-math -ftree-vectorize -funsafe-math-optimizations -mf16c -mavx -mfma ")
|
||||
endif()
|
||||
|
||||
target_include_directories(onnxruntime_providers PRIVATE ${ONNXRUNTIME_ROOT} ${eigen_INCLUDE_DIRS})
|
||||
onnxruntime_add_include_to_target(onnxruntime_providers re2::re2)
|
||||
add_dependencies(onnxruntime_providers onnx ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
||||
|
||||
if (onnxruntime_ENABLE_TRAINING OR onnxruntime_ENABLE_TRAINING_OPS)
|
||||
|
@ -275,7 +283,7 @@ endif()
|
|||
if (onnxruntime_ENABLE_ATEN)
|
||||
target_compile_definitions(onnxruntime_providers PRIVATE ENABLE_ATEN)
|
||||
# DLPack is a header-only dependency
|
||||
set(DLPACK_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/external/dlpack/include)
|
||||
set(DLPACK_INCLUDE_DIR ${dlpack_SOURCE_DIR}/include)
|
||||
target_include_directories(onnxruntime_providers PRIVATE ${DLPACK_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
|
@ -318,6 +326,8 @@ if (NOT onnxruntime_MINIMAL_BUILD AND NOT onnxruntime_EXTENDED_MINIMAL_BUILD
|
|||
|
||||
|
||||
# On Apple/Unix we don't directly link with this library as we load it with RTLD_GLOBAL, so this is only set to the actual library on WIN32
|
||||
# But, in exchange we need to manually add Boost::mp11 to include dirs for every EP.
|
||||
# It is because "provider_api.h" includes core/framework/op_kernel.h which includes op_kernel.h which includes "boost/mp11.hpp"
|
||||
set(ONNXRUNTIME_PROVIDERS_SHARED)
|
||||
|
||||
if(APPLE)
|
||||
|
@ -452,7 +462,7 @@ if (onnxruntime_USE_CUDA)
|
|||
endif()
|
||||
|
||||
add_dependencies(onnxruntime_providers_cuda onnxruntime_providers_shared ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
||||
target_link_libraries(onnxruntime_providers_cuda PRIVATE cublasLt cublas cudnn curand cufft ${ABSEIL_LIBS} ${ONNXRUNTIME_PROVIDERS_SHARED})
|
||||
target_link_libraries(onnxruntime_providers_cuda PRIVATE cublasLt cublas cudnn curand cufft ${ABSEIL_LIBS} ${ONNXRUNTIME_PROVIDERS_SHARED} Boost::mp11 safeint_interface)
|
||||
if(onnxruntime_CUDNN_HOME)
|
||||
target_include_directories(onnxruntime_providers_cuda PRIVATE ${onnxruntime_CUDNN_HOME}/include)
|
||||
endif()
|
||||
|
@ -585,11 +595,10 @@ if (onnxruntime_USE_TENSORRT)
|
|||
set(BUILD_LIBRARY_ONLY 1)
|
||||
add_definitions("-DONNX_ML=1")
|
||||
add_definitions("-DONNX_NAMESPACE=onnx")
|
||||
include_directories(${PROJECT_SOURCE_DIR}/external/protobuf)
|
||||
set(CUDA_INCLUDE_DIRS ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
|
||||
set(TENSORRT_ROOT ${onnxruntime_TENSORRT_HOME})
|
||||
include_directories(${ONNXRUNTIME_ROOT}/../cmake/external/onnx)
|
||||
set(OLD_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
set(PROTOBUF_LIBRARY ${PROTOBUF_LIB})
|
||||
if (WIN32)
|
||||
add_definitions(-D_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING=1)
|
||||
set(OLD_CMAKE_CUDA_FLAGS ${CMAKE_CUDA_FLAGS})
|
||||
|
@ -598,7 +607,6 @@ if (onnxruntime_USE_TENSORRT)
|
|||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4805")
|
||||
endif()
|
||||
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -include algorithm")
|
||||
set(PROTOBUF_LIBRARY libprotobuf)
|
||||
set(DISABLED_WARNINGS_FOR_TRT /wd4456)
|
||||
endif()
|
||||
if ( CMAKE_COMPILER_IS_GNUCC )
|
||||
|
@ -624,7 +632,13 @@ if (onnxruntime_USE_TENSORRT)
|
|||
set(TENSORRT_LIBRARY ${TENSORRT_LIBRARY_INFER} ${TENSORRT_LIBRARY_INFER_PLUGIN} ${TENSORRT_LIBRARY_NVONNXPARSER})
|
||||
MESSAGE(STATUS "Find TensorRT libs at ${TENSORRT_LIBRARY}")
|
||||
else()
|
||||
add_subdirectory(${ONNXRUNTIME_ROOT}/../cmake/external/onnx-tensorrt)
|
||||
FetchContent_Declare(
|
||||
onnx_tensorrt
|
||||
URL ${DEP_URL_onnx_tensorrt}
|
||||
URL_HASH SHA1=${DEP_SHA1_onnx_tensorrt}
|
||||
)
|
||||
FetchContent_MakeAvailable(onnx_tensorrt)
|
||||
include_directories(${onnx_tensorrt_SOURCE_DIR})
|
||||
set(CMAKE_CXX_FLAGS ${OLD_CMAKE_CXX_FLAGS})
|
||||
if ( CMAKE_COMPILER_IS_GNUCC )
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter")
|
||||
|
@ -638,7 +652,6 @@ if (onnxruntime_USE_TENSORRT)
|
|||
target_compile_options(nvonnxparser_static PRIVATE /FIio.h /wd4100)
|
||||
target_compile_options(nvonnxparser PRIVATE /FIio.h /wd4100)
|
||||
endif()
|
||||
include_directories(${ONNXRUNTIME_ROOT}/../cmake/external/onnx-tensorrt)
|
||||
include_directories(${TENSORRT_INCLUDE_DIR})
|
||||
set(onnxparser_link_libs nvonnxparser_static)
|
||||
endif()
|
||||
|
@ -654,10 +667,10 @@ if (onnxruntime_USE_TENSORRT)
|
|||
|
||||
source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_tensorrt_cc_srcs})
|
||||
onnxruntime_add_shared_library_module(onnxruntime_providers_tensorrt ${onnxruntime_providers_tensorrt_cc_srcs})
|
||||
onnxruntime_add_include_to_target(onnxruntime_providers_tensorrt onnxruntime_common onnx flatbuffers)
|
||||
onnxruntime_add_include_to_target(onnxruntime_providers_tensorrt onnxruntime_common onnx flatbuffers Boost::mp11 safeint_interface)
|
||||
add_dependencies(onnxruntime_providers_tensorrt onnxruntime_providers_shared ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
||||
if (onnxruntime_USE_TENSORRT_BUILTIN_PARSER)
|
||||
target_link_libraries(onnxruntime_providers_tensorrt PRIVATE ${trt_link_libs} cudart ${ONNXRUNTIME_PROVIDERS_SHARED} ${PROTOBUF_LIB} flatbuffers ${ABSEIL_LIBS})
|
||||
target_link_libraries(onnxruntime_providers_tensorrt PRIVATE ${trt_link_libs} cudart ${ONNXRUNTIME_PROVIDERS_SHARED} ${PROTOBUF_LIB} flatbuffers Boost::mp11 safeint_interface ${ABSEIL_LIBS})
|
||||
target_include_directories(onnxruntime_providers_tensorrt PRIVATE ${ONNXRUNTIME_ROOT} ${CMAKE_CURRENT_BINARY_DIR} ${eigen_INCLUDE_DIRS} ${TENSORRT_INCLUDE_DIR} PUBLIC ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
|
||||
else()
|
||||
target_link_libraries(onnxruntime_providers_tensorrt PRIVATE ${onnxparser_link_libs} ${trt_link_libs} cudart ${ONNXRUNTIME_PROVIDERS_SHARED} ${PROTOBUF_LIB} flatbuffers ${ABSEIL_LIBS})
|
||||
|
@ -666,6 +679,7 @@ if (onnxruntime_USE_TENSORRT)
|
|||
if(onnxruntime_CUDNN_HOME)
|
||||
target_include_directories(onnxruntime_providers_tensorrt PRIVATE ${onnxruntime_CUDNN_HOME}/include)
|
||||
endif()
|
||||
|
||||
# ${CMAKE_CURRENT_BINARY_DIR} is so that #include "onnxruntime_config.h" inside tensor_shape.h is found
|
||||
install(DIRECTORY ${PROJECT_SOURCE_DIR}/../include/onnxruntime/core/providers/tensorrt DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnxruntime/core/providers)
|
||||
set_target_properties(onnxruntime_providers_tensorrt PROPERTIES LINKER_LANGUAGE CUDA)
|
||||
|
@ -712,7 +726,7 @@ if (onnxruntime_USE_VITISAI)
|
|||
source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_vitisai_cc_srcs})
|
||||
onnxruntime_add_static_library(onnxruntime_providers_vitisai ${onnxruntime_providers_vitisai_cc_srcs})
|
||||
onnxruntime_add_include_to_target(onnxruntime_providers_vitisai
|
||||
onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers
|
||||
onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers Boost::mp11 safeint_interface
|
||||
)
|
||||
add_dependencies(onnxruntime_providers_vitisai ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
||||
set_target_properties(onnxruntime_providers_vitisai PROPERTIES FOLDER "ONNXRuntime")
|
||||
|
@ -778,7 +792,7 @@ if (onnxruntime_USE_OPENVINO)
|
|||
endif()
|
||||
add_dependencies(onnxruntime_providers_openvino onnxruntime_providers_shared ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
||||
target_include_directories(onnxruntime_providers_openvino SYSTEM PUBLIC ${ONNXRUNTIME_ROOT} ${CMAKE_CURRENT_BINARY_DIR} ${eigen_INCLUDE_DIRS} ${OpenVINO_INCLUDE_DIR} ${OPENVINO_INCLUDE_DIR_LIST} ${PYTHON_INCLUDE_DIRS} $ENV{OPENCL_INCS})
|
||||
target_link_libraries(onnxruntime_providers_openvino ${ONNXRUNTIME_PROVIDERS_SHARED} ${OPENVINO_LIB_LIST} ${ABSEIL_LIBS})
|
||||
target_link_libraries(onnxruntime_providers_openvino ${ONNXRUNTIME_PROVIDERS_SHARED} Boost::mp11 ${OPENVINO_LIB_LIST} ${ABSEIL_LIBS})
|
||||
|
||||
target_compile_definitions(onnxruntime_providers_openvino PRIVATE VER_MAJOR=${VERSION_MAJOR_PART})
|
||||
target_compile_definitions(onnxruntime_providers_openvino PRIVATE VER_MINOR=${VERSION_MINOR_PART})
|
||||
|
@ -896,14 +910,15 @@ if (onnxruntime_USE_COREML)
|
|||
${onnxruntime_providers_coreml_cc_srcs} ${onnxruntime_providers_coreml_objcc_srcs}
|
||||
)
|
||||
onnxruntime_add_include_to_target(onnxruntime_providers_coreml
|
||||
onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers
|
||||
onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers Boost::mp11 safeint_interface
|
||||
)
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||
onnxruntime_add_include_to_target(onnxruntime_providers_coreml onnxruntime_coreml_proto)
|
||||
target_link_libraries(onnxruntime_providers_coreml PRIVATE onnxruntime_coreml_proto "-framework Foundation" "-framework CoreML")
|
||||
add_dependencies(onnxruntime_providers_coreml onnxruntime_coreml_proto)
|
||||
endif()
|
||||
add_dependencies(onnxruntime_providers_coreml onnx ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
||||
add_dependencies(onnxruntime_providers_coreml ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
||||
|
||||
set_target_properties(onnxruntime_providers_coreml PROPERTIES CXX_STANDARD_REQUIRED ON)
|
||||
set_target_properties(onnxruntime_providers_coreml PROPERTIES FOLDER "ONNXRuntime")
|
||||
target_include_directories(onnxruntime_providers_coreml PRIVATE ${ONNXRUNTIME_ROOT} ${coreml_INCLUDE_DIRS})
|
||||
|
@ -980,7 +995,7 @@ if (onnxruntime_USE_NNAPI_BUILTIN)
|
|||
source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_nnapi_cc_srcs})
|
||||
onnxruntime_add_static_library(onnxruntime_providers_nnapi ${onnxruntime_providers_nnapi_cc_srcs})
|
||||
onnxruntime_add_include_to_target(onnxruntime_providers_nnapi
|
||||
onnxruntime_common onnxruntime_framework onnx onnx_proto protobuf::libprotobuf-lite flatbuffers
|
||||
onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers Boost::mp11 safeint_interface
|
||||
)
|
||||
target_link_libraries(onnxruntime_providers_nnapi)
|
||||
add_dependencies(onnxruntime_providers_nnapi onnx ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
||||
|
@ -1026,7 +1041,7 @@ if (onnxruntime_USE_RKNPU)
|
|||
source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_rknpu_cc_srcs})
|
||||
onnxruntime_add_static_library(onnxruntime_providers_rknpu ${onnxruntime_providers_rknpu_cc_srcs})
|
||||
onnxruntime_add_include_to_target(onnxruntime_providers_rknpu
|
||||
onnxruntime_common onnxruntime_framework onnx onnx_proto protobuf::libprotobuf-lite flatbuffers
|
||||
onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers Boost::mp11 safeint_interface
|
||||
)
|
||||
target_link_libraries(onnxruntime_providers_rknpu PRIVATE -lrknpu_ddk)
|
||||
add_dependencies(onnxruntime_providers_rknpu onnx ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
||||
|
@ -1055,11 +1070,11 @@ if (onnxruntime_USE_DML)
|
|||
source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_dml_cc_srcs})
|
||||
onnxruntime_add_static_library(onnxruntime_providers_dml ${onnxruntime_providers_dml_cc_srcs})
|
||||
onnxruntime_add_include_to_target(onnxruntime_providers_dml
|
||||
onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers
|
||||
onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers Boost::mp11 safeint_interface WIL::WIL
|
||||
)
|
||||
add_dependencies(onnxruntime_providers_dml ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
||||
target_include_directories(onnxruntime_providers_dml PRIVATE
|
||||
${ONNXRUNTIME_ROOT} ${ONNXRUNTIME_ROOT}/../cmake/external/wil/include
|
||||
${ONNXRUNTIME_ROOT}
|
||||
)
|
||||
|
||||
add_definitions(-DDML_TARGET_VERSION_USE_LATEST=1)
|
||||
|
@ -1138,9 +1153,11 @@ if (onnxruntime_USE_MIGRAPHX)
|
|||
set(BUILD_LIBRARY_ONLY 1)
|
||||
add_definitions("-DONNX_ML=1")
|
||||
add_definitions("-DONNX_NAMESPACE=onnx")
|
||||
# TODO: Remove the next line so that we can delete the git submodule
|
||||
include_directories(${PROJECT_SOURCE_DIR}/external/protobuf ${PROJECT_SOURCE_DIR}/external/eigen)
|
||||
set(MIGRAPHX_ROOT ${onnxruntime_MIGRAPHX_HOME})
|
||||
include_directories(${ONNXRUNTIME_ROOT}/../cmake/external/onnx)
|
||||
# TODO: Remove the next line so that we can delete the git submodule
|
||||
include_directories(${PROJECT_SOURCE_DIR}/external/onnx)
|
||||
set(OLD_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
if ( CMAKE_COMPILER_IS_GNUCC )
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter -Wno-missing-field-initializers")
|
||||
|
@ -1167,9 +1184,9 @@ if (onnxruntime_USE_MIGRAPHX)
|
|||
)
|
||||
source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_migraphx_cc_srcs})
|
||||
onnxruntime_add_shared_library_module(onnxruntime_providers_migraphx ${onnxruntime_providers_migraphx_cc_srcs})
|
||||
onnxruntime_add_include_to_target(onnxruntime_providers_migraphx onnxruntime_common onnx flatbuffers)
|
||||
onnxruntime_add_include_to_target(onnxruntime_providers_migraphx onnxruntime_common onnx flatbuffers Boost::mp11 safeint_interface)
|
||||
add_dependencies(onnxruntime_providers_migraphx onnxruntime_providers_shared ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
||||
target_link_libraries(onnxruntime_providers_migraphx PRIVATE ${migraphx_libs} ${ONNXRUNTIME_PROVIDERS_SHARED} onnx flatbuffers)
|
||||
target_link_libraries(onnxruntime_providers_migraphx PRIVATE ${migraphx_libs} ${ONNXRUNTIME_PROVIDERS_SHARED} onnx flatbuffers Boost::mp11 safeint_interface)
|
||||
target_include_directories(onnxruntime_providers_migraphx PRIVATE ${ONNXRUNTIME_ROOT} ${CMAKE_CURRENT_BINARY_DIR})
|
||||
install(DIRECTORY ${PROJECT_SOURCE_DIR}/../include/onnxruntime/core/providers/migraphx DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnxruntime/core/providers)
|
||||
set_target_properties(onnxruntime_providers_migraphx PROPERTIES LINKER_LANGUAGE CXX)
|
||||
|
@ -1206,8 +1223,9 @@ if (onnxruntime_USE_ACL)
|
|||
source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_acl_cc_srcs})
|
||||
onnxruntime_add_static_library(onnxruntime_providers_acl ${onnxruntime_providers_acl_cc_srcs})
|
||||
onnxruntime_add_include_to_target(onnxruntime_providers_acl
|
||||
onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers
|
||||
onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers Boost::mp11 safeint_interface
|
||||
)
|
||||
|
||||
target_link_libraries(onnxruntime_providers_acl -L$ENV{LD_LIBRARY_PATH})
|
||||
add_dependencies(onnxruntime_providers_acl ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
||||
set_target_properties(onnxruntime_providers_acl PROPERTIES FOLDER "ONNXRuntime")
|
||||
|
@ -1239,8 +1257,9 @@ if (onnxruntime_USE_ARMNN)
|
|||
source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_armnn_cc_srcs})
|
||||
onnxruntime_add_static_library(onnxruntime_providers_armnn ${onnxruntime_providers_armnn_cc_srcs})
|
||||
onnxruntime_add_include_to_target(onnxruntime_providers_armnn
|
||||
onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers
|
||||
onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers Boost::mp11 safeint_interface
|
||||
)
|
||||
|
||||
add_dependencies(onnxruntime_providers_armnn ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
||||
set_target_properties(onnxruntime_providers_armnn PROPERTIES FOLDER "ONNXRuntime")
|
||||
target_include_directories(onnxruntime_providers_armnn PRIVATE
|
||||
|
@ -1350,7 +1369,7 @@ if (onnxruntime_USE_ROCM)
|
|||
target_compile_options(onnxruntime_providers_rocm PRIVATE -Wno-undefined-var-template)
|
||||
endif()
|
||||
|
||||
onnxruntime_add_include_to_target(onnxruntime_providers_rocm onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers)
|
||||
onnxruntime_add_include_to_target(onnxruntime_providers_rocm onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers Boost::mp11 safeint_interface)
|
||||
if (onnxruntime_ENABLE_TRAINING OR onnxruntime_ENABLE_TRAINING_OPS)
|
||||
onnxruntime_add_include_to_target(onnxruntime_providers_rocm onnxruntime_training)
|
||||
target_link_libraries(onnxruntime_providers_rocm PRIVATE onnxruntime_training)
|
||||
|
@ -1379,6 +1398,7 @@ if (onnxruntime_USE_ROCM)
|
|||
${onnxruntime_ROCM_HOME}/include
|
||||
${onnxruntime_ROCM_HOME}/include/roctracer)
|
||||
install(DIRECTORY ${PROJECT_SOURCE_DIR}/../include/onnxruntime/core/providers/rocm DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnxruntime/core/providers)
|
||||
|
||||
set_target_properties(onnxruntime_providers_rocm PROPERTIES LINKER_LANGUAGE CXX)
|
||||
set_target_properties(onnxruntime_providers_rocm PROPERTIES FOLDER "ONNXRuntime")
|
||||
|
||||
|
@ -1444,16 +1464,10 @@ if (onnxruntime_USE_TVM)
|
|||
target_include_directories(onnxruntime_providers_tvm PRIVATE
|
||||
${TVM_INCLUDES}
|
||||
${PYTHON_INLCUDE_DIRS})
|
||||
onnxruntime_add_include_to_target(onnxruntime_providers_tvm onnxruntime_common onnx tvm)
|
||||
onnxruntime_add_include_to_target(onnxruntime_providers_tvm onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers Boost::mp11 safeint_interface)
|
||||
|
||||
add_dependencies(onnxruntime_providers_tvm ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
||||
|
||||
target_link_libraries(onnxruntime_providers_tvm PRIVATE
|
||||
onnx
|
||||
tvm
|
||||
onnxruntime_common
|
||||
onnxruntime_framework
|
||||
)
|
||||
if (onnxruntime_TVM_USE_HASH)
|
||||
add_dependencies(onnxruntime_providers_tvm ippcp_s)
|
||||
target_include_directories(onnxruntime_providers_tvm PRIVATE ${IPP_CRYPTO_INCLUDE_DIR})
|
||||
|
@ -1467,6 +1481,7 @@ if (onnxruntime_USE_TVM)
|
|||
# wd4100: identifier' : unreferenced formal parameter
|
||||
# wd4127: conditional expression is constant
|
||||
# wd4244: conversion from 'int' to 'char', possible loss of data
|
||||
# TODO: 4244 should not be disabled
|
||||
target_compile_options(onnxruntime_providers_tvm PRIVATE "/wd4100" "/wd4127" "/wd4244")
|
||||
else()
|
||||
target_compile_options(onnxruntime_providers_tvm PRIVATE "-Wno-error=type-limits")
|
||||
|
@ -1499,7 +1514,7 @@ if (onnxruntime_USE_XNNPACK)
|
|||
source_group(TREE ${REPO_ROOT} FILES ${onnxruntime_providers_xnnpack_cc_srcs})
|
||||
onnxruntime_add_static_library(onnxruntime_providers_xnnpack ${onnxruntime_providers_xnnpack_cc_srcs})
|
||||
onnxruntime_add_include_to_target(onnxruntime_providers_xnnpack
|
||||
onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} XNNPACK pthreadpool
|
||||
onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} XNNPACK pthreadpool Boost::mp11 safeint_interface
|
||||
)
|
||||
|
||||
add_dependencies(onnxruntime_providers_xnnpack onnx ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License.
|
||||
file(GLOB onnxruntime_pyop_srcs "${ONNXRUNTIME_ROOT}/core/language_interop_ops/pyop/pyop.cc")
|
||||
onnxruntime_add_static_library(onnxruntime_pyop ${onnxruntime_pyop_srcs})
|
||||
add_dependencies(onnxruntime_pyop onnxruntime_graph)
|
||||
onnxruntime_add_include_to_target(onnxruntime_pyop onnxruntime_common onnxruntime_graph onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers)
|
||||
onnxruntime_add_static_library(onnxruntime_pyop "${ONNXRUNTIME_ROOT}/core/language_interop_ops/pyop/pyop.cc")
|
||||
add_dependencies(onnxruntime_pyop ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
||||
onnxruntime_add_include_to_target(onnxruntime_pyop onnxruntime_common onnxruntime_graph onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers ${GSL_TARGET} Boost::mp11)
|
||||
target_include_directories(onnxruntime_pyop PRIVATE ${ONNXRUNTIME_ROOT} ${eigen_INCLUDE_DIRS})
|
||||
onnxruntime_add_include_to_target(onnxruntime_pyop Python::Module Python::NumPy)
|
||||
if (TARGET Python::Python)
|
||||
|
|
|
@ -138,7 +138,7 @@ endif()
|
|||
|
||||
if (onnxruntime_ENABLE_ATEN)
|
||||
target_compile_definitions(onnxruntime_pybind11_state PRIVATE ENABLE_ATEN)
|
||||
target_include_directories(onnxruntime_pybind11_state PRIVATE ${PROJECT_SOURCE_DIR}/external/dlpack/include)
|
||||
target_include_directories(onnxruntime_pybind11_state PRIVATE ${dlpack_SOURCE_DIR}/include)
|
||||
endif()
|
||||
|
||||
if (onnxruntime_ENABLE_TRAINING)
|
||||
|
|
|
@ -28,7 +28,7 @@ source_group(TREE ${REPO_ROOT} FILES ${onnxruntime_session_srcs})
|
|||
|
||||
onnxruntime_add_static_library(onnxruntime_session ${onnxruntime_session_srcs})
|
||||
install(DIRECTORY ${PROJECT_SOURCE_DIR}/../include/onnxruntime/core/session DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnxruntime/core)
|
||||
onnxruntime_add_include_to_target(onnxruntime_session onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers)
|
||||
onnxruntime_add_include_to_target(onnxruntime_session onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers Boost::mp11 safeint_interface nlohmann_json::nlohmann_json)
|
||||
if(onnxruntime_ENABLE_INSTRUMENT)
|
||||
target_compile_definitions(onnxruntime_session PUBLIC ONNXRUNTIME_ENABLE_INSTRUMENT)
|
||||
endif()
|
||||
|
@ -37,7 +37,6 @@ if(NOT MSVC)
|
|||
set_source_files_properties(${ONNXRUNTIME_ROOT}/core/session/environment.cc PROPERTIES COMPILE_FLAGS "-Wno-parentheses")
|
||||
endif()
|
||||
target_include_directories(onnxruntime_session PRIVATE ${ONNXRUNTIME_ROOT} ${eigen_INCLUDE_DIRS})
|
||||
target_link_libraries(onnxruntime_session PRIVATE nlohmann_json::nlohmann_json)
|
||||
if (onnxruntime_USE_EXTENSIONS)
|
||||
target_link_libraries(onnxruntime_session PRIVATE onnxruntime_extensions)
|
||||
endif()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
set (CXXOPTS ${PROJECT_SOURCE_DIR}/external/cxxopts/include)
|
||||
set (CXXOPTS ${cxxopts_SOURCE_DIR}/include)
|
||||
|
||||
# training lib
|
||||
file(GLOB_RECURSE onnxruntime_training_srcs
|
||||
|
@ -28,14 +28,14 @@ list(REMOVE_ITEM onnxruntime_training_srcs ${onnxruntime_training_framework_excl
|
|||
|
||||
onnxruntime_add_static_library(onnxruntime_training ${onnxruntime_training_srcs})
|
||||
add_dependencies(onnxruntime_training onnx tensorboard ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
||||
onnxruntime_add_include_to_target(onnxruntime_training onnxruntime_common onnx onnx_proto tensorboard ${PROTOBUF_LIB} flatbuffers)
|
||||
onnxruntime_add_include_to_target(onnxruntime_training onnxruntime_common onnx onnx_proto tensorboard ${PROTOBUF_LIB} flatbuffers re2::re2 Boost::mp11 safeint_interface)
|
||||
|
||||
# fix event_writer.cc 4100 warning
|
||||
if(WIN32)
|
||||
target_compile_options(onnxruntime_training PRIVATE /wd4100)
|
||||
endif()
|
||||
|
||||
target_include_directories(onnxruntime_training PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${ONNXRUNTIME_ROOT} ${ORTTRAINING_ROOT} ${eigen_INCLUDE_DIRS} ${RE2_INCLUDE_DIR} PUBLIC ${onnxruntime_graph_header} ${MPI_CXX_INCLUDE_DIRS})
|
||||
target_include_directories(onnxruntime_training PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${ONNXRUNTIME_ROOT} ${ORTTRAINING_ROOT} ${eigen_INCLUDE_DIRS} PUBLIC ${onnxruntime_graph_header} ${MPI_CXX_INCLUDE_DIRS})
|
||||
|
||||
if (onnxruntime_USE_CUDA)
|
||||
target_include_directories(onnxruntime_training PRIVATE ${onnxruntime_CUDNN_HOME}/include ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
|
||||
|
@ -75,7 +75,7 @@ if (onnxruntime_BUILD_UNIT_TESTS)
|
|||
target_link_libraries(onnxruntime_training_runner PRIVATE Python::Python)
|
||||
endif()
|
||||
|
||||
onnxruntime_add_include_to_target(onnxruntime_training_runner onnxruntime_training onnxruntime_framework onnxruntime_common onnx onnx_proto ${PROTOBUF_LIB} onnxruntime_training flatbuffers)
|
||||
onnxruntime_add_include_to_target(onnxruntime_training_runner onnxruntime_training onnxruntime_framework onnxruntime_common onnx onnx_proto ${PROTOBUF_LIB} onnxruntime_training flatbuffers Boost::mp11 safeint_interface)
|
||||
|
||||
target_include_directories(onnxruntime_training_runner PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${ONNXRUNTIME_ROOT} ${ORTTRAINING_ROOT} ${eigen_INCLUDE_DIRS} PUBLIC ${onnxruntime_graph_header})
|
||||
target_link_libraries(onnxruntime_training_runner PRIVATE nlohmann_json::nlohmann_json)
|
||||
|
@ -113,7 +113,7 @@ if (onnxruntime_BUILD_UNIT_TESTS)
|
|||
"${ORTTRAINING_SOURCE_DIR}/models/mnist/main.cc"
|
||||
)
|
||||
onnxruntime_add_executable(onnxruntime_training_mnist ${training_mnist_src})
|
||||
onnxruntime_add_include_to_target(onnxruntime_training_mnist onnxruntime_common onnx onnx_proto ${PROTOBUF_LIB} onnxruntime_training flatbuffers)
|
||||
onnxruntime_add_include_to_target(onnxruntime_training_mnist onnxruntime_common onnx onnx_proto ${PROTOBUF_LIB} onnxruntime_training flatbuffers Boost::mp11 safeint_interface)
|
||||
target_include_directories(onnxruntime_training_mnist PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${ONNXRUNTIME_ROOT} ${ORTTRAINING_ROOT} ${eigen_INCLUDE_DIRS} ${CXXOPTS} ${extra_includes} ${onnxruntime_graph_header} ${onnxruntime_exec_src_dir} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/onnx onnxruntime_training_runner)
|
||||
|
||||
set(ONNXRUNTIME_LIBS
|
||||
|
@ -136,6 +136,7 @@ if (onnxruntime_BUILD_UNIT_TESTS)
|
|||
${ONNXRUNTIME_MLAS_LIBS}
|
||||
onnxruntime_common
|
||||
onnxruntime_flatbuffers
|
||||
Boost::mp11 safeint_interface
|
||||
)
|
||||
|
||||
if (onnxruntime_ENABLE_LANGUAGE_INTEROP_OPS)
|
||||
|
@ -158,7 +159,7 @@ if (onnxruntime_BUILD_UNIT_TESTS)
|
|||
"${ORTTRAINING_SOURCE_DIR}/models/squeezenet/*.cc"
|
||||
)
|
||||
onnxruntime_add_executable(onnxruntime_training_squeezenet ${training_squeezene_src})
|
||||
onnxruntime_add_include_to_target(onnxruntime_training_squeezenet onnxruntime_common onnx onnx_proto ${PROTOBUF_LIB} onnxruntime_training flatbuffers)
|
||||
onnxruntime_add_include_to_target(onnxruntime_training_squeezenet onnxruntime_common onnx onnx_proto ${PROTOBUF_LIB} onnxruntime_training flatbuffers Boost::mp11 safeint_interface)
|
||||
target_include_directories(onnxruntime_training_squeezenet PUBLIC ${ONNXRUNTIME_ROOT} ${ORTTRAINING_ROOT} ${eigen_INCLUDE_DIRS} ${extra_includes} ${onnxruntime_graph_header} ${onnxruntime_exec_src_dir} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/onnx onnxruntime_training_runner)
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
|
@ -181,7 +182,7 @@ if (onnxruntime_BUILD_UNIT_TESTS)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
onnxruntime_add_include_to_target(onnxruntime_training_bert onnxruntime_common onnx onnx_proto ${PROTOBUF_LIB} onnxruntime_training flatbuffers)
|
||||
onnxruntime_add_include_to_target(onnxruntime_training_bert onnxruntime_common onnx onnx_proto ${PROTOBUF_LIB} onnxruntime_training flatbuffers Boost::mp11 safeint_interface)
|
||||
target_include_directories(onnxruntime_training_bert PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${ONNXRUNTIME_ROOT} ${ORTTRAINING_ROOT} ${MPI_CXX_INCLUDE_DIRS} ${eigen_INCLUDE_DIRS} ${CXXOPTS} ${extra_includes} ${onnxruntime_graph_header} ${onnxruntime_exec_src_dir} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/onnx onnxruntime_training_runner)
|
||||
|
||||
# ROCM provider sources are generated, need to add include directory for generated headers
|
||||
|
@ -205,7 +206,7 @@ if (onnxruntime_BUILD_UNIT_TESTS)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
onnxruntime_add_include_to_target(onnxruntime_training_pipeline_poc onnxruntime_common onnx onnx_proto ${PROTOBUF_LIB} onnxruntime_training flatbuffers)
|
||||
onnxruntime_add_include_to_target(onnxruntime_training_pipeline_poc onnxruntime_common onnx onnx_proto ${PROTOBUF_LIB} onnxruntime_training flatbuffers Boost::mp11 safeint_interface)
|
||||
target_include_directories(onnxruntime_training_pipeline_poc PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${ONNXRUNTIME_ROOT} ${ORTTRAINING_ROOT} ${MPI_CXX_INCLUDE_DIRS} ${eigen_INCLUDE_DIRS} ${CXXOPTS} ${extra_includes} ${onnxruntime_graph_header} ${onnxruntime_exec_src_dir} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/onnx onnxruntime_training_runner)
|
||||
if (onnxruntime_USE_NCCL)
|
||||
target_include_directories(onnxruntime_training_pipeline_poc PRIVATE ${NCCL_INCLUDE_DIRS})
|
||||
|
@ -226,7 +227,6 @@ if (onnxruntime_BUILD_UNIT_TESTS)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
onnxruntime_add_include_to_target(onnxruntime_training_gpt2 onnxruntime_common onnx onnx_proto ${PROTOBUF_LIB} onnxruntime_training flatbuffers)
|
||||
target_include_directories(onnxruntime_training_gpt2 PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${ONNXRUNTIME_ROOT} ${ORTTRAINING_ROOT} ${MPI_CXX_INCLUDE_DIRS} ${eigen_INCLUDE_DIRS} ${CXXOPTS} ${extra_includes} ${onnxruntime_graph_header} ${onnxruntime_exec_src_dir} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/onnx onnxruntime_training_runner)
|
||||
|
||||
target_link_libraries(onnxruntime_training_gpt2 PRIVATE onnxruntime_training_runner onnxruntime_training ${ONNXRUNTIME_LIBS} ${onnxruntime_EXTERNAL_LIBRARIES})
|
||||
|
|
|
@ -125,7 +125,7 @@ function(AddTest)
|
|||
${TEST_SRC_DIR}/xctest/ortxctest.m
|
||||
${TEST_SRC_DIR}/xctest/xcgtest.mm
|
||||
${_UT_SOURCES})
|
||||
|
||||
onnxruntime_configure_target(${_UT_TARGET}_xc)
|
||||
if(_UT_DYN)
|
||||
target_link_libraries(${_UT_TARGET}_xc PRIVATE ${_UT_LIBS} GTest::gtest GTest::gmock onnxruntime ${CMAKE_DL_LIBS}
|
||||
Threads::Threads)
|
||||
|
@ -596,7 +596,9 @@ file(GLOB onnxruntime_test_framework_src CONFIGURE_DEPENDS
|
|||
${onnxruntime_test_framework_src_patterns}
|
||||
)
|
||||
|
||||
#without auto initialize onnxruntime
|
||||
#This is a small wrapper library that shouldn't use any onnxruntime internal symbols(except onnxruntime_common).
|
||||
#Because it could dynamically link to onnxruntime. Otherwise you will have two copies of onnxruntime in the same
|
||||
#process and you won't know which one you are testing.
|
||||
onnxruntime_add_static_library(onnxruntime_test_utils ${onnxruntime_test_utils_src})
|
||||
if(MSVC)
|
||||
target_compile_options(onnxruntime_test_utils PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:--compiler-options /utf-8>"
|
||||
|
@ -606,7 +608,7 @@ if(MSVC)
|
|||
else()
|
||||
target_compile_definitions(onnxruntime_test_utils PUBLIC -DNSYNC_ATOMIC_CPP11)
|
||||
target_include_directories(onnxruntime_test_utils PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${ONNXRUNTIME_ROOT}
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/external/nsync/public")
|
||||
${nsync_SOURCE_DIR}/public)
|
||||
endif()
|
||||
if (onnxruntime_USE_NCCL)
|
||||
target_include_directories(onnxruntime_test_utils PRIVATE ${NCCL_INCLUDE_DIRS})
|
||||
|
@ -614,7 +616,8 @@ endif()
|
|||
if (onnxruntime_USE_ROCM)
|
||||
target_include_directories(onnxruntime_test_utils PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/amdgpu/onnxruntime ${CMAKE_CURRENT_BINARY_DIR}/amdgpu/orttraining)
|
||||
endif()
|
||||
onnxruntime_add_include_to_target(onnxruntime_test_utils onnxruntime_common onnxruntime_framework onnxruntime_session GTest::gtest GTest::gmock onnx onnx_proto flatbuffers)
|
||||
onnxruntime_add_include_to_target(onnxruntime_test_utils onnxruntime_common onnxruntime_framework onnxruntime_session GTest::gtest GTest::gmock onnx onnx_proto flatbuffers nlohmann_json::nlohmann_json Boost::mp11 safeint_interface)
|
||||
|
||||
|
||||
|
||||
if (onnxruntime_USE_DML)
|
||||
|
@ -639,17 +642,17 @@ if(MSVC)
|
|||
else()
|
||||
target_compile_definitions(onnx_test_runner_common PUBLIC -DNSYNC_ATOMIC_CPP11)
|
||||
target_include_directories(onnx_test_runner_common PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${ONNXRUNTIME_ROOT}
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/external/nsync/public")
|
||||
${nsync_SOURCE_DIR}/public)
|
||||
endif()
|
||||
if (MSVC AND NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
#TODO: fix the warnings, they are dangerous
|
||||
target_compile_options(onnx_test_runner_common PRIVATE "/wd4244")
|
||||
endif()
|
||||
onnxruntime_add_include_to_target(onnx_test_runner_common onnxruntime_common onnxruntime_framework
|
||||
onnxruntime_test_utils onnx onnx_proto re2::re2 flatbuffers)
|
||||
onnxruntime_test_utils onnx onnx_proto re2::re2 flatbuffers Boost::mp11 safeint_interface)
|
||||
|
||||
add_dependencies(onnx_test_runner_common onnx_test_data_proto ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
||||
target_include_directories(onnx_test_runner_common PRIVATE ${eigen_INCLUDE_DIRS} ${RE2_INCLUDE_DIR}
|
||||
target_include_directories(onnx_test_runner_common PRIVATE ${eigen_INCLUDE_DIRS}
|
||||
${CMAKE_CURRENT_BINARY_DIR} ${ONNXRUNTIME_ROOT})
|
||||
|
||||
set_target_properties(onnx_test_runner_common PROPERTIES FOLDER "ONNXRuntimeTest")
|
||||
|
@ -719,7 +722,7 @@ AddTest(
|
|||
SOURCES ${all_tests} ${onnxruntime_unittest_main_src}
|
||||
LIBS
|
||||
onnx_test_runner_common ${onnxruntime_test_providers_libs} ${onnxruntime_test_common_libs}
|
||||
onnx_test_data_proto nlohmann_json::nlohmann_json
|
||||
onnx_test_data_proto
|
||||
DEPENDS ${all_dependencies}
|
||||
TEST_ARGS ${test_all_args}
|
||||
)
|
||||
|
@ -781,7 +784,7 @@ endif()
|
|||
onnxruntime_add_include_to_target(onnx_test_data_proto onnx_proto)
|
||||
target_include_directories(onnx_test_data_proto PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_target_properties(onnx_test_data_proto PROPERTIES FOLDER "ONNXRuntimeTest")
|
||||
onnxruntime_protobuf_generate(APPEND_PATH IMPORT_DIRS external/onnx TARGET onnx_test_data_proto)
|
||||
onnxruntime_protobuf_generate(APPEND_PATH IMPORT_DIRS ${onnx_SOURCE_DIR} TARGET onnx_test_data_proto)
|
||||
|
||||
#
|
||||
# onnxruntime_ir_graph test data
|
||||
|
@ -953,6 +956,9 @@ if (NOT onnxruntime_ENABLE_TRAINING_TORCH_INTEROP)
|
|||
else()
|
||||
target_link_libraries(onnxruntime_mlas_benchmark PRIVATE nsync_cpp ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
if (CPUINFO_SUPPORTED AND NOT onnxruntime_BUILD_WEBASSEMBLY)
|
||||
target_link_libraries(onnxruntime_mlas_benchmark PRIVATE cpuinfo)
|
||||
endif()
|
||||
set_target_properties(onnxruntime_mlas_benchmark PROPERTIES FOLDER "ONNXRuntimeTest")
|
||||
endif()
|
||||
|
||||
|
@ -962,9 +968,9 @@ if (NOT onnxruntime_ENABLE_TRAINING_TORCH_INTEROP)
|
|||
|
||||
if (NOT onnxruntime_REDUCED_OPS_BUILD AND NOT onnxruntime_BUILD_WEBASSEMBLY)
|
||||
add_test(NAME onnx_test_pytorch_converted
|
||||
COMMAND onnx_test_runner ${PROJECT_SOURCE_DIR}/external/onnx/onnx/backend/test/data/pytorch-converted)
|
||||
COMMAND onnx_test_runner ${onnx_SOURCE_DIR}/onnx/backend/test/data/pytorch-converted)
|
||||
add_test(NAME onnx_test_pytorch_operator
|
||||
COMMAND onnx_test_runner ${PROJECT_SOURCE_DIR}/external/onnx/onnx/backend/test/data/pytorch-operator)
|
||||
COMMAND onnx_test_runner ${onnx_SOURCE_DIR}/onnx/backend/test/data/pytorch-operator)
|
||||
endif()
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||
|
@ -977,7 +983,7 @@ if(onnxruntime_ENABLE_EAGER_MODE)
|
|||
file(GLOB onnxruntime_eager_mode_test_src CONFIGURE_DEPENDS
|
||||
"${TEST_SRC_DIR}/eager/*.cc"
|
||||
)
|
||||
add_executable(onnxruntime_eager_mode_test ${onnxruntime_eager_mode_test_src})
|
||||
onnxruntime_add_executable(onnxruntime_eager_mode_test ${onnxruntime_eager_mode_test_src})
|
||||
target_include_directories(onnxruntime_eager_mode_test PRIVATE ${ONNXRUNTIME_ROOT}
|
||||
${onnxruntime_graph_header}
|
||||
${onnxruntime_exec_src_dir}
|
||||
|
@ -1058,9 +1064,11 @@ if (NOT onnxruntime_ENABLE_TRAINING_TORCH_INTEROP)
|
|||
endif()
|
||||
|
||||
if (onnxruntime_BUILD_SHARED_LIB)
|
||||
#It will dynamically link to onnxruntime. So please don't add onxruntime_graph/onxruntime_framework/... here.
|
||||
#onnxruntime_common is kind of ok because it is thin, tiny and totally stateless.
|
||||
set(onnxruntime_perf_test_libs
|
||||
onnx_test_runner_common onnxruntime_test_utils onnxruntime_common
|
||||
onnxruntime onnxruntime_flatbuffers onnx_test_data_proto
|
||||
onnxruntime onnxruntime_flatbuffers onnx_test_data_proto
|
||||
${onnxruntime_EXTERNAL_LIBRARIES}
|
||||
${GETOPT_LIB_WIDE} ${SYS_PATH_LIB} ${CMAKE_DL_LIBS})
|
||||
if(NOT WIN32)
|
||||
|
@ -1222,21 +1230,25 @@ if (NOT onnxruntime_ENABLE_TRAINING_TORCH_INTEROP)
|
|||
endif()
|
||||
target_include_directories(onnxruntime_mlas_test PRIVATE ${ONNXRUNTIME_ROOT}/core/mlas/inc ${ONNXRUNTIME_ROOT}
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
set(onnxruntime_mlas_test_libs GTest::gtest GTest::gmock ${ONNXRUNTIME_MLAS_LIBS} onnxruntime_common)
|
||||
target_link_libraries(onnxruntime_mlas_test PRIVATE GTest::gtest GTest::gmock ${ONNXRUNTIME_MLAS_LIBS} onnxruntime_common)
|
||||
if (CPUINFO_SUPPORTED AND NOT onnxruntime_BUILD_WEBASSEMBLY)
|
||||
target_link_libraries(onnxruntime_mlas_test PRIVATE cpuinfo)
|
||||
endif()
|
||||
if(NOT WIN32)
|
||||
list(APPEND onnxruntime_mlas_test_libs nsync_cpp ${CMAKE_DL_LIBS})
|
||||
target_link_libraries(onnxruntime_mlas_test PRIVATE nsync_cpp ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||
list(APPEND onnxruntime_mlas_test_libs ${android_shared_libs})
|
||||
endif()
|
||||
list(APPEND onnxruntime_mlas_test_libs Threads::Threads)
|
||||
target_link_libraries(onnxruntime_mlas_test PRIVATE ${onnxruntime_mlas_test_libs})
|
||||
target_link_libraries(onnxruntime_mlas_test PRIVATE ${android_shared_libs})
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(onnxruntime_mlas_test PRIVATE debug Dbghelp Advapi32)
|
||||
endif()
|
||||
if (onnxruntime_LINK_LIBATOMIC)
|
||||
target_link_libraries(onnxruntime_mlas_test PRIVATE atomic)
|
||||
endif()
|
||||
target_link_libraries(onnxruntime_mlas_test PRIVATE Threads::Threads)
|
||||
|
||||
set_target_properties(onnxruntime_mlas_test PROPERTIES FOLDER "ONNXRuntimeTest")
|
||||
if (onnxruntime_BUILD_WEBASSEMBLY)
|
||||
if (onnxruntime_ENABLE_WEBASSEMBLY_THREADS)
|
||||
|
@ -1247,6 +1259,7 @@ if (NOT onnxruntime_ENABLE_TRAINING_TORCH_INTEROP)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT onnxruntime_BUILD_WEBASSEMBLY)
|
||||
if (onnxruntime_USE_CUDA)
|
||||
onnxruntime_add_shared_library_module(custom_op_library ${ONNXRUNTIME_SHARED_LIB_TEST_SRC_DIR}/cuda_ops.cu
|
||||
${TEST_SRC_DIR}/testdata/custom_op_library/custom_op_library.cc)
|
||||
|
@ -1306,7 +1319,7 @@ if (NOT onnxruntime_ENABLE_TRAINING_TORCH_INTEROP)
|
|||
set_property(TEST onnxruntime4j_test APPEND PROPERTY DEPENDS onnxruntime4j_jni)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endif()
|
||||
# limit to only test on windows first, due to a runtime path issue on linux
|
||||
if (NOT onnxruntime_MINIMAL_BUILD AND NOT onnxruntime_EXTENDED_MINIMAL_BUILD
|
||||
AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin|iOS"
|
||||
|
@ -1322,7 +1335,7 @@ if (NOT onnxruntime_MINIMAL_BUILD AND NOT onnxruntime_EXTENDED_MINIMAL_BUILD
|
|||
|
||||
onnxruntime_add_shared_library_module(test_execution_provider ${test_execution_provider_srcs})
|
||||
add_dependencies(test_execution_provider onnxruntime_providers_shared onnx ${ABSEIL_LIBS})
|
||||
target_link_libraries(test_execution_provider PRIVATE onnxruntime_providers_shared ${ABSEIL_LIBS})
|
||||
target_link_libraries(test_execution_provider PRIVATE onnxruntime_providers_shared ${ABSEIL_LIBS} Boost::mp11)
|
||||
target_include_directories(test_execution_provider PRIVATE $<TARGET_PROPERTY:onnx,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
target_include_directories(test_execution_provider PRIVATE $<TARGET_PROPERTY:onnxruntime_common,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
target_include_directories(test_execution_provider PRIVATE ${ONNXRUNTIME_ROOT} ${CMAKE_CURRENT_BINARY_DIR} ${ORTTRAINING_ROOT})
|
||||
|
|
|
@ -10,7 +10,7 @@ source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_util_srcs})
|
|||
|
||||
onnxruntime_add_static_library(onnxruntime_util ${onnxruntime_util_srcs})
|
||||
target_include_directories(onnxruntime_util PRIVATE ${ONNXRUNTIME_ROOT} PUBLIC ${eigen_INCLUDE_DIRS})
|
||||
onnxruntime_add_include_to_target(onnxruntime_util onnxruntime_common onnx onnx_proto ${PROTOBUF_LIB})
|
||||
onnxruntime_add_include_to_target(onnxruntime_util onnxruntime_common onnx onnx_proto ${PROTOBUF_LIB} Boost::mp11)
|
||||
if(UNIX)
|
||||
target_compile_options(onnxruntime_util PUBLIC "-Wno-error=comment")
|
||||
endif()
|
||||
|
|
|
@ -1,54 +1 @@
|
|||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
set(TENSORBOARD_ROOT ${PROJECT_SOURCE_DIR}/external/tensorboard)
|
||||
|
||||
# tensorboard protos
|
||||
file(GLOB_RECURSE tensorboard_proto_srcs CONFIGURE_DEPENDS
|
||||
"${TENSORBOARD_ROOT}/tensorboard/compat/proto/*.proto"
|
||||
)
|
||||
|
||||
if(EXISTS "${ONNX_CUSTOM_PROTOC_EXECUTABLE}")
|
||||
set(PROTOC_EXECUTABLE ${ONNX_CUSTOM_PROTOC_EXECUTABLE})
|
||||
else()
|
||||
set(PROTOC_EXECUTABLE $<TARGET_FILE:protobuf::protoc>)
|
||||
set(PROTOC_DEPS protobuf::protoc)
|
||||
endif()
|
||||
if(NOT onnxruntime_USE_FULL_PROTOBUF)
|
||||
set(PROTOC_PROTOBUF_ARG "lite:")
|
||||
endif()
|
||||
|
||||
# tensorboard generated files
|
||||
foreach(_proto ${tensorboard_proto_srcs})
|
||||
get_filename_component(_abs_file ${_proto} ABSOLUTE)
|
||||
get_filename_component(_basename ${_proto} NAME_WE)
|
||||
set(_tensorboard_cpp_srcs
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/tensorboard/compat/proto/${_basename}.pb.cc"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/tensorboard/compat/proto/${_basename}.pb.h"
|
||||
)
|
||||
add_custom_command(
|
||||
OUTPUT ${_tensorboard_cpp_srcs}
|
||||
COMMAND ${PROTOC_EXECUTABLE}
|
||||
ARGS --cpp_out ${PROTOC_PROTOBUF_ARG}${CMAKE_CURRENT_BINARY_DIR} -I ${TENSORBOARD_ROOT} -I ${REPO_ROOT}/cmake/external/protobuf/src ${_abs_file}
|
||||
DEPENDS ${_abs_file} ${PROTOC_DEPS}
|
||||
COMMENT "Running cpp protocol buffer compiler on ${_proto}"
|
||||
VERBATIM )
|
||||
list(APPEND tensorboard_cpp_srcs ${_tensorboard_cpp_srcs})
|
||||
endforeach()
|
||||
|
||||
onnxruntime_add_static_library(tensorboard ${tensorboard_cpp_srcs})
|
||||
target_include_directories(tensorboard PUBLIC $<TARGET_PROPERTY:protobuf::libprotobuf,INTERFACE_INCLUDE_DIRECTORIES> "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
target_compile_definitions(tensorboard PUBLIC $<TARGET_PROPERTY:protobuf::libprotobuf,INTERFACE_COMPILE_DEFINITIONS>)
|
||||
|
||||
if(WIN32)
|
||||
target_compile_options(tensorboard PRIVATE /wd4100 /wd4125 /wd4127 /wd4996 /wd4244 /wd4267 /wd4309)
|
||||
set_target_properties(tensorboard PROPERTIES FOLDER "External/tensorboard")
|
||||
else()
|
||||
target_compile_options(tensorboard PRIVATE "-Wno-unused-parameter")
|
||||
if(HAS_UNUSED_BUT_SET_VARIABLE)
|
||||
target_compile_options(tensorboard PRIVATE "-Wno-unused-but-set-variable")
|
||||
endif()
|
||||
target_compile_options(tensorboard PRIVATE "-Wno-unused-variable")
|
||||
target_compile_options(tensorboard PRIVATE "-Wno-deprecated-declarations")
|
||||
endif()
|
||||
|
||||
add_subdirectory(compat/proto)
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
FetchContent_Declare(
|
||||
tensorboard
|
||||
URL ${DEP_URL_tensorboard}
|
||||
URL_HASH SHA1=${DEP_SHA1_tensorboard}
|
||||
)
|
||||
FetchContent_MakeAvailable(tensorboard)
|
||||
|
||||
set(TENSORBOARD_ROOT ${tensorboard_SOURCE_DIR})
|
||||
|
||||
# tensorboard protos
|
||||
file(GLOB_RECURSE tensorboard_proto_srcs CONFIGURE_DEPENDS
|
||||
"${TENSORBOARD_ROOT}/tensorboard/compat/proto/*.proto"
|
||||
)
|
||||
|
||||
add_library(tensorboard STATIC ${tensorboard_proto_srcs})
|
||||
onnxruntime_protobuf_generate(APPEND_PATH IMPORT_DIRS ${tensorboard_SOURCE_DIR} ${protobuf_SOURCE_DIR}/src TARGET tensorboard)
|
||||
onnxruntime_add_include_to_target(tensorboard ${PROTOBUF_LIB})
|
||||
target_include_directories(tensorboard PRIVATE ${PROJECT_BINARY_DIR})
|
||||
add_dependencies(tensorboard ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
||||
if(WIN32)
|
||||
target_compile_options(tensorboard PRIVATE "/wd4100" "/wd4125" "/wd4127" "/wd4267" "/wd4456" "/wd4800" "/wd6011" "/wd6387" "/wd28182")
|
||||
endif()
|
|
@ -1,5 +0,0 @@
|
|||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
add_library(wil INTERFACE)
|
||||
target_include_directories(wil INTERFACE external/wil/include/)
|
|
@ -202,7 +202,7 @@ add_dependencies(winml_lib_telemetry winml_api_native)
|
|||
add_dependencies(winml_lib_telemetry winml_api_native_internal)
|
||||
|
||||
# Link libraries
|
||||
target_link_libraries(winml_lib_telemetry PRIVATE wil)
|
||||
target_link_libraries(winml_lib_telemetry PRIVATE WIL::WIL)
|
||||
|
||||
###########################
|
||||
# Add winml_lib_ort
|
||||
|
@ -282,7 +282,7 @@ add_dependencies(winml_lib_ort winml_api_native_internal)
|
|||
if (onnxruntime_USE_DML)
|
||||
target_add_dml(winml_lib_ort)
|
||||
endif()
|
||||
target_link_libraries(winml_lib_ort PRIVATE wil)
|
||||
target_link_libraries(winml_lib_ort PRIVATE WIL::WIL)
|
||||
target_link_libraries(winml_lib_ort INTERFACE winml_lib_api)
|
||||
target_link_libraries(winml_lib_ort INTERFACE winml_lib_telemetry)
|
||||
|
||||
|
@ -321,7 +321,7 @@ set_target_properties(winml_adapter PROPERTIES CXX_STANDARD 17)
|
|||
set_target_properties(winml_adapter PROPERTIES CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# Compiler definitions
|
||||
onnxruntime_add_include_to_target(winml_adapter onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers)
|
||||
onnxruntime_add_include_to_target(winml_adapter onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers safeint_interface Boost::mp11)
|
||||
target_include_directories(winml_adapter PRIVATE ${ONNXRUNTIME_ROOT} ${eigen_INCLUDE_DIRS})
|
||||
add_dependencies(winml_adapter ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
||||
|
||||
|
@ -339,7 +339,7 @@ set_target_properties(winml_adapter
|
|||
${target_folder})
|
||||
|
||||
# Link libraries
|
||||
target_link_libraries(winml_adapter PRIVATE wil)
|
||||
target_link_libraries(winml_adapter PRIVATE WIL::WIL)
|
||||
if (onnxruntime_USE_DML)
|
||||
target_add_dml(winml_adapter)
|
||||
endif()
|
||||
|
@ -405,10 +405,8 @@ target_include_directories(winml_lib_image PRIVATE ${winml_lib_api_image_dir})
|
|||
target_include_directories(winml_lib_image PRIVATE ${winml_lib_common_dir}/inc)
|
||||
target_include_directories(winml_lib_image PRIVATE ${ONNXRUNTIME_ROOT})
|
||||
target_include_directories(winml_lib_image PRIVATE ${ONNXRUNTIME_INCLUDE_DIR}) # for status.h
|
||||
onnxruntime_add_include_to_target(winml_lib_image ${PROTOBUF_LIB} onnx onnx_proto)
|
||||
onnxruntime_add_include_to_target(winml_lib_image onnx onnx_proto ${PROTOBUF_LIB} re2::re2 flatbuffers Boost::mp11)
|
||||
target_include_directories(winml_lib_image PRIVATE ${ONNXRUNTIME_INCLUDE_DIR}/core/platform/windows)
|
||||
target_include_directories(winml_lib_image PRIVATE ${REPO_ROOT}/cmake/external/flatbuffers/include)
|
||||
target_include_directories(winml_lib_image PRIVATE ${REPO_ROOT}/cmake/external/mp11/include)
|
||||
target_include_directories(winml_lib_image PRIVATE ${REPO_ROOT}/winml)
|
||||
target_include_directories(winml_lib_image PRIVATE ${GSL_INCLUDE_DIR})
|
||||
|
||||
|
@ -425,7 +423,7 @@ add_dependencies(winml_lib_image winml_api_native)
|
|||
add_dependencies(winml_lib_image winml_api_native_internal)
|
||||
|
||||
# Link libraries
|
||||
target_link_libraries(winml_lib_image PRIVATE dxgi d3d11 d3d12 wil winml_lib_common)
|
||||
target_link_libraries(winml_lib_image PRIVATE dxgi d3d11 d3d12 WIL::WIL winml_lib_common)
|
||||
|
||||
get_target_property(winml_lib_image_include_directories winml_lib_image INCLUDE_DIRECTORIES)
|
||||
|
||||
|
@ -511,19 +509,13 @@ target_include_directories(winml_lib_api PRIVATE ${winml_lib_telemetry_dir}/inc)
|
|||
target_include_directories(winml_lib_api PRIVATE ${winml_lib_common_dir}/inc)
|
||||
|
||||
target_include_directories(winml_lib_api PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
target_include_directories(winml_lib_api PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/external/date/include)
|
||||
|
||||
target_include_directories(winml_lib_api PRIVATE ${ONNXRUNTIME_INCLUDE_DIR})
|
||||
target_include_directories(winml_lib_api PRIVATE ${ONNXRUNTIME_INCLUDE_DIR}/core/graph)
|
||||
target_include_directories(winml_lib_api PRIVATE ${ONNXRUNTIME_ROOT})
|
||||
target_include_directories(winml_lib_api PRIVATE ${ONNXRUNTIME_ROOT}/core/graph)
|
||||
target_include_directories(winml_lib_api PRIVATE ${REPO_ROOT}/cmake/external/eigen)
|
||||
onnxruntime_add_include_to_target(winml_lib_api ${PROTOBUF_LIB} onnx onnx_proto)
|
||||
target_include_directories(winml_lib_api PRIVATE ${REPO_ROOT}/cmake/external/SafeInt)
|
||||
target_include_directories(winml_lib_api PRIVATE ${REPO_ROOT}/cmake/external/flatbuffers/include)
|
||||
target_include_directories(winml_lib_api PRIVATE ${REPO_ROOT}/cmake/external/mp11/include)
|
||||
target_include_directories(winml_lib_api PRIVATE ${REPO_ROOT}/winml)
|
||||
target_include_directories(winml_lib_api PRIVATE ${GSL_INCLUDE_DIR})
|
||||
target_include_directories(winml_lib_api PRIVATE ${eigen_INCLUDE_DIRS})
|
||||
target_link_libraries(winml_lib_api PRIVATE ${GSL_TARGET} safeint_interface flatbuffers Boost::mp11 onnx onnx_proto)
|
||||
|
||||
# Properties
|
||||
set_target_properties(winml_lib_api
|
||||
|
@ -539,7 +531,7 @@ add_dependencies(winml_lib_api winml_api_native)
|
|||
add_dependencies(winml_lib_api winml_api_native_internal)
|
||||
|
||||
# Link libraries
|
||||
target_link_libraries(winml_lib_api PRIVATE wil winml_lib_telemetry)
|
||||
target_link_libraries(winml_lib_api PRIVATE WIL::WIL winml_lib_telemetry)
|
||||
if (onnxruntime_USE_DML)
|
||||
target_add_dml(winml_lib_api)
|
||||
endif(onnxruntime_USE_DML)
|
||||
|
@ -603,20 +595,14 @@ target_include_directories(winml_lib_api_experimental PRIVATE ${winml_lib_teleme
|
|||
target_include_directories(winml_lib_api_experimental PRIVATE ${winml_lib_common_dir}/inc)
|
||||
|
||||
target_include_directories(winml_lib_api_experimental PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
target_include_directories(winml_lib_api_experimental PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/external/date/include)
|
||||
|
||||
|
||||
target_include_directories(winml_lib_api_experimental PRIVATE ${ONNXRUNTIME_INCLUDE_DIR})
|
||||
target_include_directories(winml_lib_api_experimental PRIVATE ${ONNXRUNTIME_INCLUDE_DIR}/core/graph)
|
||||
target_include_directories(winml_lib_api_experimental PRIVATE ${ONNXRUNTIME_ROOT})
|
||||
target_include_directories(winml_lib_api_experimental PRIVATE ${ONNXRUNTIME_ROOT}/core/graph)
|
||||
target_include_directories(winml_lib_api_experimental PRIVATE ${REPO_ROOT}/cmake/external/eigen)
|
||||
onnxruntime_add_include_to_target(winml_lib_api_experimental ${PROTOBUF_LIB} onnx onnx_proto)
|
||||
target_include_directories(winml_lib_api_experimental PRIVATE ${REPO_ROOT}/cmake/external/SafeInt)
|
||||
target_include_directories(winml_lib_api_experimental PRIVATE ${REPO_ROOT}/cmake/external/flatbuffers/include)
|
||||
target_include_directories(winml_lib_api_experimental PRIVATE ${REPO_ROOT}/cmake/external/mp11/include)
|
||||
target_include_directories(winml_lib_api_experimental PRIVATE ${eigen_INCLUDE_DIRS})
|
||||
target_include_directories(winml_lib_api_experimental PRIVATE ${REPO_ROOT}/winml)
|
||||
target_include_directories(winml_lib_api_experimental PRIVATE ${GSL_INCLUDE_DIR})
|
||||
onnxruntime_add_include_to_target(winml_lib_api_experimental PRIVATE ${PROTOBUF_LIB} safeint_interface flatbuffers Boost::mp11 onnx onnx_proto ${GSL_TARGET})
|
||||
|
||||
# Properties
|
||||
set_target_properties(winml_lib_api_experimental
|
||||
|
@ -633,7 +619,7 @@ add_dependencies(winml_lib_api_experimental winml_api_native_internal)
|
|||
add_dependencies(winml_lib_api_experimental winml_api_experimental)
|
||||
|
||||
# Link libraries
|
||||
target_link_libraries(winml_lib_api_experimental PRIVATE wil winml_lib_telemetry)
|
||||
target_link_libraries(winml_lib_api_experimental PRIVATE WIL::WIL winml_lib_telemetry)
|
||||
if (onnxruntime_USE_DML)
|
||||
target_add_dml(winml_lib_api_experimental)
|
||||
endif(onnxruntime_USE_DML)
|
||||
|
@ -662,7 +648,7 @@ onnxruntime_add_static_library(winml_lib_common
|
|||
set_target_properties(winml_lib_common PROPERTIES CXX_STANDARD 17)
|
||||
set_target_properties(winml_lib_common PROPERTIES CXX_STANDARD_REQUIRED ON)
|
||||
target_compile_options(winml_lib_common PRIVATE /GR- /await /bigobj /wd4238)
|
||||
target_link_libraries(winml_lib_common PRIVATE wil)
|
||||
target_link_libraries(winml_lib_common PRIVATE WIL::WIL)
|
||||
target_include_directories(winml_lib_common PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/winml_api)
|
||||
|
||||
# Compiler flags
|
||||
|
@ -719,7 +705,6 @@ onnxruntime_add_shared_library(winml_dll
|
|||
${winml_dll_dir}/pch.h
|
||||
${winml_dll_dir}/module.cpp
|
||||
)
|
||||
|
||||
# Compiler options
|
||||
target_compile_features(winml_dll PRIVATE cxx_std_17)
|
||||
target_compile_options(winml_dll PRIVATE /GR- /await /bigobj /wd4238)
|
||||
|
@ -764,21 +749,16 @@ target_include_directories(winml_dll PRIVATE ${winml_lib_telemetry_dir}/inc)
|
|||
target_include_directories(winml_dll PRIVATE ${winml_lib_common_dir}/inc)
|
||||
|
||||
target_include_directories(winml_dll PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
target_include_directories(winml_dll PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/external/date/include)
|
||||
|
||||
|
||||
target_include_directories(winml_dll PRIVATE ${ONNXRUNTIME_INCLUDE_DIR})
|
||||
target_include_directories(winml_dll PRIVATE ${ONNXRUNTIME_INCLUDE_DIR}/core/graph)
|
||||
target_include_directories(winml_dll PRIVATE ${ONNXRUNTIME_ROOT})
|
||||
target_include_directories(winml_dll PRIVATE ${ONNXRUNTIME_ROOT}/core/graph)
|
||||
onnxruntime_add_include_to_target(winml_dll ${PROTOBUF_LIB} onnx onnx_proto)
|
||||
target_include_directories(winml_dll PRIVATE ${REPO_ROOT}/cmake/external/eigen)
|
||||
target_include_directories(winml_dll PRIVATE ${REPO_ROOT}/cmake/external/SafeInt)
|
||||
target_include_directories(winml_dll PRIVATE ${REPO_ROOT}/cmake/external/flatbuffers/include)
|
||||
target_include_directories(winml_dll PRIVATE ${REPO_ROOT}/cmake/external/mp11/include)
|
||||
target_include_directories(winml_dll PRIVATE ${REPO_ROOT}/winml)
|
||||
target_include_directories(winml_dll PRIVATE ${GSL_INCLUDE_DIR})
|
||||
|
||||
target_include_directories(winml_dll PRIVATE ${eigen_INCLUDE_DIRS})
|
||||
target_include_directories(winml_dll PRIVATE ${REPO_ROOT}/winml)
|
||||
target_link_libraries(winml_dll PRIVATE onnx onnx_proto ${PROTOBUF_LIB} flatbuffers safeint_interface Boost::mp11 ${GSL_TARGET})
|
||||
target_link_libraries(winml_dll PRIVATE debug Dbghelp)
|
||||
# Properties
|
||||
set_target_properties(winml_dll
|
||||
PROPERTIES
|
||||
|
@ -806,7 +786,7 @@ add_dependencies(winml_dll winml_api_native_internal)
|
|||
|
||||
# Link libraries
|
||||
target_link_libraries(winml_dll PRIVATE re2)
|
||||
target_link_libraries(winml_dll PRIVATE wil)
|
||||
target_link_libraries(winml_dll PRIVATE WIL::WIL)
|
||||
target_link_libraries(winml_dll PRIVATE winml_lib_api)
|
||||
if (NOT winml_is_inbox)
|
||||
target_link_libraries(winml_dll PRIVATE winml_lib_api_experimental)
|
||||
|
@ -818,14 +798,6 @@ target_link_libraries(winml_dll PRIVATE winml_lib_telemetry)
|
|||
target_link_libraries(winml_dll PRIVATE RuntimeObject.lib)
|
||||
target_link_libraries(winml_dll PRIVATE windowsapp.lib)
|
||||
|
||||
# Any project that links in debug_alloc.obj needs this lib.
|
||||
# unresolved external symbol __imp_SymSetOptions
|
||||
# ... __imp_SymGetLineFromAddr64
|
||||
# ... __imp_SymInitialize
|
||||
# ... __imp_SymFromAddr
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
|
||||
target_link_libraries(winml_dll PRIVATE dbghelp.lib)
|
||||
endif()
|
||||
|
||||
# 1 of 3 projects that fail in link with 'failed to do memory mapped file I/O' (Only release)
|
||||
# when using x86 hosted architecture. When using the LKG compiler this becomes a problem
|
||||
|
@ -837,9 +809,7 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
|||
endif("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
||||
|
||||
option(onnxruntime_BUILD_WINML_TESTS "Build WinML tests" ON)
|
||||
if (onnxruntime_BUILD_WINML_TESTS)
|
||||
include(winml_unittests.cmake)
|
||||
endif()
|
||||
|
||||
|
||||
# This is needed to suppress warnings that complain that no imports are found for the delayloaded library cublas64*.lib
|
||||
# When cuda is enabled in the pipeline, it sets CMAKE_SHARED_LINKER_FLAGS which affects all targets including winml_dll.
|
||||
|
|
|
@ -8,9 +8,6 @@ set(WINML_TEST_INC_DIR
|
|||
${REPO_ROOT}/winml/lib/Common/inc
|
||||
${REPO_ROOT}/onnxruntime
|
||||
${REPO_ROOT}/onnxruntime/core/providers/dml/DmlExecutionProvider/src/External/D3DX12
|
||||
${REPO_ROOT}/cmake/external/googletest/googletest/include
|
||||
${REPO_ROOT}/cmake/external/wil/include
|
||||
${REPO_ROOT}/cmake/external/SafeInt
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/winml_api
|
||||
${CMAKE_CURRENT_BINARY_DIR}/winml_api/comp_generated
|
||||
|
@ -26,7 +23,6 @@ function(set_winml_target_properties target)
|
|||
CXX_STANDARD_REQUIRED YES
|
||||
CXX_EXTENSIONS NO
|
||||
)
|
||||
onnxruntime_add_include_to_target(${target} ${PROTOBUF_LIB})
|
||||
target_include_directories(${target} PRIVATE ${WINML_TEST_INC_DIR})
|
||||
target_compile_definitions(${target} PRIVATE WINML_ROOT_NS=${winml_root_ns})
|
||||
target_compile_definitions(${target} PRIVATE BINARY_NAME=\"${BINARY_NAME}\")
|
||||
|
@ -183,8 +179,10 @@ add_dependencies(winml_test_common
|
|||
winml_api
|
||||
winml_dll
|
||||
)
|
||||
onnxruntime_add_include_to_target(winml_test_common onnx_proto ${GSL_TARGET})
|
||||
|
||||
onnxruntime_add_include_to_target(winml_test_common onnx_proto gtest ${PROTOBUF_LIB} WIL::WIL safeint_interface ${GSL_TARGET})
|
||||
onnxruntime_add_static_library(winml_google_test_lib ${WINML_TEST_SRC_DIR}/common/googletest/main.cpp)
|
||||
onnxruntime_add_include_to_target(winml_google_test_lib gtest)
|
||||
set_winml_target_properties(winml_google_test_lib)
|
||||
|
||||
set_winml_target_properties(winml_test_common)
|
||||
|
@ -269,7 +267,7 @@ target_include_directories(winml_test_adapter PRIVATE ${winml_lib_common_dir}/in
|
|||
target_include_directories(winml_test_adapter PRIVATE ${ONNXRUNTIME_INCLUDE_DIR})
|
||||
target_include_directories(winml_test_adapter PRIVATE ${ONNXRUNTIME_ROOT})
|
||||
|
||||
onnxruntime_add_include_to_target(winml_test_adapter onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers)
|
||||
onnxruntime_add_include_to_target(winml_test_adapter onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers safeint_interface Boost::mp11)
|
||||
target_include_directories(winml_test_adapter PRIVATE ${ONNXRUNTIME_ROOT} ${eigen_INCLUDE_DIRS})
|
||||
add_dependencies(winml_test_adapter ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
||||
target_include_directories(winml_test_adapter PRIVATE ${winml_adapter_dir})
|
||||
|
|
|
@ -32,7 +32,8 @@ class SafeIntExceptionHandler<onnxruntime::OnnxRuntimeException> {
|
|||
#pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
|
||||
#endif
|
||||
#endif
|
||||
#include "safeint/SafeInt.hpp"
|
||||
#include "SafeInt.hpp"
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
|
|
|
@ -952,6 +952,10 @@ def generate_build_tree(
|
|||
"-Donnxruntime_USE_XNNPACK=" + ("ON" if args.use_xnnpack else "OFF"),
|
||||
"-Donnxruntime_USE_CANN=" + ("ON" if args.use_cann else "OFF"),
|
||||
]
|
||||
# By default cmake does not check TLS/SSL certificates. Here we turn it on.
|
||||
# But, in some cases you may also need to supply a CA file.
|
||||
add_default_definition(cmake_extra_defines, "CMAKE_TLS_VERIFY", "ON")
|
||||
add_default_definition(cmake_extra_defines, "FETCHCONTENT_QUIET", "OFF")
|
||||
if args.external_graph_transformer_path:
|
||||
cmake_args.append("-Donnxruntime_EXTERNAL_TRANSFORMER_SRC_PATH=" + args.external_graph_transformer_path)
|
||||
if args.use_winml:
|
||||
|
@ -1299,7 +1303,7 @@ def generate_build_tree(
|
|||
+ os.pathsep
|
||||
+ os.environ["PATH"]
|
||||
)
|
||||
|
||||
preinstalled_dir = Path(build_dir) / config
|
||||
run_subprocess(
|
||||
cmake_args
|
||||
+ [
|
||||
|
@ -1315,6 +1319,9 @@ def generate_build_tree(
|
|||
else "OFF"
|
||||
),
|
||||
"-DCMAKE_BUILD_TYPE={}".format(config),
|
||||
"-DCMAKE_PREFIX_PATH={}/{}/installed".format(build_dir, config)
|
||||
if preinstalled_dir.exists() and not (args.arm64 or args.arm64ec or args.arm)
|
||||
else "",
|
||||
],
|
||||
cwd=config_build_dir,
|
||||
cuda_home=cuda_home,
|
||||
|
|
|
@ -70,6 +70,13 @@ def main():
|
|||
|
||||
log.info("Image: {}".format(full_image_name))
|
||||
|
||||
dst_deps_file = Path(args.context) / "scripts" / "deps.txt"
|
||||
# The docker file may provide a special deps.txt in its docker context dir and uses that one.
|
||||
# Otherwise, copy a generic one from this repo's cmake dir.
|
||||
if not dst_deps_file.exists():
|
||||
log.info("Copy deps.txt to : {}".format(str(dst_deps_file)))
|
||||
shutil.copyfile(Path(REPO_DIR) / "cmake" / "deps.txt", str(dst_deps_file))
|
||||
|
||||
if "manylinux" in args.dockerfile:
|
||||
manylinux_build_scripts_folder = Path(args.manylinux_src) / "docker" / "build_scripts"
|
||||
dest = Path(args.context) / "build_scripts"
|
||||
|
@ -89,7 +96,6 @@ def main():
|
|||
str((Path(SCRIPT_DIR) / "github" / "linux" / "docker" / "manylinux.patch").resolve()),
|
||||
cwd=str(dest),
|
||||
)
|
||||
|
||||
if use_container_registry:
|
||||
run(
|
||||
args.docker_path,
|
||||
|
|
|
@ -45,7 +45,7 @@ jobs:
|
|||
steps:
|
||||
- checkout: self
|
||||
clean: true
|
||||
submodules: recursive
|
||||
submodules: none
|
||||
|
||||
- template: templates/get-docker-image-steps.yml
|
||||
parameters:
|
||||
|
|
|
@ -17,7 +17,7 @@ jobs:
|
|||
steps:
|
||||
- checkout: self
|
||||
clean: true
|
||||
submodules: recursive
|
||||
submodules: none
|
||||
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
|
|
|
@ -42,7 +42,7 @@ jobs:
|
|||
steps:
|
||||
- checkout: self
|
||||
clean: true
|
||||
submodules: recursive
|
||||
submodules: none
|
||||
|
||||
- template: templates/get-docker-image-steps.yml
|
||||
parameters:
|
||||
|
@ -298,7 +298,7 @@ jobs:
|
|||
--build_shared_lib \
|
||||
--disable_ml_ops \
|
||||
--disable_exceptions \
|
||||
--skip_tests
|
||||
--skip_tests --path_to_protoc_exe /usr/bin/protoc
|
||||
workingDirectory: $(Build.SourcesDirectory)
|
||||
|
||||
- template: templates/clean-agent-build-directory-step.yml
|
||||
|
|
|
@ -17,7 +17,7 @@ jobs:
|
|||
steps:
|
||||
- checkout: self
|
||||
clean: true
|
||||
submodules: recursive
|
||||
submodules: none
|
||||
|
||||
- template: templates/get-docker-image-steps.yml
|
||||
parameters:
|
||||
|
|
|
@ -17,7 +17,7 @@ jobs:
|
|||
steps:
|
||||
- checkout: self
|
||||
clean: true
|
||||
submodules: recursive
|
||||
submodules: none
|
||||
|
||||
- template: templates/get-docker-image-steps.yml
|
||||
parameters:
|
||||
|
@ -56,7 +56,7 @@ jobs:
|
|||
- task: CmdLine@2
|
||||
inputs:
|
||||
script: |
|
||||
rm -rf $(Build.BinariesDirectory)/Release/onnxruntime $(Build.BinariesDirectory)/Release/pybind11
|
||||
rm -rf $(Build.BinariesDirectory)/Release/onnxruntime $(Build.BinariesDirectory)/Release/pybind11 $(Build.BinariesDirectory)/Release/_deps
|
||||
rm -f $(Build.BinariesDirectory)/Release/models
|
||||
rm -rf $(Build.BinariesDirectory)/Release/_deps
|
||||
cd $(Build.BinariesDirectory)/Release
|
||||
|
|
|
@ -18,7 +18,7 @@ jobs:
|
|||
steps:
|
||||
- checkout: self
|
||||
clean: true
|
||||
submodules: recursive
|
||||
submodules: none
|
||||
|
||||
- template: templates/get-docker-image-steps.yml
|
||||
parameters:
|
||||
|
|
|
@ -24,8 +24,8 @@ jobs:
|
|||
|
||||
- template: templates/get-docker-image-steps.yml
|
||||
parameters:
|
||||
Dockerfile: tools/ci_build/github/pai/migraphx-ci-pipeline-env.Dockerfile
|
||||
Context: tools/ci_build/github/pai
|
||||
Dockerfile: tools/ci_build/github/linux/docker/migraphx-ci-pipeline-env.Dockerfile
|
||||
Context: tools/ci_build/github/linux/docker
|
||||
Repository: onnxruntimetrainingmigraphx-cibuild-rocm$(RocmVersion)
|
||||
|
||||
- task: CmdLine@2
|
||||
|
@ -60,7 +60,7 @@ jobs:
|
|||
--parallel 32 \
|
||||
--build_wheel \
|
||||
--skip_submodule_sync \
|
||||
--skip_tests
|
||||
--skip_tests --cmake_path /usr/bin/cmake --ctest_path /usr/bin/ctest
|
||||
workingDirectory: $(Build.SourcesDirectory)
|
||||
displayName: 'Build onnxruntime'
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ jobs:
|
|||
steps:
|
||||
- checkout: self
|
||||
clean: true
|
||||
submodules: recursive
|
||||
submodules: none
|
||||
|
||||
- template: templates/get-docker-image-steps.yml
|
||||
parameters:
|
||||
|
|
|
@ -1,19 +1,6 @@
|
|||
jobs:
|
||||
- template: templates/mac-ci.yml
|
||||
parameters:
|
||||
DoNugetPack: 'false'
|
||||
BuildCommand: >-
|
||||
python3 $(Build.SourcesDirectory)/tools/ci_build/build.py
|
||||
--config Debug
|
||||
--build_dir $(Build.BinariesDirectory)
|
||||
--build_wheel
|
||||
--skip_submodule_sync
|
||||
--parallel
|
||||
--build_shared_lib
|
||||
--build_java
|
||||
--build_nodejs
|
||||
--build_objc
|
||||
--enable_language_interop_ops
|
||||
# Enable unreleased onnx opsets in CI builds
|
||||
# This facilitates testing the implementation for the new opsets
|
||||
AllowReleasedOpsetOnly: '0'
|
||||
AllowReleasedOpsetOnly: 0
|
||||
BuildForAllArchs: false
|
||||
AdditionalBuildFlags: --build_objc --enable_language_interop_ops
|
|
@ -12,10 +12,7 @@ jobs:
|
|||
timeoutInMinutes: 150
|
||||
steps:
|
||||
- script: |
|
||||
/bin/bash $(Build.SourcesDirectory)/tools/ci_build/github/apple/build_host_protoc.sh \
|
||||
$(Build.SourcesDirectory) \
|
||||
$(Build.BinariesDirectory)/protobuf \
|
||||
$(Build.BinariesDirectory)/protobuf_install
|
||||
$(Build.SourcesDirectory)/tools/ci_build/github/linux/docker/inference/x64/python/cpu/scripts/install_protobuf.sh -p $(Build.BinariesDirectory)/protobuf_install -d $(Build.SourcesDirectory)/cmake/deps.txt
|
||||
displayName: Build Host Protoc
|
||||
|
||||
- script: |
|
||||
|
|
|
@ -77,10 +77,7 @@ jobs:
|
|||
displayName: "Set variables"
|
||||
|
||||
- script: |
|
||||
/bin/bash $(Build.SourcesDirectory)/tools/ci_build/github/apple/build_host_protoc.sh \
|
||||
$(Build.SourcesDirectory) \
|
||||
$(Build.BinariesDirectory)/protobuf \
|
||||
$(Build.BinariesDirectory)/protobuf_install
|
||||
$(Build.SourcesDirectory)/tools/ci_build/github/linux/docker/inference/x64/python/cpu/scripts/install_protobuf.sh -p $(Build.BinariesDirectory)/protobuf_install -d $(Build.SourcesDirectory)/cmake/deps.txt
|
||||
displayName: "Build Host Protoc"
|
||||
|
||||
# create and test mobile pods
|
||||
|
|
|
@ -48,6 +48,7 @@ jobs:
|
|||
build_py_lto_flag: --enable_lto
|
||||
|
||||
steps:
|
||||
# Windows_CI_GPU_DML_Dev_arm64 build job still needs protobuf submodule
|
||||
- checkout: self
|
||||
clean: true
|
||||
submodules: recursive
|
||||
|
@ -82,20 +83,12 @@ jobs:
|
|||
modifyEnvironment: true
|
||||
workingFolder: '$(Build.BinariesDirectory)'
|
||||
|
||||
- script: |
|
||||
python -m pip install -q setuptools wheel numpy
|
||||
workingDirectory: '$(Build.BinariesDirectory)'
|
||||
displayName: 'Install python modules'
|
||||
|
||||
- powershell: |
|
||||
$Env:USE_MSVC_STATIC_RUNTIME=1
|
||||
$Env:ONNX_ML=1
|
||||
$Env:CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DProtobuf_USE_STATIC_LIBS=ON -DONNX_USE_LITE_PROTO=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=${{ parameters.BuildArch }}-windows-static"
|
||||
python setup.py bdist_wheel
|
||||
python -m pip uninstall -y onnx -qq
|
||||
Get-ChildItem -Path dist/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname}
|
||||
workingDirectory: '$(Build.SourcesDirectory)\cmake\external\onnx'
|
||||
- task: PowerShell@2
|
||||
displayName: 'Install ONNX'
|
||||
inputs:
|
||||
filePath: '$(Build.SourcesDirectory)/tools/ci_build/github/windows/install_third_party_deps.ps1'
|
||||
workingDirectory: '$(Build.BinariesDirectory)'
|
||||
arguments: -cpu_arch ${{ parameters.BuildArch }} -install_prefix $(Build.BinariesDirectory)\${{ parameters.BuildConfig }}\installed -build_config $(BuildConfig)
|
||||
|
||||
- task: PythonScript@0
|
||||
displayName: 'Generate cmake config'
|
||||
|
|
|
@ -1,17 +1,6 @@
|
|||
jobs:
|
||||
- template: templates/mac-ci.yml
|
||||
parameters:
|
||||
JobName: 'Mac_CPU_Training'
|
||||
SubmoduleCheckoutMode: 'recursive'
|
||||
BuildCommand: >
|
||||
python3 $(Build.SourcesDirectory)/tools/ci_build/build.py
|
||||
--build_dir $(Build.BinariesDirectory)
|
||||
--skip_submodule_sync
|
||||
--parallel
|
||||
--build_shared_lib
|
||||
--config RelWithDebInfo
|
||||
--enable_training
|
||||
DoNugetPack: 'false'
|
||||
# Enable unreleased onnx opsets in CI builds
|
||||
# This facilitates testing the implementation for the new opsets
|
||||
AllowReleasedOpsetOnly: '0'
|
||||
AllowReleasedOpsetOnly: 0
|
||||
BuildForAllArchs: false
|
||||
AdditionalBuildFlags: --enable_training
|
|
@ -1,4 +1,38 @@
|
|||
jobs:
|
||||
- template: templates/win-ci-vs-2019.yml
|
||||
parameters:
|
||||
BuildConfig: 'Debug'
|
||||
EnvSetupScript: setup_env.bat
|
||||
buildArch: x64
|
||||
additionalBuildFlags: --disable_memleak_checker --use_mimalloc
|
||||
msbuildPlatform: x64
|
||||
isX86: false
|
||||
job_name_suffix: x64_mimalloc
|
||||
RunOnnxRuntimeTests: true
|
||||
RunStaticCodeAnalysis: false
|
||||
isTraining: false
|
||||
ORT_EP_NAME: CPU
|
||||
GenerateDocumentation: false
|
||||
EnablePython: false
|
||||
MachinePool: 'Win-CPU-2021'
|
||||
|
||||
- template: templates/win-ci-vs-2019.yml
|
||||
parameters:
|
||||
BuildConfig: 'Debug'
|
||||
EnvSetupScript: setup_env.bat
|
||||
buildArch: x64
|
||||
additionalBuildFlags: --cmake_extra_defines onnxruntime_DISABLE_ABSEIL=ON
|
||||
msbuildPlatform: x64
|
||||
isX86: false
|
||||
job_name_suffix: x64_no_absl
|
||||
RunOnnxRuntimeTests: true
|
||||
RunStaticCodeAnalysis: false
|
||||
isTraining: false
|
||||
ORT_EP_NAME: CPU
|
||||
GenerateDocumentation: false
|
||||
EnablePython: false
|
||||
MachinePool: 'Win-CPU-2021'
|
||||
|
||||
- job: CodeCoverage
|
||||
workspace:
|
||||
clean: all
|
||||
|
|
|
@ -54,7 +54,7 @@ jobs:
|
|||
steps:
|
||||
- checkout: self
|
||||
clean: true
|
||||
submodules: recursive
|
||||
submodules: none
|
||||
|
||||
- task: CmdLine@2
|
||||
displayName: Create artifacts directory
|
||||
|
|
|
@ -59,68 +59,10 @@ jobs:
|
|||
OnnxruntimeNodejsBindingArch: 'arm64'
|
||||
PoolName: 'aiinfra-linux-ARM64-CPU-2019'
|
||||
|
||||
- job: MacOS_C_API_Packaging_CPU_x64
|
||||
workspace:
|
||||
clean: all
|
||||
variables:
|
||||
MACOSX_DEPLOYMENT_TARGET: '10.14'
|
||||
pool:
|
||||
vmImage: 'macOS-11'
|
||||
timeoutInMinutes: 300
|
||||
steps:
|
||||
- template: set-version-number-variables-step.yml
|
||||
|
||||
- task: UsePythonVersion@0
|
||||
# Use python 3.8 to avoid build some of the required packages
|
||||
displayName: Use Python 3.8
|
||||
inputs:
|
||||
versionSpec: 3.8
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
pushd .
|
||||
cd $(Build.SourcesDirectory)/cmake/external/protobuf
|
||||
cmake ./cmake -DCMAKE_INSTALL_PREFIX=$(Build.BinariesDirectory)/protobuf -DCMAKE_POSITION_INDEPENDENT_CODE=ON -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Relwithdebinfo '-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64'
|
||||
make -j$(getconf _NPROCESSORS_ONLN)
|
||||
make install
|
||||
popd
|
||||
export PATH=$(Build.BinariesDirectory)/protobuf/bin:$PATH
|
||||
export ONNX_ML=1
|
||||
export CMAKE_ARGS="-DONNX_GEN_PB_TYPE_STUBS=OFF -DONNX_WERROR=OFF"
|
||||
python3 -m pip install numpy wheel
|
||||
python3 -m pip install $(Build.SourcesDirectory)/cmake/external/onnx
|
||||
sudo xcode-select --switch /Applications/Xcode_12.4.app/Contents/Developer
|
||||
displayName: 'Build and Test MacOS'
|
||||
|
||||
- template: mac-packaging.yml
|
||||
parameters :
|
||||
AdditionalBuildFlags : ${{ parameters.AdditionalBuildFlags }} --build_java --build_nodejs --use_coreml --cmake_extra_defines CMAKE_OSX_ARCHITECTURES=arm64
|
||||
MacosArch: arm64
|
||||
BuildJava: true
|
||||
BuildNodejs: true
|
||||
|
||||
- template: mac-packaging.yml
|
||||
parameters :
|
||||
AdditionalBuildFlags : ${{ parameters.AdditionalBuildFlags }} --use_coreml --cmake_extra_defines CMAKE_OSX_ARCHITECTURES="arm64;x86_64"
|
||||
MacosArch: universal2
|
||||
BuildJava: false
|
||||
BuildNodejs: false
|
||||
|
||||
- template: mac-packaging.yml
|
||||
parameters :
|
||||
AdditionalBuildFlags : ${{ parameters.AdditionalBuildFlags }} --build_java --build_nodejs --use_coreml
|
||||
MacosArch: x86_64
|
||||
BuildJava: true
|
||||
BuildNodejs: true
|
||||
|
||||
- task: PublishPipelineArtifact@1
|
||||
inputs:
|
||||
targetPath: '$(Build.ArtifactStagingDirectory)'
|
||||
artifactName: 'onnxruntime-osx'
|
||||
|
||||
- template: component-governance-component-detection-steps.yml
|
||||
parameters :
|
||||
condition : 'succeeded'
|
||||
- template: mac-ci.yml
|
||||
parameters:
|
||||
AllowReleasedOpsetOnly: 1
|
||||
BuildForAllArchs: true
|
||||
|
||||
- template: android-java-api-aar.yml
|
||||
parameters:
|
||||
|
@ -211,7 +153,7 @@ jobs:
|
|||
buildArch: x64
|
||||
msbuildPlatform: arm
|
||||
packageName: arm
|
||||
buildparameter: --arm ${{ parameters.AdditionalBuildFlags }} ${{ parameters.AdditionalWinBuildFlags}}
|
||||
buildparameter: --arm ${{ parameters.AdditionalBuildFlags }} ${{ parameters.AdditionalWinBuildFlags}} --path_to_protoc_exe $(Build.BinariesDirectory)\RelWithDebInfo\installed\bin\protoc.exe
|
||||
runTests: false
|
||||
buildJava: false
|
||||
buildNodejs: false
|
||||
|
@ -225,7 +167,7 @@ jobs:
|
|||
buildArch: x64
|
||||
msbuildPlatform: arm64
|
||||
packageName: arm64
|
||||
buildparameter: --build_nodejs --arm64 ${{ parameters.AdditionalBuildFlags }} ${{ parameters.AdditionalWinBuildFlags}}
|
||||
buildparameter: --build_nodejs --arm64 ${{ parameters.AdditionalBuildFlags }} ${{ parameters.AdditionalWinBuildFlags}} --path_to_protoc_exe $(Build.BinariesDirectory)\RelWithDebInfo\installed\bin\protoc.exe
|
||||
runTests: false
|
||||
buildJava: false
|
||||
buildNodejs: true
|
||||
|
|
|
@ -35,17 +35,9 @@ jobs:
|
|||
timeoutInMinutes: 210
|
||||
pool: ${{parameters.PoolName}}
|
||||
steps:
|
||||
- bash: |
|
||||
set -euo pipefail
|
||||
if ! which docker; then
|
||||
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
|
||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
|
||||
sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
|
||||
sudo chmod 666 /var/run/docker.sock
|
||||
fi
|
||||
displayName: Install Docker Engine
|
||||
- checkout: self
|
||||
clean: true
|
||||
submodules: none
|
||||
- template: set-version-number-variables-step.yml
|
||||
- template: get-docker-image-steps.yml
|
||||
parameters:
|
||||
|
|
|
@ -1,29 +1,37 @@
|
|||
parameters:
|
||||
JobName: 'MacOS_CI_Dev'
|
||||
SubmoduleCheckoutMode: ''
|
||||
BuildCommand: ''
|
||||
DoNodejsPack: 'false'
|
||||
DoNugetPack: 'false'
|
||||
NuPackScript: ''
|
||||
ArtifactName: 'drop-osx'
|
||||
# Controls whether unreleased onnx opsets are allowed. Default is set to 1
|
||||
AllowReleasedOpsetOnly: '1'
|
||||
- name: AdditionalBuildFlags
|
||||
displayName: Additional build flags for build.py
|
||||
type: string
|
||||
default: ''
|
||||
|
||||
# Must be 1 or 0
|
||||
- name: AllowReleasedOpsetOnly
|
||||
displayName: Whether unreleased onnx opsets are allowed
|
||||
type: number
|
||||
default: 1
|
||||
values:
|
||||
- 1
|
||||
- 0
|
||||
|
||||
- name: BuildForAllArchs
|
||||
displayName: Build for all CPU ARCHs
|
||||
type: boolean
|
||||
|
||||
jobs:
|
||||
- job: ${{ parameters.JobName }}
|
||||
- job: MacOS_C_API_Packaging_CPU_x64
|
||||
workspace:
|
||||
clean: all
|
||||
timeoutInMinutes: 180
|
||||
variables:
|
||||
MACOSX_DEPLOYMENT_TARGET: '10.14'
|
||||
ALLOW_RELEASED_ONNX_OPSET_ONLY: ${{ parameters.AllowReleasedOpsetOnly }}
|
||||
pool:
|
||||
vmImage: 'macOS-11'
|
||||
variables:
|
||||
BuildCommand: ${{ parameters.BuildCommand }}
|
||||
ALLOW_RELEASED_ONNX_OPSET_ONLY: ${{ parameters.AllowReleasedOpsetOnly }}
|
||||
MACOSX_DEPLOYMENT_TARGET: '10.14'
|
||||
timeoutInMinutes: 300
|
||||
steps:
|
||||
- checkout: self
|
||||
${{ if ne(parameters.SubmoduleCheckoutMode, '') }}:
|
||||
submodules: ${{ parameters.SubmoduleCheckoutMode }}
|
||||
clean: true
|
||||
submodules: none
|
||||
|
||||
- task: UsePythonVersion@0
|
||||
# Use python 3.8 to avoid build some of the required packages
|
||||
displayName: Use Python 3.8
|
||||
|
@ -32,56 +40,49 @@ jobs:
|
|||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: '16.x'
|
||||
|
||||
- template: set-version-number-variables-step.yml
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
set -e -x
|
||||
pushd .
|
||||
cd $(Build.SourcesDirectory)/cmake/external/protobuf
|
||||
cmake ./cmake -DCMAKE_INSTALL_PREFIX=$(Build.BinariesDirectory)/protobuf -DCMAKE_POSITION_INDEPENDENT_CODE=ON -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Relwithdebinfo
|
||||
make -j $(getconf _NPROCESSORS_ONLN)
|
||||
make install
|
||||
$(Build.SourcesDirectory)/tools/ci_build/github/linux/docker/inference/x64/python/cpu/scripts/install_protobuf.sh -d $(Build.SourcesDirectory)/cmake/deps.txt -p $(Build.BinariesDirectory)/installed
|
||||
popd
|
||||
export PATH=$(Build.BinariesDirectory)/protobuf/bin:$PATH
|
||||
export PATH=$(Build.BinariesDirectory)/installed/bin:$PATH
|
||||
export ONNX_ML=1
|
||||
export CMAKE_ARGS="-DONNX_GEN_PB_TYPE_STUBS=OFF -DONNX_WERROR=OFF"
|
||||
sudo python3 -m pip install -r '$(Build.SourcesDirectory)/tools/ci_build/github/linux/docker/scripts/requirements.txt'
|
||||
python3 -m pip install -r '$(Build.SourcesDirectory)/tools/ci_build/github/linux/docker/scripts/requirements.txt'
|
||||
sudo xcode-select --switch /Applications/Xcode_12.4.app/Contents/Developer
|
||||
${{ parameters.BuildCommand }}
|
||||
displayName: 'Build and Test OnnxRuntime lib for MacOS'
|
||||
displayName: 'Install dependencies'
|
||||
|
||||
- ${{ if eq(parameters['DoNugetPack'], 'true') }}:
|
||||
- script: |
|
||||
${{ parameters.NuPackScript }}
|
||||
displayName: 'Copy MacOS libs to Artifact Staging'
|
||||
- task: PublishPipelineArtifact@0
|
||||
displayName: 'Publish Pipeline Artifact: ${{ parameters.ArtifactName }}'
|
||||
inputs:
|
||||
artifactName: ${{ parameters.ArtifactName }}
|
||||
targetPath: '$(Build.ArtifactStagingDirectory)'
|
||||
- ${{ if eq(parameters.BuildForAllArchs, true) }}:
|
||||
- template: mac-packaging.yml
|
||||
parameters :
|
||||
AdditionalBuildFlags : ${{ parameters.AdditionalBuildFlags }} --build_java --build_nodejs --use_coreml --cmake_extra_defines CMAKE_OSX_ARCHITECTURES=arm64
|
||||
MacosArch: arm64
|
||||
BuildJava: true
|
||||
BuildNodejs: true
|
||||
|
||||
- ${{ if eq(parameters['DoNodejsPack'], 'true') }}:
|
||||
# Esrp signing
|
||||
#
|
||||
# TODO: ESRP team is working on enable signing workflow on Mac. Should enable the following step when it's ready.
|
||||
#
|
||||
# - template: mac-esrp-dll.yml
|
||||
# parameters:
|
||||
# FolderPath: '$(Build.SourcesDirectory)/js/node/bin/napi-v3/darwin/x64'
|
||||
# DisplayName: 'ESRP - Sign Node.js binding binaries'
|
||||
# DoEsrp: ${{ parameters.DoEsrp }}
|
||||
# Pattern: '*.dylib,*.node'
|
||||
- ${{ if eq(parameters.BuildForAllArchs, true) }}:
|
||||
- template: mac-packaging.yml
|
||||
parameters :
|
||||
AdditionalBuildFlags : ${{ parameters.AdditionalBuildFlags }} --use_coreml --cmake_extra_defines CMAKE_OSX_ARCHITECTURES="arm64;x86_64"
|
||||
MacosArch: universal2
|
||||
BuildJava: false
|
||||
BuildNodejs: false
|
||||
|
||||
- script: |
|
||||
cp -R $(Build.SourcesDirectory)/js/node/bin $(Build.ArtifactStagingDirectory)/bin
|
||||
workingDirectory: '$(Build.SourcesDirectory)/js/node'
|
||||
displayName: 'Create Node.js Binding Artifact'
|
||||
- template: mac-packaging.yml
|
||||
parameters :
|
||||
AdditionalBuildFlags : ${{ parameters.AdditionalBuildFlags }} --build_java --build_nodejs --use_coreml
|
||||
MacosArch: x86_64
|
||||
BuildJava: true
|
||||
BuildNodejs: true
|
||||
|
||||
- task: PublishPipelineArtifact@0
|
||||
displayName: 'Publish Pipeline Artifact: ${{ parameters.ArtifactName }}'
|
||||
inputs:
|
||||
artifactName: ${{ parameters.ArtifactName }}
|
||||
targetPath: '$(Build.ArtifactStagingDirectory)'
|
||||
- task: PublishPipelineArtifact@1
|
||||
inputs:
|
||||
targetPath: '$(Build.ArtifactStagingDirectory)'
|
||||
artifactName: 'onnxruntime-osx'
|
||||
|
||||
- template: component-governance-component-detection-steps.yml
|
||||
parameters :
|
||||
condition : 'succeeded'
|
||||
- template: clean-agent-build-directory-step.yml
|
||||
condition : 'succeeded'
|
|
@ -28,25 +28,13 @@ jobs:
|
|||
DockerBuildArgs: "--network=host --build-arg POLICY=manylinux2014 --build-arg PLATFORM=x86_64 --build-arg DEVTOOLSET_ROOTPATH=/opt/rh/devtoolset-11/root --build-arg PREPEND_PATH=/opt/rh/devtoolset-11/root/usr/bin: --build-arg LD_LIBRARY_PATH_ARG=/opt/rh/devtoolset-11/root/usr/lib64:/opt/rh/devtoolset-11/root/usr/lib:/opt/rh/devtoolset-11/root/usr/lib64/dyninst:/opt/rh/devtoolset-11/root/usr/lib/dyninst:/usr/local/lib64 --build-arg BUILD_UID=$( id -u ) --build-arg PLATFORM=${{ parameters.arch }}"
|
||||
Repository: onnxruntimecuda116xtrt84build${{ parameters.arch }}
|
||||
|
||||
- task: CmdLine@2
|
||||
|
||||
- task: Bash@3
|
||||
displayName: 'Build Python Wheel'
|
||||
inputs:
|
||||
script: |
|
||||
set -e -x
|
||||
mkdir -p $HOME/.onnx
|
||||
docker run --rm \
|
||||
--volume /data/onnx:/data/onnx:ro \
|
||||
--volume $(Build.SourcesDirectory):/onnxruntime_src \
|
||||
--volume $(Build.BinariesDirectory):/build \
|
||||
--volume /data/models:/build/models:ro \
|
||||
--volume $HOME/.onnx:/home/onnxruntimedev/.onnx \
|
||||
-w /onnxruntime_src \
|
||||
-e NIGHTLY_BUILD \
|
||||
-e BUILD_BUILDNUMBER \
|
||||
onnxruntimecuda116xtrt84build${{ parameters.arch }} /bin/bash tools/ci_build/github/linux/build_linux_arm64_python_package.sh -d GPU
|
||||
rm -rf $(Build.BinariesDirectory)/Release/onnxruntime $(Build.BinariesDirectory)/Release/pybind11 $(Build.BinariesDirectory)/Release/models $(Build.BinariesDirectory)/Release/_deps $(Build.BinariesDirectory)/Release/CMakeFiles
|
||||
cd $(Build.BinariesDirectory)/Release
|
||||
find -executable -type f > $(Build.BinariesDirectory)/Release/perms.txt
|
||||
targetType: filePath
|
||||
filePath: tools/ci_build/github/linux/run_python_dockerbuild.sh
|
||||
arguments: -i onnxruntimecuda116xtrt84build${{ parameters.arch }} -x "-d GPU"
|
||||
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: 'Publish Artifact: ONNXRuntime python wheel'
|
||||
|
|
|
@ -4,7 +4,7 @@ parameters:
|
|||
|
||||
- name: machine_pool
|
||||
type: string
|
||||
|
||||
|
||||
- name: base_image
|
||||
type: string
|
||||
|
||||
|
@ -20,7 +20,7 @@ jobs:
|
|||
steps:
|
||||
- checkout: self
|
||||
clean: true
|
||||
submodules: recursive
|
||||
submodules: none
|
||||
|
||||
- template: set-nightly-build-option-variable-step.yml
|
||||
|
||||
|
@ -33,25 +33,12 @@ jobs:
|
|||
${{ if eq(parameters.arch, 'aarch64') }}:
|
||||
UpdateDepsTxt: false
|
||||
|
||||
- task: CmdLine@2
|
||||
- task: Bash@3
|
||||
displayName: 'Build Python Wheel'
|
||||
inputs:
|
||||
script: |
|
||||
set -e -x
|
||||
mkdir -p $HOME/.onnx
|
||||
docker run --rm \
|
||||
--volume /data/onnx:/data/onnx:ro \
|
||||
--volume $(Build.SourcesDirectory):/onnxruntime_src \
|
||||
--volume $(Build.BinariesDirectory):/build \
|
||||
--volume /data/models:/build/models:ro \
|
||||
--volume $HOME/.onnx:/home/onnxruntimedev/.onnx \
|
||||
-w /onnxruntime_src \
|
||||
-e NIGHTLY_BUILD \
|
||||
-e BUILD_BUILDNUMBER \
|
||||
onnxruntimecpubuildubuntu20python${{ parameters.arch }} tools/ci_build/github/linux/build_linux_arm64_python_package.sh
|
||||
rm -rf $(Build.BinariesDirectory)/Release/onnxruntime $(Build.BinariesDirectory)/Release/pybind11 $(Build.BinariesDirectory)/Release/models $(Build.BinariesDirectory)/Release/_deps $(Build.BinariesDirectory)/Release/CMakeFiles
|
||||
cd $(Build.BinariesDirectory)/Release
|
||||
find -executable -type f > $(Build.BinariesDirectory)/Release/perms.txt
|
||||
targetType: filePath
|
||||
filePath: tools/ci_build/github/linux/run_python_dockerbuild.sh
|
||||
arguments: -i onnxruntimecpubuildubuntu20python${{ parameters.arch }}
|
||||
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: 'Publish Artifact: ONNXRuntime python wheel'
|
||||
|
|
|
@ -4,7 +4,7 @@ parameters:
|
|||
|
||||
- name: machine_pool
|
||||
type: string
|
||||
|
||||
|
||||
- name: base_image
|
||||
type: string
|
||||
|
||||
|
@ -29,7 +29,7 @@ jobs:
|
|||
steps:
|
||||
- checkout: self
|
||||
clean: true
|
||||
submodules: recursive
|
||||
submodules: none
|
||||
|
||||
- template: set-nightly-build-option-variable-step.yml
|
||||
|
||||
|
@ -42,25 +42,12 @@ jobs:
|
|||
${{ if eq(parameters.arch, 'aarch64') }}:
|
||||
UpdateDepsTxt: false
|
||||
|
||||
- task: CmdLine@2
|
||||
- task: Bash@3
|
||||
displayName: 'Build Python Wheel'
|
||||
inputs:
|
||||
script: |
|
||||
set -e -x
|
||||
mkdir -p $HOME/.onnx
|
||||
docker run --rm \
|
||||
--volume /data/onnx:/data/onnx:ro \
|
||||
--volume $(Build.SourcesDirectory):/onnxruntime_src \
|
||||
--volume $(Build.BinariesDirectory):/build \
|
||||
--volume /data/models:/build/models:ro \
|
||||
--volume $HOME/.onnx:/home/onnxruntimedev/.onnx \
|
||||
-w /onnxruntime_src \
|
||||
-e NIGHTLY_BUILD \
|
||||
-e BUILD_BUILDNUMBER \
|
||||
onnxruntimecpubuilpython${{ parameters.arch }} tools/ci_build/github/linux/build_linux_arm64_python_package.sh
|
||||
rm -rf $(Build.BinariesDirectory)/Release/onnxruntime $(Build.BinariesDirectory)/Release/pybind11 $(Build.BinariesDirectory)/Release/models $(Build.BinariesDirectory)/Release/_deps $(Build.BinariesDirectory)/Release/CMakeFiles
|
||||
cd $(Build.BinariesDirectory)/Release
|
||||
find -executable -type f > $(Build.BinariesDirectory)/Release/perms.txt
|
||||
targetType: filePath
|
||||
filePath: tools/ci_build/github/linux/run_python_dockerbuild.sh
|
||||
arguments: -i onnxruntimecpubuilpython${{ parameters.arch }}
|
||||
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: 'Publish Artifact: ONNXRuntime python wheel'
|
||||
|
|
|
@ -157,15 +157,12 @@ stages:
|
|||
workingDirectory: '$(Build.BinariesDirectory)'
|
||||
displayName: 'Install python modules'
|
||||
|
||||
- powershell: |
|
||||
$Env:USE_MSVC_STATIC_RUNTIME=1
|
||||
$Env:ONNX_ML=1
|
||||
$Env:CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DProtobuf_USE_STATIC_LIBS=ON -DONNX_USE_LITE_PROTO=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static"
|
||||
python setup.py bdist_wheel
|
||||
python -m pip uninstall -y onnx -qq
|
||||
Get-ChildItem -Path dist/*.whl | foreach {pip --disable-pip-version-check install --force-reinstall --upgrade $_.fullname}
|
||||
workingDirectory: '$(Build.SourcesDirectory)\cmake\external\onnx'
|
||||
- task: PowerShell@2
|
||||
displayName: 'Install ONNX'
|
||||
inputs:
|
||||
filePath: '$(Build.SourcesDirectory)/tools/ci_build/github/windows/install_third_party_deps.ps1'
|
||||
workingDirectory: '$(Build.BinariesDirectory)'
|
||||
arguments: -cpu_arch x64 -install_prefix $(Build.BinariesDirectory)\${{ parameters.BuildConfig }}\installed -build_config $(BuildConfig)
|
||||
|
||||
- task: PythonScript@0
|
||||
displayName: 'Generate cmake config'
|
||||
|
@ -420,15 +417,12 @@ stages:
|
|||
workingDirectory: '$(Build.BinariesDirectory)'
|
||||
displayName: 'Install python modules'
|
||||
|
||||
- powershell: |
|
||||
$Env:USE_MSVC_STATIC_RUNTIME=1
|
||||
$Env:ONNX_ML=1
|
||||
$Env:CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DProtobuf_USE_STATIC_LIBS=ON -DONNX_USE_LITE_PROTO=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=$(buildArch)-windows-static"
|
||||
python setup.py bdist_wheel
|
||||
python -m pip uninstall -y onnx -qq
|
||||
Get-ChildItem -Path dist/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname}
|
||||
workingDirectory: '$(Build.SourcesDirectory)\cmake\external\onnx'
|
||||
- task: PowerShell@2
|
||||
displayName: 'Install ONNX'
|
||||
inputs:
|
||||
filePath: '$(Build.SourcesDirectory)/tools/ci_build/github/windows/install_third_party_deps.ps1'
|
||||
workingDirectory: '$(Build.BinariesDirectory)'
|
||||
arguments: -cpu_arch x64 -install_prefix $(Build.BinariesDirectory)\RelWithDebInfo\installed -build_config RelWithDebInfo
|
||||
|
||||
- task: PythonScript@0
|
||||
displayName: 'Generate cmake config'
|
||||
|
|
|
@ -132,7 +132,7 @@ stages:
|
|||
displayName: 'Install python modules'
|
||||
|
||||
- template: download-deps.yml
|
||||
|
||||
|
||||
- task: PythonScript@0
|
||||
displayName: 'Update deps.txt'
|
||||
inputs:
|
||||
|
@ -140,15 +140,12 @@ stages:
|
|||
arguments: --new_dir $(Build.BinariesDirectory)/deps
|
||||
workingDirectory: $(Build.BinariesDirectory)
|
||||
|
||||
- powershell: |
|
||||
$Env:USE_MSVC_STATIC_RUNTIME=1
|
||||
$Env:ONNX_ML=1
|
||||
$Env:CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DProtobuf_USE_STATIC_LIBS=ON -DONNX_USE_LITE_PROTO=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=$(buildArch)-windows-static"
|
||||
python setup.py bdist_wheel
|
||||
python -m pip uninstall -y onnx -qq
|
||||
Get-ChildItem -Path dist/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname}
|
||||
workingDirectory: '$(Build.SourcesDirectory)\cmake\external\onnx'
|
||||
- task: PowerShell@2
|
||||
displayName: 'Install ONNX'
|
||||
inputs:
|
||||
filePath: '$(Build.SourcesDirectory)/tools/ci_build/github/windows/install_third_party_deps.ps1'
|
||||
workingDirectory: '$(Build.BinariesDirectory)'
|
||||
arguments: -cpu_arch $(buildArch) -install_prefix $(Build.BinariesDirectory)\$(BuildConfig)\installed -build_config $(BuildConfig)
|
||||
|
||||
- task: PythonScript@0
|
||||
displayName: 'Generate cmake config'
|
||||
|
@ -300,7 +297,7 @@ stages:
|
|||
PYTHON_VERSION: '3.10'
|
||||
EP_BUILD_FLAGS: --use_tensorrt --tensorrt_home="C:\local\TensorRT-8.4.1.5.Windows10.x86_64.cuda-11.6.cudnn8.4" --cuda_version=11.6 --cuda_home="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6" --cmake_extra_defines "CMAKE_CUDA_ARCHITECTURES=37;50;52;60;61;70;75;80"
|
||||
ENV_SETUP_SCRIPT: setup_env_gpu.bat
|
||||
EP_NAME: gpu
|
||||
EP_NAME: gpu
|
||||
|
||||
- template: py-win-gpu.yml
|
||||
parameters:
|
||||
|
@ -333,7 +330,7 @@ stages:
|
|||
EP_BUILD_FLAGS: --use_dml --cmake_extra_defines CMAKE_SYSTEM_VERSION=10.0.18362.0 --enable_wcos
|
||||
ENV_SETUP_SCRIPT: setup_env.bat
|
||||
EP_NAME: directml
|
||||
|
||||
|
||||
- ${{ if eq(parameters.enable_mac_cpu, true) }}:
|
||||
- job: MacOS_py_Wheels
|
||||
timeoutInMinutes: 90
|
||||
|
@ -364,17 +361,17 @@ stages:
|
|||
versionSpec: $(PythonVersion)
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
set -e -x
|
||||
pushd .
|
||||
cd $(Build.SourcesDirectory)/cmake/external/protobuf
|
||||
cmake ./cmake -DCMAKE_INSTALL_PREFIX=$(Build.BinariesDirectory)/protobuf -DCMAKE_POSITION_INDEPENDENT_CODE=ON -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Relwithdebinfo '-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64'
|
||||
make -j$(getconf _NPROCESSORS_ONLN)
|
||||
make install
|
||||
mkdir -p /tmp/scripts
|
||||
mkdir -p $(Build.BinariesDirectory)/installed
|
||||
cp $(Build.SourcesDirectory)/cmake/deps.txt /tmp/scripts
|
||||
$(Build.SourcesDirectory)/tools/ci_build/github/linux/docker/inference/x64/python/cpu/scripts/install_protobuf.sh -p $(Build.BinariesDirectory)/installed
|
||||
popd
|
||||
export PATH=$(Build.BinariesDirectory)/protobuf/bin:$PATH
|
||||
export PATH=$(Build.BinariesDirectory)/installed/bin:$PATH
|
||||
export ONNX_ML=1
|
||||
export CMAKE_ARGS="-DONNX_GEN_PB_TYPE_STUBS=OFF -DONNX_WERROR=OFF"
|
||||
sudo python3 -m pip install -r '$(Build.SourcesDirectory)/tools/ci_build/github/linux/docker/scripts/requirements.txt'
|
||||
python3 -m pip install -r '$(Build.SourcesDirectory)/tools/ci_build/github/linux/docker/scripts/requirements.txt'
|
||||
sudo xcode-select --switch /Applications/Xcode_12.4.app/Contents/Developer
|
||||
python3 $(Build.SourcesDirectory)/tools/ci_build/build.py --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --parallel --config Release --skip_onnx_tests --build_wheel ${{ parameters.build_py_parameters }}
|
||||
displayName: 'Command Line Script'
|
||||
|
@ -431,18 +428,17 @@ stages:
|
|||
displayName: 'Mac machine info'
|
||||
|
||||
- script: |
|
||||
set -e
|
||||
set -e -x
|
||||
pushd .
|
||||
cd $(Build.SourcesDirectory)/cmake/external/protobuf
|
||||
cmake ./cmake -DCMAKE_INSTALL_PREFIX=$(Build.BinariesDirectory)/protobuf -DCMAKE_POSITION_INDEPENDENT_CODE=ON -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Relwithdebinfo '-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64'
|
||||
make -j$(getconf _NPROCESSORS_ONLN)
|
||||
make install
|
||||
mkdir -p /tmp/scripts
|
||||
mkdir -p $(Build.BinariesDirectory)/installed
|
||||
cp $(Build.SourcesDirectory)/cmake/deps.txt /tmp/scripts
|
||||
$(Build.SourcesDirectory)/tools/ci_build/github/linux/docker/inference/x64/python/cpu/scripts/install_protobuf.sh -p $(Build.BinariesDirectory)/installed
|
||||
popd
|
||||
export PATH=$(Build.BinariesDirectory)/protobuf/bin:$PATH
|
||||
export PATH=$(Build.BinariesDirectory)/installed/bin:$PATH
|
||||
export ONNX_ML=1
|
||||
export CMAKE_ARGS="-DONNX_GEN_PB_TYPE_STUBS=OFF -DONNX_WERROR=OFF"
|
||||
export _PYTHON_HOST_PLATFORM=macosx-${{variables.MACOSX_DEPLOYMENT_TARGET}}-arm64
|
||||
sudo python3 -m pip install -r '$(Build.SourcesDirectory)/tools/ci_build/github/linux/docker/scripts/requirements.txt'
|
||||
python3 -m pip install -r '$(Build.SourcesDirectory)/tools/ci_build/github/linux/docker/scripts/requirements.txt'
|
||||
sudo xcode-select --switch /Applications/Xcode_12.4.app/Contents/Developer
|
||||
python3 $(Build.SourcesDirectory)/tools/ci_build/build.py --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --parallel --config Release --skip_tests --cmake_extra_defines CMAKE_OSX_ARCHITECTURES=arm64 --build_wheel ${{ parameters.build_py_parameters }}
|
||||
displayName: 'Command Line Script'
|
||||
|
@ -511,4 +507,4 @@ stages:
|
|||
- template: py-linux-gpu.yml
|
||||
parameters:
|
||||
arch: 'x86_64'
|
||||
machine_pool: 'Linux-CPU'
|
||||
machine_pool: 'Linux-CPU'
|
||||
|
|
|
@ -53,7 +53,7 @@ jobs:
|
|||
displayName: 'Install python modules'
|
||||
|
||||
- template: download-deps.yml
|
||||
|
||||
|
||||
- task: PythonScript@0
|
||||
displayName: 'Update deps.txt'
|
||||
inputs:
|
||||
|
@ -61,15 +61,12 @@ jobs:
|
|||
arguments: --new_dir $(Build.BinariesDirectory)/deps
|
||||
workingDirectory: $(Build.BinariesDirectory)
|
||||
|
||||
- powershell: |
|
||||
$Env:USE_MSVC_STATIC_RUNTIME=1
|
||||
$Env:ONNX_ML=1
|
||||
$Env:CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DProtobuf_USE_STATIC_LIBS=ON -DONNX_USE_LITE_PROTO=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static"
|
||||
python setup.py bdist_wheel
|
||||
python -m pip uninstall -y onnx -qq
|
||||
Get-ChildItem -Path dist/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname}
|
||||
workingDirectory: '$(Build.SourcesDirectory)\cmake\external\onnx'
|
||||
- task: PowerShell@2
|
||||
displayName: 'Install ONNX'
|
||||
inputs:
|
||||
filePath: '$(Build.SourcesDirectory)/tools/ci_build/github/windows/install_third_party_deps.ps1'
|
||||
workingDirectory: '$(Build.BinariesDirectory)'
|
||||
arguments: -cpu_arch x64 -install_prefix $(Build.BinariesDirectory)\RelWithDebInfo\installed -build_config RelWithDebInfo
|
||||
|
||||
- template: set-nightly-build-option-variable-step.yml
|
||||
|
||||
|
|
|
@ -1,126 +0,0 @@
|
|||
parameters:
|
||||
DoDebugBuild: 'true'
|
||||
DoCompliance: 'false'
|
||||
BuildCommand: ''
|
||||
JobName: 'Windows_CI_Dev'
|
||||
DoNugetPack: 'false'
|
||||
NuPackScript : ''
|
||||
ArtifactName: 'drop-nuget'
|
||||
DoEsrp: 'false'
|
||||
BuildArch: 'x64'
|
||||
DoTestCoverage: 'false'
|
||||
sln_platform: 'Arm64' # Options: Win32, x64,Arm64
|
||||
SetVcvars: 'false'
|
||||
MsbuildArguments: '/m'
|
||||
EnvSetupScript: 'setup_env.bat'
|
||||
CudaVersion: ''
|
||||
|
||||
jobs:
|
||||
- job: ${{ parameters.JobName }}
|
||||
workspace:
|
||||
clean: all
|
||||
timeoutInMinutes: 120
|
||||
pool: ${{ parameters.AgentPool }}
|
||||
variables:
|
||||
buildDirectory: '$(Build.BinariesDirectory)'
|
||||
BuildCommand: ${{ parameters.BuildCommand }}
|
||||
OnnxRuntimeBuildDirectory: '$(Build.BinariesDirectory)'
|
||||
DotNetExe: 'dotnet.exe'
|
||||
CUDA_VERSION: ${{ parameters.CudaVersion }}
|
||||
|
||||
steps:
|
||||
- powershell: |
|
||||
if($env:TELEMETRYGUID)
|
||||
{
|
||||
$length = $env:TELEMETRYGUID.length
|
||||
$fileContent = "#define TraceLoggingOptionMicrosoftTelemetry() \
|
||||
TraceLoggingOptionGroup("+$env:TELEMETRYGUID.substring(1, $length-2)+")"
|
||||
New-Item -Path "$(Build.SourcesDirectory)\include\onnxruntime\core\platform\windows\TraceLoggingConfigPrivate.h" -ItemType "file" -Value "$fileContent" -Force
|
||||
Write-Output "Enabling TELEMETRY"
|
||||
}
|
||||
displayName: 'Create TraceLoggingConfigPrivate.h For WinML Telemetry'
|
||||
env:
|
||||
TELEMETRYGUID: $(TELEMETRYGUID)
|
||||
|
||||
- task: BatchScript@1
|
||||
displayName: 'setup env'
|
||||
inputs:
|
||||
filename: '$(Build.SourcesDirectory)\tools\ci_build\github\windows\${{ parameters.EnvSetupScript }}'
|
||||
modifyEnvironment: true
|
||||
workingFolder: '$(Build.BinariesDirectory)'
|
||||
|
||||
- task: BatchScript@1
|
||||
displayName: 'Setup VS2019 env vars'
|
||||
inputs:
|
||||
filename: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat'
|
||||
arguments: amd64_arm
|
||||
modifyEnvironment: true
|
||||
|
||||
- task: UsePythonVersion@0
|
||||
inputs:
|
||||
versionSpec: '3.7'
|
||||
addToPath: true
|
||||
architecture: x64
|
||||
|
||||
- script: |
|
||||
python -m pip install -q setuptools wheel numpy
|
||||
workingDirectory: '$(Build.BinariesDirectory)'
|
||||
displayName: 'Install python modules'
|
||||
|
||||
- task: PythonScript@0
|
||||
displayName: 'Generate cmake config'
|
||||
inputs:
|
||||
scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py'
|
||||
arguments: '$(BuildCommand) --update --config RelWithDebInfo'
|
||||
workingDirectory: '$(Build.BinariesDirectory)'
|
||||
|
||||
- task: VSBuild@1
|
||||
displayName: 'Build'
|
||||
inputs:
|
||||
solution: '$(Build.BinariesDirectory)\RelWithDebInfo\onnxruntime.sln'
|
||||
platform: ${{ parameters.sln_platform }}
|
||||
configuration: RelWithDebInfo
|
||||
msbuildArchitecture: ${{ parameters.BuildArch }}
|
||||
maximumCpuCount: true
|
||||
logProjectEvents: true
|
||||
workingFolder: '$(Build.BinariesDirectory)\RelWithDebInfo'
|
||||
createLogFile: true
|
||||
|
||||
# Build RelWithDebInfo -- this variable required to build C#
|
||||
- script: |
|
||||
@echo ##vso[task.setvariable variable=Configuration]RelWithDebInfo
|
||||
|
||||
|
||||
# Nuget packaging if needed
|
||||
- ${{ if eq(parameters['DoNugetPack'], 'true') }}:
|
||||
# Esrp signing
|
||||
- template: win-esrp-dll.yml
|
||||
parameters:
|
||||
FolderPath: '$(Build.BinariesDirectory)\RelWithDebInfo'
|
||||
DisplayName: 'ESRP - Sign Native dlls'
|
||||
DoEsrp: ${{ parameters.DoEsrp }}
|
||||
|
||||
- script: |
|
||||
${{ parameters.NuPackScript }}
|
||||
workingDirectory: '$(Build.SourcesDirectory)\csharp'
|
||||
displayName: 'Create NuGet Package'
|
||||
|
||||
- task: PublishPipelineArtifact@0
|
||||
displayName: 'Publish Pipeline Artifact: drop-nuget'
|
||||
inputs:
|
||||
artifactName: ${{ parameters.ArtifactName }}
|
||||
targetPath: '$(Build.ArtifactStagingDirectory)'
|
||||
|
||||
- task: PublishSymbols@2
|
||||
displayName: 'Publish Build Symbols'
|
||||
condition: eq(variables['IsReleaseBuild'], 'true')
|
||||
inputs:
|
||||
symbolsFolder: '$(Build.BinariesDirectory)\RelWithDebInfo\RelWithDebInfo'
|
||||
searchPattern: '**/*.pdb'
|
||||
symbolServerType: teamServices
|
||||
|
||||
- template: component-governance-component-detection-steps.yml
|
||||
parameters :
|
||||
condition : 'succeeded'
|
||||
|
||||
- template: clean-agent-build-directory-step.yml
|
|
@ -65,6 +65,10 @@ jobs:
|
|||
pool: ${{ parameters.MachinePool }}
|
||||
timeoutInMinutes: 300
|
||||
steps:
|
||||
- checkout: self
|
||||
clean: true
|
||||
submodules: none
|
||||
|
||||
- task: UsePythonVersion@0
|
||||
inputs:
|
||||
versionSpec: '3.7'
|
||||
|
@ -72,7 +76,7 @@ jobs:
|
|||
architecture: ${{ parameters.buildArch }}
|
||||
|
||||
- template: download-deps.yml
|
||||
|
||||
|
||||
- task: PythonScript@0
|
||||
displayName: 'Update deps.txt'
|
||||
inputs:
|
||||
|
@ -116,15 +120,13 @@ jobs:
|
|||
displayName: 'Install python modules'
|
||||
|
||||
- ${{ if or(eq(parameters.RunOnnxRuntimeTests, true), eq(parameters.GenerateDocumentation, true)) }}:
|
||||
- powershell: |
|
||||
$Env:USE_MSVC_STATIC_RUNTIME=1
|
||||
$Env:ONNX_ML=1
|
||||
$Env:CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DProtobuf_USE_STATIC_LIBS=ON -DONNX_USE_LITE_PROTO=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=${{ parameters.buildArch }}-windows-static"
|
||||
python setup.py bdist_wheel
|
||||
python -m pip uninstall -y onnx -qq
|
||||
Get-ChildItem -Path dist/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname}
|
||||
workingDirectory: '$(Build.SourcesDirectory)\cmake\external\onnx'
|
||||
- task: PowerShell@2
|
||||
displayName: 'Install ONNX'
|
||||
inputs:
|
||||
filePath: '$(Build.SourcesDirectory)/tools/ci_build/github/windows/install_third_party_deps.ps1'
|
||||
workingDirectory: '$(Build.BinariesDirectory)'
|
||||
arguments: -cpu_arch ${{ parameters.buildArch }} -install_prefix $(Build.BinariesDirectory)\${{ parameters.BuildConfig }}\installed -build_config ${{ parameters.BuildConfig }}
|
||||
|
||||
|
||||
#Build.py disables running training python frontend tests on Windows, so here we don't install pytorch.
|
||||
- ${{ if eq(parameters.isTraining, true) }}:
|
||||
|
|
|
@ -60,6 +60,10 @@ jobs:
|
|||
timeoutInMinutes: 300
|
||||
|
||||
steps:
|
||||
- checkout: self
|
||||
clean: true
|
||||
submodules: none
|
||||
|
||||
- template: telemetry-steps.yml
|
||||
|
||||
- task: UsePythonVersion@0
|
||||
|
@ -80,13 +84,8 @@ jobs:
|
|||
modifyEnvironment: true
|
||||
workingFolder: '$(Build.BinariesDirectory)'
|
||||
|
||||
- script: |
|
||||
python -m pip install -q setuptools wheel numpy
|
||||
workingDirectory: '$(Build.BinariesDirectory)'
|
||||
displayName: 'Install python modules'
|
||||
|
||||
- template: download-deps.yml
|
||||
|
||||
|
||||
- task: PythonScript@0
|
||||
displayName: 'Update deps.txt'
|
||||
inputs:
|
||||
|
@ -94,15 +93,12 @@ jobs:
|
|||
arguments: --new_dir $(Build.BinariesDirectory)/deps
|
||||
workingDirectory: $(Build.BinariesDirectory)
|
||||
|
||||
- powershell: |
|
||||
$Env:USE_MSVC_STATIC_RUNTIME=1
|
||||
$Env:ONNX_ML=1
|
||||
$Env:CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DProtobuf_USE_STATIC_LIBS=ON -DONNX_USE_LITE_PROTO=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=${{ parameters.buildArch }}-windows-static"
|
||||
python setup.py bdist_wheel
|
||||
python -m pip uninstall -y onnx -qq
|
||||
Get-ChildItem -Path dist/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname}
|
||||
workingDirectory: '$(Build.SourcesDirectory)\cmake\external\onnx'
|
||||
displayName: 'Install ONNX'
|
||||
- task: PowerShell@2
|
||||
displayName: 'Install ONNX'
|
||||
inputs:
|
||||
filePath: '$(Build.SourcesDirectory)/tools/ci_build/github/windows/install_third_party_deps.ps1'
|
||||
workingDirectory: '$(Build.BinariesDirectory)'
|
||||
arguments: -cpu_arch ${{ parameters.buildArch }} -install_prefix $(Build.BinariesDirectory)\RelWithDebInfo\installed -build_config RelWithDebInfo
|
||||
|
||||
- template: set-version-number-variables-step.yml
|
||||
|
||||
|
@ -158,7 +154,7 @@ jobs:
|
|||
- task: PublishPipelineArtifact@1
|
||||
condition: and(succeeded(), eq('${{ parameters.packageName}}', 'x64'))
|
||||
inputs:
|
||||
targetPath: '$(Build.BinariesDirectory)\RelWithDebInfo\_deps\protobuf-build\RelWithDebInfo\protoc.exe'
|
||||
targetPath: '$(Build.BinariesDirectory)\RelWithDebInfo\installed\bin\protoc.exe'
|
||||
artifactName: 'drop-extra'
|
||||
|
||||
|
||||
|
@ -174,7 +170,7 @@ jobs:
|
|||
- task: PublishPipelineArtifact@1
|
||||
condition: and(succeeded(), eq('${{ parameters.packageName}}', 'x64'))
|
||||
inputs:
|
||||
targetPath: '$(Build.BinariesDirectory)\RelWithDebInfo\_deps\protobuf-build\RelWithDebInfo\protoc.exe'
|
||||
targetPath: '$(Build.BinariesDirectory)\RelWithDebInfo\installed\bin\protoc.exe'
|
||||
artifactName: 'drop-nuget'
|
||||
|
||||
|
||||
|
|
|
@ -41,15 +41,12 @@ jobs:
|
|||
workingDirectory: '$(Build.BinariesDirectory)'
|
||||
displayName: 'Install python modules'
|
||||
|
||||
- powershell: |
|
||||
$Env:USE_MSVC_STATIC_RUNTIME=1
|
||||
$Env:ONNX_ML=1
|
||||
$Env:CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DProtobuf_USE_STATIC_LIBS=ON -DONNX_USE_LITE_PROTO=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=$(buildArch)-windows-static"
|
||||
python setup.py bdist_wheel
|
||||
python -m pip uninstall -y onnx -qq
|
||||
Get-ChildItem -Path dist/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname}
|
||||
workingDirectory: '$(Build.SourcesDirectory)\cmake\external\onnx'
|
||||
- task: PowerShell@2
|
||||
displayName: 'Install ONNX'
|
||||
inputs:
|
||||
filePath: '$(Build.SourcesDirectory)/tools/ci_build/github/windows/install_third_party_deps.ps1'
|
||||
workingDirectory: '$(Build.BinariesDirectory)'
|
||||
arguments: -cpu_arch x64 -install_prefix $(Build.BinariesDirectory)\$(BuildConfig)\installed -build_config $(BuildConfig)
|
||||
|
||||
- task: NuGetToolInstaller@0
|
||||
displayName: Use Nuget 5.7.0
|
||||
|
|
|
@ -13,7 +13,7 @@ stages:
|
|||
BuildConfig: 'Debug'
|
||||
EnvSetupScript: setup_env.bat
|
||||
buildArch: x64
|
||||
additionalBuildFlags: --build_java --build_nodejs --build_wheel
|
||||
additionalBuildFlags: --build_java --build_nodejs --build_wheel --disable_memleak_checker
|
||||
msbuildPlatform: x64
|
||||
isX86: false
|
||||
job_name_suffix: x64_debug
|
||||
|
@ -131,7 +131,7 @@ stages:
|
|||
BuildConfig: 'Debug'
|
||||
EnvSetupScript: setup_env.bat
|
||||
buildArch: x64
|
||||
additionalBuildFlags: --enable_training --build_wheel
|
||||
additionalBuildFlags: --enable_training --build_wheel --disable_memleak_checker
|
||||
msbuildPlatform: x64
|
||||
isX86: false
|
||||
job_name_suffix: training_x64_debug
|
||||
|
@ -179,4 +179,4 @@ stages:
|
|||
isTraining: true
|
||||
ORT_EP_NAME: CPU
|
||||
GenerateDocumentation: false
|
||||
MachinePool: 'onnxruntime-Win2019-CPU-training'
|
||||
MachinePool: 'onnxruntime-Win2019-CPU-training'
|
|
@ -38,15 +38,12 @@ jobs:
|
|||
workingDirectory: '$(Build.BinariesDirectory)'
|
||||
displayName: 'Install python modules'
|
||||
|
||||
- powershell: |
|
||||
$Env:USE_MSVC_STATIC_RUNTIME=1
|
||||
$Env:ONNX_ML=1
|
||||
$Env:CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DProtobuf_USE_STATIC_LIBS=ON -DONNX_USE_LITE_PROTO=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=$(buildArch)-windows-static"
|
||||
python setup.py bdist_wheel
|
||||
python -m pip uninstall -y onnx -qq
|
||||
Get-ChildItem -Path dist/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname}
|
||||
workingDirectory: '$(Build.SourcesDirectory)\cmake\external\onnx'
|
||||
- task: PowerShell@2
|
||||
displayName: 'Install ONNX'
|
||||
inputs:
|
||||
filePath: '$(Build.SourcesDirectory)/tools/ci_build/github/windows/install_third_party_deps.ps1'
|
||||
workingDirectory: '$(Build.BinariesDirectory)'
|
||||
arguments: -cpu_arch x64 -install_prefix $(Build.BinariesDirectory)\$(BuildConfig)\installed -build_config $(BuildConfig)
|
||||
|
||||
- task: PythonScript@0
|
||||
displayName: 'Build and test'
|
||||
|
|
|
@ -34,15 +34,21 @@ jobs:
|
|||
workingDirectory: '$(Build.BinariesDirectory)'
|
||||
displayName: 'Install python modules'
|
||||
|
||||
- powershell: |
|
||||
$Env:USE_MSVC_STATIC_RUNTIME=1
|
||||
$Env:ONNX_ML=1
|
||||
$Env:CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DProtobuf_USE_STATIC_LIBS=ON -DONNX_USE_LITE_PROTO=ON -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=$(buildArch)-windows-static"
|
||||
python setup.py bdist_wheel
|
||||
python -m pip uninstall -y onnx -qq
|
||||
Get-ChildItem -Path dist/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname}
|
||||
workingDirectory: '$(Build.SourcesDirectory)\cmake\external\onnx'
|
||||
- template: templates/download-deps.yml
|
||||
|
||||
- task: PythonScript@0
|
||||
displayName: 'Update deps.txt'
|
||||
inputs:
|
||||
scriptPath: $(Build.SourcesDirectory)/tools/ci_build/replace_urls_in_deps.py
|
||||
arguments: --new_dir $(Build.BinariesDirectory)/deps
|
||||
workingDirectory: $(Build.BinariesDirectory)
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: 'Install ONNX'
|
||||
inputs:
|
||||
filePath: '$(Build.SourcesDirectory)/tools/ci_build/github/windows/install_third_party_deps.ps1'
|
||||
workingDirectory: '$(Build.BinariesDirectory)'
|
||||
arguments: -cpu_arch x64 -install_prefix $(Build.BinariesDirectory)\$(BuildConfig)\installed -build_config $(BuildConfig)
|
||||
|
||||
- task: PythonScript@0
|
||||
displayName: 'Generate cmake config'
|
||||
|
|
|
@ -7,11 +7,13 @@ CXXFLAGS="-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-st
|
|||
|
||||
BUILD_DEVICE="CPU"
|
||||
BUILD_CONFIG="Release"
|
||||
PYTHON_EXES=("/opt/python/cp37-cp37m/bin/python3.7" "/opt/python/cp38-cp38/bin/python3.8" "/opt/python/cp39-cp39/bin/python3.9" "/opt/python/cp310-cp310/bin/python3.10")
|
||||
while getopts "d:" parameter_Option
|
||||
do case "${parameter_Option}"
|
||||
in
|
||||
#GPU or CPU.
|
||||
#GPU or CPU.
|
||||
d) BUILD_DEVICE=${OPTARG};;
|
||||
p) PYTHON_EXES=(${OPTARG});;
|
||||
esac
|
||||
done
|
||||
|
||||
|
@ -45,11 +47,10 @@ if [ "$BUILD_DEVICE" == "GPU" ]; then
|
|||
fi
|
||||
export CFLAGS
|
||||
export CXXFLAGS
|
||||
PYTHON_EXES=("/opt/python/cp37-cp37m/bin/python3.7" "/opt/python/cp38-cp38/bin/python3.8" "/opt/python/cp39-cp39/bin/python3.9" "/opt/python/cp310-cp310/bin/python3.10")
|
||||
for PYTHON_EXE in "${PYTHON_EXES[@]}"
|
||||
do
|
||||
rm -rf /build/$BUILD_CONFIG
|
||||
${PYTHON_EXE} /onnxruntime_src/tools/ci_build/build.py "${BUILD_ARGS[@]}"
|
||||
|
||||
|
||||
cp /build/$BUILD_CONFIG/dist/*.whl /build/dist
|
||||
done
|
||||
|
|
|
@ -14,10 +14,5 @@ for PYTHON_EXE in "${PYTHON_EXES[@]}"
|
|||
do
|
||||
${PYTHON_EXE} -m pip install -r requirements.txt
|
||||
done
|
||||
if [ -f "/tmp/protobuf_install_manifest.txt" ]; then
|
||||
echo "Uninstalling protobuf..."
|
||||
xargs rm -f < /tmp/protobuf_install_manifest.txt
|
||||
rm /tmp/protobuf_install_manifest.txt
|
||||
fi
|
||||
|
||||
|
||||
|
|
|
@ -1,43 +1,51 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
#Download a file from internet
|
||||
function GetFile {
|
||||
local uri=$1
|
||||
local path=$2
|
||||
local force=${3:-false}
|
||||
local download_retries=${4:-5}
|
||||
local retry_wait_time_seconds=${5:-30}
|
||||
set -e -x
|
||||
|
||||
if [[ -f $path ]]; then
|
||||
if [[ $force = false ]]; then
|
||||
echo "File '$path' already exists. Skipping download"
|
||||
return 0
|
||||
else
|
||||
rm -rf $path
|
||||
INSTALL_PREFIX='/usr'
|
||||
DEP_FILE_PATH='/tmp/scripts/deps.txt'
|
||||
while getopts "p:d:" parameter_Option
|
||||
do case "${parameter_Option}"
|
||||
in
|
||||
p) INSTALL_PREFIX=${OPTARG};;
|
||||
d) DEP_FILE_PATH=${OPTARG};;
|
||||
esac
|
||||
done
|
||||
|
||||
EXTRA_CMAKE_ARGS=""
|
||||
|
||||
case "$(uname -s)" in
|
||||
Darwin*)
|
||||
echo 'Building ONNX Runtime on Mac OS X'
|
||||
EXTRA_CMAKE_ARGS="-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64"
|
||||
;;
|
||||
Linux*)
|
||||
# Depending on how the compiler has been configured when it was built, sometimes "gcc -dumpversion" shows the full version.
|
||||
GCC_VERSION=$(gcc -dumpversion | cut -d . -f 1)
|
||||
#-fstack-clash-protection prevents attacks based on an overlapping heap and stack.
|
||||
if [ "$GCC_VERSION" -ge 8 ]; then
|
||||
CFLAGS="$CFLAGS -fstack-clash-protection"
|
||||
CXXFLAGS="$CXXFLAGS -fstack-clash-protection"
|
||||
fi
|
||||
fi
|
||||
ARCH=$(uname -m)
|
||||
|
||||
if [[ -f $uri ]]; then
|
||||
echo "'$uri' is a file path, copying file to '$path'"
|
||||
cp $uri $path
|
||||
return $?
|
||||
fi
|
||||
|
||||
echo "Downloading $uri"
|
||||
# Use aria2c if available, otherwise use curl
|
||||
if command -v aria2c > /dev/null; then
|
||||
aria2c -q -d $(dirname $path) -o $(basename $path) "$uri"
|
||||
else
|
||||
curl "$uri" -sSL --retry $download_retries --retry-delay $retry_wait_time_seconds --create-dirs -o "$path" --fail
|
||||
fi
|
||||
|
||||
return $?
|
||||
}
|
||||
|
||||
GetFile https://github.com/protocolbuffers/protobuf/archive/v3.18.1.tar.gz protobuf_src.tar.gz
|
||||
tar -xf protobuf_src.tar.gz
|
||||
cd protobuf-3.18.1
|
||||
cmake ./cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_SYSCONFDIR=/etc -DCMAKE_POSITION_INDEPENDENT_CODE=ON -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Relwithdebinfo
|
||||
if [ "$ARCH" == "x86_64" ] && [ "$GCC_VERSION" -ge 9 ]; then
|
||||
CFLAGS="$CFLAGS -fcf-protection"
|
||||
CXXFLAGS="$CXXFLAGS -fcf-protection"
|
||||
fi
|
||||
export CFLAGS
|
||||
export CXXFLAGS
|
||||
;;
|
||||
*)
|
||||
exit -1
|
||||
esac
|
||||
mkdir -p $INSTALL_PREFIX
|
||||
echo "Installing protobuf ..."
|
||||
protobuf_url=$(grep '^protobuf' $DEP_FILE_PATH | cut -d ';' -f 2 | sed 's/\.zip$/\.tar.gz/')
|
||||
curl -sSL --retry 5 --retry-delay 10 --create-dirs --fail -L -o protobuf_src.tar.gz $protobuf_url
|
||||
mkdir protobuf
|
||||
cd protobuf
|
||||
tar -zxf ../protobuf_src.tar.gz --strip=1
|
||||
cmake ./cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX -DCMAKE_POSITION_INDEPENDENT_CODE=ON -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release -Dprotobuf_WITH_ZLIB_DEFAULT=OFF -Dprotobuf_BUILD_SHARED_LIBS=OFF $EXTRA_CMAKE_ARGS
|
||||
make -j$(getconf _NPROCESSORS_ONLN)
|
||||
make install
|
||||
cp install_manifest.txt /tmp/protobuf_install_manifest.txt
|
||||
cd ..
|
|
@ -3,7 +3,7 @@ mypy
|
|||
pytest
|
||||
setuptools>=41.4.0
|
||||
wheel
|
||||
onnx==1.12.0
|
||||
git+http://github.com/onnx/onnx.git@5a5f8a5935762397aa68429b5493084ff970f774#egg=onnx
|
||||
protobuf==3.18.3
|
||||
sympy==1.10.1
|
||||
flatbuffers
|
||||
|
|
|
@ -3,7 +3,7 @@ FROM rocm/pytorch:rocm5.2.3_ubuntu20.04_py3.7_pytorch_1.12.1
|
|||
ENV DEBIAN_FRONTEND noninteractive
|
||||
ENV MIGRAPHX_DISABLE_FAST_GELU=1
|
||||
|
||||
RUN apt-get clean && apt-get update && apt-get install -y locales
|
||||
RUN apt-get clean && apt-get update && apt-get install -y locales unzip
|
||||
RUN locale-gen en_US.UTF-8
|
||||
RUN update-locale LANG=en_US.UTF-8
|
||||
ENV LC_ALL C.UTF-8
|
||||
|
@ -11,6 +11,9 @@ ENV LANG C.UTF-8
|
|||
|
||||
WORKDIR /stage
|
||||
|
||||
ADD scripts /tmp/scripts
|
||||
RUN /tmp/scripts/install_os_deps.sh
|
||||
|
||||
# from rocm/pytorch's image, work around ucx's dlopen replacement conflicting with shared provider
|
||||
RUN cd /opt/mpi_install/ucx/build &&\
|
||||
make clean &&\
|
||||
|
@ -18,11 +21,7 @@ RUN cd /opt/mpi_install/ucx/build &&\
|
|||
make -j $(nproc) &&\
|
||||
make install
|
||||
|
||||
# CMake
|
||||
ENV CMAKE_VERSION=3.24.2
|
||||
RUN cd /usr/local && \
|
||||
wget -q -O - https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz | tar zxf -
|
||||
ENV PATH=/usr/local/cmake-${CMAKE_VERSION}-linux-x86_64/bin:${PATH}
|
||||
|
||||
|
||||
RUN apt-get update &&\
|
||||
apt-get install -y half libnuma-dev
|
|
@ -1,42 +1,51 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
#Download a file from internet
|
||||
function GetFile {
|
||||
local uri=$1
|
||||
local path=$2
|
||||
local force=${3:-false}
|
||||
local download_retries=${4:-5}
|
||||
local retry_wait_time_seconds=${5:-30}
|
||||
set -e -x
|
||||
|
||||
if [[ -f $path ]]; then
|
||||
if [[ $force = false ]]; then
|
||||
echo "File '$path' already exists. Skipping download"
|
||||
return 0
|
||||
else
|
||||
rm -rf $path
|
||||
INSTALL_PREFIX='/usr'
|
||||
DEP_FILE_PATH='/tmp/scripts/deps.txt'
|
||||
while getopts "p:d:" parameter_Option
|
||||
do case "${parameter_Option}"
|
||||
in
|
||||
p) INSTALL_PREFIX=${OPTARG};;
|
||||
d) DEP_FILE_PATH=${OPTARG};;
|
||||
esac
|
||||
done
|
||||
|
||||
EXTRA_CMAKE_ARGS=""
|
||||
|
||||
case "$(uname -s)" in
|
||||
Darwin*)
|
||||
echo 'Building ONNX Runtime on Mac OS X'
|
||||
EXTRA_CMAKE_ARGS="-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64"
|
||||
;;
|
||||
Linux*)
|
||||
# Depending on how the compiler has been configured when it was built, sometimes "gcc -dumpversion" shows the full version.
|
||||
GCC_VERSION=$(gcc -dumpversion | cut -d . -f 1)
|
||||
#-fstack-clash-protection prevents attacks based on an overlapping heap and stack.
|
||||
if [ "$GCC_VERSION" -ge 8 ]; then
|
||||
CFLAGS="$CFLAGS -fstack-clash-protection"
|
||||
CXXFLAGS="$CXXFLAGS -fstack-clash-protection"
|
||||
fi
|
||||
fi
|
||||
ARCH=$(uname -m)
|
||||
|
||||
if [[ -f $uri ]]; then
|
||||
echo "'$uri' is a file path, copying file to '$path'"
|
||||
cp $uri $path
|
||||
return $?
|
||||
fi
|
||||
|
||||
echo "Downloading $uri"
|
||||
# Use aria2c if available, otherwise use curl
|
||||
if command -v aria2c > /dev/null; then
|
||||
aria2c -q -d $(dirname $path) -o $(basename $path) "$uri"
|
||||
else
|
||||
curl "$uri" -sSL --retry $download_retries --retry-delay $retry_wait_time_seconds --create-dirs -o "$path" --fail
|
||||
fi
|
||||
|
||||
return $?
|
||||
}
|
||||
|
||||
GetFile https://github.com/protocolbuffers/protobuf/archive/v3.18.1.tar.gz /tmp/src/v3.18.1.tar.gz
|
||||
tar -xf /tmp/src/v3.18.1.tar.gz -C /tmp/src
|
||||
cd /tmp/src/protobuf-3.18.1
|
||||
cmake ./cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_SYSCONFDIR=/etc -DCMAKE_POSITION_INDEPENDENT_CODE=ON -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Relwithdebinfo
|
||||
if [ "$ARCH" == "x86_64" ] && [ "$GCC_VERSION" -ge 9 ]; then
|
||||
CFLAGS="$CFLAGS -fcf-protection"
|
||||
CXXFLAGS="$CXXFLAGS -fcf-protection"
|
||||
fi
|
||||
export CFLAGS
|
||||
export CXXFLAGS
|
||||
;;
|
||||
*)
|
||||
exit -1
|
||||
esac
|
||||
mkdir -p $INSTALL_PREFIX
|
||||
echo "Installing protobuf ..."
|
||||
protobuf_url=$(grep '^protobuf' $DEP_FILE_PATH | cut -d ';' -f 2 | sed 's/\.zip$/\.tar.gz/')
|
||||
curl -sSL --retry 5 --retry-delay 10 --create-dirs --fail -L -o protobuf_src.tar.gz $protobuf_url
|
||||
mkdir protobuf
|
||||
cd protobuf
|
||||
tar -zxf ../protobuf_src.tar.gz --strip=1
|
||||
cmake ./cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX -DCMAKE_POSITION_INDEPENDENT_CODE=ON -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release -Dprotobuf_WITH_ZLIB_DEFAULT=OFF -Dprotobuf_BUILD_SHARED_LIBS=OFF $EXTRA_CMAKE_ARGS
|
||||
make -j$(getconf _NPROCESSORS_ONLN)
|
||||
make install
|
||||
cd ..
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash
|
||||
set -e -x
|
||||
while getopts "x:i:" parameter_Option
|
||||
do case "${parameter_Option}"
|
||||
in
|
||||
i) DOCKER_IMAGE=${OPTARG};;
|
||||
x) BUILD_EXTR_PAR=${OPTARG};;
|
||||
esac
|
||||
done
|
||||
|
||||
mkdir -p $HOME/.onnx
|
||||
docker run --rm \
|
||||
--volume /data/onnx:/data/onnx:ro \
|
||||
--volume $BUILD_SOURCESDIRECTORY:/onnxruntime_src \
|
||||
--volume $BUILD_BINARIESDIRECTORY:/build \
|
||||
--volume /data/models:/build/models:ro \
|
||||
--volume $HOME/.onnx:/home/onnxruntimedev/.onnx \
|
||||
-w /onnxruntime_src \
|
||||
-e NIGHTLY_BUILD \
|
||||
-e BUILD_BUILDNUMBER \
|
||||
$DOCKER_IMAGE tools/ci_build/github/linux/build_linux_arm64_python_package.sh $BUILD_EXTR_PAR
|
||||
|
||||
rm -rf $BUILD_BINARIESDIRECTORY/Release/onnxruntime $BUILD_BINARIESDIRECTORY/Release/pybind11 \
|
||||
$BUILD_BINARIESDIRECTORY/Release/models $BUILD_BINARIESDIRECTORY/Release/_deps \
|
||||
$BUILD_BINARIESDIRECTORY/Release/CMakeFiles
|
||||
cd $BUILD_BINARIESDIRECTORY/Release
|
||||
find -executable -type f > $BUILD_BINARIESDIRECTORY/Release/perms.txt
|
|
@ -0,0 +1,60 @@
|
|||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
param (
|
||||
[string]$cpu_arch = "x64",
|
||||
[string]$build_config = "RelWithDebInfo",
|
||||
[string]$install_prefix
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$env:Path = "$install_prefix\bin;C:\Program Files\7-Zip;" + $env:Path
|
||||
|
||||
New-Item -Path "$install_prefix" -ItemType Directory -Force
|
||||
|
||||
$cmake_extra_args=@()
|
||||
if($cpu_arch -eq 'x86'){
|
||||
Write-Host "Build for x86"
|
||||
$cmake_extra_args="-A", "Win32", "-T", "host=x64"
|
||||
} else {
|
||||
Write-Host "Build for $cpu_arch"
|
||||
}
|
||||
|
||||
$url='https://github.com/pybind/pybind11/archive/refs/tags/v2.10.1.zip'
|
||||
Write-Host "Downloading pybind11 from $url"
|
||||
Invoke-WebRequest -Uri $url -OutFile pybind11.zip
|
||||
7z x pybind11.zip
|
||||
cd pybind11-2.10.1
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
cmake .. "-DCMAKE_INSTALL_PREFIX=$install_prefix" -DBUILD_TESTING=OFF $cmake_extra_args
|
||||
cmake --build . --parallel --config $build_config --target INSTALL
|
||||
cd ../..
|
||||
|
||||
$protobuf_version="3.18.3"
|
||||
$url="https://github.com/protocolbuffers/protobuf/releases/download/v$protobuf_version/protobuf-cpp-$protobuf_version.zip"
|
||||
Write-Host "Downloading protobuf from $url"
|
||||
Invoke-WebRequest -Uri $url -OutFile protobuf_src.zip
|
||||
7z x protobuf_src.zip
|
||||
cd protobuf-$protobuf_version
|
||||
Get-Content $Env:BUILD_SOURCESDIRECTORY\cmake\patches\protobuf\protobuf_cmake.patch | &'C:\Program Files\Git\usr\bin\patch.exe' --binary --ignore-whitespace -p1
|
||||
cmake cmake -DCMAKE_BUILD_TYPE=$build_config -Dprotobuf_BUILD_TESTS=OFF -DBUILD_SHARED_LIBS=OFF "-DCMAKE_PREFIX_PATH=$install_prefix" "-DCMAKE_INSTALL_PREFIX=$install_prefix" -Dprotobuf_MSVC_STATIC_RUNTIME=OFF $cmake_extra_args
|
||||
cmake --build . --parallel --config $build_config --target INSTALL
|
||||
cd ..
|
||||
python -m pip install -q setuptools wheel numpy protobuf==$protobuf_version pybind11
|
||||
$onnx_commit_id="5a5f8a5935762397aa68429b5493084ff970f774"
|
||||
$url="https://github.com/onnx/onnx/archive/$onnx_commit_id.zip"
|
||||
Write-Host "Downloading onnx from $url"
|
||||
Invoke-WebRequest -Uri $url -OutFile onnx.zip
|
||||
7z x onnx.zip
|
||||
cd "onnx-$onnx_commit_id"
|
||||
$Env:ONNX_ML=1
|
||||
if($build_config -eq 'Debug'){
|
||||
$Env:DEBUG='1'
|
||||
}
|
||||
$Env:CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=OFF -DProtobuf_USE_STATIC_LIBS=ON -DONNX_USE_LITE_PROTO=OFF"
|
||||
python setup.py bdist_wheel
|
||||
python -m pip uninstall -y onnx -qq
|
||||
Get-ChildItem -Path dist/*.whl | foreach {pip --disable-pip-version-check install --upgrade $_.fullname}
|
Загрузка…
Ссылка в новой задаче