Use project structure and dotnet cli
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -77,3 +77,7 @@ cache/
|
||||
|
||||
tools/netstandard/CreateSigningKey/bin
|
||||
tools/netstandard/CreateSigningKey/obj
|
||||
|
||||
ortools/fsharp/**/bin
|
||||
ortools/fsharp/**/obj
|
||||
ortools/fsharp/**/packages
|
||||
34
ortools/fsharp/src/Google.sln
Normal file
34
ortools/fsharp/src/Google.sln
Normal file
@@ -0,0 +1,34 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.26124.0
|
||||
MinimumVisualStudioVersion = 15.0.26124.0
|
||||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "OrTools.FSharp", "OrTools.FSharp\OrTools.FSharp.fsproj", "{B7DC098E-1334-47D2-88D4-7DA1EF8A4076}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{B7DC098E-1334-47D2-88D4-7DA1EF8A4076}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B7DC098E-1334-47D2-88D4-7DA1EF8A4076}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B7DC098E-1334-47D2-88D4-7DA1EF8A4076}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{B7DC098E-1334-47D2-88D4-7DA1EF8A4076}.Debug|x64.Build.0 = Debug|x64
|
||||
{B7DC098E-1334-47D2-88D4-7DA1EF8A4076}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{B7DC098E-1334-47D2-88D4-7DA1EF8A4076}.Debug|x86.Build.0 = Debug|x86
|
||||
{B7DC098E-1334-47D2-88D4-7DA1EF8A4076}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B7DC098E-1334-47D2-88D4-7DA1EF8A4076}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B7DC098E-1334-47D2-88D4-7DA1EF8A4076}.Release|x64.ActiveCfg = Release|x64
|
||||
{B7DC098E-1334-47D2-88D4-7DA1EF8A4076}.Release|x64.Build.0 = Release|x64
|
||||
{B7DC098E-1334-47D2-88D4-7DA1EF8A4076}.Release|x86.ActiveCfg = Release|x86
|
||||
{B7DC098E-1334-47D2-88D4-7DA1EF8A4076}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
17
ortools/fsharp/src/OrTools.FSharp/OrTools.FSharp.fsproj
Normal file
17
ortools/fsharp/src/OrTools.FSharp/OrTools.FSharp.fsproj
Normal file
@@ -0,0 +1,17 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="../netfx.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Library</OutputType>
|
||||
<AssemblyTitle>Google.OrTools.FSharp</AssemblyTitle>
|
||||
<TargetFrameworks>netstandard2.0;net462</TargetFrameworks>
|
||||
<AssemblyName>Google.OrTools.FSharp</AssemblyName>
|
||||
<NuspecFile>OrTools.FSharp.nuspec</NuspecFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="OrTools.fsx" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
22
ortools/fsharp/src/OrTools.FSharp/OrTools.FSharp.nuspec
Normal file
22
ortools/fsharp/src/OrTools.FSharp/OrTools.FSharp.nuspec
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0"?>
|
||||
<package >
|
||||
<metadata>
|
||||
<id>Google.OrTools.FSharp</id>
|
||||
<version>VVVV</version>
|
||||
<authors>Google</authors>
|
||||
<licenseUrl>https://github.com/google/or-tools/blob/master/LICENSE-2.0.txt</licenseUrl>
|
||||
<projectUrl>https://developers.google.com/optimization</projectUrl>
|
||||
<description>F# wrapper for the Operations Research Tools project</description>
|
||||
<copyright>Copyright 2018 Google, Inc</copyright>
|
||||
<tags>Operations Research Math Linear Constraint Programming F#</tags>
|
||||
<dependencies>
|
||||
<dependency id="Google.OrTools" version="VVVV" />
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="bin/Release/netstandard2.0/*.*" target="lib/netstandard2.0"/>
|
||||
<file src="bin/Release/net462/*.*" target="lib/net462"/>
|
||||
<file src="examples/fsharp/*.*" target="examples"/>
|
||||
<file src="LICENSE-2.0.txt"/>
|
||||
</files>
|
||||
</package>
|
||||
359
ortools/fsharp/src/OrTools.FSharp/OrTools.fsx
Normal file
359
ortools/fsharp/src/OrTools.FSharp/OrTools.fsx
Normal file
@@ -0,0 +1,359 @@
|
||||
module Google.OrTools.FSharp
|
||||
|
||||
#I "../../../../bin"
|
||||
#r "Google.OrTools.dll"
|
||||
|
||||
open System
|
||||
open Google.OrTools.Algorithms
|
||||
open Google.OrTools.LinearSolver
|
||||
|
||||
type Goal =
|
||||
/// Maximize the Objective Function
|
||||
| Maximize
|
||||
/// Minimize the Objective Function
|
||||
| Minimize
|
||||
|
||||
/// Linear Programming Algorithm
|
||||
type LinearProgramming =
|
||||
/// Coin-Or (Recommended default)
|
||||
| CLP
|
||||
/// GNU Linear Programming Kit
|
||||
| GLPK
|
||||
/// Google Linear Optimization
|
||||
| GLOP
|
||||
/// Gurobi Optimizer
|
||||
| GUROBI
|
||||
/// IBM CPLEX
|
||||
| CPLEX
|
||||
/// Solver Name
|
||||
override this.ToString() =
|
||||
match this with
|
||||
| CLP -> "CLP_LINEAR_PROGRAMMING"
|
||||
| GLPK -> "GLPK_LINEAR_PROGRAMMING"
|
||||
| GLOP -> "GLOP_LINEAR_PROGRAMMING"
|
||||
| GUROBI -> "GUROBI_LINEAR_PROGRAMMING"
|
||||
| CPLEX -> "CPLEX_LINEAR_PROGRAMMING"
|
||||
/// Solver Id
|
||||
member this.Id =
|
||||
match this with
|
||||
| CLP -> 0
|
||||
| GLPK -> 1
|
||||
| GLOP -> 2
|
||||
| GUROBI -> 6
|
||||
| CPLEX -> 10
|
||||
|
||||
/// Integer Programming Algoritm
|
||||
type IntegerProgramming =
|
||||
/// Solving Constraint Integer Programs (Recommended default)
|
||||
| SCIP
|
||||
/// GNU Linear Programming Kit
|
||||
| GLPK
|
||||
/// Coin-Or Branch and Cut
|
||||
| CBC
|
||||
/// Gurobi Optimizer
|
||||
| GUROBI
|
||||
/// IBM CPLEX
|
||||
| CPLEX
|
||||
/// Binary Optimizer
|
||||
| BOP
|
||||
/// Solver Name
|
||||
override this.ToString() =
|
||||
match this with
|
||||
| SCIP -> "SCIP_MIXED_INTEGER_PROGRAMMING"
|
||||
| GLPK -> "GLPK_MIXED_INTEGER_PROGRAMMING"
|
||||
| CBC -> "CBC_MIXED_INTEGER_PROGRAMMING"
|
||||
| GUROBI -> "GUROBI_MIXED_INTEGER_PROGRAMMING"
|
||||
| CPLEX -> "CPLEX_MIXED_INTEGER_PROGRAMMING"
|
||||
| BOP -> "BOP_INTEGER_PROGRAMMING"
|
||||
/// Solver Id
|
||||
member this.Id =
|
||||
match this with
|
||||
| SCIP -> 3
|
||||
| GLPK -> 4
|
||||
| CBC -> 5
|
||||
| GUROBI -> 7
|
||||
| CPLEX -> 11
|
||||
| BOP -> 12
|
||||
|
||||
type LinearSolverAlgorithm =
|
||||
| LP of LinearProgramming
|
||||
| IP of IntegerProgramming
|
||||
|
||||
/// Max Flow Solver Result
|
||||
type MaximumFlowResult =
|
||||
| Optimal
|
||||
| IntegerOverflow
|
||||
| BadInput
|
||||
| BadResult
|
||||
member this.Id =
|
||||
match this with
|
||||
| Optimal -> 0
|
||||
| IntegerOverflow -> 1
|
||||
| BadInput -> 2
|
||||
| BadResult -> 3
|
||||
|
||||
/// Minimum Cost Flow Result
|
||||
type MinimumCostFlowResult =
|
||||
| NotSolved
|
||||
| Optimal
|
||||
| Feasible
|
||||
| Infeasible
|
||||
| Unbalanced
|
||||
| BadResult
|
||||
| BadCostRange
|
||||
member this.Id =
|
||||
match this with
|
||||
| NotSolved -> 0
|
||||
| Optimal -> 1
|
||||
| Feasible -> 2
|
||||
| Infeasible -> 3
|
||||
| Unbalanced -> 4
|
||||
| BadResult -> 5
|
||||
| BadCostRange -> 6
|
||||
|
||||
|
||||
/// Knapsack Solver Algorithm
|
||||
type KnapsackSolverAlgorithm =
|
||||
| BruteForce
|
||||
| SixtyFourItems
|
||||
| DynamicProgramming
|
||||
| MultidimensionCBC
|
||||
| MultidimensionGLPK
|
||||
| MultidimensionBranchAndBound
|
||||
| MultidimensionSCIP
|
||||
/// Solver Id
|
||||
member this.Id =
|
||||
match this with
|
||||
| BruteForce -> 0
|
||||
| SixtyFourItems -> 1
|
||||
| DynamicProgramming -> 2
|
||||
| MultidimensionCBC -> 3
|
||||
| MultidimensionGLPK -> 4
|
||||
| MultidimensionBranchAndBound -> 5
|
||||
| MultidimensionSCIP -> 6
|
||||
|
||||
let knapsackSolve (name: string) (solverAlgorithm:KnapsackSolverAlgorithm) (profits:int64 list) (weights:int64 list) (capacities:int64 list) =
|
||||
// extract the specific algorithm so its Id can be used to create solver
|
||||
let algorithm =
|
||||
match solverAlgorithm with
|
||||
| MultidimensionBranchAndBound ->
|
||||
MultidimensionBranchAndBound.Id
|
||||
| BruteForce ->
|
||||
BruteForce.Id
|
||||
| SixtyFourItems ->
|
||||
SixtyFourItems.Id
|
||||
| DynamicProgramming ->
|
||||
DynamicProgramming.Id
|
||||
| MultidimensionCBC ->
|
||||
MultidimensionCBC.Id
|
||||
| MultidimensionGLPK ->
|
||||
MultidimensionGLPK.Id
|
||||
| MultidimensionSCIP ->
|
||||
MultidimensionSCIP.Id
|
||||
|
||||
let solver = new KnapsackSolver(algorithm, name)
|
||||
|
||||
// transform lists to compatible structures for C++ Solver
|
||||
let profits = new KInt64Vector( List.toArray profits )
|
||||
|
||||
let weights =
|
||||
let tempVector = new KInt64VectorVector(1)
|
||||
let tempWeights = new KInt64Vector(List.toArray weights)
|
||||
tempVector.Add(tempWeights)
|
||||
tempVector
|
||||
|
||||
let capacities = new KInt64Vector (List.toArray capacities)
|
||||
|
||||
solver.Init(profits, weights, capacities)
|
||||
solver
|
||||
|
||||
type SolverOpts = {
|
||||
/// Name of the solver
|
||||
SolverName: string;
|
||||
/// Linear objective function vector
|
||||
ObjectiveFunction: float list;
|
||||
/// Matrix for linear inequality constraints
|
||||
ConstraintMatrix: float list list option;
|
||||
/// Upper Bound vector for linear inequality constraints
|
||||
ConstraintVectorUpperBound: float list option;
|
||||
/// Lower Bound vector for linear inequality constraints
|
||||
ConstraintVectorLowerBound: float list option;
|
||||
/// Vector of variable upper bounds
|
||||
VariableUpperBound: float list;
|
||||
/// Vector of variable lower bounds
|
||||
VariableLowerBound: float list;
|
||||
/// Matrix for linear equality constraints
|
||||
ConstraintMatrixEq: float list list option;
|
||||
/// Vector for linear equality constraints
|
||||
ConstraintVectorEq: float list option;
|
||||
/// Solver Algorithm to use
|
||||
SolverAlgorithm: LinearSolverAlgorithm;
|
||||
/// Solver Goal (Minimize/Maximize)
|
||||
SolverGoal: Goal
|
||||
} with
|
||||
member this.Name(nm:string)=
|
||||
{this with SolverName = nm}
|
||||
member this.Objective(objVector:float list) =
|
||||
{this with ObjectiveFunction = objVector}
|
||||
member this.Matrix(mat:float list list) =
|
||||
{this with ConstraintMatrix = Some(mat)}
|
||||
member this.VectorUpperBound(vec:float list) =
|
||||
{this with ConstraintVectorUpperBound = Some(vec)}
|
||||
member this.VectorLowerBound(vec:float list) =
|
||||
{this with ConstraintVectorLowerBound = Some(vec)}
|
||||
member this.MatrixEq(mat:float list list) =
|
||||
{this with ConstraintMatrixEq = Some(mat)}
|
||||
member this.VectorEq(vec:float list) =
|
||||
{this with ConstraintVectorEq = Some(vec)}
|
||||
member this.VarUpperBound(ub:float list) =
|
||||
{this with VariableUpperBound = ub}
|
||||
member this.VarLowerBound(lb:float list) =
|
||||
{this with VariableLowerBound = lb}
|
||||
member this.Algorithm(algo:LinearSolverAlgorithm) =
|
||||
{this with SolverAlgorithm = algo}
|
||||
member this.Goal(goal:Goal) =
|
||||
{this with SolverGoal = goal}
|
||||
static member Default =
|
||||
{
|
||||
SolverName = "Solver";
|
||||
ObjectiveFunction = [];
|
||||
ConstraintMatrix = None;
|
||||
ConstraintVectorUpperBound = None;
|
||||
ConstraintVectorLowerBound = None;
|
||||
VariableUpperBound = [];
|
||||
VariableLowerBound = [];
|
||||
ConstraintMatrixEq = None;
|
||||
ConstraintVectorEq = None;
|
||||
SolverAlgorithm = LP CLP
|
||||
SolverGoal = Maximize
|
||||
}
|
||||
|
||||
let lpSolve (solverOptions:SolverOpts) =
|
||||
// extract the specific algorithm so its Id can be used to create solver
|
||||
let algorithm =
|
||||
match solverOptions.SolverAlgorithm with
|
||||
| LP lp -> lp.Id
|
||||
| IP ip -> ip.Id
|
||||
|
||||
let solver = new Solver(solverOptions.SolverName, algorithm)
|
||||
|
||||
// Detect errors on required parameters
|
||||
if (solverOptions.ConstraintMatrix.IsNone && solverOptions.ConstraintVectorUpperBound.IsNone && solverOptions.ConstraintVectorLowerBound.IsNone)
|
||||
&& (solverOptions.ConstraintMatrixEq.IsNone && solverOptions.ConstraintVectorEq.IsNone) then
|
||||
failwith "Must provide at least one Matrix/Vector pair for inequality/equality contraints"
|
||||
|
||||
if solverOptions.ObjectiveFunction.IsEmpty then
|
||||
failwith "Objective function cannot be empty"
|
||||
|
||||
if solverOptions.VariableUpperBound.IsEmpty then
|
||||
failwith "Variable upper bound values cannot be empty"
|
||||
|
||||
if solverOptions.VariableLowerBound.IsEmpty then
|
||||
failwith "Variable lower bound values cannot be empty"
|
||||
|
||||
// check inequality matrix dimensions against bounds
|
||||
match (solverOptions.ConstraintMatrix, solverOptions.ConstraintVectorLowerBound, solverOptions.ConstraintVectorUpperBound) with
|
||||
| _, Some lb, Some ub when lb.Length <> ub.Length ->
|
||||
failwithf "Constraint vector dimensions should be equal.\nLower Bound Length: %i\nUpper Bound Length: %i" lb.Length ub.Length
|
||||
| _ -> ()
|
||||
|
||||
// Check Objective function dimensions with variable bounds dimensions
|
||||
match (solverOptions.ObjectiveFunction.Length, solverOptions.VariableLowerBound.Length, solverOptions.VariableUpperBound.Length) with
|
||||
| _ , lb, ub when lb <> ub ->
|
||||
failwithf "Variable vector dimensions should be equal.\nLower Bound Length: %i\nUpper Bound Length: %i" lb ub
|
||||
| obj, _ , ub when obj <> ub ->
|
||||
failwithf "Variable vector dimensions should be equal.\nUpper Bound Length: %i\nObjective Function Length: %i" ub obj
|
||||
| obj, lb, _ when obj <> lb ->
|
||||
failwithf "Variable vector dimensions should be equal.\nLower Bound Length: %i\nObjective Function Length: %i" lb obj
|
||||
| _ -> ()
|
||||
|
||||
// Variables
|
||||
let vars =
|
||||
match solverOptions.SolverAlgorithm with
|
||||
| LP lp ->
|
||||
[ for i in 0 .. (solverOptions.VariableLowerBound.Length-1) -> solver.MakeNumVar(solverOptions.VariableLowerBound.[i], solverOptions.VariableUpperBound.[i], (sprintf "var[%i]" i ) ) ]
|
||||
| IP ip ->
|
||||
[ for i in 0 .. (solverOptions.VariableLowerBound.Length-1) -> solver.MakeIntVar(solverOptions.VariableLowerBound.[i], solverOptions.VariableUpperBound.[i], (sprintf "var[%i]" i ) ) ]
|
||||
|
||||
// Constraints
|
||||
let cols = [ for i in 0 .. (solverOptions.VariableLowerBound.Length-1) -> i ] // generate column index selectors
|
||||
|
||||
// Inequality Constraints
|
||||
match (solverOptions.ConstraintMatrix, solverOptions.ConstraintVectorLowerBound, solverOptions.ConstraintVectorUpperBound) with
|
||||
| (None, Some lb, Some ub) ->
|
||||
failwithf "Matrix for Equality Constraints undefined."
|
||||
| (Some mat, None, Some ub) ->
|
||||
for row = 0 to (ub.Length-1) do
|
||||
// generate constraint operands based on indices
|
||||
let constraintOperands = List.map (fun c -> vars.[c] * mat.[c].[row]) cols
|
||||
let linearExp = List.reduce (+) constraintOperands
|
||||
|
||||
// create the constraint
|
||||
let rangeConstraint = RangeConstraint(linearExp, Double.NegativeInfinity, ub.[row])
|
||||
solver.Add(rangeConstraint) |> ignore
|
||||
| (Some mat, Some lb, None) ->
|
||||
for row = 0 to (lb.Length-1) do
|
||||
// generate constraint operands based on indices
|
||||
let constraintOperands = List.map (fun c -> vars.[c] * mat.[c].[row]) cols
|
||||
let linearExp = List.reduce (+) constraintOperands
|
||||
|
||||
// create the constraint
|
||||
let rangeConstraint = RangeConstraint(linearExp, lb.[row], Double.PositiveInfinity)
|
||||
solver.Add(rangeConstraint) |> ignore
|
||||
| (Some mat, Some lb, Some ub) ->
|
||||
for row = 0 to (ub.Length-1) do
|
||||
// generate constraint operands based on indices
|
||||
let constraintOperands = List.map (fun c -> vars.[c] * mat.[c].[row]) cols
|
||||
let linearExp = List.reduce (+) constraintOperands
|
||||
|
||||
// create the constraint
|
||||
let rangeConstraint = RangeConstraint(linearExp, lb.[row], ub.[row])
|
||||
solver.Add(rangeConstraint) |> ignore
|
||||
| _ -> ()
|
||||
|
||||
|
||||
// Equality Constraints
|
||||
match (solverOptions.ConstraintMatrixEq, solverOptions.ConstraintVectorEq) with
|
||||
| (None, Some b) ->
|
||||
failwithf "Matrix for Equality Constraints undefined."
|
||||
| (Some mat, Some vec) ->
|
||||
for row = 0 to (vec.Length-1) do
|
||||
// generate constraint operands based on indices
|
||||
let constraintOperands = List.map (fun c -> vars.[c] * mat.[c].[row]) cols
|
||||
let linearExp = List.reduce (+) constraintOperands
|
||||
|
||||
// create the constraint
|
||||
let equalityConstraint = RangeConstraint(linearExp, vec.[row], vec.[row])
|
||||
solver.Add(equalityConstraint) |> ignore
|
||||
| _ -> ()
|
||||
|
||||
// Objective
|
||||
let objectiveOperands = List.map (fun c -> solverOptions.ObjectiveFunction.[c] * vars.[c]) cols
|
||||
let objectiveExp = List.reduce (+) objectiveOperands
|
||||
|
||||
match solverOptions.SolverGoal with
|
||||
| Minimize ->
|
||||
solver.Minimize(objectiveExp)
|
||||
| Maximize ->
|
||||
solver.Maximize(objectiveExp)
|
||||
|
||||
solver
|
||||
|
||||
/// Solves the optimization problem and prints the results to console
|
||||
let SolverSummary (solver:Solver) =
|
||||
let resultStatus = solver.Solve();
|
||||
|
||||
match resultStatus with
|
||||
| status when status <> Solver.OPTIMAL ->
|
||||
printfn "The problem does not have an optimal solution!"
|
||||
exit 0
|
||||
| _ ->
|
||||
printfn "\nProblem solved in %d milliseconds" (solver.WallTime())
|
||||
printfn "Iterations: %i\n" (solver.Iterations())
|
||||
|
||||
printfn "Objective: %f" (solver.Objective().Value())
|
||||
for i in 0 .. (solver.NumVariables()-1) do
|
||||
printfn "%-10s: %f " (sprintf "var[%i]" i) ((solver.LookupVariableOrNull(sprintf "var[%i]" i)).SolutionValue())
|
||||
|
||||
solver
|
||||
|
||||
1
ortools/fsharp/src/README.md
Normal file
1
ortools/fsharp/src/README.md
Normal file
@@ -0,0 +1 @@
|
||||
Referenced this [github issue](https://github.com/morelinq/MoreLINQ/pull/420/files) to fix compilation issue with dotnet-cli and targeting net 4.X
|
||||
51
ortools/fsharp/src/netfx.props
Normal file
51
ortools/fsharp/src/netfx.props
Normal file
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Microsoft Corporation.
|
||||
All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
-->
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<!-- When compiling .NET SDK 2.0 projects targeting .NET 4.x on Mono using 'dotnet build' you -->
|
||||
<!-- have to teach MSBuild where the Mono copy of the reference asssemblies is -->
|
||||
<TargetIsMono Condition="$(TargetFramework.StartsWith('net4')) and '$(OS)' == 'Unix'">true</TargetIsMono>
|
||||
|
||||
<!-- Look in the standard install locations -->
|
||||
<BaseFrameworkPathOverrideForMono Condition="'$(BaseFrameworkPathOverrideForMono)' == '' AND '$(TargetIsMono)' == 'true' AND EXISTS('/Library/Frameworks/Mono.framework/Versions/Current/lib/mono')">/Library/Frameworks/Mono.framework/Versions/Current/lib/mono</BaseFrameworkPathOverrideForMono>
|
||||
<BaseFrameworkPathOverrideForMono Condition="'$(BaseFrameworkPathOverrideForMono)' == '' AND '$(TargetIsMono)' == 'true' AND EXISTS('/usr/lib/mono')">/usr/lib/mono</BaseFrameworkPathOverrideForMono>
|
||||
<BaseFrameworkPathOverrideForMono Condition="'$(BaseFrameworkPathOverrideForMono)' == '' AND '$(TargetIsMono)' == 'true' AND EXISTS('/usr/local/lib/mono')">/usr/local/lib/mono</BaseFrameworkPathOverrideForMono>
|
||||
|
||||
<!-- If we found Mono reference assemblies, then use them -->
|
||||
<FrameworkPathOverride Condition="'$(BaseFrameworkPathOverrideForMono)' != '' AND '$(TargetFramework)' == 'net45'">$(BaseFrameworkPathOverrideForMono)/4.5-api</FrameworkPathOverride>
|
||||
<FrameworkPathOverride Condition="'$(BaseFrameworkPathOverrideForMono)' != '' AND '$(TargetFramework)' == 'net451'">$(BaseFrameworkPathOverrideForMono)/4.5.1-api</FrameworkPathOverride>
|
||||
<FrameworkPathOverride Condition="'$(BaseFrameworkPathOverrideForMono)' != '' AND '$(TargetFramework)' == 'net452'">$(BaseFrameworkPathOverrideForMono)/4.5.2-api</FrameworkPathOverride>
|
||||
<FrameworkPathOverride Condition="'$(BaseFrameworkPathOverrideForMono)' != '' AND '$(TargetFramework)' == 'net46'">$(BaseFrameworkPathOverrideForMono)/4.6-api</FrameworkPathOverride>
|
||||
<FrameworkPathOverride Condition="'$(BaseFrameworkPathOverrideForMono)' != '' AND '$(TargetFramework)' == 'net461'">$(BaseFrameworkPathOverrideForMono)/4.6.1-api</FrameworkPathOverride>
|
||||
<FrameworkPathOverride Condition="'$(BaseFrameworkPathOverrideForMono)' != '' AND '$(TargetFramework)' == 'net462'">$(BaseFrameworkPathOverrideForMono)/4.6.2-api</FrameworkPathOverride>
|
||||
<FrameworkPathOverride Condition="'$(BaseFrameworkPathOverrideForMono)' != '' AND '$(TargetFramework)' == 'net47'">$(BaseFrameworkPathOverrideForMono)/4.7-api</FrameworkPathOverride>
|
||||
<FrameworkPathOverride Condition="'$(BaseFrameworkPathOverrideForMono)' != '' AND '$(TargetFramework)' == 'net471'">$(BaseFrameworkPathOverrideForMono)/4.7.1-api</FrameworkPathOverride>
|
||||
<EnableFrameworkPathOverride Condition="'$(BaseFrameworkPathOverrideForMono)' != ''">true</EnableFrameworkPathOverride>
|
||||
|
||||
<!-- Add the Facades directory. Not sure how else to do this. Necessary at least for .NET 4.5 -->
|
||||
<AssemblySearchPaths Condition="'$(BaseFrameworkPathOverrideForMono)' != ''">$(FrameworkPathOverride)/Facades;$(AssemblySearchPaths)</AssemblySearchPaths>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user