Skip to content

Commit

Permalink
Fixing Ninja build in Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
kimlaine committed Oct 30, 2020
1 parent 075b68b commit d87d134
Show file tree
Hide file tree
Showing 35 changed files with 40 additions and 61 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -561,11 +561,11 @@ configure_file(

# Supporting local building of NuGet package
if(MSVC)
set(SEAL_WINDOWS_SEAL_C_PATH ${SEAL_SOURCE_DIR}/lib/x64/$Configuration$/sealc.dll)
set(SEAL_WINDOWS_SEAL_C_PATH ${CMAKE_LIBRARY_RUNTIME_DIRECTORY}/sealc.dll)
elseif(UNIX)
set(SEAL_LINUX_SEAL_C_PATH ${SEAL_SOURCE_DIR}/lib/libsealc.so)
set(SEAL_LINUX_SEAL_C_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libsealc.so)
elseif(APPLE)
set(SEAL_MACOS_SEAL_C_PATH ${SEAL_SOURCE_DIR}/lib/libsealc.dylib)
set(SEAL_MACOS_SEAL_C_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libsealc.dylib)
endif()

# Create SEALNet.nuspec for a local NuGet pack from SEALNet.nuspec.in
Expand Down
4 changes: 2 additions & 2 deletions dotnet/examples/SEALNetExamples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Copyright>Microsoft Corporation 2020</Copyright>
</PropertyGroup>

<PropertyGroup Condition="'$(Platform)'=='AnyCPU'">
<PropertyGroup>
<PlatformTarget>x64</PlatformTarget>
<OutputPath>$(ProjectDir)../../bin/dotnet/$(Configuration)</OutputPath>
</PropertyGroup>
Expand All @@ -19,7 +19,7 @@
</ItemGroup>

<ItemGroup>
<SEALCBinaryFiles Condition="$([MSBuild]::IsOsPlatform(Windows))" Include="$(ProjectDir)..\..\lib\x64\$(Configuration)\sealc.dll" />
<SEALCBinaryFiles Condition="$([MSBuild]::IsOsPlatform(Windows))" Include="$(ProjectDir)..\..\bin\sealc.dll" />
<SEALCBinaryFiles Condition="$([MSBuild]::IsOsPlatform(Linux))" Include="$(ProjectDir)../../lib/libsealc.so.*" />
<SEALCBinaryFiles Condition="$([MSBuild]::IsOsPlatform(OSX))" Include="$(ProjectDir)../../lib/libsealc*.dylib" />
</ItemGroup>
Expand Down
11 changes: 4 additions & 7 deletions dotnet/nuget/NUGET.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@ After building `dotnet\src\SEALNet.csproj` you can create a NuGet package that y
use to easily add Microsoft SEAL capabilities to all of your .NET projects. Currently
the NuGet package is only supported in Windows.

You will need to:
1. Compile binaries
1. `native\src\SEAL.vcxproj`
2. `native\src\SEAL_C.vcxproj`
3. `dotnet\src\SEALNet.csproj`
You will need to do the following:
1. Compile both SEAL and SEAL_C projects with CMake; make sure you have the file `bin\sealc.dll`. Build `dotnet\src\SEALNet.csproj`.
3. [Download the NuGet command line tool](https://dist.nuget.org/win-x86-commandline/latest/nuget.exe)
4. Run the command below to create NuGet package
5. Add NuGet package reference to your .NET projects
4. Run the command below to create NuGet package.
5. Add NuGet package reference to your .NET projects.

The command to create the NuGet package after compiling binaries is the following:

Expand Down
6 changes: 3 additions & 3 deletions dotnet/src/SEALNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
<AssemblyOriginatorKeyFile Condition="'$(OS)' == 'Windows_NT' And '$(SEALNetSigningCertificate)' != ''">SEALNetCert.snk</AssemblyOriginatorKeyFile>
<DelaySign Condition="'$(OS)' == 'Windows_NT' And '$(SEALNetSigningCertificate)' != ''">true</DelaySign>
</PropertyGroup>
<PropertyGroup Condition="'$(Platform)'=='AnyCPU'">
<PropertyGroup>
<DocumentationFile>$(ProjectDir)../../lib/dotnet/$(Configuration)/SEALNet.xml</DocumentationFile>
<PlatformTarget>x64</PlatformTarget>
<OutputPath>$(ProjectDir)../../lib/dotnet/$(Configuration)</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<DefineConstants />
<DebugType>pdbonly</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>
</Project>
4 changes: 2 additions & 2 deletions dotnet/tests/SEALNetTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Copyright>Microsoft Corporation 2020</Copyright>
</PropertyGroup>

<PropertyGroup Condition="'$(Platform)'=='AnyCPU'">
<PropertyGroup>
<PlatformTarget>x64</PlatformTarget>
<OutputPath>$(ProjectDir)../../bin/dotnet/$(Configuration)</OutputPath>
</PropertyGroup>
Expand All @@ -25,7 +25,7 @@
</ItemGroup>

<ItemGroup>
<SEALCBinaryFiles Condition="$([MSBuild]::IsOsPlatform(Windows))" Include="$(ProjectDir)..\..\lib\x64\$(Configuration)\sealc.dll" />
<SEALCBinaryFiles Condition="$([MSBuild]::IsOsPlatform(Windows))" Include="$(ProjectDir)..\..\bin\sealc.dll" />
<SEALCBinaryFiles Condition="$([MSBuild]::IsOsPlatform(Linux))" Include="$(ProjectDir)../../lib/libsealc.so.*" />
<SEALCBinaryFiles Condition="$([MSBuild]::IsOsPlatform(OSX))" Include="$(ProjectDir)../../lib/libsealc*.dylib" />
</ItemGroup>
Expand Down
1 change: 0 additions & 1 deletion native/src/seal/c/batchencoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

// SEALNet
#include "seal/c/batchencoder.h"
#include "seal/c/stdafx.h"
#include "seal/c/utilities.h"

// SEAL
Expand Down
1 change: 0 additions & 1 deletion native/src/seal/c/ciphertext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

// SEALNet
#include "seal/c/ciphertext.h"
#include "seal/c/stdafx.h"
#include "seal/c/utilities.h"

// SEAL
Expand Down
1 change: 0 additions & 1 deletion native/src/seal/c/ckksencoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

// SEALNet
#include "seal/c/ckksencoder.h"
#include "seal/c/stdafx.h"
#include "seal/c/utilities.h"

// SEAL
Expand Down
1 change: 0 additions & 1 deletion native/src/seal/c/contextdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

// SEALNet
#include "seal/c/contextdata.h"
#include "seal/c/stdafx.h"
#include "seal/c/utilities.h"

// SEAL
Expand Down
1 change: 0 additions & 1 deletion native/src/seal/c/decryptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

// SEALNet
#include "seal/c/decryptor.h"
#include "seal/c/stdafx.h"
#include "seal/c/utilities.h"

// SEAL
Expand Down
5 changes: 4 additions & 1 deletion native/src/seal/c/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
// STD
#include <cstddef>

// SEALNet
#include "seal/c/stdafx.h"

// Check that std::size_t is 64 bits
static_assert(sizeof(std::size_t) == 8, "Require sizeof(std::size_t) == 8");

Expand All @@ -16,7 +19,7 @@ static_assert(sizeof(std::size_t) == 8, "Require sizeof(std::size_t) == 8");
static_assert(false, "Require architecture == x64");
#endif

#ifdef SEAL_C_EXPORTS
#if defined(SEAL_C_EXPORTS) || defined(seal_c_EXPORTS) || defined(sealc_EXPORTS)
#define SEAL_C_DECOR extern "C" __declspec(dllexport)
#else
#define SEAL_C_DECOR extern "C" __declspec(dllimport)
Expand Down
1 change: 0 additions & 1 deletion native/src/seal/c/encryptionparameterqualifiers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

// SEALNet
#include "seal/c/encryptionparameterqualifiers.h"
#include "seal/c/stdafx.h"
#include "seal/c/utilities.h"

// SEAL
Expand Down
1 change: 0 additions & 1 deletion native/src/seal/c/encryptionparameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

// SEALNet
#include "seal/c/encryptionparameters.h"
#include "seal/c/stdafx.h"
#include "seal/c/utilities.h"

// SEAL
Expand Down
1 change: 0 additions & 1 deletion native/src/seal/c/encryptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

// SEALNet
#include "seal/c/encryptor.h"
#include "seal/c/stdafx.h"
#include "seal/c/utilities.h"

// SEAL
Expand Down
1 change: 0 additions & 1 deletion native/src/seal/c/evaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

// SEALNet
#include "seal/c/evaluator.h"
#include "seal/c/stdafx.h"
#include "seal/c/utilities.h"

// SEAL
Expand Down
1 change: 0 additions & 1 deletion native/src/seal/c/galoiskeys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

// SEALNet
#include "seal/c/galoiskeys.h"
#include "seal/c/stdafx.h"
#include "seal/c/utilities.h"

// SEAL
Expand Down
1 change: 0 additions & 1 deletion native/src/seal/c/keygenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

// SEALNet
#include "seal/c/keygenerator.h"
#include "seal/c/stdafx.h"
#include "seal/c/utilities.h"

// SEAL
Expand Down
1 change: 0 additions & 1 deletion native/src/seal/c/kswitchkeys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

// SEALNet
#include "seal/c/kswitchkeys.h"
#include "seal/c/stdafx.h"
#include "seal/c/utilities.h"

// SEAL
Expand Down
6 changes: 4 additions & 2 deletions native/src/seal/c/memorymanager.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

// STD
#include <utility>

// SEALNet
#include "seal/c/memorymanager.h"
#include "seal/c/stdafx.h"
#include "seal/c/utilities.h"

// SEAL
Expand Down Expand Up @@ -100,7 +102,7 @@ SEAL_C_FUNC MemoryManager_SwitchProfile(void *new_profile)
MMProf *new_mm_profile = nullptr;
IfFailRet(CreateProfileCopy(profile, &new_mm_profile));

MemoryManager::SwitchProfile(static_cast<MMProf *>(new_mm_profile));
MemoryManager::SwitchProfile(move(static_cast<MMProf *>(new_mm_profile)));
return S_OK;
}

Expand Down
1 change: 0 additions & 1 deletion native/src/seal/c/memorypoolhandle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

// SEALNet
#include "seal/c/memorypoolhandle.h"
#include "seal/c/stdafx.h"
#include "seal/c/utilities.h"

// SEAL
Expand Down
1 change: 0 additions & 1 deletion native/src/seal/c/modulus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

// SEALNet
#include "seal/c/modulus.h"
#include "seal/c/stdafx.h"
#include "seal/c/utilities.h"

// SEAL
Expand Down
1 change: 0 additions & 1 deletion native/src/seal/c/plaintext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

// SEALNet
#include "seal/c/plaintext.h"
#include "seal/c/stdafx.h"
#include "seal/c/utilities.h"

// SEAL
Expand Down
1 change: 0 additions & 1 deletion native/src/seal/c/publickey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

// SEALNet
#include "seal/c/publickey.h"
#include "seal/c/stdafx.h"
#include "seal/c/utilities.h"

// SEAL
Expand Down
1 change: 0 additions & 1 deletion native/src/seal/c/relinkeys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

// SEALNet
#include "seal/c/relinkeys.h"
#include "seal/c/stdafx.h"
#include "seal/c/utilities.h"

// SEAL
Expand Down
1 change: 0 additions & 1 deletion native/src/seal/c/sealcontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

// SEALNet
#include "seal/c/sealcontext.h"
#include "seal/c/stdafx.h"
#include "seal/c/utilities.h"

// SEAL
Expand Down
1 change: 0 additions & 1 deletion native/src/seal/c/secretkey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

// SEALNet
#include "seal/c/secretkey.h"
#include "seal/c/stdafx.h"
#include "seal/c/utilities.h"

// SEAL
Expand Down
1 change: 0 additions & 1 deletion native/src/seal/c/serialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

// SEALNet
#include "seal/c/serialization.h"
#include "seal/c/stdafx.h"
#include "seal/c/utilities.h"

// SEAL
Expand Down
2 changes: 1 addition & 1 deletion native/src/seal/c/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files
#include <CorError.h>
#include <windows.h>
#include <Windows.h>
#endif // _MSC_VER

#define IfNullRet(expr, ret) \
Expand Down
1 change: 0 additions & 1 deletion native/src/seal/c/utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <iterator>

// SEALNet
#include "seal/c/stdafx.h"
#include "seal/c/utilities.h"

// SEAL
Expand Down
1 change: 0 additions & 1 deletion native/src/seal/c/valcheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the MIT license.

// SEALNet
#include "seal/c/stdafx.h"
#include "seal/c/utilities.h"
#include "seal/c/valcheck.h"

Expand Down
1 change: 0 additions & 1 deletion native/src/seal/c/version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the MIT license.

// SEALNet
#include "seal/c/stdafx.h"
#include "seal/c/utilities.h"
#include "seal/c/version.h"

Expand Down
4 changes: 2 additions & 2 deletions native/src/seal/ckks.h
Original file line number Diff line number Diff line change
Expand Up @@ -504,12 +504,12 @@ namespace seal
double max_coeff = 0;
for (std::size_t i = 0; i < n; i++)
{
max_coeff = std::max(max_coeff, std::fabs(conj_values[i].real()));
max_coeff = std::max<>(max_coeff, std::fabs(conj_values[i].real()));
}
// Verify that the values are not too large to fit in coeff_modulus
// Note that we have an extra + 1 for the sign bit
// Don't compute logarithmis of numbers less than 1
int max_coeff_bit_count = static_cast<int>(std::ceil(std::log2(std::max(max_coeff, 1.0)))) + 1;
int max_coeff_bit_count = static_cast<int>(std::ceil(std::log2(std::max<>(max_coeff, 1.0)))) + 1;
if (max_coeff_bit_count >= context_data.total_coeff_modulus_bit_count())
{
throw std::invalid_argument("encoded values are too large");
Expand Down
2 changes: 1 addition & 1 deletion native/src/seal/dynarray.h
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ namespace seal
*/
inline void reserve(std::size_t capacity)
{
std::size_t copy_size = std::min(capacity, size_);
std::size_t copy_size = std::min<>(capacity, size_);

// Create new allocation and copy over value
auto new_data(util::allocate<T>(capacity, pool_));
Expand Down
Loading

0 comments on commit d87d134

Please sign in to comment.