From 4e3391ef6027fbc258a47ae431cc1d2d4ba9c034 Mon Sep 17 00:00:00 2001 From: jignparm Date: Tue, 9 Apr 2019 22:48:00 -0700 Subject: [PATCH] Refactor NuGet to allow arbitrary PackageId names (e.g. Microsoft.ML.OnnxRuntime.MKLML) (#797) * Refactor NuGet to allow arbitrary namespaces * Move csharp build to end of cmake --- cmake/CMakeLists.txt | 12 +++---- ...soft.ML.OnnxRuntime.InferenceSample.csproj | 4 +++ .../Microsoft.ML.OnnxRuntime.csproj | 11 ++++++ .../Microsoft.ML.OnnxRuntime.props | 36 ------------------- .../Microsoft.ML.OnnxRuntime.targets | 16 --------- ...oft.ML.OnnxRuntime.Gpu.props => props.xml} | 7 ++++ ...ML.OnnxRuntime.Gpu.targets => targets.xml} | 0 7 files changed, 28 insertions(+), 58 deletions(-) delete mode 100644 csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.props delete mode 100644 csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.targets rename csharp/src/Microsoft.ML.OnnxRuntime/{Microsoft.ML.OnnxRuntime.Gpu.props => props.xml} (81%) rename csharp/src/Microsoft.ML.OnnxRuntime/{Microsoft.ML.OnnxRuntime.Gpu.targets => targets.xml} (100%) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 65ac0b791b..bf6736f6b3 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -584,12 +584,6 @@ if (onnxruntime_BUILD_SHARED_LIB) include(onnxruntime.cmake) endif() -if (onnxruntime_BUILD_CSHARP) - message(STATUS "CSharp Build is enabled") -# set_property(GLOBAL PROPERTY VS_DOTNET_TARGET_FRAMEWORK_VERSION "netstandard2.0") - include(onnxruntime_csharp.cmake) -endif() - # some of the tests rely on the shared libs to be # built; hence the ordering if (onnxruntime_BUILD_UNIT_TESTS) @@ -610,3 +604,9 @@ if (onnxruntime_BUILD_UNIT_TESTS) set_target_properties(gtest_main PROPERTIES FOLDER "External/GTest") include(onnxruntime_unittests.cmake) endif() + +if (onnxruntime_BUILD_CSHARP) + message(STATUS "CSharp Build is enabled") +# set_property(GLOBAL PROPERTY VS_DOTNET_TARGET_FRAMEWORK_VERSION "netstandard2.0") + include(onnxruntime_csharp.cmake) +endif() diff --git a/csharp/sample/Microsoft.ML.OnnxRuntime.InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.csproj b/csharp/sample/Microsoft.ML.OnnxRuntime.InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.csproj index ae8cb450c2..8a43842d72 100644 --- a/csharp/sample/Microsoft.ML.OnnxRuntime.InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.csproj +++ b/csharp/sample/Microsoft.ML.OnnxRuntime.InferenceSample/Microsoft.ML.OnnxRuntime.InferenceSample.csproj @@ -22,6 +22,10 @@ Always false + + Always + false + Always false diff --git a/csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.csproj b/csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.csproj index 6e253e7a6a..1e4cdb2bc6 100644 --- a/csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.csproj +++ b/csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.csproj @@ -65,6 +65,13 @@ CopyToOutputDirectory="Always" Visible="false" /> + + + @@ -111,6 +120,8 @@ + + diff --git a/csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.props b/csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.props deleted file mode 100644 index 5ccd0a3672..0000000000 --- a/csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.props +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - $(MSBuildThisFileDirectory)../../build/native/include/;%(AdditionalIncludeDirectories) - - - $(MSBuildThisFileDirectory)../../build/native/include/;%(AdditionalIncludeDirectories) - - - - - - $(MSBuildThisFileDirectory)../../runtimes/win-x64/native/onnxruntime.lib - - - - - - onnxruntime.dll - PreserveNewest - false - - - mkldnn.dll - PreserveNewest - false - - - diff --git a/csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.targets b/csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.targets deleted file mode 100644 index c4829504ed..0000000000 --- a/csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.targets +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - diff --git a/csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.Gpu.props b/csharp/src/Microsoft.ML.OnnxRuntime/props.xml similarity index 81% rename from csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.Gpu.props rename to csharp/src/Microsoft.ML.OnnxRuntime/props.xml index 5ccd0a3672..c2a3a9b4ae 100644 --- a/csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.Gpu.props +++ b/csharp/src/Microsoft.ML.OnnxRuntime/props.xml @@ -32,5 +32,12 @@ PreserveNewest false + + mklml.dll + PreserveNewest + false + diff --git a/csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.Gpu.targets b/csharp/src/Microsoft.ML.OnnxRuntime/targets.xml similarity index 100% rename from csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.Gpu.targets rename to csharp/src/Microsoft.ML.OnnxRuntime/targets.xml