File tree Expand file tree Collapse file tree 4 files changed +29
-5
lines changed Expand file tree Collapse file tree 4 files changed +29
-5
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,11 @@ newoption {
43
43
description = " Only generate configuration file" ,
44
44
}
45
45
46
+ newoption {
47
+ trigger = " target-framework" ,
48
+ description = " .NET target framework version" ,
49
+ }
50
+
46
51
rootdir = path .getabsolute (" ../" )
47
52
srcdir = path .join (rootdir , " src" );
48
53
incdir = path .join (rootdir , " include" );
@@ -61,7 +66,17 @@ msvc_cpp_defines = { }
61
66
default_gcc_version = " 9.0.0"
62
67
generate_build_config = true
63
68
premake .path = premake .path .. " ;" .. path .join (builddir , " modules" )
64
- targetframework = " net6.0"
69
+
70
+ function string .isempty (s )
71
+ return s == nil or s == ' '
72
+ end
73
+
74
+ local function target_framework ()
75
+ local value = _OPTIONS [" target-framework" ]
76
+ return string .isempty (value ) and " net6.0" or value
77
+ end
78
+
79
+ targetframework = target_framework ()
65
80
66
81
function string .starts (str , start )
67
82
if str == nil then return end
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ vs=vs2019
6
6
configuration=Release
7
7
build_only=false
8
8
ci=false
9
+ target_framework=
9
10
verbosity=minimal
10
11
rootdir=" $builddir /.."
11
12
bindir=" $rootdir /bin"
@@ -46,18 +47,18 @@ build()
46
47
47
48
generate_config ()
48
49
{
49
- " $builddir /premake.sh" --file=" $builddir /premake5.lua" $vs --os=$os --arch=$platform --configuration=$configuration --config_only
50
+ " $builddir /premake.sh" --file=" $builddir /premake5.lua" $vs --os=$os --arch=$platform --configuration=$configuration --target-framework= $target_framework -- config_only
50
51
}
51
52
52
53
generate ()
53
54
{
54
55
download_llvm
55
56
56
57
if [ " $os " = " linux" ] || [ " $os " = " macosx" ]; then
57
- " $builddir /premake.sh" --file=" $builddir /premake5.lua" gmake2 --os=$os --arch=$platform --configuration=$configuration " $@ "
58
+ " $builddir /premake.sh" --file=" $builddir /premake5.lua" gmake2 --os=$os --arch=$platform --configuration=$configuration --target-framework= $target_framework " $@ "
58
59
fi
59
60
60
- " $builddir /premake.sh" --file=" $builddir /premake5.lua" $vs --os=$os --arch=$platform --configuration=$configuration
61
+ " $builddir /premake.sh" --file=" $builddir /premake5.lua" $vs --os=$os --arch=$platform --configuration=$configuration --target-framework= $target_framework
61
62
}
62
63
63
64
restore ()
@@ -194,6 +195,11 @@ while [[ $# > 0 ]]; do
194
195
os=$2
195
196
shift
196
197
;;
198
+ -target-framework)
199
+ target_framework=$2
200
+ echo $target_framework
201
+ shift
202
+ ;;
197
203
-ci)
198
204
ci=true
199
205
export CI=true
Original file line number Diff line number Diff line change @@ -44,6 +44,8 @@ The following steps should be called from the VS developer command prompt.
44
44
< sh> build.sh generate -configuration Release -platform x64
45
45
```
46
46
47
+ > :information_source: You can use the ` -target-framework` option to target any valid .NET target framework.
48
+
47
49
2. Compile the VS projects
48
50
49
51
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
84
./build.sh generate -configuration Release -platform x64
83
85
```
84
86
87
+ > :information_source: You can use the `-target-framework` option to target any valid .NET target framework.
88
+
85
89
2. Compile the csproj files and makefiles
86
90
87
91
```
Original file line number Diff line number Diff line change 1
1
<Project Sdk =" Microsoft.NET.Sdk" >
2
2
<PropertyGroup >
3
3
<OutputType >Exe</OutputType >
4
- <TargetFramework >net6.0</TargetFramework >
5
4
</PropertyGroup >
6
5
7
6
<ItemGroup >
You can’t perform that action at this time.
0 commit comments