Commit a144865d authored by gaoqiong's avatar gaoqiong
Browse files

update v1.14.0

parent cf1acfd2
#!/usr/bin/env python3
# args: <submodule path>
# output: <path> <url> <commit>
import subprocess
import sys
assert len(sys.argv) == 2
path = sys.argv[1]
proc = subprocess.run(
["git", "config", "--get", "remote.origin.url"],
check=True,
cwd=path,
stdout=subprocess.PIPE,
universal_newlines=True,
)
url = proc.stdout.strip()
proc = subprocess.run(
["git", "rev-parse", "HEAD"], check=True, cwd=path, stdout=subprocess.PIPE, universal_newlines=True
)
commit = proc.stdout.strip()
print("{} {} {}".format(path, url, commit))
This diff is collapsed.
{
"configurations": [
{
"name": "WinML-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\..\\build\\${name}",
"installRoot": "${projectDir}\\..\\build\\${name}\\install",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"variables": [
{
"name": "onnxruntime_USE_WINML",
"value": "True",
"type": "BOOL"
},
{
"name": "onnxruntime_WINML_NAMESPACE_OVERRIDE",
"value": "Microsoft"
},
{
"name": "onnxruntime_USE_DML",
"value": "True",
"type": "BOOL"
},
{
"name": "onnxruntime_BUILD_SHARED_LIB",
"value": "True",
"type": "BOOL"
}
],
"cmakeToolchain": "${projectDir}\\wcos_toolchain.cmake"
},
{
"name": "WinML-RelWithDebInfo",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\..\\build\\${name}",
"installRoot": "${projectDir}\\..\\build\\${name}\\install",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"variables": [
{
"name": "onnxruntime_USE_WINML",
"value": "True",
"type": "BOOL"
},
{
"name": "onnxruntime_WINML_NAMESPACE_OVERRIDE",
"value": "Microsoft"
},
{
"name": "onnxruntime_USE_DML",
"value": "True",
"type": "BOOL"
},
{
"name": "onnxruntime_BUILD_SHARED_LIB",
"value": "True",
"type": "BOOL"
}
],
"cmakeToolchain": "${projectDir}\\wcos_toolchain.cmake"
}
]
}
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)Sdl.ruleset</CodeAnalysisRuleSet>
<!-- External libraries are in or below the directory with the sln file. Source is under \onnxruntime so not affected by this.
Also need to exclude things under \cmake such as \cmake\external\protobuf, and the easiest way to do that in all
environments is to use the directory this file is in.
-->
<CAExcludePath>$(SolutionDir);$(MSBuildThisFileDirectory)</CAExcludePath>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
</Project>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>${MACOSX_FRAMEWORK_NAME}</string>
<key>CFBundleName</key>
<string>${MACOSX_FRAMEWORK_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${MACOSX_FRAMEWORK_IDENTIFIER}</string>
<key>CFBundleVersion</key>
<string>${ORT_VERSION}</string>
<key>CFBundleShortVersionString</key>
<string>${ORT_VERSION}</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
</dict>
</plist>
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="ONNX Runtime SDL Rules" Description="These rules focus on the most critical and common problems in your native code, including potential security holes and application crashes. You should include this rule set in any custom rule set you create for your native projects. This ruleset is designed to work with Visual Studio Professional edition and higher." ToolsVersion="16.0">
<Rules AnalyzerId="Microsoft.Analyzers.NativeCodeAnalysis" RuleNamespace="Microsoft.Rules.Native">
<Rule Id="C26100" Action="Error" />
<Rule Id="C26101" Action="Error" />
<Rule Id="C26110" Action="Error" />
<Rule Id="C26111" Action="Error" />
<Rule Id="C26112" Action="Error" />
<Rule Id="C26115" Action="Error" />
<Rule Id="C26116" Action="Error" />
<Rule Id="C26117" Action="Error" />
<Rule Id="C26140" Action="Error" />
<Rule Id="C26400" Action="Error" />
<Rule Id="C26404" Action="Error" />
<Rule Id="C26406" Action="Error" />
<Rule Id="C26408" Action="Error" />
<Rule Id="C26409" Action="Error" />
<Rule Id="C26426" Action="Error" />
<Rule Id="C26427" Action="Error" />
<Rule Id="C26436" Action="Error" />
<Rule Id="C26437" Action="Error" />
<Rule Id="C26439" Action="Error" />
<Rule Id="C26441" Action="Error" />
<Rule Id="C26444" Action="Error" />
<Rule Id="C26449" Action="Error" />
<Rule Id="C26450" Action="Error" />
<Rule Id="C26451" Action="Error" />
<Rule Id="C26452" Action="Error" />
<Rule Id="C26453" Action="Error" />
<Rule Id="C26454" Action="Error" />
<Rule Id="C26464" Action="Error" />
<Rule Id="C26478" Action="Error" />
<Rule Id="C26479" Action="Error" />
<Rule Id="C26488" Action="Error" />
<Rule Id="C26497" Action="Error" />
<Rule Id="C26498" Action="Error" />
<Rule Id="C26810" Action="Error" />
<Rule Id="C26811" Action="Error" />
<Rule Id="C26814" Action="Error" />
<Rule Id="C26815" Action="Error" />
<Rule Id="C26816" Action="Error" />
<Rule Id="C26817" Action="Error" />
<Rule Id="C26819" Action="Error" />
<Rule Id="C26820" Action="Error" />
<Rule Id="C28020" Action="Error" />
<Rule Id="C28021" Action="Error" />
<Rule Id="C28022" Action="Error" />
<Rule Id="C28023" Action="Error" />
<Rule Id="C28024" Action="Error" />
<Rule Id="C28039" Action="Error" />
<Rule Id="C28112" Action="Error" />
<Rule Id="C28113" Action="Error" />
<Rule Id="C28125" Action="Error" />
<Rule Id="C28137" Action="Error" />
<Rule Id="C28138" Action="Error" />
<Rule Id="C28159" Action="Error" />
<Rule Id="C28160" Action="Error" />
<Rule Id="C28163" Action="Error" />
<Rule Id="C28164" Action="Error" />
<Rule Id="C28182" Action="Error" />
<Rule Id="C28183" Action="Error" />
<Rule Id="C28193" Action="Error" />
<Rule Id="C28196" Action="Error" />
<Rule Id="C28199" Action="Error" />
<Rule Id="C28202" Action="Error" />
<Rule Id="C28203" Action="Error" />
<Rule Id="C28204" Action="Error" />
<Rule Id="C28205" Action="Error" />
<Rule Id="C28206" Action="Error" />
<Rule Id="C28207" Action="Error" />
<Rule Id="C28208" Action="Error" />
<Rule Id="C28209" Action="Error" />
<Rule Id="C28210" Action="Error" />
<Rule Id="C28211" Action="Error" />
<Rule Id="C28212" Action="Error" />
<Rule Id="C28213" Action="Error" />
<Rule Id="C28214" Action="Error" />
<Rule Id="C28215" Action="Error" />
<Rule Id="C28216" Action="Error" />
<Rule Id="C28217" Action="Error" />
<Rule Id="C28218" Action="Error" />
<Rule Id="C28219" Action="Error" />
<Rule Id="C28220" Action="Error" />
<Rule Id="C28221" Action="Error" />
<Rule Id="C28222" Action="Error" />
<Rule Id="C28223" Action="Error" />
<Rule Id="C28224" Action="Error" />
<Rule Id="C28225" Action="Error" />
<Rule Id="C28226" Action="Error" />
<Rule Id="C28227" Action="Error" />
<Rule Id="C28228" Action="Error" />
<Rule Id="C28229" Action="Error" />
<Rule Id="C28230" Action="Error" />
<Rule Id="C28231" Action="Error" />
<Rule Id="C28232" Action="Error" />
<Rule Id="C28233" Action="Error" />
<Rule Id="C28234" Action="Error" />
<Rule Id="C28235" Action="Error" />
<Rule Id="C28236" Action="Error" />
<Rule Id="C28237" Action="Error" />
<Rule Id="C28238" Action="Error" />
<Rule Id="C28239" Action="Error" />
<Rule Id="C28240" Action="Error" />
<Rule Id="C28241" Action="Error" />
<Rule Id="C28243" Action="Error" />
<Rule Id="C28244" Action="Error" />
<Rule Id="C28245" Action="Error" />
<Rule Id="C28246" Action="Error" />
<Rule Id="C28250" Action="Error" />
<Rule Id="C28251" Action="Error" />
<Rule Id="C28252" Action="Error" />
<Rule Id="C28253" Action="Error" />
<Rule Id="C28254" Action="Error" />
<Rule Id="C28260" Action="Error" />
<Rule Id="C28262" Action="Error" />
<Rule Id="C28263" Action="Error" />
<Rule Id="C28266" Action="Error" />
<Rule Id="C28267" Action="Error" />
<Rule Id="C28272" Action="Error" />
<Rule Id="C28273" Action="Error" />
<Rule Id="C28275" Action="Error" />
<Rule Id="C28278" Action="Error" />
<Rule Id="C28279" Action="Error" />
<Rule Id="C28280" Action="Error" />
<Rule Id="C28282" Action="Error" />
<Rule Id="C28283" Action="Error" />
<Rule Id="C28284" Action="Error" />
<Rule Id="C28285" Action="Error" />
<Rule Id="C28286" Action="Error" />
<Rule Id="C28287" Action="Error" />
<Rule Id="C28288" Action="Error" />
<Rule Id="C28289" Action="Error" />
<Rule Id="C28290" Action="Error" />
<Rule Id="C28291" Action="Error" />
<Rule Id="C28300" Action="Error" />
<Rule Id="C28301" Action="Error" />
<Rule Id="C28302" Action="Error" />
<Rule Id="C28303" Action="Error" />
<Rule Id="C28304" Action="Error" />
<Rule Id="C28305" Action="Error" />
<Rule Id="C28306" Action="Error" />
<Rule Id="C28307" Action="Error" />
<Rule Id="C28308" Action="Error" />
<Rule Id="C28309" Action="Error" />
<Rule Id="C28350" Action="Error" />
<Rule Id="C28351" Action="Error" />
<Rule Id="C28601" Action="Error" />
<Rule Id="C28602" Action="Error" />
<Rule Id="C28604" Action="Error" />
<Rule Id="C28615" Action="Error" />
<Rule Id="C28616" Action="Error" />
<Rule Id="C28617" Action="Error" />
<Rule Id="C28623" Action="Error" />
<Rule Id="C28624" Action="Error" />
<Rule Id="C28625" Action="Error" />
<Rule Id="C28636" Action="Error" />
<Rule Id="C28637" Action="Error" />
<Rule Id="C28638" Action="Error" />
<Rule Id="C28639" Action="Error" />
<Rule Id="C28640" Action="Error" />
<Rule Id="C28645" Action="Error" />
<Rule Id="C28648" Action="Error" />
<Rule Id="C28649" Action="Error" />
<Rule Id="C28650" Action="Error" />
<Rule Id="C28714" Action="Error" />
<Rule Id="C28715" Action="Error" />
<Rule Id="C28716" Action="Error" />
<Rule Id="C28717" Action="Error" />
<Rule Id="C28719" Action="Error" />
<Rule Id="C28720" Action="Error" />
<Rule Id="C28721" Action="Error" />
<Rule Id="C28726" Action="Error" />
<Rule Id="C28727" Action="Error" />
<Rule Id="C28730" Action="Error" />
<Rule Id="C28735" Action="Error" />
<Rule Id="C28736" Action="Error" />
<Rule Id="C28750" Action="Error" />
<Rule Id="C28751" Action="Error" />
<Rule Id="C33001" Action="Error" />
<Rule Id="C33004" Action="Error" />
<Rule Id="C33005" Action="Error" />
<Rule Id="C33010" Action="Error" />
<Rule Id="C33011" Action="Error" />
<Rule Id="C33020" Action="Error" />
<Rule Id="C33022" Action="Error" />
<Rule Id="C6001" Action="Error" />
<Rule Id="C6011" Action="Error" />
<Rule Id="C6029" Action="Error" />
<Rule Id="C6031" Action="Error" />
<Rule Id="C6053" Action="Error" />
<Rule Id="C6054" Action="Error" />
<Rule Id="C6059" Action="Error" />
<Rule Id="C6063" Action="Error" />
<Rule Id="C6064" Action="Error" />
<Rule Id="C6066" Action="Error" />
<Rule Id="C6067" Action="Error" />
<Rule Id="C6101" Action="Error" />
<Rule Id="C6200" Action="Error" />
<Rule Id="C6201" Action="Error" />
<Rule Id="C6214" Action="Error" />
<Rule Id="C6215" Action="Error" />
<Rule Id="C6216" Action="Error" />
<Rule Id="C6217" Action="Error" />
<Rule Id="C6220" Action="Error" />
<Rule Id="C6226" Action="Error" />
<Rule Id="C6230" Action="Error" />
<Rule Id="C6235" Action="Error" />
<Rule Id="C6236" Action="Error" />
<Rule Id="C6237" Action="Error" />
<Rule Id="C6242" Action="Error" />
<Rule Id="C6248" Action="Error" />
<Rule Id="C6250" Action="Error" />
<Rule Id="C6255" Action="Error" />
<Rule Id="C6258" Action="Error" />
<Rule Id="C6259" Action="Error" />
<Rule Id="C6260" Action="Error" />
<Rule Id="C6262" Action="Error" />
<Rule Id="C6263" Action="Error" />
<Rule Id="C6268" Action="Error" />
<Rule Id="C6269" Action="Error" />
<Rule Id="C6270" Action="Error" />
<Rule Id="C6271" Action="Error" />
<Rule Id="C6272" Action="Error" />
<Rule Id="C6273" Action="Error" />
<Rule Id="C6274" Action="Error" />
<Rule Id="C6276" Action="Error" />
<Rule Id="C6277" Action="Error" />
<Rule Id="C6278" Action="Error" />
<Rule Id="C6279" Action="Error" />
<Rule Id="C6280" Action="Error" />
<Rule Id="C6281" Action="Error" />
<Rule Id="C6282" Action="Error" />
<Rule Id="C6283" Action="Error" />
<Rule Id="C6284" Action="Error" />
<Rule Id="C6285" Action="Error" />
<Rule Id="C6286" Action="Error" />
<Rule Id="C6287" Action="Error" />
<Rule Id="C6288" Action="Error" />
<Rule Id="C6289" Action="Error" />
<Rule Id="C6290" Action="Error" />
<Rule Id="C6291" Action="Error" />
<Rule Id="C6292" Action="Error" />
<Rule Id="C6293" Action="Error" />
<Rule Id="C6294" Action="Error" />
<Rule Id="C6295" Action="Error" />
<Rule Id="C6296" Action="Error" />
<Rule Id="C6297" Action="Error" />
<Rule Id="C6299" Action="Error" />
<Rule Id="C6302" Action="Error" />
<Rule Id="C6303" Action="Error" />
<Rule Id="C6305" Action="Error" />
<Rule Id="C6306" Action="Error" />
<Rule Id="C6308" Action="Error" />
<Rule Id="C6310" Action="Error" />
<Rule Id="C6312" Action="Error" />
<Rule Id="C6314" Action="Error" />
<Rule Id="C6317" Action="Error" />
<Rule Id="C6318" Action="Error" />
<Rule Id="C6319" Action="Error" />
<Rule Id="C6324" Action="Error" />
<Rule Id="C6326" Action="Error" />
<Rule Id="C6328" Action="Error" />
<Rule Id="C6331" Action="Error" />
<Rule Id="C6332" Action="Error" />
<Rule Id="C6333" Action="Error" />
<Rule Id="C6335" Action="Error" />
<Rule Id="C6381" Action="Error" />
<Rule Id="C6383" Action="Error" />
<Rule Id="C6384" Action="Error" />
<Rule Id="C6385" Action="Error" />
<Rule Id="C6386" Action="Error" />
<Rule Id="C6387" Action="Error" />
<Rule Id="C6388" Action="Error" />
<Rule Id="C6500" Action="Error" />
<Rule Id="C6501" Action="Error" />
<Rule Id="C6503" Action="Error" />
<Rule Id="C6504" Action="Error" />
<Rule Id="C6505" Action="Error" />
<Rule Id="C6506" Action="Error" />
<Rule Id="C6508" Action="Error" />
<Rule Id="C6509" Action="Error" />
<Rule Id="C6510" Action="Error" />
<Rule Id="C6511" Action="Error" />
<Rule Id="C6513" Action="Error" />
<Rule Id="C6514" Action="Error" />
<Rule Id="C6515" Action="Error" />
<Rule Id="C6516" Action="Error" />
<Rule Id="C6517" Action="Error" />
<Rule Id="C6518" Action="Error" />
<Rule Id="C6522" Action="Error" />
<Rule Id="C6525" Action="Error" />
<Rule Id="C6527" Action="Error" />
<Rule Id="C6530" Action="Error" />
<Rule Id="C6540" Action="Error" />
<Rule Id="C6551" Action="Error" />
<Rule Id="C6552" Action="Error" />
<Rule Id="C6701" Action="Error" />
<Rule Id="C6702" Action="Error" />
<Rule Id="C6703" Action="Error" />
<Rule Id="C6704" Action="Error" />
<Rule Id="C6705" Action="Error" />
<Rule Id="C6706" Action="Error" />
<Rule Id="C6993" Action="Error" />
<Rule Id="C6995" Action="Error" />
<Rule Id="C6997" Action="Error" />
</Rules>
</RuleSet>
<?xml version="1.0" encoding="utf-8"?>
<!-- File name extension must be .runsettings -->
<RunSettings>
<GoogleTestAdapterSettings>
<SolutionSettings>
<Settings>
<OutputMode>Verbose</OutputMode>
<TestDiscoveryTimeoutInSeconds>120</TestDiscoveryTimeoutInSeconds>
</Settings>
</SolutionSettings>
</GoogleTestAdapterSettings>
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="Code Coverage" uri="datacollector://Microsoft/CodeCoverage/2.0" assemblyQualifiedName="Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollector, Microsoft.VisualStudio.TraceCollector, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<Configuration>
<CodeCoverage>
<!-- Match fully qualified names of functions: -->
<!-- (Use "\." to delimit namespaces in C# or Visual Basic, "::" in C++.) -->
<Functions>
<Exclude>
<Function>^std::.*</Function>
<Function>^ATL::.*</Function>
<Function>^gsl::.*</Function>
<Function>^google::.*</Function>
<Function>^onnx::.*</Function>
<Function>^nlohmann::.*</Function>
<Function>^Microsoft::Featurizer.*</Function>
<Function>^Eigen::.*</Function>
<Function>^onnxruntime::test::.*</Function>
<Function>.*::__GetTestMethodInfo.*</Function>
<Function>^Microsoft::VisualStudio::CppCodeCoverageFramework::.*</Function>
<Function>^Microsoft::VisualStudio::CppUnitTestFramework::.*</Function>
</Exclude>
</Functions>
<!-- Match the path of the source files in which each method is defined: -->
<Sources>
<Include>
<Source>.*\\include\\onnxruntime\\core\\.*</Source>
<Source>.*\\onnxruntime\\core\\.*</Source>
<Source>.*\\onnxruntime\\featurizers_ops\\.*</Source>
<Source>.*\\onnxruntime\\contrib_ops\\.*</Source>
</Include>
<Exclude>
<Source>.*\\atlmfc\\.*</Source>
<Source>.*\\vctools\\.*</Source>
<Source>.*\\public\\sdk\\.*</Source>
<Source>.*\\microsoft sdks\\.*</Source>
<Source>.*\\vc\\include\\.*</Source>
<Source>.*\\vc\\tools\\msvc\\.*</Source>
<Source>.*\\cmake\\external\\.*</Source>
</Exclude>
</Sources>
</CodeCoverage>
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
</RunSettings>
\ No newline at end of file
#Name;Url;SHA1
#This is a CSV file.
#The columns are separated by ";" because a list in cmake is just a ";" separated group of strings.
#Names should be in lower case. They will be used as variable names in cmake.
#URLs can be either https URLs or local file paths in cmake-style(directory separator is a forward slash character).
#SHA1 hashes can be generated by running sha1sum command.
#If you need to change abseil's version to a different one, you may also want to update external\abseil-cpp.natvis
#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;file:///data/onnxruntimefiles/20211102.0.zip;ce61532df974d00025b1220408ce1c900d81baf2
microsoft_gsl;file:///data/onnxruntimefiles/GSL-4.0.0.zip;cf368104cd22a87b4dd0c80228919bb2df3e2a14
onnx;file:///data/onnxruntimefiles/onnx-5a5f8a5935762397aa68429b5493084ff970f774.zip;edc8e1338c02f3ab222f3d803a24e17608c13895
protobuf;file:///data/onnxruntimefiles/protobuf-3.18.3.zip;b95bf7e9de9c2249b6c1f2ca556ace49999e90bd
if (NOT SNPE_ARCH_ABI)
if(MSVC)
string(TOLOWER ${CMAKE_GENERATOR_PLATFORM} GEN_PLATFORM)
message(STATUS "Building MSVC for architecture ${CMAKE_SYSTEM_PROCESSOR} with CMAKE_GENERATOR_PLATFORM as ${GEN_PLATFORM}")
if (${GEN_PLATFORM} STREQUAL "arm64")
set(SNPE_ARCH_ABI aarch64-windows-vc19)
else()
set(SNPE_ARCH_ABI x86_64-windows-vc19)
endif()
else()
if (CMAKE_SYSTEM_NAME STREQUAL "Android")
set(SNPE_ARCH_ABI aarch64-android-clang6.0)
elseif (LINUX)
if (${GEN_PLATFORM} STREQUAL "x64")
set(SNPE_ARCH_ABI x86_64-linux-clang)
else()
set(SNPE_ARCH_ABI aarch64-linux-gcc4.9)
endif()
endif()
endif()
list(APPEND onnxruntime_LINK_DIRS ${SNPE_ROOT}/lib/${SNPE_ARCH_ABI})
endif()
file(TO_CMAKE_PATH ${SNPE_ROOT} SNPE_ROOT)
get_filename_component(SNPE_CMAKE_DIR ${SNPE_ROOT} ABSOLUTE)
file(TO_CMAKE_PATH "${SNPE_CMAKE_DIR}/lib/${SNPE_ARCH_ABI}" SNPE_LIB_DIR)
file(TO_NATIVE_PATH ${SNPE_LIB_DIR} SNPE_NATIVE_DIR)
message(STATUS "Looking for SNPE library in ${SNPE_NATIVE_DIR}")
find_library(SNPE NAMES snpe SNPE libSNPE.so PATHS "${SNPE_NATIVE_DIR}" "${SNPE_ROOT}" NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH REQUIRED)
file(GLOB SNPE_SO_FILES LIST_DIRECTORIES false "${SNPE_CMAKE_DIR}/lib/${SNPE_ARCH_ABI}/*.so" "${SNPE_CMAKE_DIR}/lib/${SNPE_ARCH_ABI}/*.dll")
# add dsp skel files to distribution
file(GLOB SNPE_DSP_FILES LIST_DIRECTORIES false "${SNPE_CMAKE_DIR}/lib/dsp/*.so")
list(APPEND SNPE_SO_FILES ${QCDK_FILES} ${SNPE_DSP_FILES})
if(NOT SNPE OR NOT SNPE_SO_FILES)
message(ERROR "Snpe not found in ${SNPE_CMAKE_DIR}/lib/${SNPE_ARCH_ABI} for platform ${CMAKE_GENERATOR_PLATFORM}")
endif()
set(SNPE_NN_LIBS ${SNPE})
if(ANDROID)
# Use libc++_shared.so from SNPE SDK
list(APPEND SNPE_NN_LIBS libc++_shared.so)
endif()
message(STATUS "SNPE library at ${SNPE}")
message(STATUS "SNPE so/dlls in ${SNPE_SO_FILES}")
\ No newline at end of file
# Options to configure the toolchain.
set(GDK_EDITION 210602 CACHE STRING "GDK edition.")
set(GDK_PLATFORM Scarlett CACHE STRING "GDK target platform.")
# Required to propagate variables when CMake calls try_compile() to test the toolchain.
# https://cmake.org/cmake/help/latest/variable/CMAKE_TRY_COMPILE_PLATFORM_VARIABLES.html
set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES GDK_EDITION GDK_PLATFORM)
cmake_path(SET gdk_gxdk_path $ENV{GameDK}/${GDK_EDITION}/GXDK NORMALIZE)
# Set C/C++ compile flags and additional include directories.
foreach(lang C CXX)
set(CMAKE_${lang}_FLAGS_INIT "")
string(APPEND CMAKE_${lang}_FLAGS_INIT
" /D_GAMING_XBOX"
" /DWINAPI_FAMILY=WINAPI_FAMILY_GAMES"
" /D_ATL_NO_DEFAULT_LIBS"
" /D__WRL_NO_DEFAULT_LIB__"
" /D__WRL_CLASSIC_COM_STRICT__"
" /D_CRT_USE_WINAPI_PARTITION_APP"
" /DWIN32_LEAN_AND_MEAN"
" /favor:AMD64"
)
if(GDK_PLATFORM STREQUAL Scarlett)
string(APPEND CMAKE_${lang}_FLAGS_INIT " /D_GAMING_XBOX_SCARLETT /arch:AVX2")
elseif(GDK_PLATFORM STREQUAL XboxOne)
string(APPEND CMAKE_${lang}_FLAGS_INIT " /D_GAMING_XBOX_XBOXONE /arch:AVX")
endif()
set(CMAKE_${lang}_STANDARD_INCLUDE_DIRECTORIES ${gdk_gxdk_path}/gameKit/Include/${GDK_PLATFORM})
set(CMAKE_${lang}_STANDARD_LIBRARIES "onecoreuap_apiset.lib" CACHE STRING "" FORCE)
endforeach()
# It's best to avoid inadvertently linking with any libraries not present in the OS.
list(APPEND nodefault_libs
advapi32.lib
comctl32.lib
comsupp.lib
dbghelp.lib
gdi32.lib
gdiplus.lib
guardcfw.lib
kernel32.lib
mmc.lib
msimg32.lib
msvcole.lib
msvcoled.lib
mswsock.lib
ntstrsafe.lib
ole2.lib
ole2autd.lib
ole2auto.lib
ole2d.lib
ole2ui.lib
ole2uid.lib
ole32.lib
oleacc.lib
oleaut32.lib
oledlg.lib
oledlgd.lib
oldnames.lib
runtimeobject.lib
shell32.lib
shlwapi.lib
strsafe.lib
urlmon.lib
user32.lib
userenv.lib
wlmole.lib
wlmoled.lib
onecore.lib
)
foreach(link_type EXE SHARED MODULE)
set(CMAKE_${link_type}_LINKER_FLAGS_INIT "")
foreach(lib ${nodefault_libs})
string(APPEND CMAKE_${link_type}_LINKER_FLAGS_INIT " /NODEFAULTLIB:${lib}")
endforeach()
string(APPEND CMAKE_${link_type}_LINKER_FLAGS_INIT " /DYNAMICBASE /NXCOMPAT /MANIFEST:NO")
endforeach()
set(gdk_dx_libs ${gdk_gxdk_path}/gameKit/lib/amd64/PIXEvt.lib)
if(GDK_PLATFORM STREQUAL Scarlett)
list(APPEND gdk_dx_libs ${gdk_gxdk_path}/gameKit/lib/amd64/Scarlett/d3d12_xs.lib)
list(APPEND gdk_dx_libs ${gdk_gxdk_path}/gameKit/lib/amd64/Scarlett/xg_xs.lib)
elseif(GDK_PLATFORM STREQUAL XboxOne)
list(APPEND gdk_dx_libs ${gdk_gxdk_path}/gameKit/lib/amd64/XboxOne/d3d12_x.lib)
list(APPEND gdk_dx_libs ${gdk_gxdk_path}/gameKit/lib/amd64/XboxOne/xg_x.lib)
endif()
\ No newline at end of file
prefix=@CMAKE_INSTALL_PREFIX@
bindir=${prefix}/@CMAKE_INSTALL_BINDIR@
mandir=${prefix}/@CMAKE_INSTALL_MANDIR@
docdir=${prefix}/@CMAKE_INSTALL_DOCDIR@
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@/@CMAKE_PROJECT_NAME@
Name: @CMAKE_PROJECT_NAME@
Description: ONNX runtime
URL: https://github.com/microsoft/@CMAKE_PROJECT_NAME@
Version: @ORT_VERSION@
Libs: -L${libdir} -l@CMAKE_PROJECT_NAME@
Cflags: -I${includedir}
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
cmake_minimum_required(VERSION 3.0)
# Determines the version of a native nuget package from the root packages.config.
#
# id : package id
# out : name of variable to set result
function(package_version id out packages_config)
file(READ ${packages_config} packages_config_contents)
string(REGEX MATCH "package[ ]*id[ ]*=[ ]*\"${id}\"" found_package_id ${packages_config_contents})
if (NOT(found_package_id))
message(FATAL_ERROR "Could not find '${id}' in packages.config!")
endif()
set(pattern ".*id[ ]*=[ ]*\"${id}\"[ ]+version=\"([0-9a-zA-Z\\.-]+)\"[ ]+targetFramework.*")
string(REGEX REPLACE ${pattern} "\\1" version ${packages_config_contents})
set(${out} ${version} PARENT_SCOPE)
endfunction()
# Downloads the nuget packages based on packages.config
function(
add_fetch_nuget_target
nuget_target # Target to be written to
target_dependency # The file in the nuget package that is needed
)
# Pull down the nuget packages
if (NOT(MSVC) OR NOT(WIN32))
message(FATAL_ERROR "NuGet packages are only supported for MSVC on Windows.")
endif()
# Retrieve the latest version of nuget
include(ExternalProject)
ExternalProject_Add(nuget_exe
PREFIX nuget_exe
URL "https://dist.nuget.org/win-x86-commandline/v5.3.0/nuget.exe"
DOWNLOAD_NO_EXTRACT 1
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
UPDATE_COMMAND ""
INSTALL_COMMAND "")
set(NUGET_CONFIG ${PROJECT_SOURCE_DIR}/../NuGet.config)
set(PACKAGES_CONFIG ${PROJECT_SOURCE_DIR}/../packages.config)
get_filename_component(PACKAGES_DIR ${CMAKE_CURRENT_BINARY_DIR}/../packages ABSOLUTE)
# Restore nuget packages
add_custom_command(
OUTPUT ${target_dependency}
DEPENDS ${PACKAGES_CONFIG} ${NUGET_CONFIG}
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/nuget_exe/src/nuget restore ${PACKAGES_CONFIG} -PackagesDirectory ${PACKAGES_DIR} -ConfigFile ${NUGET_CONFIG}
VERBATIM)
add_custom_target(${nuget_target} DEPENDS ${target_dependency})
add_dependencies(${nuget_target} nuget_exe)
endfunction()
\ No newline at end of file
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
if(UNIX)
set(SYMBOL_FILE ${CMAKE_CURRENT_BINARY_DIR}/onnxruntime.lds)
if(APPLE)
set(OUTPUT_STYLE xcode)
else()
set(OUTPUT_STYLE gcc)
endif()
else()
set(SYMBOL_FILE ${CMAKE_CURRENT_BINARY_DIR}/onnxruntime_dll.def)
set(OUTPUT_STYLE vc)
endif()
if (${CMAKE_SYSTEM_NAME} STREQUAL "iOS")
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
set(OUTPUT_STYLE xcode)
endif()
# This macro is to get the path of header files for mobile packaging, for iOS and Android
macro(get_mobile_api_headers _HEADERS)
# include both c and cxx api
set(${_HEADERS}
"${REPO_ROOT}/include/onnxruntime/core/session/onnxruntime_c_api.h"
"${REPO_ROOT}/include/onnxruntime/core/session/onnxruntime_cxx_api.h"
"${REPO_ROOT}/include/onnxruntime/core/session/onnxruntime_cxx_inline.h"
)
# need to add header files for enabled EPs
foreach(f ${ONNXRUNTIME_PROVIDER_NAMES})
file(GLOB _provider_headers CONFIGURE_DEPENDS
"${REPO_ROOT}/include/onnxruntime/core/providers/${f}/*.h"
)
list(APPEND ${_HEADERS} "${_provider_headers}")
unset(_provider_headers)
endforeach()
endmacro()
#If you want to verify if there is any extra line in symbols.txt, run
# nm -C -g --defined libonnxruntime.so |grep -v '\sA\s' | cut -f 3 -d ' ' | sort
# after build
list(APPEND SYMBOL_FILES "${REPO_ROOT}/tools/ci_build/gen_def.py")
foreach(f ${ONNXRUNTIME_PROVIDER_NAMES})
list(APPEND SYMBOL_FILES "${ONNXRUNTIME_ROOT}/core/providers/${f}/symbols.txt")
endforeach()
add_custom_command(OUTPUT ${SYMBOL_FILE} ${CMAKE_CURRENT_BINARY_DIR}/generated_source.c
COMMAND ${Python_EXECUTABLE} "${REPO_ROOT}/tools/ci_build/gen_def.py"
--version_file "${ONNXRUNTIME_ROOT}/../VERSION_NUMBER" --src_root "${ONNXRUNTIME_ROOT}"
--config ${ONNXRUNTIME_PROVIDER_NAMES} --style=${OUTPUT_STYLE} --output ${SYMBOL_FILE}
--output_source ${CMAKE_CURRENT_BINARY_DIR}/generated_source.c
DEPENDS ${SYMBOL_FILES}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
add_custom_target(onnxruntime_generate_def ALL DEPENDS ${SYMBOL_FILE} ${CMAKE_CURRENT_BINARY_DIR}/generated_source.c)
if(WIN32)
onnxruntime_add_shared_library(onnxruntime
${SYMBOL_FILE}
"${ONNXRUNTIME_ROOT}/core/dll/dllmain.cc"
"${ONNXRUNTIME_ROOT}/core/dll/onnxruntime.rc"
)
elseif(onnxruntime_BUILD_APPLE_FRAMEWORK)
get_mobile_api_headers(APPLE_FRAMEWORK_HEADERS)
# apple framework requires the header file be part of the library
onnxruntime_add_shared_library(onnxruntime
${APPLE_FRAMEWORK_HEADERS}
"${CMAKE_CURRENT_BINARY_DIR}/generated_source.c"
)
# create Info.plist for the framework and podspec for CocoaPods (optional)
set(MACOSX_FRAMEWORK_NAME "onnxruntime")
set(MACOSX_FRAMEWORK_IDENTIFIER "com.microsoft.onnxruntime")
# Need to include CoreML as a weaklink for CocoaPods package if the EP is enabled
if(onnxruntime_USE_COREML)
set(APPLE_WEAK_FRAMEWORK "\\\"CoreML\\\"")
endif()
set(INFO_PLIST_PATH "${CMAKE_CURRENT_BINARY_DIR}/Info.plist")
configure_file(${REPO_ROOT}/cmake/Info.plist.in ${INFO_PLIST_PATH})
configure_file(
${REPO_ROOT}/tools/ci_build/github/apple/framework_info.json.template
${CMAKE_CURRENT_BINARY_DIR}/framework_info.json)
set_target_properties(onnxruntime PROPERTIES
FRAMEWORK TRUE
FRAMEWORK_VERSION A
PUBLIC_HEADER "${APPLE_FRAMEWORK_HEADERS}"
MACOSX_FRAMEWORK_INFO_PLIST ${CMAKE_CURRENT_BINARY_DIR}/Info.plist
VERSION ${ORT_VERSION}
SOVERSION ${ORT_VERSION}
)
else()
onnxruntime_add_shared_library(onnxruntime ${CMAKE_CURRENT_BINARY_DIR}/generated_source.c)
if (onnxruntime_USE_CUDA)
set_property(TARGET onnxruntime APPEND_STRING PROPERTY LINK_FLAGS " -Xlinker -rpath=\\$ORIGIN")
endif()
endif()
add_dependencies(onnxruntime onnxruntime_generate_def ${onnxruntime_EXTERNAL_DEPENDENCIES})
target_include_directories(onnxruntime PRIVATE ${ONNXRUNTIME_ROOT})
target_compile_definitions(onnxruntime PRIVATE VER_MAJOR=${VERSION_MAJOR_PART})
target_compile_definitions(onnxruntime PRIVATE VER_MINOR=${VERSION_MINOR_PART})
target_compile_definitions(onnxruntime PRIVATE VER_BUILD=${VERSION_BUILD_PART})
target_compile_definitions(onnxruntime PRIVATE VER_PRIVATE=${VERSION_PRIVATE_PART})
target_compile_definitions(onnxruntime PRIVATE VER_STRING=\"${VERSION_STRING}\")
target_compile_definitions(onnxruntime PRIVATE FILE_NAME=\"onnxruntime.dll\")
if(UNIX)
if (APPLE)
set(ONNXRUNTIME_SO_LINK_FLAG " -Xlinker -dead_strip")
else()
set(ONNXRUNTIME_SO_LINK_FLAG " -Xlinker --version-script=${SYMBOL_FILE} -Xlinker --no-undefined -Xlinker --gc-sections -z noexecstack")
endif()
else()
set(ONNXRUNTIME_SO_LINK_FLAG " -DEF:${SYMBOL_FILE}")
endif()
if (NOT WIN32)
if (APPLE OR ${CMAKE_SYSTEM_NAME} MATCHES "^iOS")
set(ONNXRUNTIME_SO_LINK_FLAG " -Wl,-exported_symbols_list,${SYMBOL_FILE}")
if (${CMAKE_SYSTEM_NAME} STREQUAL "iOS")
set_target_properties(onnxruntime PROPERTIES
SOVERSION ${ORT_VERSION}
MACOSX_RPATH TRUE
INSTALL_RPATH_USE_LINK_PATH FALSE
BUILD_WITH_INSTALL_NAME_DIR TRUE
INSTALL_NAME_DIR @rpath)
else()
set_target_properties(onnxruntime PROPERTIES INSTALL_RPATH "@loader_path")
endif()
elseif (NOT onnxruntime_BUILD_WEBASSEMBLY)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-rpath='$ORIGIN'")
endif()
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Android" AND onnxruntime_MINIMAL_BUILD)
# target onnxruntime is a shared library, the dummy __cxa_demangle is only attach to it to avoid
# affecting downstream ort library users with the behaviour of dummy __cxa_demangle. So the dummy
# __cxa_demangle must not expose to libonnxruntime_common.a. It works as when the linker is
# creating the DSO, our dummy __cxa_demangle always comes before libc++abi.a so the
# __cxa_demangle in libc++abi.a is discarded, thus, huge binary size reduction.
target_sources(onnxruntime PRIVATE "${ONNXRUNTIME_ROOT}/core/platform/android/cxa_demangle.cc")
target_compile_definitions(onnxruntime PRIVATE USE_DUMMY_EXA_DEMANGLE=1)
endif()
# strip binary on Android, or for a minimal build on Unix
if(CMAKE_SYSTEM_NAME STREQUAL "Android" OR (onnxruntime_MINIMAL_BUILD AND UNIX))
if (onnxruntime_MINIMAL_BUILD AND ADD_DEBUG_INFO_TO_MINIMAL_BUILD)
# don't strip
else()
set_target_properties(onnxruntime PROPERTIES LINK_FLAGS_RELEASE -s)
set_target_properties(onnxruntime PROPERTIES LINK_FLAGS_MINSIZEREL -s)
endif()
endif()
# we need to copy C/C++ API headers to be packed into Android AAR package
if(CMAKE_SYSTEM_NAME STREQUAL "Android" AND onnxruntime_BUILD_JAVA)
get_mobile_api_headers(ANDROID_AAR_HEADERS)
set(ANDROID_HEADERS_DIR ${CMAKE_CURRENT_BINARY_DIR}/android/headers)
file(MAKE_DIRECTORY ${ANDROID_HEADERS_DIR})
# copy the header files one by one
foreach(h_ ${ANDROID_AAR_HEADERS})
get_filename_component(HEADER_NAME_ ${h_} NAME)
add_custom_command(TARGET onnxruntime POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${h_} ${ANDROID_HEADERS_DIR}/${HEADER_NAME_})
endforeach()
endif()
# This list is a reversed topological ordering of library dependencies.
# Earlier entries may depend on later ones. Later ones should not depend on earlier ones.
set(onnxruntime_INTERNAL_LIBRARIES
onnxruntime_session
${onnxruntime_libs}
${PROVIDERS_ACL}
${PROVIDERS_ARMNN}
${PROVIDERS_COREML}
${PROVIDERS_DML}
${PROVIDERS_NNAPI}
${PROVIDERS_SNPE}
${PROVIDERS_TVM}
${PROVIDERS_RKNPU}
# ${PROVIDERS_ROCM}
${PROVIDERS_VITISAI}
${PROVIDERS_XNNPACK}
${PROVIDERS_INTERNAL_TESTING}
${onnxruntime_winml}
onnxruntime_optimizer
onnxruntime_providers
${onnxruntime_tvm_libs}
onnxruntime_framework
onnxruntime_graph
onnxruntime_util
${ONNXRUNTIME_MLAS_LIBS}
onnxruntime_common
onnxruntime_flatbuffers
)
if (onnxruntime_ENABLE_LANGUAGE_INTEROP_OPS)
list(APPEND onnxruntime_INTERNAL_LIBRARIES
onnxruntime_language_interop
onnxruntime_pyop
)
endif()
# If you are linking a new library, please add it to the list onnxruntime_INTERNAL_LIBRARIES or onnxruntime_EXTERNAL_LIBRARIES,
# Please do not add a library directly to the target_link_libraries command
target_link_libraries(onnxruntime PRIVATE
${onnxruntime_INTERNAL_LIBRARIES}
${onnxruntime_EXTERNAL_LIBRARIES}
)
set_property(TARGET onnxruntime APPEND_STRING PROPERTY LINK_FLAGS ${ONNXRUNTIME_SO_LINK_FLAG} ${onnxruntime_DELAYLOAD_FLAGS})
set_target_properties(onnxruntime PROPERTIES LINK_DEPENDS ${SYMBOL_FILE})
set_target_properties(onnxruntime PROPERTIES VERSION ${ORT_VERSION})
install(TARGETS onnxruntime
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
FRAMEWORK DESTINATION ${CMAKE_INSTALL_BINDIR})
set_target_properties(onnxruntime PROPERTIES FOLDER "ONNXRuntime")
if (WIN32 AND NOT CMAKE_CXX_STANDARD_LIBRARIES MATCHES kernel32.lib)
# Workaround STL bug https://github.com/microsoft/STL/issues/434#issuecomment-921321254
# Note that the workaround makes std::system_error crash before Windows 10
# The linker warns "LNK4199: /DELAYLOAD:api-ms-win-core-heapl2-1-0.dll ignored; no imports found from api-ms-win-core-heapl2-1-0.dll"
# when you're not using imports directly, even though the import exists in the STL and the DLL would have been linked without DELAYLOAD
target_link_options(onnxruntime PRIVATE /DELAYLOAD:api-ms-win-core-heapl2-1-0.dll /ignore:4199)
endif()
if (winml_is_inbox)
# Apply linking flags required by inbox static analysis tools
target_link_options(onnxruntime PRIVATE ${os_component_link_flags_list})
# Link *_x64/*_arm64 DLLs for the ARM64X forwarder
function(duplicate_shared_library target new_target)
get_target_property(sources ${target} SOURCES)
get_target_property(compile_definitions ${target} COMPILE_DEFINITIONS)
get_target_property(compile_options ${target} COMPILE_OPTIONS)
get_target_property(include_directories ${target} INCLUDE_DIRECTORIES)
get_target_property(link_libraries ${target} LINK_LIBRARIES)
get_target_property(link_flags ${target} LINK_FLAGS)
get_target_property(link_options ${target} LINK_OPTIONS)
add_library(${new_target} SHARED ${sources})
add_dependencies(${target} ${new_target})
target_compile_definitions(${new_target} PRIVATE ${compile_definitions})
target_compile_options(${new_target} PRIVATE ${compile_options})
target_include_directories(${new_target} PRIVATE ${include_directories})
target_link_libraries(${new_target} PRIVATE ${link_libraries})
set_property(TARGET ${new_target} PROPERTY LINK_FLAGS "${link_flags}")
target_link_options(${new_target} PRIVATE ${link_options})
endfunction()
if (WAI_ARCH STREQUAL x64 OR WAI_ARCH STREQUAL arm64)
duplicate_shared_library(onnxruntime onnxruntime_${WAI_ARCH})
endif()
endif()
# Assemble the Apple static framework (iOS and macOS)
if(onnxruntime_BUILD_APPLE_FRAMEWORK)
set(STATIC_LIB_DIR ${CMAKE_CURRENT_BINARY_DIR}/static_libraries)
file(MAKE_DIRECTORY ${STATIC_LIB_DIR})
# Remove the existing files in the STATIC_LIB_DIR folder
file(GLOB _OLD_STATIC_LIBS ${STATIC_LIB_DIR}/*.a)
file(REMOVE "${_OLD_STATIC_LIBS}")
# Go through all the static libraries, and create symbolic links
foreach(_LIB ${onnxruntime_INTERNAL_LIBRARIES} ${onnxruntime_EXTERNAL_LIBRARIES})
GET_TARGET_PROPERTY(_LIB_TYPE ${_LIB} TYPE)
if(_LIB_TYPE STREQUAL "STATIC_LIBRARY")
add_custom_command(TARGET onnxruntime POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE:${_LIB}> ${STATIC_LIB_DIR}/$<TARGET_LINKER_FILE_NAME:${_LIB}>)
endif()
endforeach()
if(${CMAKE_SYSTEM_NAME} STREQUAL "iOS")
set(STATIC_FRAMEWORK_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}-${CMAKE_OSX_SYSROOT})
else() # macOS
set(STATIC_FRAMEWORK_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
endif()
# Assemble the static framework
set(STATIC_FRAMEWORK_DIR ${STATIC_FRAMEWORK_OUTPUT_DIR}/static_framework/onnxruntime.framework)
set(STATIC_FRAMEWORK_HEADER_DIR ${STATIC_FRAMEWORK_DIR}/Headers)
file(MAKE_DIRECTORY ${STATIC_FRAMEWORK_DIR})
# Remove all files under STATIC_FRAMEWORK_DIR (if any)
file(GLOB_RECURSE _OLD_STATIC_FRAMEWORK ${STATIC_FRAMEWORK_DIR}/*.*)
file(REMOVE "${_OLD_STATIC_FRAMEWORK}")
file(MAKE_DIRECTORY ${STATIC_FRAMEWORK_HEADER_DIR})
# copy the header files one by one, and the Info.plist
foreach(h_ ${APPLE_FRAMEWORK_HEADERS})
get_filename_component(HEADER_NAME_ ${h_} NAME)
add_custom_command(TARGET onnxruntime POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${h_} ${STATIC_FRAMEWORK_HEADER_DIR}/${HEADER_NAME_})
endforeach()
add_custom_command(TARGET onnxruntime POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INFO_PLIST_PATH} ${STATIC_FRAMEWORK_DIR}/Info.plist)
# link the static library
add_custom_command(TARGET onnxruntime POST_BUILD COMMAND libtool -static -o ${STATIC_FRAMEWORK_DIR}/onnxruntime *.a WORKING_DIRECTORY ${STATIC_LIB_DIR})
endif()
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
file(GLOB_RECURSE onnxruntime_codegen_common_srcs
"${ONNXRUNTIME_ROOT}/core/codegen/common/*.h"
"${ONNXRUNTIME_ROOT}/core/codegen/common/*.cc"
)
file(GLOB_RECURSE onnxruntime_codegen_tvm_srcs CONFIGURE_DEPENDS
"${ONNXRUNTIME_ROOT}/core/codegen/mti/*.h"
"${ONNXRUNTIME_ROOT}/core/codegen/mti/*.cc"
"${ONNXRUNTIME_ROOT}/core/codegen/passes/*.h"
"${ONNXRUNTIME_ROOT}/core/codegen/passes/*.cc"
)
source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_codegen_common_srcs} ${onnxruntime_codegen_tvm_srcs})
#onnxruntime_codegen_tvm depends on onnxruntime framework
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)
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})
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
set(onnxruntime_common_src_patterns
"${ONNXRUNTIME_INCLUDE_DIR}/core/common/*.h"
"${ONNXRUNTIME_INCLUDE_DIR}/core/common/logging/*.h"
"${ONNXRUNTIME_INCLUDE_DIR}/core/platform/*.h"
"${ONNXRUNTIME_ROOT}/core/common/*.h"
"${ONNXRUNTIME_ROOT}/core/common/*.cc"
"${ONNXRUNTIME_ROOT}/core/common/logging/*.h"
"${ONNXRUNTIME_ROOT}/core/common/logging/*.cc"
"${ONNXRUNTIME_ROOT}/core/common/logging/sinks/*.h"
"${ONNXRUNTIME_ROOT}/core/common/logging/sinks/*.cc"
"${ONNXRUNTIME_ROOT}/core/platform/env.h"
"${ONNXRUNTIME_ROOT}/core/platform/env.cc"
"${ONNXRUNTIME_ROOT}/core/platform/env_time.h"
"${ONNXRUNTIME_ROOT}/core/platform/env_time.cc"
"${ONNXRUNTIME_ROOT}/core/platform/path_lib.h"
"${ONNXRUNTIME_ROOT}/core/platform/path_lib.cc"
"${ONNXRUNTIME_ROOT}/core/platform/scoped_resource.h"
"${ONNXRUNTIME_ROOT}/core/platform/telemetry.h"
"${ONNXRUNTIME_ROOT}/core/platform/telemetry.cc"
"${ONNXRUNTIME_ROOT}/core/platform/logging/make_platform_default_log_sink.h"
"${ONNXRUNTIME_ROOT}/core/platform/logging/make_platform_default_log_sink.cc"
"$(ONNXRUNTIME_ROOT}/core/quantization/*.h"
"$(ONNXRUNTIME_ROOT}/core/quantization/*.cc"
)
if(WIN32)
list(APPEND onnxruntime_common_src_patterns
"${ONNXRUNTIME_ROOT}/core/platform/windows/*.h"
"${ONNXRUNTIME_ROOT}/core/platform/windows/*.cc"
"${ONNXRUNTIME_ROOT}/core/platform/windows/logging/*.h"
"${ONNXRUNTIME_ROOT}/core/platform/windows/logging/*.cc"
)
else()
list(APPEND onnxruntime_common_src_patterns
"${ONNXRUNTIME_ROOT}/core/platform/posix/*.h"
"${ONNXRUNTIME_ROOT}/core/platform/posix/*.cc"
)
if (onnxruntime_USE_SYSLOG)
list(APPEND onnxruntime_common_src_patterns
"${ONNXRUNTIME_ROOT}/core/platform/posix/logging/*.h"
"${ONNXRUNTIME_ROOT}/core/platform/posix/logging/*.cc"
)
endif()
if (CMAKE_SYSTEM_NAME STREQUAL "Android")
list(APPEND onnxruntime_common_src_patterns
"${ONNXRUNTIME_ROOT}/core/platform/android/logging/*.h"
"${ONNXRUNTIME_ROOT}/core/platform/android/logging/*.cc"
)
endif()
if (APPLE)
list(APPEND onnxruntime_common_src_patterns
"${ONNXRUNTIME_ROOT}/core/platform/apple/logging/*.h"
"${ONNXRUNTIME_ROOT}/core/platform/apple/logging/*.mm"
)
endif()
endif()
if(onnxruntime_target_platform STREQUAL "ARM64EC")
if (MSVC)
link_directories("$ENV{VCINSTALLDIR}/Tools/MSVC/$ENV{VCToolsVersion}/lib/ARM64EC")
link_directories("$ENV{VCINSTALLDIR}/Tools/MSVC/$ENV{VCToolsVersion}/ATLMFC/lib/ARM64EC")
link_libraries(softintrin.lib)
add_compile_options("/bigobj")
endif()
endif()
file(GLOB onnxruntime_common_src CONFIGURE_DEPENDS
${onnxruntime_common_src_patterns}
)
# Remove new/delete intercept. To deal with memory leaks
# Use either non-mimalloc build OR use mimalloc built-in features.
if(WIN32 AND onnxruntime_USE_MIMALLOC)
list(REMOVE_ITEM onnxruntime_common_src
"${ONNXRUNTIME_ROOT}/core/platform/windows/debug_alloc.cc"
"${ONNXRUNTIME_ROOT}/core/platform/windows/debug_alloc.h")
endif()
source_group(TREE ${REPO_ROOT} FILES ${onnxruntime_common_src})
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()
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")
target_sources(
onnxruntime_common
INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/external/${ABSEIL_NATVIS_FILE}>)
endif()
endif()
onnxruntime_add_include_to_target(onnxruntime_common date_interface 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()
add_dependencies(onnxruntime_common ${onnxruntime_EXTERNAL_DEPENDENCIES})
install(DIRECTORY ${PROJECT_SOURCE_DIR}/../include/onnxruntime/core/common DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnxruntime/core)
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")
endif()
# check if we need to link against libatomic due to std::atomic usage by the threadpool code
# e.g. Raspberry Pi requires this
if (onnxruntime_LINK_LIBATOMIC)
list(APPEND onnxruntime_EXTERNAL_LIBRARIES atomic)
endif()
if(APPLE)
target_link_libraries(onnxruntime_common "-framework Foundation")
endif()
if(MSVC)
if(onnxruntime_target_platform STREQUAL "ARM64")
set(ARM64 TRUE)
elseif (onnxruntime_target_platform STREQUAL "ARM")
set(ARM TRUE)
elseif(onnxruntime_target_platform STREQUAL "x64")
set(X64 TRUE)
elseif(onnxruntime_target_platform STREQUAL "x86")
set(X86 TRUE)
endif()
elseif(APPLE)
if(CMAKE_OSX_ARCHITECTURES_LEN LESS_EQUAL 1)
set(X64 TRUE)
endif()
elseif(NOT onnxruntime_BUILD_WEBASSEMBLY)
if (CMAKE_SYSTEM_NAME STREQUAL "Android")
if (CMAKE_ANDROID_ARCH_ABI STREQUAL "armeabi-v7a")
set(ARM TRUE)
elseif (CMAKE_ANDROID_ARCH_ABI STREQUAL "arm64-v8a")
set(ARM64 TRUE)
elseif (CMAKE_ANDROID_ARCH_ABI STREQUAL "x86_64")
set(X86_64 TRUE)
elseif (CMAKE_ANDROID_ARCH_ABI STREQUAL "x86")
set(X86 TRUE)
endif()
else()
execute_process(
COMMAND ${CMAKE_C_COMPILER} -dumpmachine
OUTPUT_VARIABLE dumpmachine_output
ERROR_QUIET
)
if(dumpmachine_output MATCHES "^arm64.*")
set(ARM64 TRUE)
elseif(dumpmachine_output MATCHES "^arm.*")
set(ARM TRUE)
elseif(dumpmachine_output MATCHES "^aarch64.*")
set(ARM64 TRUE)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(i.86|x86?)$")
set(X86 TRUE)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|amd64)$")
set(X86_64 TRUE)
endif()
endif()
endif()
if (ARM64 OR ARM OR X86 OR X64 OR X86_64)
if((WIN32 AND NOT CMAKE_CXX_STANDARD_LIBRARIES MATCHES kernel32.lib) OR ((ARM64 OR ARM) AND MSVC))
# msvc compiler report syntax error with cpuinfo arm source files
# and cpuinfo does not have code for getting arm uarch info under windows
else()
# 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)
list(APPEND onnxruntime_EXTERNAL_LIBRARIES cpuinfo clog)
endif()
endif()
endif()
if (NOT onnxruntime_BUILD_SHARED_LIB)
install(TARGETS onnxruntime_common
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
FRAMEWORK DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment