Skip to content

Commit

Permalink
Merge pull request #12 from MoonCollider/clean-upstream-sync
Browse files Browse the repository at this point in the history
Sync with upstream
  • Loading branch information
JordanL8 authored Oct 6, 2023
2 parents 79c750e + a1916ef commit 95b705f
Show file tree
Hide file tree
Showing 56 changed files with 5,997 additions and 2,602 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/llvm-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ jobs:
fail-fast: false
matrix:
config:
- { os: windows-2022, platform: x86, vs: 2022 }
- { os: windows-2022, platform: x64, vs: 2022 }
- { os: windows-2022, platform: x86, vs: "Program Files/Microsoft Visual Studio/2022" }
- { os: windows-2022, platform: x64, vs: "Program Files/Microsoft Visual Studio/2022" }

runs-on: ${{ matrix.config.os }}

Expand All @@ -35,7 +35,7 @@ jobs:
- name: Environment
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\%VS_VERSION%\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" %PLATFORM%
call "C:\%VS_VERSION%\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" %PLATFORM%
:: Loop over all environment variables and make them global using set-env.
:: See: https://stackoverflow.com/a/39184941
setlocal
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@ jobs:
fail-fast: false
matrix:
config:
- { os: ubuntu-20.04, platform: x64, cxx: g++-10, cc: gcc-10 }
- { os: ubuntu-22.04, platform: x64, cxx: g++-11, cc: gcc-11 }
- { os: macos-11, platform: x64, cxx: clang++, cc: clang }
- { os: windows-2019, platform: x64, vs: msvc }
- { os: windows-2022, platform: x64, vs: "Program Files/Microsoft Visual Studio/2022" }

runs-on: ${{ matrix.config.os }}

env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
VS_VERSION: ${{ matrix.config.vs }}
PLATFORM: ${{ matrix.config.platform }}
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
Expand All @@ -38,7 +39,7 @@ jobs:
- name: Environment
if: matrix.config.vs
shell: bash
run: echo "/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/MSBuild/Current/Bin" >> $GITHUB_PATH
run: echo "/c/$VS_VERSION/Enterprise/MSBuild/Current/Bin" >> $GITHUB_PATH

- name: Setup
shell: bash
Expand Down
1 change: 0 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
</PropertyGroup>

<Target Name="prepack" DependsOnTargets="Build" Condition="'$(IsPackable)' == 'true' AND '$(Platform)' == 'x64'">
<Copy SourceFiles="$(TargetDir)ref\$(TargetFileName)" DestinationFolder="$(PackageDir)ref\$(GlobalTargetFramework)" Condition="'$(ProduceReferenceAssembly)' == 'true' AND '$(RID)' == 'win-x64'" />
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(PackageDir)runtimes\$(RID)\lib\$(GlobalTargetFramework)" />
</Target>
</Project>
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ Alternatively, you may post bounties at https://www.bountysource.com/.

CppSharp is used by the following projects:

[Kythera AI](https://kythera.ai)

[QtSharp](https://gitlab.com/ddobrev/QtSharp)

[MonoGame](https://github.com/mono/MonoGame)
Expand Down
3 changes: 2 additions & 1 deletion build/Helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ end

local function target_framework()
local value = _OPTIONS["target-framework"]
return string.isempty(value) and "net6.0" or value
local default_framework = _ACTION <= "vs2019" and "net5.0" or "net6.0"
return string.isempty(value) and default_framework or value
end

targetframework = target_framework()
Expand Down
13 changes: 12 additions & 1 deletion build/LLVM.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ function SetupLLVMIncludes()
includedirs
{
path.join(LLVMRootDirDebug, "include"),
path.join(LLVMRootDirDebug, "llvm/include"),
path.join(LLVMRootDirDebug, "lld/include"),
path.join(LLVMRootDirDebug, "clang/include"),
path.join(LLVMRootDirDebug, "clang/lib"),
Expand All @@ -53,6 +54,7 @@ function SetupLLVMIncludes()
includedirs
{
path.join(LLVMRootDirRelease, "include"),
path.join(LLVMRootDirRelease, "llvm/include"),
path.join(LLVMRootDirRelease, "lld/include"),
path.join(LLVMRootDirRelease, "clang/include"),
path.join(LLVMRootDirRelease, "clang/lib"),
Expand All @@ -64,6 +66,7 @@ function SetupLLVMIncludes()
includedirs
{
path.join(LLVMRootDir, "include"),
path.join(LLVMRootDir, "llvm/include"),
path.join(LLVMRootDir, "lld/include"),
path.join(LLVMRootDir, "clang/include"),
path.join(LLVMRootDir, "clang/lib"),
Expand Down Expand Up @@ -144,18 +147,22 @@ function SetupLLVMLibs()
"clangCodeGen",
"clangParse",
"clangSema",
"clangSupport",
"clangAnalysis",
"clangEdit",
"clangAST",
"clangLex",
"clangBasic",
"clangIndex",
"clangASTMatchers",
"LLVMWindowsDriver",
"LLVMWindowsManifest",
"LLVMDebugInfoPDB",
"LLVMLTO",
"LLVMPasses",
"LLVMObjCARCOpts",
"LLVMLibDriver",
"LLVMFrontendHLSL",
"LLVMFrontendOpenMP",
"LLVMOption",
"LLVMCoverage",
Expand All @@ -170,6 +177,7 @@ function SetupLLVMLibs()
"LLVMVectorize",
"LLVMLinker",
"LLVMIRReader",
"LLVMIRPrinter",
"LLVMAsmParser",
"LLVMMCDisassembler",
"LLVMCFGuard",
Expand All @@ -178,7 +186,9 @@ function SetupLLVMLibs()
"LLVMAsmPrinter",
"LLVMDebugInfoDWARF",
"LLVMCodeGen",
"LLVMCodeGenTypes",
"LLVMTarget",
"LLVMTargetParser",
"LLVMScalarOpts",
"LLVMInstCombine",
"LLVMAggressiveInstCombine",
Expand All @@ -202,7 +212,8 @@ function SetupLLVMLibs()
"lldCommon",
"lldCOFF",
"lldELF",
"lldMachO"
"lldMachO",
"lldMinGW"
}

filter(c)
Expand Down
16 changes: 12 additions & 4 deletions build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -e
builddir=$(cd "$(dirname "$0")"; pwd)
platform=x64
vs=vs2019
vs=vs2022
configuration=Release
build_only=false
ci=false
Expand Down Expand Up @@ -104,18 +104,26 @@ download_premake()
{
premake_dir="$builddir/premake"
premake_filename=premake5
premake_archive_ext=tar.gz
if [ $oshost = "windows" ]; then
premake_filename=$premake_filename.exe
premake_archive_ext=zip
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
premake_version=5.0.0-beta2
premake_archive=premake-$premake_version-$oshost.$premake_archive_ext
premake_url=https://github.com/premake/premake-core/releases/download/v$premake_version/$premake_archive
curl -L -O $premake_url
unzip premake-$oshost-$platform.zip $premake_filename -d "$premake_dir"
if [ $oshost = "windows" ]; then
unzip $premake_archive $premake_filename -d "$premake_dir"
else
tar -xf $premake_archive -C "$premake_dir" ./$premake_filename
fi
chmod +x "$premake_path"
rm premake-$oshost-$platform.zip
rm $premake_archive
fi
}

Expand Down
2 changes: 1 addition & 1 deletion build/llvm/LLVM-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
791523bae6153b13bb41ba05c9fc89e502cc4a1a
6eb36aed86ea276695697093eb8136554c29286b
7 changes: 4 additions & 3 deletions build/llvm/LLVM.lua
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ function cmake(gen, conf, builddir, options)
.. ' -DLLVM_ENABLE_LIBXML2=false'
.. ' -DLLVM_ENABLE_TERMINFO=false'
.. ' -DLLVM_ENABLE_ZLIB=false'
.. ' -DLLVM_ENABLE_ZSTD=false'
.. ' -DLLVM_INCLUDE_DOCS=false'
.. ' -DLLVM_INCLUDE_EXAMPLES=false'
.. ' -DLLVM_TARGETS_TO_BUILD="X86"'
Expand Down Expand Up @@ -370,6 +371,8 @@ function cmake(gen, conf, builddir, options)
.. ' -DCLANG_TOOL_CLANG_FUZZER_BUILD=false'
.. ' -DCLANG_TOOL_CLANG_IMPORT_TEST_BUILD=false'
.. ' -DCLANG_TOOL_CLANG_NVLINK_WRAPPER_BUILD=false'
.. ' -DCLANG_TOOL_CLANG_LINKER_WRAPPER_BUILD=false'
.. ' -DCLANG_TOOL_CLANG_OFFLOAD_PACKAGER_BUILD=false'
.. ' -DCLANG_TOOL_CLANG_OFFLOAD_BUNDLER_BUILD=false'
.. ' -DCLANG_TOOL_CLANG_OFFLOAD_WRAPPER_BUILD=false'
.. ' -DCLANG_TOOL_CLANG_REFACTOR_BUILD=false'
Expand Down Expand Up @@ -456,7 +459,7 @@ function package_llvm(conf, llvm_base, llvm_build)
if os.isdir(out) then os.rmdir(out) end
os.mkdir(out)

os.copydir(llvm_base .. "/llvm/include", out .. "/include")
os.copydir(llvm_base .. "/llvm/include", out .. "/llvm/include")
os.copydir(llvm_base .. "/lld/include", out .. "/lld/include")
os.copydir(llvm_build .. "/include", out .. "/build/include")

Expand All @@ -483,12 +486,10 @@ function package_llvm(conf, llvm_base, llvm_build)
local out_lib_dir = out .. "/build/lib"
if os.ishost("windows") then
os.rmfiles(out_lib_dir, "clang*ARC*.lib")
os.rmfiles(out_lib_dir, "clang*Matchers*.lib")
os.rmfiles(out_lib_dir, "clang*Rewrite*.lib")
os.rmfiles(out_lib_dir, "clang*StaticAnalyzer*.lib")
else
os.rmfiles(out_lib_dir, "libclang*ARC*.a")
os.rmfiles(out_lib_dir, "libclang*Matchers*.a")
os.rmfiles(out_lib_dir, "libclang*Rewrite*.a")
os.rmfiles(out_lib_dir, "libclang*StaticAnalyzer*.a")
end
Expand Down
5 changes: 4 additions & 1 deletion src/AST/Method.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,12 @@ public Method(Method method)
{
Access = method.Access;
IsVirtual = method.IsVirtual;
IsStatic = method.IsStatic;
IsConst = method.IsConst;
IsExplicit = method.IsExplicit;
IsVolatile = method.IsVolatile;
IsFinal = method.IsFinal;
IsProxy = method.IsProxy;
IsStatic = method.IsStatic;
Kind = method.Kind;
IsDefaultConstructor = method.IsDefaultConstructor;
IsCopyConstructor = method.IsCopyConstructor;
Expand All @@ -119,6 +121,7 @@ public Method(Function function)
public bool IsStatic { get; set; }
public bool IsConst { get; set; }
public bool IsExplicit { get; set; }
public bool IsVolatile { get; set; }

public bool IsOverride
{
Expand Down
6 changes: 5 additions & 1 deletion src/Core/Toolchains/MSVCToolchain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public enum VisualStudioVersion
VS2015 = 14,
VS2017 = 15,
VS2019 = 16,
VS2022 = 17,
Latest,
}

Expand Down Expand Up @@ -67,9 +68,12 @@ public static Version GetCLVersion(VisualStudioVersion vsVersion)
clVersion = new Version { Major = 19, Minor = 10 };
break;
case VisualStudioVersion.VS2019:
case VisualStudioVersion.Latest:
clVersion = new Version { Major = 19, Minor = 20 };
break;
case VisualStudioVersion.VS2022:
case VisualStudioVersion.Latest:
clVersion = new Version { Major = 19, Minor = 30 };
break;
default:
throw new Exception("Unknown Visual Studio version");
}
Expand Down
3 changes: 3 additions & 0 deletions src/CppParser/AST.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,7 @@ Method::Method()
, isStatic(false)
, isConst(false)
, isExplicit(false)
, isVolatile(false)
, isDefaultConstructor(false)
, isCopyConstructor(false)
, isMoveConstructor(false)
Expand Down Expand Up @@ -1078,6 +1079,8 @@ HTMLStartTagComment::Attribute::Attribute() {}

HTMLStartTagComment::Attribute::Attribute(const Attribute& rhs) : name(rhs.name), value(rhs.value) {}

HTMLStartTagComment::Attribute::~Attribute() {}

HTMLStartTagComment::HTMLStartTagComment() : HTMLTagComment(CommentKind::HTMLStartTagComment) {}

DEF_VECTOR(HTMLStartTagComment, HTMLStartTagComment::Attribute, Attributes)
Expand Down
1 change: 1 addition & 0 deletions src/CppParser/AST.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ class CS_API HTMLStartTagComment : public HTMLTagComment
public:
Attribute();
Attribute(const Attribute&);
~Attribute();
std::string name;
std::string value;
};
Expand Down
Loading

0 comments on commit 95b705f

Please sign in to comment.