Make:dotnet: add variable to csproj.in

Change needed since CMake build out of the source tree
i.e. path are differents
This commit is contained in:
Corentin Le Molgat
2020-03-05 14:42:01 +01:00
parent 8aff548fca
commit c81dd15a15
8 changed files with 33 additions and 15 deletions

View File

@@ -331,6 +331,10 @@ $(LIB_DIR)/$(OR_TOOLS_NATIVE_LIB).$(SWIG_DOTNET_LIB_SUFFIX): \
$(SRC_DIR)/ortools/dotnet/orLogo.png: $(SRC_DIR)/tools/doc/orLogo.png
$(COPY) $(SRC_DIR)$Stools$Sdoc$SorLogo.png $(SRC_DIR)$Sortools$Sdotnet$SorLogo.png
$(SRC_DIR)/ortools/dotnet/Directory.Build.props: $(SRC_DIR)/ortools/dotnet/Directory.Build.props.in
$(COPY) $(SRC_DIR)$Sortools$Sdotnet$SDirectory.Build.props.in $(SRC_DIR)$Sortools$Sdotnet$SDirectory.Build.props
$(SED) -i -e 's/@DOTNET_PACKAGES_DIR@/..\/..\/..\/packages/g' $(SRC_DIR)$Sortools$Sdotnet$SDirectory.Build.props
$(SRC_DIR)/ortools/dotnet/$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME)/$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME).csproj: \
$(SRC_DIR)/ortools/dotnet/$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME)/$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME).csproj.in
$(SED) -e "s/@PROJECT_VERSION@/$(OR_TOOLS_VERSION)/" \
@@ -338,7 +342,14 @@ $(SRC_DIR)/ortools/dotnet/$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME)/$(OR_TOOLS_RUNTIME_A
> ortools$Sdotnet$S$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME)$S$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME).csproj
$(DOTNET_ORTOOLS_NATIVE_NUPKG): \
$(SED) -i -e 's/@DOTNET_PACKAGES_DIR@/..\/..\/..\/packages/' \
ortools$Sdotnet$S$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME)$S$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME).csproj
$(SED) -i -e 's/@native@/..\/..\/..\/lib\/$(OR_TOOLS_NATIVE_LIB).$(SWIG_DOTNET_LIB_SUFFIX)/' \
ortools$Sdotnet$S$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME)$S$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME).csproj
$(SED) -i -e 's/@ortools@/..\/..\/..\/lib\/$(LIB_PREFIX)ortools.$L;..\/..\/..\/dependencies\/install\/lib*\/*.$L*/' \
ortools$Sdotnet$S$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME)$S$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME).csproj
$(LIB_DIR)/$(OR_TOOLS_NATIVE_LIB).$(SWIG_DOTNET_LIB_SUFFIX) \
$(SRC_DIR)/ortools/dotnet/Directory.Build.props \
$(SRC_DIR)/ortools/dotnet/orLogo.png \
$(SRC_DIR)/ortools/dotnet/$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME)/$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME).csproj \
$(SRC_DIR)/ortools/constraint_solver/csharp/IntVarArrayHelper.cs \
@@ -381,6 +392,8 @@ $(SRC_DIR)/ortools/dotnet/$(OR_TOOLS_ASSEMBLY_NAME)/$(OR_TOOLS_ASSEMBLY_NAME).cs
$(SED) -e "s/@PROJECT_VERSION@/$(OR_TOOLS_VERSION)/" \
ortools$Sdotnet$S$(OR_TOOLS_ASSEMBLY_NAME)$S$(OR_TOOLS_ASSEMBLY_NAME).csproj.in \
> ortools$Sdotnet$S$(OR_TOOLS_ASSEMBLY_NAME)$S$(OR_TOOLS_ASSEMBLY_NAME).csproj
$(SED) -i -e 's/@DOTNET_PACKAGES_DIR@/..\/..\/..\/packages/' \
ortools$Sdotnet$S$(OR_TOOLS_ASSEMBLY_NAME)$S$(OR_TOOLS_ASSEMBLY_NAME).csproj
# Pack managed project nuget
$(DOTNET_ORTOOLS_NUPKG): \
@@ -402,6 +415,8 @@ $(SRC_DIR)/ortools/dotnet/$(OR_TOOLS_FSHARP_ASSEMBLY_NAME)/$(OR_TOOLS_FSHARP_ASS
$(SED) -e "s/@PROJECT_VERSION@/$(OR_TOOLS_VERSION)/" \
ortools$Sdotnet$S$(OR_TOOLS_FSHARP_ASSEMBLY_NAME)$S$(OR_TOOLS_FSHARP_ASSEMBLY_NAME).fsproj.in \
> ortools$Sdotnet$S$(OR_TOOLS_FSHARP_ASSEMBLY_NAME)$S$(OR_TOOLS_FSHARP_ASSEMBLY_NAME).fsproj
$(SED) -i -e 's/@DOTNET_PACKAGES_DIR@/..\/..\/..\/packages/' \
ortools$Sdotnet$S$(OR_TOOLS_FSHARP_ASSEMBLY_NAME)$S$(OR_TOOLS_FSHARP_ASSEMBLY_NAME).fsproj
# build and pack nuget
$(DOTNET_ORTOOLS_FSHARP_NUPKG): \
@@ -417,6 +432,8 @@ ortools/dotnet/$(OR_TOOLS_FSHARP_TESTS_ASSEMBLY_NAME)/$(OR_TOOLS_FSHARP_TESTS_AS
$(SED) -e "s/@PROJECT_VERSION@/$(OR_TOOLS_VERSION)/" \
ortools$Sdotnet$S$(OR_TOOLS_FSHARP_TESTS_ASSEMBLY_NAME)$S$(OR_TOOLS_FSHARP_TESTS_ASSEMBLY_NAME).fsproj.in \
> ortools$Sdotnet$S$(OR_TOOLS_FSHARP_TESTS_ASSEMBLY_NAME)$S$(OR_TOOLS_FSHARP_TESTS_ASSEMBLY_NAME).fsproj
$(SED) -i -e 's/@DOTNET_PACKAGES_DIR@/..\/..\/..\/packages/' \
ortools$Sdotnet$S$(OR_TOOLS_FSHARP_TESTS_ASSEMBLY_NAME)$S$(OR_TOOLS_FSHARP_TESTS_ASSEMBLY_NAME).fsproj
.PHONY: test_dotnet_fsharp # Run F# OrTools Tests
test_dotnet_fsharp: $(DOTNET_ORTOOLS_FSHARP_NUPKG) \
@@ -699,6 +716,7 @@ clean_dotnet:
-$(DELREC) ortools$Sdotnet$SCreateSigningKey$Sobj
-$(DEL) $(DOTNET_ORTOOLS_SNK_PATH)
-$(DEL) ortools$Sdotnet$SorLogo.png
-$(DEL) ortools$Sdotnet$SDirectory.Build.props
-$(DEL) ortools$Sdotnet$S$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME)$S$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME)*.csproj
-$(DELREC) ortools$Sdotnet$S$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME)$Sbin
-$(DELREC) ortools$Sdotnet$S$(OR_TOOLS_RUNTIME_ASSEMBLY_NAME)$Sobj

View File

@@ -17,7 +17,7 @@
<PackageProjectUrl>https://developers.google.com/optimization</PackageProjectUrl>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageOutputPath>../../../packages</PackageOutputPath>
<PackageOutputPath>@DOTNET_PACKAGES_DIR@</PackageOutputPath>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/google/or-tools</RepositoryUrl>

View File

@@ -7,7 +7,7 @@
<AssemblyName>Google.OrTools.FSharp.Tests</AssemblyName>
<IsPackable>false</IsPackable>
<RestoreSources>../../../packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources>
<RestoreSources>@DOTNET_PACKAGES_DIR@;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">

View File

@@ -39,7 +39,7 @@
</ItemGroup>
<PropertyGroup>
<RestoreSources>../../../packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources>
<RestoreSources>@DOTNET_PACKAGES_DIR@;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Google.OrTools" Version="@PROJECT_VERSION@" />

View File

@@ -23,12 +23,12 @@
<ItemGroup>
<!-- Native library must be in native directory... -->
<Content Include="../../../dependencies/install/lib*/*.so*">
<Content Include="@ortools@">
<PackagePath>runtimes/linux-x64/native/%(Filename)%(Extension)</PackagePath>
<Pack>true</Pack>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="../../../lib/$(AssemblyName).so; ../../../lib/libortools.so">
<Content Include="@native@">
<PackagePath>runtimes/linux-x64/native/%(Filename)%(Extension)</PackagePath>
<Pack>true</Pack>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

View File

@@ -23,12 +23,12 @@
<ItemGroup>
<!-- Native library must be in native directory... -->
<Content Include="../../../dependencies/install/lib/*.dylib*">
<Content Include="@ortools@">
<PackagePath>runtimes/osx-x64/native/%(Filename)%(Extension)</PackagePath>
<Pack>true</Pack>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="../../../lib/$(AssemblyName).dylib; ../../../lib/libortools.dylib">
<Content Include="@native@">
<PackagePath>runtimes/osx-x64/native/%(Filename)%(Extension)</PackagePath>
<Pack>true</Pack>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

View File

@@ -24,7 +24,7 @@
<ItemGroup>
<!-- Native library must be in native directory... -->
<!-- On windows libortools is built as static -->
<Content Include="../../../lib/$(AssemblyName).dll">
<Content Include="@native@">
<PackagePath>runtimes/win-x64/native/%(Filename)%(Extension)</PackagePath>
<Pack>true</Pack>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

View File

@@ -73,9 +73,9 @@
<!-- Validate at least one runtime package has been generated -->
<Target Name="ValidateRuntimePack" BeforeTargets="GenerateNuspec">
<ItemGroup>
<RuntimeLinux Include="../../../packages/Google.OrTools.runtime.linux-x64.*.nupkg"/>
<RuntimeOsx Include="../../../packages/Google.OrTools.runtime.osx-x64.*.nupkg"/>
<RuntimeWin Include="../../../packages/Google.OrTools.runtime.win-x64.*.nupkg"/>
<RuntimeLinux Include="@DOTNET_PACKAGES_DIR@/Google.OrTools.runtime.linux-x64.*.nupkg"/>
<RuntimeOsx Include="@DOTNET_PACKAGES_DIR@/Google.OrTools.runtime.osx-x64.*.nupkg"/>
<RuntimeWin Include="@DOTNET_PACKAGES_DIR@/Google.OrTools.runtime.win-x64.*.nupkg"/>
</ItemGroup>
<Message Importance="high" Text="Package Google.OrTools.runtime.linux-x64: found" Condition="Exists('@(RuntimeLinux)')"/>
<Message Importance="high" Text="------- $(OS) "/>
@@ -142,15 +142,15 @@
<!-- Need to add required runtime dependencies so Meta-Project will pull runtime Nuget(s) -->
<PropertyGroup>
<RestoreSources>../../../packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources>
<RestoreSources>@DOTNET_PACKAGES_DIR@;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources>
</PropertyGroup>
<ItemGroup Condition="Exists('../../../packages/Google.OrTools.runtime.linux-x64.@PROJECT_VERSION@.nupkg')">
<ItemGroup Condition="Exists('@DOTNET_PACKAGES_DIR@/Google.OrTools.runtime.linux-x64.@PROJECT_VERSION@.nupkg')">
<PackageReference Include="Google.OrTools.runtime.linux-x64" Version="@PROJECT_VERSION@"/>
</ItemGroup>
<ItemGroup Condition="Exists('../../../packages/Google.OrTools.runtime.osx-x64.@PROJECT_VERSION@.nupkg')">
<ItemGroup Condition="Exists('@DOTNET_PACKAGES_DIR@/Google.OrTools.runtime.osx-x64.@PROJECT_VERSION@.nupkg')">
<PackageReference Include="Google.OrTools.runtime.osx-x64" Version="@PROJECT_VERSION@"/>
</ItemGroup>
<ItemGroup Condition="Exists('../../../packages/Google.OrTools.runtime.win-x64.@PROJECT_VERSION@.nupkg')">
<ItemGroup Condition="Exists('@DOTNET_PACKAGES_DIR@/Google.OrTools.runtime.win-x64.@PROJECT_VERSION@.nupkg')">
<PackageReference Include="Google.OrTools.runtime.win-x64" Version="@PROJECT_VERSION@"/>
</ItemGroup>
</Project>