Browse Source

[driver] Compilation platform is now nullable by default and validated to the host platforms.

pull/935/head
Joao Matos 8 years ago
parent
commit
a560297ab8
  1. 2
      src/Core/Compilation.cs
  2. 17
      src/Core/Platform.cs
  3. 3
      src/Generator/Driver.cs

2
src/Core/Compilation.cs

@ -12,7 +12,7 @@ namespace CppSharp @@ -12,7 +12,7 @@ namespace CppSharp
/// <summary>
/// Target platform for code compilation.
/// </summary>
public TargetPlatform Platform;
public TargetPlatform? Platform;
/// <summary>
/// Specifies the VS version.

17
src/Core/Platform.cs

@ -77,5 +77,22 @@ namespace CppSharp @@ -77,5 +77,22 @@ namespace CppSharp
return platform == PlatformID.Unix || platform == PlatformID.MacOSX;
}
}
public static TargetPlatform Host
{
get
{
if (IsWindows)
return TargetPlatform.Windows;
if (IsMacOS)
return TargetPlatform.MacOS;
if (IsLinux)
return TargetPlatform.Linux;
throw new NotImplementedException();
}
}
}
}

3
src/Generator/Driver.cs

@ -48,6 +48,9 @@ namespace CppSharp @@ -48,6 +48,9 @@ namespace CppSharp
void ValidateOptions()
{
if (!Options.Compilation.Platform.HasValue)
Options.Compilation.Platform = Platform.Host;
foreach (var module in Options.Modules)
{
if (string.IsNullOrWhiteSpace(module.LibraryName))

Loading…
Cancel
Save