diff --git a/appveyor.yml b/appveyor.yml index 76b67b94..a6f0b7c6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -48,7 +48,8 @@ install: - build\premake5.exe --file=build\scripts\LLVM.lua download_llvm --arch=%PLATFORM% build_script: - - build\premake5.exe --file=build\premake5.lua vs%VS_VERSION% --arch=%PLATFORM% + - build\premake5.exe --netcore=true --file=build\premake5.lua vs%VS_VERSION% --arch=%PLATFORM% + - nuget restore ./build/vs%VS_VERSION%/CppSharp.sln - msbuild %BUILD_PATH%\CppSharp.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" /verbosity:minimal #---------------------------------# diff --git a/build/Compile.sh b/build/Compile.sh index b1de7837..2dfdfc45 100755 --- a/build/Compile.sh +++ b/build/Compile.sh @@ -37,7 +37,7 @@ fi export PATH=$PATH:$MONO_PATH -$PREMAKE --file=$CUR_DIR/premake5.lua gmake "$@" +$PREMAKE --netcore=true --file=$CUR_DIR/premake5.lua gmake "$@" if $DEBUG; then BUILD_CONF=debug_x64; diff --git a/build/GenerateMake.bat b/build/GenerateMake.bat index 62473a69..fac241b7 100644 --- a/build/GenerateMake.bat +++ b/build/GenerateMake.bat @@ -1,5 +1,5 @@ @echo off -premake5 --file=premake5.lua gmake +premake5 --netcore=true --file=premake5.lua gmake pause \ No newline at end of file diff --git a/build/GenerateProjects.bat b/build/GenerateProjects.bat index 72c175a7..5cbc0b06 100644 --- a/build/GenerateProjects.bat +++ b/build/GenerateProjects.bat @@ -25,31 +25,19 @@ if "%C%"=="1" goto vs2012 if "%C%"=="0" goto clean :clean -"premake5" --file=premake5.lua clean -goto quit - -:vs2012 -"premake5" --file=premake5.lua vs2012 -goto quit - -:vs2013 -"premake5" --file=premake5.lua vs2013 -goto quit - -:vs2015 -"premake5" --file=premake5.lua vs2015 +"premake5" --netcore=true --file=premake5.lua clean goto quit :vs2017 -"premake5" --file=premake5.lua vs2017 +"premake5" --netcore=true --file=premake5.lua vs2017 goto quit :vs2019 -"premake5" --file=premake5.lua vs2019 +"premake5" --netcore=true --file=premake5.lua vs2019 goto quit :gmake -"premake5" --file=premake5.lua gmake +"premake5" --netcore=true --file=premake5.lua gmake goto quit :quit diff --git a/build/Helpers.lua b/build/Helpers.lua index 5311f2e9..bc2ab897 100644 --- a/build/Helpers.lua +++ b/build/Helpers.lua @@ -10,6 +10,11 @@ newoption { } } +newoption { + trigger = "netcore", + description = "enable .NET Core" +} + newoption { trigger = "no-cxx11-abi", description = "disable C++-11 ABI on GCC 4.9+" @@ -168,7 +173,17 @@ function SetupManagedProject() buildoptions {"/langversion:7.2"} buildoptions {"/platform:".._OPTIONS["arch"]} - dotnetframework "4.7.2" + if _OPTIONS.netcore then + dotnetframework "netcoreapp3.1" + else + dotnetframework "4.7.2" + end + + nuget + { + "System.CodeDom:4.7.0", + "Microsoft.Win32.Registry:4.7.0" + } if not os.istarget("macosx") then filter { "action:vs* or netcore" } @@ -176,15 +191,6 @@ function SetupManagedProject() filter {} end - filter { "action:netcore" } - dotnetframework "netstandard2.0" - - filter { "action:vs2013" } - dotnetframework "4.5" - - filter { "action:vs2012" } - dotnetframework "4.5" - filter {} end diff --git a/build/Tests.lua b/build/Tests.lua index 724da131..250c587b 100644 --- a/build/Tests.lua +++ b/build/Tests.lua @@ -59,7 +59,9 @@ function SetupTestGeneratorProject(name, depends) "CppSharp.AST", "CppSharp.Generator", "CppSharp.Generator.Tests", - "CppSharp.Parser" + "CppSharp.Parser", + "System", + "System.Core" } if depends ~= nil then @@ -70,15 +72,11 @@ function SetupTestGeneratorProject(name, depends) SetupParser() - filter { "action:netcore" } - dotnetframework "netcoreapp2.0" - - filter { "action:not netcore" } - links - { - "System", - "System.Core" - } + if _OPTIONS.netcore then + dotnetframework "netcoreapp3.1" + else + dotnetframework "4.7.2" + end end local function get_mono_exe() @@ -128,25 +126,11 @@ end function LinkNUnit() local c = filter() - filter { "action:not netcore"} - libdirs - { - depsdir .. "/NUnit", - depsdir .. "/NSubstitute" - } - - links - { - "nunit.framework", - "NSubstitute" - } - - filter { "action:netcore"} - nuget - { - "NUnit:3.11.0", - "NSubstitute:4.0.0-rc1" - } + nuget + { + "NUnit:3.12.0", + "NSubstitute:4.2.2" + } filter(c) end @@ -191,8 +175,11 @@ function SetupTestProjectsCSharp(name, depends, extraFiles, suffix) LinkNUnit() - filter { "action:netcore" } - dotnetframework "netcoreapp2.0" + if _OPTIONS.netcore then + dotnetframework "netcoreapp3.1" + else + dotnetframework "4.7.2" + end end function SetupTestProjectsCLI(name, extraFiles, suffix) diff --git a/src/CLI/premake5.lua b/src/CLI/premake5.lua index 277a9995..9c72449a 100644 --- a/src/CLI/premake5.lua +++ b/src/CLI/premake5.lua @@ -25,5 +25,8 @@ project "CppSharp.CLI" "System.Core" } - filter { "action:netcore" } - dotnetframework "netcoreapp2.0" + if _OPTIONS.netcore then + dotnetframework "netcoreapp3.1" + else + dotnetframework "4.7.2" + end diff --git a/src/Core/premake5.lua b/src/Core/premake5.lua index 0c3cc9d7..e8588cd8 100644 --- a/src/Core/premake5.lua +++ b/src/Core/premake5.lua @@ -14,8 +14,4 @@ project "CppSharp" depsdir .. "/vs2017/Microsoft.VisualStudio.Setup.Configuration.Interop" } - filter { "action:netcore" } - nuget { "Microsoft.Win32.Registry:4.5.0" } - - filter { "action:not netcore"} - links { "System", "System.Core" } + nuget { "Microsoft.Win32.Registry:4.7.0" } diff --git a/src/Generator.Tests/premake5.lua b/src/Generator.Tests/premake5.lua index 506900af..7eaa3c69 100644 --- a/src/Generator.Tests/premake5.lua +++ b/src/Generator.Tests/premake5.lua @@ -27,19 +27,8 @@ project "CppSharp.Generator.Tests" "CppSharp.Parser", } - filter { "action:netcore"} - nuget - { - "NUnit:3.11.0", - "NSubstitute:4.0.0-rc1" - } - - filter { "action:not netcore"} - links - { - "System", - "System.Core", - "Microsoft.CSharp", - "nunit.framework", - "NSubstitute" - } + nuget + { + "NUnit:3.12.0", + "NSubstitute:4.2.2" + } diff --git a/src/Generator/premake5.lua b/src/Generator/premake5.lua index 56da57db..f2ca9bec 100644 --- a/src/Generator/premake5.lua +++ b/src/Generator/premake5.lua @@ -20,20 +20,11 @@ project "CppSharp.Generator" SetupParser() - filter { "action:netcore"} - nuget - { - "System.CodeDom:4.5.0", - "Microsoft.CSharp:4.5.0" - } - - filter { "action:not netcore"} - links - { - "System", - "System.Core", - "Microsoft.CSharp" - } + nuget + { + "System.CodeDom:4.7.0", + "Microsoft.CSharp:4.7.0" + } filter { 'files:**verbs.txt' } buildaction "Embed"