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>
This commit is contained in:
Dimitar Dobrev 2020-07-30 01:26:59 +03:00
Родитель 3dd467626c
Коммит 0a15871751
7 изменённых файлов: 28 добавлений и 16 удалений

5
.gitignore поставляемый
Просмотреть файл

@ -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

Просмотреть файл

@ -21,7 +21,7 @@ branches:
matrix:
fast_finish: true
os: Visual Studio 2017
os: Visual Studio 2019
platform:
- x86
@ -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:
- 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
#---------------------------------#

Просмотреть файл

@ -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
"premake5" --file=premake5.lua vs2017
goto quit
:vs2019
"premake5" --file=premake5.lua vs2019
goto quit
:gmake
"premake5" --file=premake5.lua gmake
goto quit

Просмотреть файл

@ -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" }

Двоичные данные
build/premake5.exe

Двоичный файл не отображается.

Просмотреть файл

@ -17,6 +17,7 @@ namespace CppSharp
VS2013 = 12,
VS2015 = 14,
VS2017 = 15,
VS2019 = 16,
Latest,
}
@ -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
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");
}

Просмотреть файл

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