Skip to content

Commit

Permalink
Replaced SEALNet.sln with SEALNet.sln.in for pure-source-tree build e…
Browse files Browse the repository at this point in the history
…xperience. Updated .NET SDK version to 6.0.x.
  • Loading branch information
Wei Dai committed Mar 15, 2022
1 parent e121860 commit cfe4fa4
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 44 deletions.
18 changes: 17 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
# List of Changes

## Version 3.7.3

### Features

- All output files including downloaded thirdparty dependencies and Visual Studio project and solution files will be created in the build directory [(PR 427)](https://github.com/microsoft/SEAL/pull/427).
- Updated .Net SDK version to 6.0.x and supported Visual Studio version to 17 2022.

## Bug Fixes

- Removed exceptions in `KeyGenerator::CreateGaloisKeys` when inputs do not include steps so that even when `EncryptionParameterQualifiers::using_batching` is false Galois automorphisms are still available.

## File Changes

- `dotnet/SEALNet.sln` is removed.
- `dotnet/SEALNet.sln.in` is added.

## Version 3.7.2

### Bug Fixes

- Fixed a bug when Intel HEXL is used [(Issue 411)](https://github.com/microsoft/SEAL/issues/411) [(PR414)](https://github.com/microsoft/SEAL/pull/414).
- Fixed a bug when Intel HEXL is used [(Issue 411)](https://github.com/microsoft/SEAL/issues/411) [(PR 414)](https://github.com/microsoft/SEAL/pull/414).
- Fixed an abnormal benchmark case due to AVX512 transitions when Intel HEXL is used [(PR 416)](https://github.com/microsoft/SEAL/pull/416).

## Version 3.7.1
Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,12 @@ configure_file(
${CMAKE_CURRENT_BINARY_DIR}/dotnet/examples/SEALNetExamples.csproj
@ONLY)

# Create SEALNet.sln for Visual Studio to build all dotnet projects
configure_file(
${CMAKE_CURRENT_LIST_DIR}/dotnet/SEALNet.sln.in
${CMAKE_CURRENT_BINARY_DIR}/dotnet/SEALNet.sln
@ONLY)

# Set the sealc dynamic library file names to be included in creating
# the NuGet package. When building a multi-platform NuGet package, the
# dynamic library paths need to be specified explicitly in the NuGet
Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ A global install requires elevated (root or administrator) privileges.

| System | Toolchain |
|---|---|
| Windows | Visual Studio 2019 with C++ CMake Tools for Windows |
| Windows | Visual Studio 2022 with C++ CMake Tools for Windows |
| Linux | Clang++ (>= 5.0) or GNU G++ (>= 6.0), CMake (>= 3.13) |
| macOS/iOS | Xcode toolchain (>= 9.3), CMake (>= 3.13) |
| Android | Android Studio |
Expand Down Expand Up @@ -271,32 +271,32 @@ sudo cmake --install build

#### Building and Installing on Windows

On Windows the same scripts above work in a developer command prompt for Visual Studio using either the Ninja or "Visual Studio 16 2019" generators.
On Windows the same scripts above work in a developer command prompt for Visual Studio using either the Ninja or "Visual Studio 17 2022" generators.

When using the Ninja generator, please use the appropriate command prompt depending on the platform you want to build for. If you want to build for x64, please use the **x64 Native Tools Command Prompt for Visual Studio 2019** command prompt to configure and build the library. If you want to build for x86, please use the **x86 Native Tools Command Prompt for Visual Studio 2019** command prompt to configure and build the library. To build using Ninja, type
When using the Ninja generator, please use the appropriate command prompt depending on the platform you want to build for. If you want to build for x64, please use the **x64 Native Tools Command Prompt for Visual Studio 2022** command prompt to configure and build the library. If you want to build for x86, please use the **x86 Native Tools Command Prompt for Visual Studio 2022** command prompt to configure and build the library. To build using Ninja, type

```PowerShell
cmake -S . -B build -G Ninja
cmake --build build
```

When using the "Visual Studio 16 2019" generator you can use the **Developer Command Prompt for VS 2019** command prompt to configure and build the library. By default the generated platform will be x64. You can specify the desired platform using the architecture flag `-A <x64|Win32>` and the desired configuration using `--config <Debug|Release>`.
When using the "Visual Studio 17 2022" generator you can use the **Developer Command Prompt for VS 2022** command prompt to configure and build the library. By default the generated platform will be x64. You can specify the desired platform using the architecture flag `-A <x64|Win32>` and the desired configuration using `--config <Debug|Release>`.

```PowerShell
# Generate and build for x64 in Release mode
cmake -S . -B build -G "Visual Studio 16 2019" -A x64
cmake -S . -B build -G "Visual Studio 17 2022" -A x64
cmake --build build --config Release
```

```PowerShell
# Generate and build for x86 in Release mode
cmake -S . -B build -G "Visual Studio 16 2019" -A Win32
cmake -S . -B build -G "Visual Studio 17 2022" -A Win32
cmake --build build --config Release
```

Installing the library in Windows works as well. Instead of using the `sudo` command, however, you need to run `cmake --install build` from a command prompt with Administrator permissions. Files will be installed by default to `C:\Program Files (x86)\SEAL\`.

Visual Studio 2019 provides support for CMake-based projects. You can select the menu option `File / Open / Folder...` and navigate to the folder where the Microsoft SEAL repository is located. After opening the folder, Visual Studio will detect that this is a CMake-based project and will enable the menu command `Project / CMake settings for SEAL`. This will open the CMake settings editor that provides a user interface where you can create different configurations and set different CMake options.
Visual Studio 2022 provides support for CMake-based projects. You can select the menu option `File / Open / Folder...` and navigate to the folder where the Microsoft SEAL repository is located. After opening the folder, Visual Studio will detect that this is a CMake-based project and will enable the menu command `Project / CMake settings for SEAL`. This will open the CMake settings editor that provides a user interface where you can create different configurations and set different CMake options.

After the build completes, the output static library `seal-<version>.lib` can be found in `build\lib\` or `build\lib\Release\`.
When linking with applications, using CMake as is explained in [Linking with Microsoft SEAL through CMake](#linking-with-microsoft-seal-through-cmake) is highly recommended.
Expand Down Expand Up @@ -348,7 +348,7 @@ source ./emsdk_env.sh
```
**On Windows, better run from a developer command prompt for Visual Studio; and replace `./emsdk` and `source ./emsdk_env.sh` with `emsdk` and `emsdk_env.bat`, respectively.**
In other environments, `cmake` must be added to the path, and either "Ninja" or "MinGW Makefiles" should be specified as generator in the following configuration step.
`emcmake` does not work with Visual Studio 16 2019 generator.
`emcmake` does not work with Visual Studio 17 2022 generator.

Within the same shell, navigate to the root directory of Microsoft SEAL, run the following commands to build for WebAssembly:

Expand Down Expand Up @@ -483,21 +483,21 @@ The SEAL_C library is meant to be used only by the .NET library, not by end-user

#### Windows, Linux, and macOS

For compiling .NET code you will need to install a [.NET Core SDK (>= 3.1)](https://dotnet.microsoft.com/download).
For compiling .NET code you will need to install a [.NET SDK (>= 6.0)](https://dotnet.microsoft.com/download).
Building the SEAL_C library with CMake will generate project files for the .NET wrapper library, examples, and unit tests.
The SEAL_C library must be discoverable when running a .NET application, e.g., be present in the same directory as your executable, which is taken care of by the .NET examples and tests project files.
Run the following scripts to build each project:

```PowerShell
dotnet build dotnet/src --configuration <Debug|Release> # Build .NET wrapper library
dotnet test dotnet/tests # Build and run .NET unit tests
dotnet run -p dotnet/examples # Build and run .NET examples
dotnet build build/dotnet/src --configuration <Debug|Release> # Build .NET wrapper library
dotnet test build/dotnet/tests # Build and run .NET unit tests
dotnet run -p build/dotnet/examples # Build and run .NET examples
```

You can use `--configuration <Debug|Release>` to run `Debug` or `Release` examples and unit tests.
You can use `--verbosity detailed` to print the list of unit tests that are being run.

On Windows, you can also use the Microsoft Visual Studio 2019 solution file `dotnet/SEALNet.sln` to build all three projects.
On Windows, you can also use the Microsoft Visual Studio 2022 solution file, for example, `out/build/x64-Debug/dotnet/SEALNet.sln` to build all three projects.

#### Android and iOS

Expand Down
10 changes: 5 additions & 5 deletions dotnet/SEALNet.sln → dotnet/SEALNet.sln.in
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30011.22
# Visual Studio Version 17
VisualStudioVersion = 17.1.32228.430
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SEALNet", "src\SEALNet.csproj", "{1FA5DA9A-A2F0-4CC5-9072-5CBA2D1E3D2E}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SEALNet", "@CMAKE_CURRENT_BINARY_DIR@\dotnet\src\SEALNet.csproj", "{1FA5DA9A-A2F0-4CC5-9072-5CBA2D1E3D2E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SEALNetExamples", "examples\SEALNetExamples.csproj", "{4D86EEEA-D0CA-46F5-9199-C70A5C637739}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SEALNetExamples", "@CMAKE_CURRENT_BINARY_DIR@\dotnet\examples\SEALNetExamples.csproj", "{4D86EEEA-D0CA-46F5-9199-C70A5C637739}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SEALNetTest", "tests\SEALNetTest.csproj", "{BA3D23D1-93AF-40ED-9771-D4346708CD53}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SEALNetTest", "@CMAKE_CURRENT_BINARY_DIR@\dotnet\tests\SEALNetTest.csproj", "{BA3D23D1-93AF-40ED-9771-D4346708CD53}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
4 changes: 2 additions & 2 deletions dotnet/examples/SEALNetExamples.csproj.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Authors>Microsoft Research</Authors>
<Company>Microsoft Corporation</Company>
<Description>.NET wrapper examples for Microsoft SEAL</Description>
<Copyright>Microsoft Corporation 2020</Copyright>
<Copyright>Microsoft Corporation 2022</Copyright>
</PropertyGroup>

<PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion dotnet/nuget/NUGET.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ cd ..\..
After the package is created, copy it from `dotnet\nuget\Release` to a known location (e.g., `C:\NuGetPackages`).

To add a reference to the NuGet package, you will need to configure Visual Studio so it can find
packages in this known location. In Microsoft Visual Studio 2019, for example, you can:
packages in this known location. In Microsoft Visual Studio 2022, for example, you can:
1. Select the menu uption `Tools / Options...`
2. On the left pane of the Options dialog, navigate to `NuGet Package Manager / Package Sources`
3. On the right pane of the Options dialog, add a new package source that points to the directory
Expand Down
10 changes: 5 additions & 5 deletions dotnet/tests/SEALNetTest.csproj.in
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
<Authors>Microsoft Research</Authors>
<Company>Microsoft Corporation</Company>
<Description>.NET wrapper unit tests for Microsoft SEAL</Description>
<Copyright>Microsoft Corporation 2020</Copyright>
<Copyright>Microsoft Corporation 2022</Copyright>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -15,9 +15,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.0.0" />
<PackageReference Include="MSTest.TestFramework" Version="2.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions dotnet/tests/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static class Utilities
/// <summary>
/// Assert that an exception of the given type is thrown.
///
/// This is a workaround for a unit testing issue in VS 2019.
/// This is a workaround for a unit testing issue in VS 2022.
/// When running unit tests a couple of them fail because of a FileNotFoundException being thrown instead
/// of the expected exception. The FileNotFoundException is thrown in the boundary between a .Net call
/// and a native method, so there is not really much we can do to fix it. As a workaround this method
Expand All @@ -38,7 +38,7 @@ public static void AssertThrows<T>(Func<object> action, [CallerFilePath] string
/// <summary>
/// Assert that an exception of the given type is thrown.
///
/// This is a workaround for a unit testing issue in VS 2019.
/// This is a workaround for a unit testing issue in VS 2022.
/// When running unit tests a couple of them fail because of a FileNotFoundException being thrown instead
/// of the expected exception. The FileNotFoundException is thrown in the boundary between a .Net call
/// and a native method, so there is not really much we can do to fix it. As a workaround this method
Expand Down
4 changes: 2 additions & 2 deletions pipelines/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ steps:
displayName: 'Run unit tests'

- task: UseDotNet@2
displayName: 'Get .NET Core 3.1 SDK'
displayName: 'Get .NET Core 6.0 SDK'
inputs:
packageType: 'sdk'
version: '3.1.x'
version: '6.0.x'

- task: DotNetCoreCLI@2
displayName: 'Run dotnet unit tests'
Expand Down
19 changes: 6 additions & 13 deletions pipelines/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,11 @@ steps:
outputFormat: sarif
debugMode: false

- ${{ if eq(parameters.configuration, 'Release') }}:
- task: UseDotNet@2
displayName: 'Get .NET Core 2.1 SDK'
inputs:
packageType: 'sdk'
version: '2.1.x'

- task: UseDotNet@2
displayName: 'Get .NET Core 3.1 SDK'
displayName: 'Get .NET Core 6.0 SDK'
inputs:
packageType: 'sdk'
version: '3.1.302'
version: '6.0.x'

- ${{ if eq(parameters.configuration, 'Release') }}:
- task: PowerShell@2
Expand Down Expand Up @@ -116,8 +109,8 @@ steps:
timeout: '1800'
ram: '16384'
addProjectDirToScanningExclusionList: true
buildCommands: '"%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsMSBuildCmd.bat" && msbuild $(Build.SourcesDirectory)/build/seal.sln'
cleanupBuildCommands: '"%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsMSBuildCmd.bat" && msbuild $(Build.SourcesDirectory)/build/seal.sln /t:Clean'
buildCommands: '"%ProgramFiles(x86)%\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsMSBuildCmd.bat" && msbuild $(Build.SourcesDirectory)/build/seal.sln'
cleanupBuildCommands: '"%ProgramFiles(x86)%\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsMSBuildCmd.bat" && msbuild $(Build.SourcesDirectory)/build/seal.sln /t:Clean'

- task: Semmle@0
displayName: 'Semmle SEALNet'
Expand All @@ -130,8 +123,8 @@ steps:
timeout: '1800'
ram: '16384'
addProjectDirToScanningExclusionList: true
buildCommands: '"%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsMSBuildCmd.bat" && msbuild $(Build.SourcesDirectory)/dotnet/SEALNet.sln'
cleanupBuildCommands: '"%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsMSBuildCmd.bat" && msbuild $(Build.SourcesDirectory)/dotnet/SEALNet.sln /t:Clean'
buildCommands: '"%ProgramFiles(x86)%\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsMSBuildCmd.bat" && msbuild $(Build.SourcesDirectory)/dotnet/SEALNet.sln'
cleanupBuildCommands: '"%ProgramFiles(x86)%\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsMSBuildCmd.bat" && msbuild $(Build.SourcesDirectory)/dotnet/SEALNet.sln /t:Clean'

- task: PublishSymbols@2
displayName: 'Publish symbols path'
Expand Down

0 comments on commit cfe4fa4

Please sign in to comment.