Browse Source

Upgrade to .NET Core 3.1 and improve build system

pull/1525/head
josetr 5 years ago
parent
commit
dbbcb6dbdf
  1. 17
      .github/workflows/main.yml
  2. 3
      .gitignore
  3. 10
      Directory.Build.props
  4. 50
      build/Compile.sh
  5. 147
      build/Helpers.lua
  6. 17
      build/InstallMono.sh
  7. 9
      build/InstallNugets.sh
  8. 5
      build/LLVM.lua
  9. 19
      build/RunTests.sh
  10. 13
      build/Setup.sh
  11. 158
      build/Tests.lua
  12. 183
      build/build.sh
  13. 10
      build/premake.sh
  14. 50
      build/premake/premake.extensions.lua
  15. 23
      build/premake/premake.fixes.lua
  16. BIN
      build/premake5-linux
  17. BIN
      build/premake5-osx
  18. BIN
      build/premake5.exe
  19. 52
      build/premake5.lua
  20. 8
      build/scripts/LLVM.lua
  21. 4
      build/test.sh
  22. 259
      deps/NSubstitute/NSubstitute.XML
  23. BIN
      deps/NSubstitute/NSubstitute.dll
  24. BIN
      deps/NUnit/nunit.framework.dll
  25. 18812
      deps/NUnit/nunit.framework.xml
  26. BIN
      deps/vs2017/Microsoft.VisualStudio.Setup.Configuration.Interop.dll
  27. 485
      deps/vs2017/Microsoft.VisualStudio.Setup.Configuration.Interop.xml
  28. 105
      docs/GettingStarted.md
  29. 12
      docs/LLVM.md
  30. 1
      examples/Parser/premake5.lua
  31. 6
      src/AST/premake5.lua
  32. 17
      src/CLI/premake5.lua
  33. 17
      src/Core/premake5.lua
  34. 7
      src/CppParser/Bindings/CLI/premake5.lua
  35. 12
      src/CppParser/Bindings/CSharp/premake5.lua
  36. 2
      src/CppParser/Bindings/premake5.lua
  37. 14
      src/CppParser/Bootstrap/premake5.lua
  38. 12
      src/CppParser/ParserGen/premake5.lua
  39. 4
      src/Generator.Tests/GeneratorTest.cs
  40. 34
      src/Generator.Tests/premake5.lua
  41. 28
      src/Generator/premake5.lua
  42. 17
      src/Parser/premake5.lua
  43. 7
      src/Runtime/premake5.lua
  44. 2
      tests/CSharp/CSharp.Tests.cs
  45. 10
      tests/NamespacesBase/premake4.lua
  46. 0
      tests/NamespacesBase/test.cs
  47. 7
      tests/NamespacesDerived/premake4.lua

17
.github/workflows/main.yml

@ -11,38 +11,37 @@ jobs: @@ -11,38 +11,37 @@ jobs:
config:
- { os: ubuntu-20.04, platform: x64, cxx: g++-9, cc: gcc-9 }
- { os: macos-10.15, platform: x64, cxx: clang++, cc: clang }
- { os: windows-2019, platform: x86, vs: 2019 }
- { os: windows-2019, platform: x64, vs: 2019 }
- { os: windows-2019, platform: x86, vs: msvc }
- { os: windows-2019, platform: x64, vs: msvc }
runs-on: ${{ matrix.config.os }}
env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
VS_VERSION: ${{ matrix.config.vs }}
PLATFORM: ${{ matrix.config.platform }}
steps:
- uses: actions/checkout@v2
- name: Environment
if: matrix.config.vs > 0
if: matrix.config.vs
shell: bash
run: echo "/c/Program Files (x86)/Microsoft Visual Studio/$VS_VERSION/Enterprise/MSBuild/Current/Bin" >> $GITHUB_PATH
run: echo "/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/MSBuild/Current/Bin" >> $GITHUB_PATH
- name: Fix intrin.h file
if: matrix.config.vs > 0
if: matrix.config.vs
shell: powershell
run: build/intrin.ps1
- name: Setup
shell: bash
run: build/Setup.sh
run: build/build.sh download_llvm -platform $PLATFORM
- name: Build
shell: bash
run: build/Compile.sh
run: build/build.sh -platform $PLATFORM
- name: Test
shell: bash
run: build/RunTests.sh
run: build/test.sh -platform $PLATFORM

3
.gitignore vendored

@ -43,9 +43,8 @@ src/generator/generator @@ -43,9 +43,8 @@ src/generator/generator
/build/vs20*
/build/gmake
/build/headers
/build/netcore
/build/gen
/deps/llvm
/deps/NUnit*
/extra
/include/include
/include/libc

10
Directory.Build.props

@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
<Project>
<PropertyGroup>
<RootDir>$(MSBuildThisFileDirectory)</RootDir>
<Platforms>x86;x64</Platforms>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<BaseIntermediateOutputPath>$(RootDir)build\obj\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
<TargetDir Condition="$(Configuration) != ''">$(RootDir)bin\$(Configuration)_$(Platform)</TargetDir>
<LangVersion>7.3</LangVersion>
</PropertyGroup>
</Project>

50
build/Compile.sh

@ -1,50 +0,0 @@ @@ -1,50 +0,0 @@
#!/usr/bin/env bash
set -e
CUR_DIR=$(cd "$(dirname "$0")"; pwd)
DEBUG=false
case $(uname -s) in
CYGWIN*|MINGW32*|MSYS*|MINGW*)
$CUR_DIR/premake5.exe --file=$CUR_DIR/premake5.lua vs$VS_VERSION --arch=$PLATFORM
MSBuild.exe $CUR_DIR/vs$VS_VERSION/CppSharp.sln //p:Configuration=Release //verbosity:minimal
exit 0
;;
esac
for i in "$@"
do
case $i in
-debug|--debug)
DEBUG=true
;;
*)
# unknown option
;;
esac
done
MONO=mono
if [ "$(uname)" == "Darwin" ]; then
MONO_PATH=/Library/Frameworks/Mono.framework/Versions/Current/bin/
MONO="$MONO_PATH$MONO"
fi
MONO_VERSION_OUTPUT="$($MONO --version)"
if [[ $MONO_VERSION_OUTPUT == *"amd64"* ]]; then
BUILD_CONF=release_x64;
else
BUILD_CONF=release_x86;
fi
export PATH=$PATH:$MONO_PATH
$CUR_DIR/premake.sh --file=$CUR_DIR/premake5.lua gmake2 "$@"
if $DEBUG; then
BUILD_CONF=debug_x64;
fi
config=$BUILD_CONF make -C $CUR_DIR/gmake/
BUILD_CONF_DIR="$(tr '[:lower:]' '[:upper:]' <<< ${BUILD_CONF:0:1})${BUILD_CONF:1}"
BUILD_DIR=$CUR_DIR/gmake/lib/$BUILD_CONF_DIR

147
build/Helpers.lua

@ -1,12 +1,15 @@ @@ -1,12 +1,15 @@
-- This module checks for the all the project dependencies.
require('vstudio')
require('premake/premake.fixes')
require('premake/premake.extensions')
newoption {
trigger = "arch",
description = "Choose a particular architecture / bitness",
default = "x64",
allowed = {
{ "x86", "x86 32-bits" },
{ "x64", "x64 64-bits" },
{ "AnyCPU", "Any CPU (.NET)" },
}
}
@ -26,99 +29,34 @@ newoption { @@ -26,99 +29,34 @@ newoption {
}
newoption {
trigger = "debug",
description = "enable debug mode"
trigger = "configuration",
description = "Choose a configuration",
default = "Release",
allowed = {
{ "Release", "Release" },
{ "Debug", "Debug" },
}
}
explicit_target_architecture = _OPTIONS["arch"]
function get_mono_path()
local mono = "mono"
local result, errorcode = os.outputof(mono .. " --version")
if result == nil and os.ishost("macosx") then
mono = "/Library/Frameworks/Mono.framework/Versions/Current/bin/" .. mono
result, errorcode = os.outputof(mono .. " --version")
end
if result == nil then
print("Could not find Mono executable, please make sure it is in PATH.")
os.exit(1)
end
return mono
end
function is_64_bits_mono_runtime()
local result, errorcode = os.outputof(get_mono_path() .. " --version")
local arch = string.match(result, "Architecture:%s*([%w]+)")
return arch == "amd64"
end
default_gcc_version = "9.0.0"
function target_architecture()
if _ACTION == "netcore" then
return "AnyCPU"
end
-- Default to 64-bit on Windows and Mono architecture otherwise.
if explicit_target_architecture ~= nil then
return explicit_target_architecture
end
if os.ishost("windows") then return "x64" end
return is_64_bits_mono_runtime() and "x64" or "x86"
end
if not _OPTIONS["arch"] then
_OPTIONS["arch"] = target_architecture()
end
-- Uncomment to enable Roslyn compiler.
--[[
premake.override(premake.tools.dotnet, "gettoolname", function(base, cfg, tool)
if tool == "csc" then
return "csc"
end
return base(cfg, tool)
end)
]]
basedir = path.getdirectory(_PREMAKE_COMMAND)
premake.path = premake.path .. ";" .. path.join(basedir, "modules")
depsdir = path.getabsolute("../deps");
srcdir = path.getabsolute("../src");
incdir = path.getabsolute("../include");
bindir = path.getabsolute("../bin");
examplesdir = path.getabsolute("../examples");
testsdir = path.getabsolute("../tests");
local function get_build_dir()
if _ARGS[1] then
return _ARGS[1]
end
if not _ACTION then
return ""
end
return _ACTION == "gmake2" and "gmake" or _ACTION
end
builddir = path.getabsolute("./" .. get_build_dir());
if _ACTION ~= "netcore" then
objsdir = path.join(builddir, "obj", "%{cfg.buildcfg}_%{cfg.platform}");
libdir = path.join(builddir, "lib", "%{cfg.buildcfg}_%{cfg.platform}");
else
objsdir = path.join(builddir, "obj", "%{cfg.buildcfg}");
libdir = path.join(builddir, "lib", "%{cfg.buildcfg}");
end
rootdir = path.getabsolute("../")
depsdir = path.join(rootdir, "deps");
srcdir = path.join(rootdir, "src");
incdir = path.join(rootdir, "include");
examplesdir = path.join(rootdir, "examples");
testsdir = path.join(rootdir, "tests");
builddir = path.join(rootdir, "build")
bindir = path.join(rootdir, "bin")
objsdir = path.join(builddir, "obj");
gendir = path.join(builddir, "gen");
actionbuilddir = path.join(builddir, _ACTION == "gmake2" and "gmake" or (_ACTION and _ACTION or ""));
bindircfg = path.join(bindir, "%{cfg.buildcfg}_%{cfg.platform}");
prjobjdir = path.join(objsdir, "%{prj.name}", "%{cfg.buildcfg}")
msvc_buildflags = { "/MP", "/wd4267" }
msvc_cpp_defines = { }
default_gcc_version = "9.0.0"
generate_build_config = true
premake.path = premake.path .. ";" .. path.join(builddir, "modules")
function string.starts(str, start)
if str == nil then return end
@ -129,8 +67,13 @@ function SafePath(path) @@ -129,8 +67,13 @@ function SafePath(path)
return "\"" .. path .. "\""
end
function target_architecture()
return _OPTIONS["arch"]
end
function SetupNativeProject()
location ("%{wks.location}/projects")
files { "*.lua" }
filter { "configurations:Debug" }
defines { "DEBUG" }
@ -177,21 +120,7 @@ end @@ -177,21 +120,7 @@ end
function SetupManagedProject()
language "C#"
location ("%{wks.location}/projects")
buildoptions {"/langversion:7.3"}
buildoptions {"/platform:".._OPTIONS["arch"]}
dotnetframework "4.7.2"
if not os.istarget("macosx") then
filter { "action:vs* or netcore" }
location "."
filter {}
end
filter { "action:netcore" }
dotnetframework "netstandard2.0"
location "."
filter {}
end
@ -271,15 +200,15 @@ function UseCxx11ABI() @@ -271,15 +200,15 @@ function UseCxx11ABI()
end
function EnableNativeProjects()
if _ACTION == "netcore" then
return false
end
return not (string.starts(_ACTION, "vs") and not os.ishost("windows"))
end
if string.starts(_ACTION, "vs") and not os.ishost("windows") then
return false
end
function EnabledManagedProjects()
return string.starts(_ACTION, "vs")
end
return true
function EnabledCLIProjects()
return EnabledManagedProjects() and os.istarget("windows")
end
function AddPlatformSpecificFiles(folder, filename)

17
build/InstallMono.sh

@ -1,17 +0,0 @@ @@ -1,17 +0,0 @@
OS=$(uname -s)
if [ "$(command -v mono)" ]; then
exit 0
fi
if [ "$OS" == "Darwin" ]; then
curl -o mono.pkg https://download.mono-project.com/archive/6.10.0/macos-10-universal/MonoFramework-MDK-6.10.0.macos10.xamarin.universal.pkg
sudo installer -pkg mono.pkg -target /
export PATH=$PATH:/Library/Frameworks/Mono.framework/Versions/Current/bin
elif [ "$OS" == "Linux" ]; then
sudo apt install gnupg ca-certificates
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt-get update -qq
sudo apt-get install -y --force-yes mono-mcs mono-roslyn libmono-system-runtime4.0-cil
fi

9
build/InstallNugets.sh

@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
BUILD_DIR=$(dirname -- $0)
NUNIT=NUnit.Console-3.9.0
if [ -e $BUILD_DIR/../deps/$NUNIT/nunit3-console.exe ]; then
exit 0
fi
curl -O -L https://github.com/nunit/nunit-console/releases/download/v3.9/$NUNIT.zip
unzip $NUNIT.zip -d $BUILD_DIR/../deps/$NUNIT

5
build/LLVM.lua

@ -10,9 +10,8 @@ local LLVMRootDirRelease = "" @@ -10,9 +10,8 @@ local LLVMRootDirRelease = ""
require "scripts/LLVM"
function SearchLLVM()
local basedir = path.getdirectory(_PREMAKE_COMMAND)
LLVMRootDirDebug = basedir .. "/scripts/" .. get_llvm_package_name(nil, "Debug")
LLVMRootDirRelease = basedir .. "/scripts/" .. get_llvm_package_name()
LLVMRootDirDebug = builddir .. "/scripts/" .. get_llvm_package_name(nil, "Debug")
LLVMRootDirRelease = builddir .. "/scripts/" .. get_llvm_package_name()
if os.isdir(LLVMRootDirDebug) or os.isdir(LLVMRootDirRelease) then
LLVMDirPerConfiguration = true

19
build/RunTests.sh

@ -1,19 +0,0 @@ @@ -1,19 +0,0 @@
#!/bin/sh
set -e
DIR=$( cd "$( dirname "$0" )" && pwd )
case $(uname -s) in
CYGWIN*|MINGW32*|MSYS*|MINGW*)
ACTION=vs2019
;;
*)
ACTION=gmake
MONO=mono
export PATH=$PATH:/Library/Frameworks/Mono.framework/Versions/Current/bin
;;
esac
$DIR/InstallNugets.sh
OUT_DIR=$(find $DIR/$ACTION/lib/* -type d -maxdepth 0)
cp $DIR/../deps/NUnit/nunit.framework.* $OUT_DIR
$MONO $DIR/../deps/NUnit.Console-3.9.0/nunit3-console.exe --result=$OUT_DIR/TestResult.xml $OUT_DIR/*Tests*.dll

13
build/Setup.sh

@ -1,13 +0,0 @@ @@ -1,13 +0,0 @@
#!/bin/sh
set -e
DIR=$( cd "$( dirname "$0" )" && pwd )
case $(uname -s) in
CYGWIN*|MINGW32*|MSYS*|MINGW*)
;;
*)
$DIR/InstallMono.sh
;;
esac
$DIR/premake.sh --file=$DIR/scripts/LLVM.lua download_llvm --arch=$PLATFORM

158
build/Tests.lua

@ -1,12 +1,12 @@ @@ -1,12 +1,12 @@
-- Tests/examples helpers
require('vstudio')
function SetupExampleProject()
kind "ConsoleApp"
language "C#"
language "C#"
debugdir "."
files { "**.cs", "./*.lua" }
excludes { "obj/**" }
links
{
"CppSharp",
@ -39,29 +39,28 @@ function SetupTestCLI(name, extraFiles, suffix) @@ -39,29 +39,28 @@ function SetupTestCLI(name, extraFiles, suffix)
end
function SetupManagedTestProject()
SetupManagedProject()
kind "SharedLib"
language "C#"
clr "Unsafe"
filter { "action:not netcore" }
links
{
"System.Core"
}
SetupManagedProject()
enabledefaultcompileitems "false"
kind "SharedLib"
language "C#"
clr "Unsafe"
files { "*.lua" }
end
function SetupTestGeneratorProject(name, depends)
if not EnabledManagedProjects() then
return
end
project(name .. ".Gen")
SetupManagedTestProject()
SetupParser()
kind "ConsoleApp"
files { name .. ".cs" }
vpaths { ["*"] = "*" }
enabledefaultnoneitems "false"
files { name .. ".cs" }
dependson { name .. ".Native" }
linktable = {
links {
"CppSharp",
"CppSharp.AST",
"CppSharp.Generator",
@ -70,45 +69,18 @@ function SetupTestGeneratorProject(name, depends) @@ -70,45 +69,18 @@ function SetupTestGeneratorProject(name, depends)
}
if depends ~= nil then
table.insert(linktable, depends .. ".Gen")
links { depends .. ".Gen" }
end
links(linktable)
SetupParser()
filter { "action:netcore" }
dotnetframework "netcoreapp2.0"
filter { "action:not netcore" }
links
{
"System",
"System.Core"
}
end
local function get_mono_exe()
if target_architecture() == "x64" then
local _, errorcode = os.outputof("mono64")
return errorcode ~= 127 and "mono64" or "mono"
end
return "mono"
local command = os.ishost("windows") and "type nul >" or "touch"
postbuildcommands { command .. " " .. SafePath(path.join(objsdir, name .. ".Native", "timestamp.cs")) }
postbuildcommands { command .. " " .. SafePath(path.join(objsdir, name .. ".Native", "timestamp.cpp")) }
end
function SetupTestGeneratorBuildEvent(name)
if _ACTION == "netcore" then
return
end
local monoExe = get_mono_exe()
local runtimeExe = os.ishost("windows") and "" or monoExe .. " --debug "
if string.starts(action, "vs") then
local exePath = SafePath("$(TargetDir)" .. name .. ".Gen.exe")
prebuildcommands { runtimeExe .. exePath }
else
local exePath = SafePath("%{cfg.buildtarget.directory}/" .. name .. ".Gen.exe")
prebuildcommands { runtimeExe .. exePath }
end
local cmd = os.ishost("windows") and "" or "dotnet "
local ext = os.ishost("windows") and "exe" or "dll"
prebuildcommands { cmd .. SafePath(path.join("%{cfg.buildtarget.directory}", name .. ".Gen." .. ext)) }
end
function SetupTestNativeProject(name, depends)
@ -124,51 +96,21 @@ function SetupTestNativeProject(name, depends) @@ -124,51 +96,21 @@ function SetupTestNativeProject(name, depends)
language "C++"
files { "**.h", "**.cpp" }
vpaths { ["*"] = "*" }
defines { "DLL_EXPORT" }
if depends ~= nil then
links { depends .. ".Native" }
end
if string.startswith(_ACTION, "vs") then
postbuildcommands { "type nul > " .. SafePath(path.join(libdir, name .. ".Native.timestamp.cs")) }
postbuildcommands { "type nul > " .. SafePath(path.join(libdir, name .. ".Native.timestamp.cpp")) }
end
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
{
"NUnit3TestAdapter:3.17.0",
}
filter(c)
local command = os.ishost("windows") and "type nul >" or "touch"
postbuildcommands { command .. " " .. SafePath(path.join(objsdir, name .. ".Native", "timestamp.cs")) }
postbuildcommands { command .. " " .. SafePath(path.join(objsdir, name .. ".Native", "timestamp.cpp")) }
end
function SetupTestProjectsCSharp(name, depends, extraFiles, suffix)
if not EnabledManagedProjects() then
return
end
if suffix ~= nil then
nm = name .. suffix
str = "Std" .. suffix
@ -181,53 +123,44 @@ function SetupTestProjectsCSharp(name, depends, extraFiles, suffix) @@ -181,53 +123,44 @@ function SetupTestProjectsCSharp(name, depends, extraFiles, suffix)
dependson { name .. ".Gen", name .. ".Native", "CppSharp.Generator" }
SetupTestGeneratorBuildEvent(name)
enabledefaultnoneitems "false"
files
{
path.join(gendir, name, nm .. ".cs"),
path.join(gendir, name, str .. ".cs")
}
vpaths { ["*"] = "*" }
linktable = { "CppSharp.Runtime" }
links { "CppSharp.Runtime" }
if depends ~= nil then
table.insert(linktable, depends .. ".CSharp")
end
links(linktable)
if string.startswith(_ACTION, "vs") then
files { path.join(libdir, name .. ".Native.timestamp.cs") }
links { name .. ".Gen" }
links { depends .. ".CSharp" }
end
project(name .. ".Tests.CSharp")
SetupManagedTestProject()
enabledefaultnoneitems "false"
files { name .. ".Tests.cs" }
vpaths { ["*"] = "*" }
links { name .. ".CSharp", "CppSharp.Generator.Tests", "CppSharp.Runtime" }
nuget { "Microsoft.NET.Test.Sdk:16.8.0" }
dependson { name .. ".Native" }
LinkNUnit()
filter { "action:netcore" }
dotnetframework "netcoreapp2.0"
end
function SetupTestProjectsCLI(name, extraFiles, suffix)
if (not os.ishost("windows")) or (_ACTION == "netcore") then
if not EnabledCLIProjects() then
return
end
project(name .. ".CLI")
SetupNativeProject()
enabledefaultcompileitems "false"
enabledefaultnoneitems "false"
kind "SharedLib"
language "C++"
clr "On"
clr "NetCore"
dependson { name .. ".Gen", name .. ".Native", "CppSharp.Generator" }
SetupTestGeneratorBuildEvent(name)
@ -252,26 +185,19 @@ function SetupTestProjectsCLI(name, extraFiles, suffix) @@ -252,26 +185,19 @@ function SetupTestProjectsCLI(name, extraFiles, suffix)
files { path.join(gendir, name, file .. ".h") }
end
end
vpaths { ["*"] = "*" }
includedirs { path.join(testsdir, name), incdir }
links { name .. ".Native" }
if string.startswith(_ACTION, "vs") then
files { path.join(libdir, name .. ".Native.timestamp.cpp") }
links { name .. ".Gen" }
end
files { path.join(objsdir, name .. ".Native", "timestamp.cpp") }
project(name .. ".Tests.CLI")
SetupManagedTestProject()
enabledefaultnoneitems "false"
files { name .. ".Tests.cs" }
vpaths { ["*"] = "*" }
links { name .. ".CLI", "CppSharp.Generator.Tests" }
dependson { name .. ".Native" }
LinkNUnit()
nuget { "Microsoft.NET.Test.Sdk:16.8.0" }
end
function IncludeExamples()

183
build/build.sh

@ -0,0 +1,183 @@ @@ -0,0 +1,183 @@
#!/usr/bin/env bash
set -e
builddir=$(cd "$(dirname "$0")"; pwd)
platform=x64
vs=vs2019
configuration=Release
build_only=false
ci=false
verbosity=minimal
rootdir="$builddir/.."
bindir="$rootdir/bin"
objdir="$builddir/obj"
gendir="$builddir/gen"
slnpath="$rootdir/CppSharp.sln"
oshost=""
os=""
test=
if [[ $(uname -m) != *"64"* ]]; then
platform=x86
fi
build()
{
if [ $ci = true ]; then
clean
fi
if [ $ci = true ] || [ $build_only = false ]; then
generate
restore
fi
if [ $oshost = "linux" ] || [ $oshost = "macosx" ]; then
config=$(tr '[:upper:]' '[:lower:]' <<< ${configuration}_$platform) make -C $builddir/gmake/
fi
find_msbuild
$msbuild $slnpath -p:Configuration=$configuration -p:Platform=$platform -v:$verbosity
if [ $ci = true ]; then
test
fi
}
generate()
{
download_llvm
if [ "$os" = "linux" ] || [ "$os" = "macosx" ]; then
$builddir/premake.sh --file=$builddir/premake5.lua gmake2 --os=$os --arch=$platform --configuration=$configuration "$@"
fi
$builddir/premake.sh --file=$builddir/premake5.lua $vs --os=$os --arch=$platform --configuration=$configuration
}
restore()
{
find_msbuild
$msbuild $slnpath -p:Configuration=$configuration -p:Platform=$platform -v:$verbosity -t:restore
}
test()
{
dotnet test $bindir/${configuration}_$platform/*.Tests*.dll
}
clean()
{
rm -rf $objdir
rm -rf $gendir
rm -rf $bindir
rm -rf $builddir/gmake
rm -rf $builddir/$vs
rm -rf $slnpath
}
download_llvm()
{
$builddir/premake.sh --file=$builddir/scripts/LLVM.lua download_llvm --os=$os --arch=$platform --configuration=$configuration
}
download_premake()
{
premake_dir=$builddir/premake
premake_filename=premake5
if [ $oshost = "windows" ]; then
premake_filename=$premake_filename.exe
fi
premake_path=$premake_dir/$premake_filename
if ! [ -f $premake_path ]; then
echo "Downloading and unpacking Premake..."
premake_url=https://github.com/InteropAlliance/premake-core/releases/download/latest/premake-$oshost-$platform.zip
curl -L -O $premake_url
unzip premake-$oshost-$platform.zip $premake_filename -d $premake_dir
chmod +x $premake_path
rm premake-$oshost-$platform.zip
fi
}
detect_os()
{
case "$(uname -s)" in
Darwin)
oshost=macosx
;;
Linux)
oshost=linux
;;
CYGWIN*|MINGW32*|MSYS*|MINGW*)
oshost=windows
;;
*)
echo "Unsupported platform"
exit 1
;;
esac
os=$oshost
}
find_msbuild()
{
if [ -x "$(command -v MSBuild.exe)" ]; then
msbuild="MSBuild.exe"
else
msbuild="msbuild"
fi
}
cmd=$(tr '[:upper:]' '[:lower:]' <<< $1)
detect_os
download_premake
while [[ $# > 0 ]]; do
option=$(tr '[:upper:]' '[:lower:]' <<< "${1/#--/-}")
case "$option" in
-debug)
configuration=Debug
;;
-platform)
platform=$2
shift
;;
-vs)
vs=vs$2
shift
;;
-os)
os=$2
shift
;;
-ci)
ci=true
;;
-build_only)
build_only=true
;;
esac
shift
done
case "$cmd" in
clean)
clean
;;
generate)
generate
;;
restore)
restore
;;
test)
test
;;
download_llvm)
download_llvm
;;
*)
build
;;
esac

10
build/premake.sh

@ -4,16 +4,12 @@ DIR=$( cd "$( dirname "$0" )" && pwd ) @@ -4,16 +4,12 @@ DIR=$( cd "$( dirname "$0" )" && pwd )
case "$(uname -s)" in
Darwin)
$DIR/premake5-osx $*
;;
Linux)
$DIR/premake5-linux $*
Darwin|Linux)
$DIR/premake/premake5 $*
;;
CYGWIN*|MINGW32*|MSYS*|MINGW*)
$DIR/premake5.exe $*
$DIR/premake/premake5.exe $*
;;
*)

50
build/premake/premake.extensions.lua

@ -0,0 +1,50 @@ @@ -0,0 +1,50 @@
premake.api.register {
name = "workspacefiles",
scope = "workspace",
kind = "list:string",
}
premake.api.register {
name = "removecompilefiles",
scope = "project",
kind = "list:string",
}
premake.api.register {
name = "enabledefaultnoneitems",
scope = "project",
kind = "boolean",
}
premake.override(premake.vstudio.dotnetbase.netcore, "enableDefaultCompileItems", function(base, cfg)
base(cfg);
if cfg.enabledefaultnoneitems ~= nil then
premake.w('<EnableDefaultNoneItems>%s</EnableDefaultNoneItems>', iif(cfg.enabledefaultnoneitems, "true", "false"))
end
end)
premake.override(premake.vstudio.dotnetbase, "files", function(base, prj)
base(prj);
if prj.removecompilefiles ~= nil then
for _, file in ipairs(prj.removecompilefiles) do
premake.w("<Compile Remove=\"%s\" />", file)
end
end
end)
-- https://github.com/premake/premake-core/issues/1061#issuecomment-441417853
premake.override(premake.vstudio.sln2005, "projects", function(base, wks)
if wks.workspacefiles and #wks.workspacefiles > 0 then
premake.push('Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{' .. os.uuid("Solution Items:"..wks.name) .. '}"')
premake.push("ProjectSection(SolutionItems) = preProject")
for _, file in ipairs(wks.workspacefiles) do
file = path.rebase(file, ".", wks.location)
premake.w(file.." = "..file)
end
premake.pop("EndProjectSection")
premake.pop("EndProject")
end
base(wks)
end)

23
build/premake/premake.fixes.lua

@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
-- https://github.com/premake/premake-core/issues/1559
premake.override(premake.vstudio.vc2010, "targetFramework", function(oldfn, prj)
if prj.clr == "NetCore" then
local action = premake.action.current()
local tools = string.format(' ToolsVersion="%s"', action.vstudio.toolsVersion)
local framework = prj.dotnetframework or action.vstudio.targetFramework or "4.0"
premake.w('<TargetFramework>%s</TargetFramework>', framework)
else
oldfn(prj)
end
end)
-- https://github.com/premake/premake-core/issues/1549
premake.override(premake.vstudio.cs2005.elements, "projectProperties", function(base, cfg)
local calls = base(cfg);
table.insert(calls, function(cfg)
if cfg.clr == "Unsafe" then
premake.w('<AllowUnsafeBlocks>true</AllowUnsafeBlocks>')
end
end)
return calls;
end)

BIN
build/premake5-linux

Binary file not shown.

BIN
build/premake5-osx

Binary file not shown.

BIN
build/premake5.exe

Binary file not shown.

52
build/premake5.lua

@ -9,35 +9,49 @@ include "LLVM.lua" @@ -9,35 +9,49 @@ include "LLVM.lua"
workspace "CppSharp"
configurations { "Debug", "Release" }
configurations { _OPTIONS["configuration"] }
platforms { target_architecture() }
dotnetframework "netcoreapp3.1"
enabledefaultcompileitems "true"
characterset "Unicode"
symbols "On"
location (builddir)
objdir (objsdir)
targetdir (libdir)
debugdir (bindir)
location (actionbuilddir)
objdir (prjobjdir)
targetdir (bindircfg)
debugdir (bindircfg)
filter "action:vs*"
location (rootdir)
filter "system:windows"
defines { "WINDOWS" }
filter {}
matches = os.matchfiles(path.join(rootdir, "*"))
for _, file in ipairs(matches) do
if not string.endswith(file, ".sln") then
workspacefiles(file)
end
end
group "Libraries"
include (srcdir .. "/Core")
include (srcdir .. "/AST")
--include (srcdir .. "/ASTViewer")
include (srcdir .. "/CppParser")
include (srcdir .. "/CppParser/Bindings")
include (srcdir .. "/CppParser/Bootstrap")
include (srcdir .. "/CppParser/ParserGen")
include (srcdir .. "/Parser")
include (srcdir .. "/CLI")
include (srcdir .. "/Generator")
include (srcdir .. "/Generator.Tests")
include (srcdir .. "/Runtime")
if EnableNativeProjects() then
include (srcdir .. "/CppParser")
end
if EnabledManagedProjects() then
include (srcdir .. "/Core")
include (srcdir .. "/AST")
--include (srcdir .. "/ASTViewer")
include (srcdir .. "/CppParser/Bindings")
include (srcdir .. "/CppParser/Bootstrap")
include (srcdir .. "/CppParser/ParserGen")
include (srcdir .. "/Parser")
include (srcdir .. "/CLI")
include (srcdir .. "/Generator")
include (srcdir .. "/Generator.Tests")
include (srcdir .. "/Runtime")
end
if not _OPTIONS["disable-tests"] then
dofile "Tests.lua"

8
build/scripts/LLVM.lua

@ -2,8 +2,7 @@ require "Build" @@ -2,8 +2,7 @@ require "Build"
require "Utils"
require "../Helpers"
local basedir = path.getdirectory(_PREMAKE_COMMAND)
local llvm = path.getabsolute(basedir .. "/../deps/llvm")
local llvm = path.getabsolute(builddir .. "/../deps/llvm")
-- Prevent premake from inserting /usr/lib64 search path on linux. GCC does not need this path specified
-- as compiler automatically knows where to look for system libs. Insertion of this path causes issues
@ -20,7 +19,7 @@ if is_vagrant() then @@ -20,7 +19,7 @@ if is_vagrant() then
end
function get_llvm_rev()
return cat(basedir .. "/LLVM-commit")
return cat(builddir .. "/LLVM-commit")
end
function clone_llvm()
@ -142,8 +141,7 @@ function get_llvm_package_name(rev, conf, arch) @@ -142,8 +141,7 @@ function get_llvm_package_name(rev, conf, arch)
end
function get_llvm_configuration_name(debug)
debug = _OPTIONS["debug"]
if debug == true then
if string.find(_OPTIONS["configuration"], "Debug") then
return "Debug"
end
return os.istarget("windows") and "RelWithDebInfo" or "Release"

4
build/test.sh

@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
#!/bin/bash
set -e
DIR=$( cd "$( dirname "$0" )" && pwd )
$DIR/build.sh test "$@"

259
deps/NSubstitute/NSubstitute.XML vendored

@ -1,259 +0,0 @@ @@ -1,259 +0,0 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>NSubstitute</name>
</assembly>
<members>
<member name="T:NSubstitute.Arg">
<summary>
Argument matchers used for specifying calls to substitutes.
</summary>
</member>
<member name="M:NSubstitute.Arg.Any``1">
<summary>
Match any argument value compatible with type <typeparamref name="T"/>.
</summary>
<typeparam name="T"></typeparam>
<returns></returns>
</member>
<member name="M:NSubstitute.Arg.Is``1(``0)">
<summary>
Match argument that is equal to <paramref name="value"/>.
</summary>
<typeparam name="T"></typeparam>
<param name="value"></param>
<returns></returns>
</member>
<member name="M:NSubstitute.Arg.Is``1(System.Linq.Expressions.Expression{System.Predicate{``0}})">
<summary>
Match argument that satisfies <paramref name="predicate"/>.
If the <paramref name="predicate"/> throws an exception for an argument it will be treated as non-matching.
</summary>
<typeparam name="T"></typeparam>
<param name="predicate"></param>
<returns></returns>
</member>
<member name="M:NSubstitute.Arg.Invoke">
<summary>
Invoke any <see cref="T:System.Action"/> argument as soon as a matching call is made to the substitute.
</summary>
<returns></returns>
</member>
<member name="M:NSubstitute.Arg.Invoke``1(``0)">
<summary>
Invoke any <see cref="T:System.Action`1"/> argument with specified argument as soon as a matching call is made to the substitute.
</summary>
<typeparam name="T"></typeparam>
<param name="arg"></param>
<returns></returns>
</member>
<member name="M:NSubstitute.Arg.Invoke``2(``0,``1)">
<summary>
Invoke any <see cref="T:System.Action`2"/> argument with specified arguments as soon as a matching call is made to the substitute.
</summary>
<typeparam name="T1"></typeparam>
<typeparam name="T2"></typeparam>
<param name="arg1"></param>
<param name="arg2"></param>
<returns></returns>
</member>
<member name="M:NSubstitute.Arg.Invoke``3(``0,``1,``2)">
<summary>
Invoke any <see cref="T:System.Action`3"/> argument with specified arguments as soon as a matching call is made to the substitute.
</summary>
<typeparam name="T1"></typeparam>
<typeparam name="T2"></typeparam>
<typeparam name="T3"></typeparam>
<param name="arg1"></param>
<param name="arg2"></param>
<param name="arg3"></param>
<returns></returns>
</member>
<member name="M:NSubstitute.Arg.Invoke``4(``0,``1,``2,``3)">
<summary>
Invoke any <see cref="T:System.Action`4"/> argument with specified arguments as soon as a matching call is made to the substitute.
</summary>
<typeparam name="T1"></typeparam>
<typeparam name="T2"></typeparam>
<typeparam name="T3"></typeparam>
<typeparam name="T4"></typeparam>
<param name="arg1"></param>
<param name="arg2"></param>
<param name="arg3"></param>
<param name="arg4"></param>
<returns></returns>
</member>
<member name="M:NSubstitute.Arg.InvokeDelegate``1(System.Object[])">
<summary>
Invoke any <typeparamref name="TDelegate"/> argument with specified arguments as soon as a matching call is made to the substitute.
</summary>
<typeparam name="TDelegate"></typeparam>
<param name="arguments">Arguments to pass to delegate.</param>
<returns></returns>
</member>
<member name="M:NSubstitute.Arg.Do``1(System.Action{``0})">
<summary>
Capture any argument compatible with type <typeparamref name="T"/> and use it to call the <paramref name="useArgument"/> function
as soon as a matching call is made to the substitute.
</summary>
<typeparam name="T"></typeparam>
<param name="useArgument"></param>
<returns></returns>
</member>
<member name="T:NSubstitute.IArgumentMatcher">
<summary>
Provides a specification for arguments for use with <see ctype="Arg.Matches (IArgumentMatcher)" />.
Can additionally implement <see ctype="IDescribeNonMatches" /> to give descriptions when arguments do not match.
</summary>
</member>
<member name="M:NSubstitute.IArgumentMatcher.IsSatisfiedBy(System.Object)">
<summary>
Checks whether the <paramref name="argument"/> satisfies the condition of the matcher.
If this throws an exception the argument will be treated as non-matching.
</summary>
<param name="argument"></param>
<returns></returns>
</member>
<member name="M:NSubstitute.IDescribeNonMatches.DescribeFor(System.Object)">
<summary>
Describes how the <paramref name="argument"/> does not match the condition specified by this class, or <see cref="F:System.String.Empty"/>
if a detailed description can not be provided for the argument.
</summary>
<param name="argument"></param>
<returns>Description of the non-match, or <see cref="F:System.String.Empty"/> if no description can be provided.</returns>
</member>
<member name="M:NSubstitute.Core.Extensions.Zip``3(System.Collections.Generic.IEnumerable{``0},System.Collections.Generic.IEnumerable{``1},System.Func{``0,``1,``2})">
<summary>
Combines two enumerables into a new enumerable using the given selector.
</summary>
<typeparam name="TFirst"></typeparam>
<typeparam name="TSecond"></typeparam>
<typeparam name="TResult"></typeparam>
<param name="first"></param>
<param name="second"></param>
<param name="selector"></param>
<returns></returns>
<remarks>
This implementation was sanity-checked against the
<a href="http://msmvps.com/blogs/jon_skeet/archive/2011/01/14/reimplementing-linq-to-objects-part-35-zip.aspx">Edulinq implementation</a> and
<a href="http://blogs.msdn.com/b/ericlippert/archive/2009/05/07/zip-me-up.aspx">Eric Lippert's implementation</a>.
</remarks>
</member>
<member name="M:NSubstitute.Core.Extensions.IsCompatibleWith(System.Object,System.Type)">
<summary>
Checks if the instance can be used when a <paramref name="type"/> is expected.
</summary>
<param name="instance"></param>
<param name="type"></param>
<returns></returns>
</member>
<member name="M:NSubstitute.Core.Extensions.Join(System.Collections.Generic.IEnumerable{System.String},System.String)">
<summary>
Join the <paramref name="strings"/> using <paramref name="seperator"/>.
</summary>
<param name="strings"></param>
<param name="seperator"></param>
<returns></returns>
</member>
<member name="T:NSubstitute.Core.RobustThreadLocal`1">
<summary>
Delegates to ThreadLocal&lt;T&gt;, but wraps Value property access in try/catch to swallow ObjectDisposedExceptions.
These can occur if the Value property is accessed from the finalizer thread. Because we can't detect this, we'll
just swallow the exception (the finalizer thread won't be using any of the values from thread local storage anyway).
</summary>
<typeparam name="T"></typeparam>
</member>
<member name="T:NSubstitute.IArgumentMatcher`1">
<summary>
Provides a specification for arguments for use with <see ctype="Arg.Matches &lt; T &gt;(IArgumentMatcher)" />.
Can additionally implement <see ctype="IDescribeNonMatches" /> to give descriptions when arguments do not match.
</summary>
<typeparam name="T">Matches arguments of type <typeparamref name="T"/> or compatible type.</typeparam>
</member>
<member name="M:NSubstitute.IArgumentMatcher`1.IsSatisfiedBy(`0)">
<summary>
Checks whether the <paramref name="argument"/> satisfies the condition of the matcher.
If this throws an exception the argument will be treated as non-matching.
</summary>
<param name="argument"></param>
<returns></returns>
</member>
<member name="M:NSubstitute.Raise.EventWith``1(System.Object,``0)">
<summary>
Raise an event for an <c>EventHandler&lt;TEventArgs&gt;</c> event with the provided <paramref name="sender"/> and <paramref name="eventArgs"/>.
</summary>
</member>
<member name="M:NSubstitute.Raise.EventWith``1(``0)">
<summary>
Raise an event for an <c>EventHandler&lt;TEventArgs&gt;</c> event with the substitute as the sender and the provided <paramref name="eventArgs" />.
</summary>
</member>
<member name="M:NSubstitute.Raise.EventWith``1">
<summary>
Raise an event for an <c>EventHandler&lt;EventArgsT&gt;</c> event with the substitute as the sender
and with a default instance of <typeparamref name="TEventArgs" />.
</summary>
</member>
<member name="M:NSubstitute.Raise.Event">
<summary>
Raise an event for an <c>EventHandler</c> or <c>EventHandler&lt;EventArgs&gt;</c> event with the substitute
as the sender and with empty <c>EventArgs</c>.
</summary>
</member>
<member name="M:NSubstitute.Raise.Event``1(System.Object[])">
<summary>
Raise an event of type <typeparamref name="THandler" /> with the provided arguments. If no arguments are provided
NSubstitute will try and provide reasonble defaults.
</summary>
</member>
<member name="T:NSubstitute.Substitute">
<summary>
Create a substitute for one or more types. For example: <c>Substitute.For&lt;ISomeType&gt;()</c>
</summary>
</member>
<member name="M:NSubstitute.Substitute.For``1(System.Object[])">
<summary>
Substitute for an interface or class.
<para>Be careful when specifying a class, as all non-virtual members will actually be executed. Only virtual members
can be recorded or have return values specified.</para>
</summary>
<typeparam name="T">The type of interface or class to substitute.</typeparam>
<param name="constructorArguments">Arguments required to construct a class being substituted. Not required for interfaces or classes with default constructors.</param>
<returns>A substitute for the interface or class.</returns>
</member>
<member name="M:NSubstitute.Substitute.For``2(System.Object[])">
<summary>
<para>Substitute for multiple interfaces or a class that implements an interface. At most one class can be specified.</para>
<para>Be careful when specifying a class, as all non-virtual members will actually be executed. Only virtual members
can be recorded or have return values specified.</para>
</summary>
<typeparam name="T1">The type of interface or class to substitute.</typeparam>
<typeparam name="T2">An additional interface or class (maximum of one class) the substitute should implement.</typeparam>
<param name="constructorArguments">Arguments required to construct a class being substituted. Not required for interfaces or classes with default constructors.</param>
<returns>A substitute of type T1, that also implements T2.</returns>
</member>
<member name="M:NSubstitute.Substitute.For``3(System.Object[])">
<summary>
<para>Substitute for multiple interfaces or a class that implements multiple interfaces. At most one class can be specified.</para>
If additional interfaces are required use the <see cref="M:For(System.Type[], System.Object[])" /> overload.
<para>Be careful when specifying a class, as all non-virtual members will actually be executed. Only virtual members
can be recorded or have return values specified.</para>
</summary>
<typeparam name="T1">The type of interface or class to substitute.</typeparam>
<typeparam name="T2">An additional interface or class (maximum of one class) the substitute should implement.</typeparam>
<typeparam name="T3">An additional interface or class (maximum of one class) the substitute should implement.</typeparam>
<param name="constructorArguments">Arguments required to construct a class being substituted. Not required for interfaces or classes with default constructors.</param>
<returns>A substitute of type T1, that also implements T2 and T3.</returns>
</member>
<member name="M:NSubstitute.Substitute.For(System.Type[],System.Object[])">
<summary>
<para>Substitute for multiple interfaces or a class that implements multiple interfaces. At most one class can be specified.</para>
<para>Be careful when specifying a class, as all non-virtual members will actually be executed. Only virtual members
can be recorded or have return values specified.</para>
</summary>
<param name="typesToProxy">The types of interfaces or a type of class and multiple interfaces the substitute should implement.</param>
<param name="constructorArguments">Arguments required to construct a class being substituted. Not required for interfaces or classes with default constructors.</param>
<returns>A substitute implementing the specified types.</returns>
</member>
</members>
</doc>

BIN
deps/NSubstitute/NSubstitute.dll vendored

Binary file not shown.

BIN
deps/NUnit/nunit.framework.dll vendored

Binary file not shown.

18812
deps/NUnit/nunit.framework.xml vendored

File diff suppressed because it is too large Load Diff

BIN
deps/vs2017/Microsoft.VisualStudio.Setup.Configuration.Interop.dll vendored

Binary file not shown.

485
deps/vs2017/Microsoft.VisualStudio.Setup.Configuration.Interop.xml vendored

@ -1,485 +0,0 @@ @@ -1,485 +0,0 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>Microsoft.VisualStudio.Setup.Configuration.Interop</name>
</assembly>
<members>
<member name="T:Microsoft.VisualStudio.Setup.Configuration.IEnumSetupInstances">
<summary>
A enumerator of installed <see cref="T:Microsoft.VisualStudio.Setup.Configuration.ISetupInstance"/> objects.
</summary>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.IEnumSetupInstances.Next(System.Int32,Microsoft.VisualStudio.Setup.Configuration.ISetupInstance[],System.Int32@)">
<summary>
Retrieves the next set of product instances in the enumeration sequence.
</summary>
<param name="celt">The number of product instances to retrieve.</param>
<param name="rgelt">A pointer to an array of <see cref="T:Microsoft.VisualStudio.Setup.Configuration.ISetupInstance"/>.</param>
<param name="pceltFetched">A pointer to the number of product instances retrieved. If celt is 1 this parameter may be NULL.</param>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.IEnumSetupInstances.Skip(System.Int32)">
<summary>
Skips the next set of product instances in the enumeration sequence.
</summary>
<param name="celt">The number of product instances to skip.</param>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.IEnumSetupInstances.Reset">
<summary>
Resets the enumeration sequence to the beginning.
</summary>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.IEnumSetupInstances.Clone">
<summary>
Creates a new enumeration object in the same state as the current enumeration object: the new object points to the same place in the enumeration sequence.
</summary>
<returns>A pointer to a pointer to a new <see cref="T:Microsoft.VisualStudio.Setup.Configuration.IEnumSetupInstances"/> interface. If the method fails, this parameter is undefined.</returns>
</member>
<member name="T:Microsoft.VisualStudio.Setup.Configuration.InstanceState">
<summary>
The state of an <see cref="T:Microsoft.VisualStudio.Setup.Configuration.ISetupInstance2"/>.
</summary>
</member>
<member name="F:Microsoft.VisualStudio.Setup.Configuration.InstanceState.None">
<summary>
The instance state has not been determined.
</summary>
</member>
<member name="F:Microsoft.VisualStudio.Setup.Configuration.InstanceState.Local">
<summary>
The instance installation path exists.
</summary>
</member>
<member name="F:Microsoft.VisualStudio.Setup.Configuration.InstanceState.Registered">
<summary>
A product is registered to the instance.
</summary>
</member>
<member name="F:Microsoft.VisualStudio.Setup.Configuration.InstanceState.NoRebootRequired">
<summary>
No reboot is required for the instance.
</summary>
</member>
<member name="F:Microsoft.VisualStudio.Setup.Configuration.InstanceState.NoErrors">
<summary>
No errors were reported for the instance.
</summary>
</member>
<member name="F:Microsoft.VisualStudio.Setup.Configuration.InstanceState.Complete">
<summary>
The instance represents a complete install.
</summary>
</member>
<member name="T:Microsoft.VisualStudio.Setup.Configuration.ISetupConfiguration2">
<summary>
Gets information about product instances set up on the machine.
</summary>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupConfiguration2.EnumInstances">
<summary>
Enumerates all completed product instances installed.
</summary>
<returns>An enumeration of installed product instances.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupConfiguration2.GetInstanceForCurrentProcess">
<summary>
Gets the instance for the current process path.
</summary>
<returns>The instance for the current process path.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupConfiguration2.GetInstanceForPath(System.String)">
<summary>
Gets the instance for the given path.
</summary>
<param name="path">Path used to determine instance</param>
<returns>The instance for the given path.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupConfiguration2.EnumAllInstances">
<summary>
Enumerates all product instances.
</summary>
<returns>An enumeration of all product instances.</returns>
</member>
<member name="T:Microsoft.VisualStudio.Setup.Configuration.ISetupConfiguration">
<summary>
Gets information about product instances set up on the machine.
</summary>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupConfiguration.EnumInstances">
<summary>
Enumerates all product instances installed.
</summary>
<returns>An enumeration of installed product instances.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupConfiguration.GetInstanceForCurrentProcess">
<summary>
Gets the instance for the current process path.
</summary>
<returns>The instance for the current process path.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupConfiguration.GetInstanceForPath(System.String)">
<summary>
Gets the instance for the given path.
</summary>
<param name="path">Path used to determine instance</param>
<returns>The instance for the given path.</returns>
</member>
<member name="T:Microsoft.VisualStudio.Setup.Configuration.ISetupErrorState">
<summary>
Information about the error state of the instance.
</summary>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupErrorState.GetFailedPackages">
<summary>
Gets an array of failed package references.
</summary>
<returns>An array of failed package references.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupErrorState.GetSkippedPackages">
<summary>
Gets an array of skipped package references.
</summary>
<returns>An array of skipped package references.</returns>
</member>
<member name="T:Microsoft.VisualStudio.Setup.Configuration.ISetupFailedPackageReference">
<summary>
A reference to a failed package.
</summary>
<remarks>
You can enumerate all properties of basic types by casting to an <see cref="T:Microsoft.VisualStudio.Setup.Configuration.ISetupPropertyStore"/>.
</remarks>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupFailedPackageReference.GetId">
<summary>
Gets the general package identifier.
</summary>
<returns>The general package identifier.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupFailedPackageReference.GetVersion">
<summary>
Gets the version of the package.
</summary>
<returns>The version of the package.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupFailedPackageReference.GetChip">
<summary>
Gets the target process architecture of the package.
</summary>
<returns>The target process architecture of the package.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupFailedPackageReference.GetLanguage">
<summary>
Gets the language and optional region identifier.
</summary>
<returns>The language and optional region identifier.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupFailedPackageReference.GetBranch">
<summary>
Gets the build branch of the package.
</summary>
<returns>The build branch of the package.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupFailedPackageReference.GetType">
<summary>
Gets the type of the package.
</summary>
<returns>The type of the package.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupFailedPackageReference.GetUniqueId">
<summary>
Gets the unique identifier consisting of all defined tokens.
</summary>
<returns>The unique identifier consisting of all defined tokens.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupFailedPackageReference.GetIsExtension">
<summary>
Gets a value indicating whether the package refers to an external extension.
</summary>
<returns>A value indicating whether the package refers to an external extension.</returns>
</member>
<member name="T:Microsoft.VisualStudio.Setup.Configuration.ISetupHelper">
<summary>
Helper functions.
</summary>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupHelper.ParseVersion(System.String)">
<summary>
Parses a dotted quad version string into a 64-bit unsigned integer.
</summary>
<param name="version">The dotted quad version string to parse, e.g. 1.2.3.4.</param>
<returns>A 64-bit unsigned integer representing the version. You can compare this to other versions.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupHelper.ParseVersionRange(System.String,System.UInt64@,System.UInt64@)">
<summary>
Parses a dotted quad version string into a 64-bit unsigned integer.
</summary>
<param name="versionRange">The string containing 1 or 2 dotted quad version strings to parse, e.g. [1.0,) that means 1.0.0.0 or newer.</param>
<param name="minVersion">A 64-bit unsigned integer representing the minimum version, which may be 0. You can compare this to other versions.</param>
<param name="maxVersion">A 64-bit unsigned integer representing the maximum version, which may be MAXULONGLONG. You can compare this to other versions.</param>
</member>
<member name="T:Microsoft.VisualStudio.Setup.Configuration.ISetupInstance2">
<summary>
Information about an instance of a product.
</summary>
<remarks>
You can enumerate all properties of basic types by casting to an <see cref="T:Microsoft.VisualStudio.Setup.Configuration.ISetupPropertyStore"/>.
</remarks>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupInstance2.GetInstanceId">
<summary>
Gets the instance identifier (should match the name of the parent instance directory).
</summary>
<returns>The instance identifier.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupInstance2.GetInstallDate">
<summary>
Gets the local date and time when the installation was originally installed.
</summary>
<returns>The local date and time when the installation was originally installed.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupInstance2.GetInstallationName">
<summary>
Gets the unique name of the installation, often indicating the branch and other information used for telemetry.
</summary>
<returns>The unique name of the installation, often indicating the branch and other information used for telemetry.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupInstance2.GetInstallationPath">
<summary>
Gets the path to the installation root of the product.
</summary>
<returns>The path to the installation root of the product.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupInstance2.GetInstallationVersion">
<summary>
Gets the version of the product installed in this instance.
</summary>
<returns>The version of the product installed in this instance.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupInstance2.GetDisplayName(System.Int32)">
<summary>
Gets the display name (title) of the product installed in this instance.
</summary>
<param name="lcid">The LCID for the display name.</param>
<returns>The display name (title) of the product installed in this instance.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupInstance2.GetDescription(System.Int32)">
<summary>
Gets the description of the product installed in this instance.
</summary>
<param name="lcid">The LCID for the description.</param>
<returns>The description of the product installed in this instance.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupInstance2.ResolvePath(System.String)">
<summary>
Resolves the optional relative path to the root path of the instance.
</summary>
<param name="pwszRelativePath">A relative path within the instance to resolve, or NULL to get the root path.</param>
<returns>The full path to the optional relative path within the instance. If the relative path is NULL, the root path will always terminate in a backslash.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupInstance2.GetState">
<summary>
Gets the state of the instance.
</summary>
<returns>The state of the instance.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupInstance2.GetPackages">
<summary>
Gets an array of package references registered to the instance.
</summary>
<returns>An array of package references registered to the instance.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupInstance2.GetProduct">
<summary>
Gets a package reference to the product registered to the instance
</summary>
<returns>A package reference to the product registered to the instance. This may be null if <see cref="M:Microsoft.VisualStudio.Setup.Configuration.ISetupInstance2.GetState"/> does not return <see cref="F:Microsoft.VisualStudio.Setup.Configuration.InstanceState.Complete"/>.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupInstance2.GetProductPath">
<summary>
Gets the relative path to the product application, if available.
</summary>
<returns>The relative path to the product application, if available.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupInstance2.GetErrors">
<summary>
Gets the error state of the instance, if available.
</summary>
<returns>The error state of the instance, if available.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupInstance2.IsLaunchable">
<summary>
Gets a value indicating whether the instance can be launched.
</summary>
<returns>Whether the instance can be launched.</returns>
<remarks>
An instance could have had errors during install but still be launched. Some features may not work correctly, but others will.
</remarks>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupInstance2.IsComplete">
<summary>
Gets a value indicating whether the instance is complete.
</summary>
<returns>Whether the instance is complete.</returns>
<remarks>
An instance is complete if it had no errors during install, resume, or repair.
</remarks>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupInstance2.GetProperties">
<summary>
Gets product-specific properties.
</summary>
<returns>An <see cref="T:Microsoft.VisualStudio.Setup.Configuration.ISetupPropertyStore"/> of product-specific properties, or null if no properties are defined.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupInstance2.GetEnginePath">
<summary>
Gets the directory path to the setup engine that installed the instance.
</summary>
<returns>The directory path to the setup engine that installed the instance.</returns>
</member>
<member name="T:Microsoft.VisualStudio.Setup.Configuration.ISetupInstance">
<summary>
Information about an instance of a product.
</summary>
<remarks>
You can enumerate all properties of basic types by casting to an <see cref="T:Microsoft.VisualStudio.Setup.Configuration.ISetupPropertyStore"/>.
</remarks>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupInstance.GetInstanceId">
<summary>
Gets the instance identifier (should match the name of the parent instance directory).
</summary>
<returns>The instance identifier.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupInstance.GetInstallDate">
<summary>
Gets the local date and time when the installation was originally installed.
</summary>
<returns>The local date and time when the installation was originally installed.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupInstance.GetInstallationName">
<summary>
Gets the unique name of the installation, often indicating the branch and other information used for telemetry.
</summary>
<returns>The unique name of the installation, often indicating the branch and other information used for telemetry.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupInstance.GetInstallationPath">
<summary>
Gets the path to the installation root of the product.
</summary>
<returns>The path to the installation root of the product.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupInstance.GetInstallationVersion">
<summary>
Gets the version of the product installed in this instance.
</summary>
<returns>The version of the product installed in this instance.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupInstance.GetDisplayName(System.Int32)">
<summary>
Gets the display name (title) of the product installed in this instance.
</summary>
<param name="lcid">The LCID for the display name.</param>
<returns>The display name (title) of the product installed in this instance.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupInstance.GetDescription(System.Int32)">
<summary>
Gets the description of the product installed in this instance.
</summary>
<param name="lcid">The LCID for the description.</param>
<returns>The description of the product installed in this instance.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupInstance.ResolvePath(System.String)">
<summary>
Resolves the optional relative path to the root path of the instance.
</summary>
<param name="pwszRelativePath">A relative path within the instance to resolve, or NULL to get the root path.</param>
<returns>The full path to the optional relative path within the instance. If the relative path is NULL, the root path will always terminate in a backslash.</returns>
</member>
<member name="T:Microsoft.VisualStudio.Setup.Configuration.ISetupPackageReference">
<summary>
A reference to a package.
</summary>
<remarks>
You can enumerate all properties of basic types by casting to an <see cref="T:Microsoft.VisualStudio.Setup.Configuration.ISetupPropertyStore"/>.
</remarks>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupPackageReference.GetId">
<summary>
Gets the general package identifier.
</summary>
<returns>The general package identifier.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupPackageReference.GetVersion">
<summary>
Gets the version of the package.
</summary>
<returns>The version of the package.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupPackageReference.GetChip">
<summary>
Gets the target process architecture of the package.
</summary>
<returns>The target process architecture of the package.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupPackageReference.GetLanguage">
<summary>
Gets the language and optional region identifier.
</summary>
<returns>The language and optional region identifier.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupPackageReference.GetBranch">
<summary>
Gets the build branch of the package.
</summary>
<returns>The build branch of the package.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupPackageReference.GetType">
<summary>
Gets the type of the package.
</summary>
<returns>The type of the package.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupPackageReference.GetUniqueId">
<summary>
Gets the unique identifier consisting of all defined tokens.
</summary>
<returns>The unique identifier consisting of all defined tokens.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupPackageReference.GetIsExtension">
<summary>
Gets a value indicating whether the package refers to an external extension.
</summary>
<returns>A value indicating whether the package refers to an external extension.</returns>
</member>
<member name="T:Microsoft.VisualStudio.Setup.Configuration.ISetupPropertyStore">
<summary>
Provides named properties.
</summary>
<remarks>
You can get this from an <see cref="T:Microsoft.VisualStudio.Setup.Configuration.ISetupInstance"/>, <see cref="T:Microsoft.VisualStudio.Setup.Configuration.ISetupPackageReference"/>, or derivative.
</remarks>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupPropertyStore.GetNames">
<summary>
Gets an array of property names in this property store.
</summary>
<returns>An array of property names in this property store.</returns>
</member>
<member name="M:Microsoft.VisualStudio.Setup.Configuration.ISetupPropertyStore.GetValue(System.String)">
<summary>
Gets the value of a named property in this property store.
</summary>
<param name="pwszName">The name of the property to get.</param>
<returns>The value of the property.</returns>
</member>
<member name="T:Microsoft.VisualStudio.Setup.Configuration.SetupConfiguration">
<summary>
The implementation of <see cref="T:Microsoft.VisualStudio.Setup.Configuration.ISetupConfiguration2"/>.
</summary>
</member>
<member name="T:Microsoft.VisualStudio.Setup.Configuration.SetupConfigurationClass">
<summary>
Class that implements <see cref="T:Microsoft.VisualStudio.Setup.Configuration.ISetupConfiguration"/>.
</summary>
</member>
</members>
</doc>

105
docs/GettingStarted.md

@ -15,104 +15,89 @@ binary releases (only provided for Windows, at the moment): @@ -15,104 +15,89 @@ binary releases (only provided for Windows, at the moment):
## Common setup
1. Clone CppSharp Git repository
2. Setup LLVM and Clang dependencies
3. Generate build files using Premake
4. Build the source code
5. Generate bindings
2. Generate build files
3. Build the source code
4. Generate bindings
## Setting up LLVM and Clang dependencies
## Pre-requisites
You can either build LLVM and Clang from source or download one of our pre-built binary
dependency packages (the same ones we use for all our continuous integration (CI) builds).
LLVM is a core dependency of CppSharp.
### Downloading the LLVM and Clang packages
By default, the `build.sh` command will automatically download a pre-built binary LLVM package
compatible with your system and version of CppSharp (the same ones we use for all our
continuous integration (CI) builds).
The dependencies can be automatically downloaded by running:
Or you can choose to build LLVM and Clang from source if you prefer,
please check the [LLVM](LLVM.md) documentation page for more information.
```shell
cd <CppSharp>\build
premake5 --file=scripts/LLVM.lua download_llvm # on Windows
premake5-osx --file=scripts/LLVM.lua download_llvm # on OSX
premake5-linux --file=scripts/LLVM.lua download_llvm # on Linux
```
Alternatively, if on Windows, just run `<CppSharp>/build/DownloadDeps.bat` from a Visual Studio command prompt
corresponding to the VS version you want to use.
After this, you should end up with one or multiple `<CppSharp>/build/scripts/llvm-<revision>-<os>-<configuration>` folders
containing the headers and libraries for LLVM.
If you do not end up with the folder, which can happen due to, for instance, not having 7-Zip on the path on Windows,
then you can manually extract the .7z archives in `<CppSharp>/build/scripts` to their respective folders.
### Building LLVM and Clang from source
Please check the guide in [Compiling LLVM and Clang from source](BuildingLLVM.md)
The build scripts also depend on `curl` command and 7-Zip on Windows, so please
make sure those are installed on your system.
## Compiling on Windows/Visual Studio
1. Generate the VS solution and project files
1. Generate the VS solution
```shell
cd <CppSharp>\build
GenerateProjects.bat
```
```shell
cd <CppSharp>\build
./build.sh generate -configuration Release -platform x64
```
2. Compile the project
2. Compile the VS projects
You can open `CppSharp.sln` and hit F5 or compile via the command line:
You can open `CppSharp.sln` and hit F5 or compile via the command line:
```
msbuild vs2017\CppSharp.sln /p:Configuration=Release;Platform=x86
```
```
./build.sh -configuration Release -platform x64
```
Building in *Release* is recommended because else we will use the Clang parser
debug configuration, which will be too slow for practical use beyond debugging.
## Compiling on macOS or Linux
1. Change directory to `<CppSharp>\build`
2. Run `./Compile.sh` to generate the project files and compile the code.
1. Generate the VS solution and makefiles
```shell
cd <CppSharp>\build
./build.sh generate -configuration Release -platform x64
```
2. Compile the csproj files and makefiles
```
./build.sh -configuration Release -platform x64
```
If the above script fails, you can try these equivalent manual steps:
1. Generate the Makefiles
1. Build the generated makefiles:
```
./premake5-osx gmake # if on OSX
./premake5-linux gmake # if on Linux
```
```
make -C gmake config=release_x64
```
2. Build the generated makefiles:
- 32-bit builds: `make -C gmake config=release_x86`
- 64-bit builds: `make -C gmake config=release_x64`
2. Build the generated VS solution:
The version you compile needs to match the version of the Mono VM installed on your
system which you can find by running `mono --version`. The reason for this is because
a 32-bit VM will only be able to load 32-bit shared libraries and vice-versa for 64-bits.
```
msbuild CppSharp.sln -p:Configuration=Release -p:Platform=x64
```
If you need more verbosity from the builds invoke `make` as:
If you need more verbosity from the builds invoke `make` and `msbuild` as:
```shell
make -C gmake config=release_x64 verbose=true
msbuild CppSharp.sln -p:Configuration=Release -p:Platform=x64 -verbosity:detailed
```
## Running the testsuite
1. Change directory to `<CppSharp>\build`
2. Run `./InstallNugets.sh` to install the NUnit test runner from Nuget.
3. Run `./RunTests.sh` to run the tests.
2. Run `./test.sh` to run the tests.
## Linux notes
Only 64-bits builds are supported.
We depend on a recent version of Mono.
Please look into the [download page](http://www.mono-project.com/download/#download-lin) on the
Mono website for official install instructions.
# Generating bindings
You can now progress to generating your first bindings, explained in our [Generating bindings](GeneratingBindings.md) page.

12
docs/BuildingLLVM.md → docs/LLVM.md

@ -67,5 +67,17 @@ git -C deps/llvm reset --hard <llvm-rev> @@ -67,5 +67,17 @@ git -C deps/llvm reset --hard <llvm-rev>
git -C deps/llvm/tools/clang reset --hard <clang-rev>
```
# Downloading the LLVM and Clang packages manually
The dependencies can be automatically downloaded by running:
```
cd <CppSharp>\build
./build.sh download_llvm
```
After this, you should end up with one or multiple <CppSharp>/build/scripts/llvm-<revision>-<os>-<configuration> folders
containing the headers and libraries for LLVM.
If you do not end up with the folder, which can happen due to, for instance, not having 7-Zip on the path on Windows,
then you can manually extract the .7z archives in <CppSharp>/build/scripts to their respective folders.

1
examples/Parser/premake5.lua

@ -5,7 +5,6 @@ project "Parser" @@ -5,7 +5,6 @@ project "Parser"
language "C#"
debugdir "."
files { "**.cs", "./*.lua" }
links
{
"CppSharp",

6
src/AST/premake5.lua

@ -4,9 +4,3 @@ project "CppSharp.AST" @@ -4,9 +4,3 @@ project "CppSharp.AST"
language "C#"
SetupManagedProject()
files { "*.cs" }
vpaths { ["*"] = "*" }
filter { "action:not netcore"}
links { "System", "System.Core" }

17
src/CLI/premake5.lua

@ -1,14 +1,11 @@ @@ -1,14 +1,11 @@
project "CppSharp.CLI"
SetupManagedProject()
SetupParser()
kind "ConsoleApp"
language "C#"
files { "**.cs" }
excludes { "obj/**" }
vpaths { ["*"] = "*" }
links
{
"CppSharp",
@ -16,15 +13,3 @@ project "CppSharp.CLI" @@ -16,15 +13,3 @@ project "CppSharp.CLI"
"CppSharp.Generator",
"CppSharp.Parser"
}
SetupParser()
filter { "action:not netcore"}
links
{
"System",
"System.Core"
}
filter { "action:netcore" }
dotnetframework "netcoreapp2.0"

17
src/Core/premake5.lua

@ -4,19 +4,8 @@ project "CppSharp" @@ -4,19 +4,8 @@ project "CppSharp"
kind "SharedLib"
language "C#"
clr "Unsafe"
files { "**.cs" }
excludes { "obj/**" }
vpaths { ["*"] = "*" }
links
{
depsdir .. "/vs2017/Microsoft.VisualStudio.Setup.Configuration.Interop"
nuget {
"Microsoft.Win32.Registry:4.7.0",
"Microsoft.VisualStudio.Setup.Configuration.Interop:2.3.2262-g94fae01e"
}
filter { "action:netcore" }
nuget { "Microsoft.Win32.Registry:4.5.0" }
filter { "action:not netcore"}
links { "System", "System.Core" }

7
src/CppParser/Bindings/CLI/premake5.lua

@ -1,15 +1,14 @@ @@ -1,15 +1,14 @@
include "../../../../build/LLVM.lua"
project "CppSharp.Parser.CLI"
SetupNativeProject()
kind "SharedLib"
language "C++"
SetupNativeProject()
SetupLLVMIncludes()
dependson { "CppSharp.CppParser" }
flags { common_flags }
clr "On"
clr "NetCore"
filter "toolset:msc*"
buildoptions { clang_msvc_flags }
@ -28,6 +27,8 @@ project "CppSharp.Parser.CLI" @@ -28,6 +27,8 @@ project "CppSharp.Parser.CLI"
"../../../../include/",
"../../../../src/CppParser/"
}
SetupLLVMIncludes()
filter {}

12
src/CppParser/Bindings/CSharp/premake5.lua

@ -1,19 +1,21 @@ @@ -1,19 +1,21 @@
project "CppSharp.Parser.CSharp"
if not EnabledManagedProjects() then
return
end
project "CppSharp.Parser.CSharp"
SetupManagedProject()
kind "SharedLib"
language "C#"
clr "Unsafe"
enabledefaultcompileitems "false"
enabledefaultnoneitems "false"
dependson { "CppSharp.CppParser" }
files { "**.lua" }
vpaths { ["*"] = "*" }
links { "CppSharp.Runtime" }
AddPlatformSpecificFiles("", "**.cs")
AddPlatformSpecificFiles("", "**.cpp")
function SetupParser()
links

2
src/CppParser/Bindings/premake5.lua

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
include ("CSharp")
if EnableNativeProjects() and os.ishost("windows") and not os.getenv("CI") then
if EnabledCLIProjects() and not os.getenv("CI") then
include ("CLI")

14
src/CppParser/Bootstrap/premake5.lua

@ -1,15 +1,15 @@ @@ -1,15 +1,15 @@
project "CppSharp.Parser.Bootstrap"
SetupManagedProject()
SetupParser()
kind "ConsoleApp"
language "C#"
debugdir "."
files { "*.cs", "*.lua" }
links { "CppSharp", "CppSharp.AST", "CppSharp.Generator", "CppSharp.Parser" }
filter { "action:not netcore" }
links { "System", "System.Core" }
SetupParser()
links {
"CppSharp",
"CppSharp.AST",
"CppSharp.Generator",
"CppSharp.Parser"
}

12
src/CppParser/ParserGen/premake5.lua

@ -1,12 +1,11 @@ @@ -1,12 +1,11 @@
project "CppSharp.Parser.Gen"
SetupManagedProject()
SetupParser()
kind "ConsoleApp"
language "C#"
SetupManagedProject()
debugdir "."
files { "ParserGen.cs", "*.lua" }
vpaths { ["*"] = "*" }
links
{
@ -15,8 +14,3 @@ project "CppSharp.Parser.Gen" @@ -15,8 +14,3 @@ project "CppSharp.Parser.Gen"
"CppSharp.Generator",
"CppSharp.Parser",
}
SetupParser()
filter { "action:not netcore"}
links { "System.Core" }

4
src/Generator.Tests/GeneratorTest.cs

@ -26,7 +26,7 @@ namespace CppSharp.Utils @@ -26,7 +26,7 @@ namespace CppSharp.Utils
{
var options = driver.Options;
options.GeneratorKind = kind;
options.OutputDir = Path.Combine(GetOutputDirectory(), "gen", name);
options.OutputDir = Path.Combine(GetOutputDirectory(), "build", "gen", name);
options.Quiet = true;
options.GenerateDebugOutput = true;
options.GenerateSequentialLayout = true;
@ -95,7 +95,7 @@ namespace CppSharp.Utils @@ -95,7 +95,7 @@ namespace CppSharp.Utils
while (directory != null)
{
var path = Path.Combine(directory.FullName, "obj");
var path = Path.Combine(directory.FullName, "build");
if (Directory.Exists(path))
return directory.FullName;

34
src/Generator.Tests/premake5.lua

@ -3,16 +3,6 @@ project "CppSharp.Generator.Tests" @@ -3,16 +3,6 @@ project "CppSharp.Generator.Tests"
kind "SharedLib"
SetupManagedProject()
files { "**.cs" }
excludes { "obj/**" }
vpaths { ["*"] = "*" }
libdirs
{
depsdir .. "/NUnit",
depsdir .. "/NSubstitute"
}
files { testsdir .. "/Native/AST.h", testsdir .. "/Native/ASTExtensions.h", testsdir .. "/Native/Passes.h" }
filter "files:**.h"
buildaction "None"
@ -28,19 +18,11 @@ project "CppSharp.Generator.Tests" @@ -28,19 +18,11 @@ 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
{
"System.CodeDom:4.7.0",
"Microsoft.CSharp:4.7.0",
"Microsoft.NET.Test.Sdk:16.8.0",
"NUnit:3.11.0",
"NUnit3TestAdapter:3.17.0",
}

28
src/Generator/premake5.lua

@ -1,14 +1,10 @@ @@ -1,14 +1,10 @@
project "CppSharp.Generator"
SetupManagedProject()
SetupParser()
kind "SharedLib"
language "C#"
files { "**.cs", "**verbs.txt" }
excludes { "obj/**/*", "Filter.cs" }
vpaths { ["*"] = "*" }
dependson { "Std-symbols" }
links
@ -18,23 +14,13 @@ project "CppSharp.Generator" @@ -18,23 +14,13 @@ project "CppSharp.Generator"
"CppSharp.Parser"
}
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"
}
files { "**verbs.txt" }
filter { 'files:**verbs.txt' }
buildaction "Embed"

17
src/Parser/premake5.lua

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
local buildconfig = path.join(builddir, "BuildConfig.cs")
local buildconfig = path.join(actionbuilddir, "BuildConfig.cs")
local function GenerateBuildConfig()
print("Generating CppSharp build configuration file 'BuildConfig.cs'")
@ -18,31 +18,20 @@ end @@ -18,31 +18,20 @@ end
project "CppSharp.Parser"
SetupManagedProject()
SetupParser()
kind "SharedLib"
language "C#"
clr "Unsafe"
files { "**.cs" }
excludes { "obj/**" }
removefiles { "BuildConfig.cs" }
if generate_build_config == true then
files { buildconfig }
else
files { "BuildConfig.cs" }
removecompilefiles { "BuildConfig.cs" }
end
vpaths { ["*"] = "*" }
links
{
"CppSharp",
"CppSharp.AST",
"CppSharp.Runtime"
}
SetupParser()
filter { "action:not netcore"}
links { "System", "System.Core" }

7
src/Runtime/premake5.lua

@ -5,13 +5,6 @@ project "CppSharp.Runtime" @@ -5,13 +5,6 @@ project "CppSharp.Runtime"
kind "SharedLib"
clr "Unsafe"
files { "**.cs" }
excludes { "obj/**" }
vpaths { ["*"] = "*" }
filter { "action:not netcore"}
links { "System" }
filter { "toolset:msc*" }
defines { "MSVC" }

2
tests/CSharp/CSharp.Tests.cs

@ -590,7 +590,7 @@ public unsafe class CSharpTests : GeneratorTestFixture @@ -590,7 +590,7 @@ public unsafe class CSharpTests : GeneratorTestFixture
Assert.AreEqual("value", ex.ParamName);
string[] message = ex.Message.Split(
Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
Assert.AreEqual("The dimensions of the provided array don't match the required size.", message[0]);
Assert.AreEqual("The dimensions of the provided array don't match the required size. (Parameter 'value')", message[0]);
foreach (Foo foo in foosMore)
{

10
tests/NamespacesBase/premake4.lua

@ -1,19 +1,19 @@ @@ -1,19 +1,19 @@
function SetupWrapper(name)
if not EnabledManagedProjects() then
return
end
project(name .. ".CSharp")
SetupManagedTestProject()
dependson { name .. ".Native", "NamespacesDerived.Gen" }
links { "CppSharp.Runtime" }
SetupTestGeneratorBuildEvent("NamespacesDerived")
files
{
path.join(gendir, "NamespacesDerived", name .. ".cs"),
}
linktable = { "CppSharp.Runtime" }
links(linktable)
end
group "Tests/Namespaces"

0
tests/NamespacesBase/test.cs

7
tests/NamespacesDerived/premake4.lua

@ -1,6 +1,11 @@ @@ -1,6 +1,11 @@
group "Tests/Namespaces"
SetupTestGeneratorProject("NamespacesDerived")
SetupTestNativeProject("NamespacesDerived", "NamespacesBase")
if not EnabledManagedProjects() then
return
end
SetupTestGeneratorProject("NamespacesDerived")
SetupTestProjectsCSharp("NamespacesDerived", "NamespacesBase")
project("NamespacesDerived.Tests.CSharp")

Loading…
Cancel
Save