Browse Source

Add an option for building with Visual Studio 2019

Fixes https://github.com/mono/CppSharp/issues/1390.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/1396/head
Dimitar Dobrev 5 years ago
parent
commit
0a15871751
  1. 5
      .gitignore
  2. 14
      appveyor.yml
  3. 10
      build/GenerateProjects.bat
  4. 2
      build/Helpers.lua
  5. BIN
      build/premake5.exe
  6. 10
      src/Core/Toolchains/MSVCToolchain.cs
  7. 3
      src/Parser/ParserOptions.cs

5
.gitignore vendored

@ -38,10 +38,7 @@ src/generator/generator @@ -38,10 +38,7 @@ src/generator/generator
/build/scripts/llvm**
/build/scripts/*.tar.gz
/build/scripts/.vagrant
/build/vs2012
/build/vs2013
/build/vs2015
/build/vs2017
/build/vs20*
/build/gmake
/build/headers
/build/netcore

14
appveyor.yml

@ -21,7 +21,7 @@ branches: @@ -21,7 +21,7 @@ branches:
matrix:
fast_finish: true
os: Visual Studio 2017
os: Visual Studio 2019
platform:
- x86
@ -31,12 +31,12 @@ configuration: @@ -31,12 +31,12 @@ configuration:
- Release
environment:
VS_VERSION: vs2017
VS_VERSION: 2019
DEPS_PATH: '%APPVEYOR_BUILD_FOLDER%\deps'
LLVM_PATH: '%APPVEYOR_BUILD_FOLDER%\deps\llvm'
BUILD_PATH: '%APPVEYOR_BUILD_FOLDER%\build\%VS_VERSION%'
LIB_PATH: '%APPVEYOR_BUILD_FOLDER%\build\%VS_VERSION%\lib\%CONFIGURATION%_%PLATFORM%'
ARTIFACT_NAME: '%APPVEYOR_PROJECT_NAME%-%APPVEYOR_REPO_TAG_NAME%-%VS_VERSION%-%PLATFORM%.zip'
BUILD_PATH: '%APPVEYOR_BUILD_FOLDER%\build\vs%VS_VERSION%'
LIB_PATH: '%APPVEYOR_BUILD_FOLDER%\build\vs%VS_VERSION%\lib\%CONFIGURATION%_%PLATFORM%'
ARTIFACT_NAME: '%APPVEYOR_PROJECT_NAME%-%APPVEYOR_REPO_TAG_NAME%-vs%VS_VERSION%-%PLATFORM%.zip'
GITHUB_ACCESS_TOKEN:
secure: CrxPDgxTKC9ZRvFjttpRPO+e1DT8s0Zkk9HrAmHOIzDkOfFbbu1iTm/yJjZ2eDcd
@ -44,11 +44,11 @@ init: @@ -44,11 +44,11 @@ init:
- git config --global core.autocrlf true
install:
- call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" %PLATFORM%
- call "C:\Program Files (x86)\Microsoft Visual Studio\%VS_VERSION%\Community\VC\Auxiliary\Build\vcvarsall.bat" %PLATFORM%
- build\premake5.exe --file=build\scripts\LLVM.lua download_llvm --arch=%PLATFORM%
build_script:
- build\premake5.exe --file=build\premake5.lua %VS_VERSION% --arch=%PLATFORM%
- build\premake5.exe --file=build\premake5.lua vs%VS_VERSION% --arch=%PLATFORM%
- msbuild %BUILD_PATH%\CppSharp.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" /verbosity:minimal
#---------------------------------#

10
build/GenerateProjects.bat

@ -9,13 +9,15 @@ echo [1] Visual C++ 2012 @@ -9,13 +9,15 @@ echo [1] Visual C++ 2012
echo [2] Visual C++ 2013
echo [3] Visual C++ 2015
echo [4] Visual C++ 2017
echo [5] GNU Make
echo [5] Visual C++ 2019
echo [6] GNU Make
echo.
:choice
set /P C="Choice: "
if "%C%"=="5" goto gmake
if "%C%"=="6" goto gmake
if "%C%"=="5" goto vs2019
if "%C%"=="4" goto vs2017
if "%C%"=="3" goto vs2015
if "%C%"=="2" goto vs2013
@ -42,6 +44,10 @@ goto quit @@ -42,6 +44,10 @@ goto quit
"premake5" --file=premake5.lua vs2017
goto quit
:vs2019
"premake5" --file=premake5.lua vs2019
goto quit
:gmake
"premake5" --file=premake5.lua gmake
goto quit

2
build/Helpers.lua

@ -167,7 +167,7 @@ function SetupManagedProject() @@ -167,7 +167,7 @@ function SetupManagedProject()
location ("%{wks.location}/projects")
buildoptions {"/platform:".._OPTIONS["arch"]}
dotnetframework "4.7"
dotnetframework "4.7.2"
if not os.istarget("macosx") then
filter { "action:vs* or netcore" }

BIN
build/premake5.exe

Binary file not shown.

10
src/Core/Toolchains/MSVCToolchain.cs

@ -17,6 +17,7 @@ namespace CppSharp @@ -17,6 +17,7 @@ namespace CppSharp
VS2013 = 12,
VS2015 = 14,
VS2017 = 15,
VS2019 = 16,
Latest,
}
@ -94,9 +95,12 @@ namespace CppSharp @@ -94,9 +95,12 @@ namespace CppSharp
clVersion = new Version { Major = 19, Minor = 0 };
break;
case VisualStudioVersion.VS2017:
case VisualStudioVersion.Latest:
clVersion = new Version { Major = 19, Minor = 10 };
break;
case VisualStudioVersion.VS2019:
case VisualStudioVersion.Latest:
clVersion = new Version { Major = 19, Minor = 20 };
break;
default:
throw new Exception("Unknown Visual Studio version");
}
@ -207,8 +211,10 @@ namespace CppSharp @@ -207,8 +211,10 @@ namespace CppSharp
case VisualStudioVersion.VS2015:
return 14;
case VisualStudioVersion.VS2017:
case VisualStudioVersion.Latest:
return 15;
case VisualStudioVersion.VS2019:
case VisualStudioVersion.Latest:
return 16;
default:
throw new Exception("Unknown Visual Studio version");
}

3
src/Parser/ParserOptions.cs

@ -120,6 +120,9 @@ namespace CppSharp.Parser @@ -120,6 +120,9 @@ namespace CppSharp.Parser
case "vs2017":
vsVersion = VisualStudioVersion.VS2017;
break;
case "vs2019":
vsVersion = VisualStudioVersion.VS2019;
break;
#pragma warning restore 162

Loading…
Cancel
Save