Skip to content

Commit

Permalink
Update DirectML preview package with unmangled names
Browse files Browse the repository at this point in the history
  • Loading branch information
fdwr committed Jun 16, 2022
1 parent ff8b173 commit babd6e3
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 58 deletions.
2 changes: 1 addition & 1 deletion .pipelines/nuget_config/x64/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="python" version="3.7.9" targetFramework="native" />
<package id="Microsoft.AI.DirectML.Preview" version="1.9.0-dev2b57b4f738b1d0dcc2dd31ecd502e36f4e3ea5a0" targetFramework="native" />
<package id="Microsoft.AI.DirectML.Preview" version="1.9.0-devd10042c94985065a565c042540e15eb75b554663" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.201201.7" targetFramework="native" />
</packages>
2 changes: 1 addition & 1 deletion .pipelines/nuget_config/x86/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="pythonx86" version="3.7.9" targetFramework="native" />
<package id="Microsoft.AI.DirectML.Preview" version="1.9.0-dev2b57b4f738b1d0dcc2dd31ecd502e36f4e3ea5a0" targetFramework="native" />
<package id="Microsoft.AI.DirectML.Preview" version="1.9.0-devd10042c94985065a565c042540e15eb75b554663" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.201201.7" targetFramework="native" />
</packages>
59 changes: 5 additions & 54 deletions cmake/external/dml.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,72 +40,23 @@ if (NOT onnxruntime_USE_CUSTOM_DIRECTML)
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)
set(DML_PACKAGE_DIR ${PACKAGES_DIR}/Microsoft.AI.DirectML.Preview.1.9.0-dev2b57b4f738b1d0dcc2dd31ecd502e36f4e3ea5a0)
set(DML_PACKAGE_DIR ${PACKAGES_DIR}/Microsoft.AI.DirectML.Preview.1.9.0-devd10042c94985065a565c042540e15eb75b554663)
set(DML_SHARED_LIB DirectML.dll)

# If using the preview package, extract the SHA-1 from the path so we can unmangle the filenames later.
# e.g. "Microsoft.AI.DirectML.Preview.1.9.0-dev2b57b4f738b1d0dcc2dd31ecd502e36f4e3ea5a0"
if(DML_PACKAGE_DIR MATCHES ".*Preview.*-dev(.*)")
set(DML_PREVIEW_FILENAME_SUFFIX ".${CMAKE_MATCH_1}")
endif()

# Restore nuget packages, which will pull down the DirectML redist package.
add_custom_command(
OUTPUT
${DML_PACKAGE_DIR}/bin/x64-win/DirectML${DML_PREVIEW_FILENAME_SUFFIX}.lib
${DML_PACKAGE_DIR}/bin/x86-win/DirectML${DML_PREVIEW_FILENAME_SUFFIX}.lib
${DML_PACKAGE_DIR}/bin/arm-win/DirectML${DML_PREVIEW_FILENAME_SUFFIX}.lib
${DML_PACKAGE_DIR}/bin/arm64-win/DirectML${DML_PREVIEW_FILENAME_SUFFIX}.lib
${DML_PACKAGE_DIR}/bin/x64-win/DirectML.lib
${DML_PACKAGE_DIR}/bin/x86-win/DirectML.lib
${DML_PACKAGE_DIR}/bin/arm-win/DirectML.lib
${DML_PACKAGE_DIR}/bin/arm64-win/DirectML.lib
DEPENDS
${PACKAGES_CONFIG}
${NUGET_CONFIG}
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/nuget/src/nuget restore ${PACKAGES_CONFIG} -PackagesDirectory ${PACKAGES_DIR} -ConfigFile ${NUGET_CONFIG}
VERBATIM
)

# If using a preview package, unmangle the filenames from the nuget so they're useable.
# e.g. Map DirectML.2b57b4f738b1d0dcc2dd31ecd502e36f4e3ea5a0.dll -> DirectML.dll
if(DEFINED DML_PREVIEW_FILENAME_SUFFIX)
add_custom_command(
OUTPUT
${DML_PACKAGE_DIR}/bin/x64-win/DirectML.lib
${DML_PACKAGE_DIR}/bin/x86-win/DirectML.lib
${DML_PACKAGE_DIR}/bin/arm-win/DirectML.lib
${DML_PACKAGE_DIR}/bin/arm64-win/DirectML.lib
DEPENDS
${DML_PACKAGE_DIR}/bin/x64-win/DirectML${DML_PREVIEW_FILENAME_SUFFIX}.lib
${DML_PACKAGE_DIR}/bin/x86-win/DirectML${DML_PREVIEW_FILENAME_SUFFIX}.lib
${DML_PACKAGE_DIR}/bin/arm-win/DirectML${DML_PREVIEW_FILENAME_SUFFIX}.lib
${DML_PACKAGE_DIR}/bin/arm64-win/DirectML${DML_PREVIEW_FILENAME_SUFFIX}.lib

COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DML_PACKAGE_DIR}/bin/x64-win/DirectML${DML_PREVIEW_FILENAME_SUFFIX}.lib ${DML_PACKAGE_DIR}/bin/x64-win/DirectML.lib
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DML_PACKAGE_DIR}/bin/x64-win/DirectML${DML_PREVIEW_FILENAME_SUFFIX}.dll ${DML_PACKAGE_DIR}/bin/x64-win/DirectML.dll
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DML_PACKAGE_DIR}/bin/x64-win/DirectML${DML_PREVIEW_FILENAME_SUFFIX}.pdb ${DML_PACKAGE_DIR}/bin/x64-win/DirectML.pdb
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DML_PACKAGE_DIR}/bin/x64-win/DirectML.Debug${DML_PREVIEW_FILENAME_SUFFIX}.dll ${DML_PACKAGE_DIR}/bin/x64-win/DirectML.Debug.dll
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DML_PACKAGE_DIR}/bin/x64-win/DirectML.Debug${DML_PREVIEW_FILENAME_SUFFIX}.pdb ${DML_PACKAGE_DIR}/bin/x64-win/DirectML.Debug.pdb

COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DML_PACKAGE_DIR}/bin/x86-win/DirectML${DML_PREVIEW_FILENAME_SUFFIX}.lib ${DML_PACKAGE_DIR}/bin/x86-win/DirectML.lib
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DML_PACKAGE_DIR}/bin/x86-win/DirectML${DML_PREVIEW_FILENAME_SUFFIX}.dll ${DML_PACKAGE_DIR}/bin/x86-win/DirectML.dll
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DML_PACKAGE_DIR}/bin/x86-win/DirectML${DML_PREVIEW_FILENAME_SUFFIX}.pdb ${DML_PACKAGE_DIR}/bin/x86-win/DirectML.pdb
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DML_PACKAGE_DIR}/bin/x86-win/DirectML.Debug${DML_PREVIEW_FILENAME_SUFFIX}.dll ${DML_PACKAGE_DIR}/bin/x86-win/DirectML.Debug.dll
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DML_PACKAGE_DIR}/bin/x86-win/DirectML.Debug${DML_PREVIEW_FILENAME_SUFFIX}.pdb ${DML_PACKAGE_DIR}/bin/x86-win/DirectML.Debug.pdb

COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DML_PACKAGE_DIR}/bin/arm-win/DirectML${DML_PREVIEW_FILENAME_SUFFIX}.lib ${DML_PACKAGE_DIR}/bin/arm-win/DirectML.lib
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DML_PACKAGE_DIR}/bin/arm-win/DirectML${DML_PREVIEW_FILENAME_SUFFIX}.dll ${DML_PACKAGE_DIR}/bin/arm-win/DirectML.dll
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DML_PACKAGE_DIR}/bin/arm-win/DirectML${DML_PREVIEW_FILENAME_SUFFIX}.pdb ${DML_PACKAGE_DIR}/bin/arm-win/DirectML.pdb
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DML_PACKAGE_DIR}/bin/arm-win/DirectML.Debug${DML_PREVIEW_FILENAME_SUFFIX}.dll ${DML_PACKAGE_DIR}/bin/arm-win/DirectML.Debug.dll
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DML_PACKAGE_DIR}/bin/arm-win/DirectML.Debug${DML_PREVIEW_FILENAME_SUFFIX}.pdb ${DML_PACKAGE_DIR}/bin/arm-win/DirectML.Debug.pdb

COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DML_PACKAGE_DIR}/bin/arm64-win/DirectML${DML_PREVIEW_FILENAME_SUFFIX}.lib ${DML_PACKAGE_DIR}/bin/arm64-win/DirectML.lib
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DML_PACKAGE_DIR}/bin/arm64-win/DirectML${DML_PREVIEW_FILENAME_SUFFIX}.dll ${DML_PACKAGE_DIR}/bin/arm64-win/DirectML.dll
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DML_PACKAGE_DIR}/bin/arm64-win/DirectML${DML_PREVIEW_FILENAME_SUFFIX}.pdb ${DML_PACKAGE_DIR}/bin/arm64-win/DirectML.pdb
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DML_PACKAGE_DIR}/bin/arm64-win/DirectML.Debug${DML_PREVIEW_FILENAME_SUFFIX}.dll ${DML_PACKAGE_DIR}/bin/arm64-win/DirectML.Debug.dll
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DML_PACKAGE_DIR}/bin/arm64-win/DirectML.Debug${DML_PREVIEW_FILENAME_SUFFIX}.pdb ${DML_PACKAGE_DIR}/bin/arm64-win/DirectML.Debug.pdb

VERBATIM
)
endif()

include_directories(BEFORE "${DML_PACKAGE_DIR}/include")
add_custom_target(
RESTORE_PACKAGES ALL
Expand Down
2 changes: 1 addition & 1 deletion packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="GoogleTestAdapter" version="0.17.1" targetFramework="net46" />
<package id="Microsoft.AI.DirectML.Preview" version="1.9.0-dev2b57b4f738b1d0dcc2dd31ecd502e36f4e3ea5a0" targetFramework="native" />
<package id="Microsoft.AI.DirectML.Preview" version="1.9.0-devd10042c94985065a565c042540e15eb75b554663" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.201201.7" targetFramework="native" />
</packages>
2 changes: 1 addition & 1 deletion tools/nuget/generate_nuspec_for_native_nuget.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def generate_dependencies(xml_text, package_name, version, dependency_id, depend
return

dml_dependency = (
'<dependency id="Microsoft.AI.DirectML.Preview" version="1.9.0-dev2b57b4f738b1d0dcc2dd31ecd502e36f4e3ea5a0"/>'
'<dependency id="Microsoft.AI.DirectML.Preview" version="1.9.0-devd10042c94985065a565c042540e15eb75b554663"/>'
)

if package_name == "Microsoft.AI.MachineLearning":
Expand Down

0 comments on commit babd6e3

Please sign in to comment.