Browse Source

Merge branch 'mono:main' into main

pull/1695/head
hxbb00 2 years ago committed by GitHub
parent
commit
4fc7801c7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      build/Helpers.lua
  2. 12
      build/build.sh
  3. 4
      docs/GettingStarted.md
  4. 1
      src/CLI/CppSharp.CLI.csproj

17
build/Helpers.lua

@ -43,6 +43,11 @@ newoption { @@ -43,6 +43,11 @@ newoption {
description = "Only generate configuration file",
}
newoption {
trigger = "target-framework",
description = ".NET target framework version",
}
rootdir = path.getabsolute("../")
srcdir = path.join(rootdir, "src");
incdir = path.join(rootdir, "include");
@ -61,7 +66,17 @@ msvc_cpp_defines = { } @@ -61,7 +66,17 @@ msvc_cpp_defines = { }
default_gcc_version = "9.0.0"
generate_build_config = true
premake.path = premake.path .. ";" .. path.join(builddir, "modules")
targetframework = "net6.0"
function string.isempty(s)
return s == nil or s == ''
end
local function target_framework()
local value = _OPTIONS["target-framework"]
return string.isempty(value) and "net6.0" or value
end
targetframework = target_framework()
function string.starts(str, start)
if str == nil then return end

12
build/build.sh

@ -6,6 +6,7 @@ vs=vs2019 @@ -6,6 +6,7 @@ vs=vs2019
configuration=Release
build_only=false
ci=false
target_framework=
verbosity=minimal
rootdir="$builddir/.."
bindir="$rootdir/bin"
@ -46,7 +47,7 @@ build() @@ -46,7 +47,7 @@ build()
generate_config()
{
"$builddir/premake.sh" --file="$builddir/premake5.lua" $vs --os=$os --arch=$platform --configuration=$configuration --config_only
"$builddir/premake.sh" --file="$builddir/premake5.lua" $vs --os=$os --arch=$platform --configuration=$configuration --target-framework=$target_framework --config_only
}
generate()
@ -54,10 +55,10 @@ generate() @@ -54,10 +55,10 @@ generate()
download_llvm
if [ "$os" = "linux" ] || [ "$os" = "macosx" ]; then
"$builddir/premake.sh" --file="$builddir/premake5.lua" gmake2 --os=$os --arch=$platform --configuration=$configuration "$@"
"$builddir/premake.sh" --file="$builddir/premake5.lua" gmake2 --os=$os --arch=$platform --configuration=$configuration --target-framework=$target_framework "$@"
fi
"$builddir/premake.sh" --file="$builddir/premake5.lua" $vs --os=$os --arch=$platform --configuration=$configuration
"$builddir/premake.sh" --file="$builddir/premake5.lua" $vs --os=$os --arch=$platform --configuration=$configuration --target-framework=$target_framework
}
restore()
@ -194,6 +195,11 @@ while [[ $# > 0 ]]; do @@ -194,6 +195,11 @@ while [[ $# > 0 ]]; do
os=$2
shift
;;
-target-framework)
target_framework=$2
echo $target_framework
shift
;;
-ci)
ci=true
export CI=true

4
docs/GettingStarted.md

@ -44,6 +44,8 @@ The following steps should be called from the VS developer command prompt. @@ -44,6 +44,8 @@ The following steps should be called from the VS developer command prompt.
<sh> build.sh generate -configuration Release -platform x64
```
> :information_source: You can use the `-target-framework` option to target any valid .NET target framework.
2. Compile the VS projects
You can open `CppSharp.sln` and hit F5 or compile via the command line:
@ -82,6 +84,8 @@ When opening the solution for the first time on a more recent version than Visua @@ -82,6 +84,8 @@ When opening the solution for the first time on a more recent version than Visua
./build.sh generate -configuration Release -platform x64
```
> :information_source: You can use the `-target-framework` option to target any valid .NET target framework.
2. Compile the csproj files and makefiles
```

1
src/CLI/CppSharp.CLI.csproj

@ -1,7 +1,6 @@ @@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>

Loading…
Cancel
Save