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 {
4343 description = " Only generate configuration file" ,
4444}
4545
46+ newoption {
47+ trigger = " target-framework" ,
48+ description = " .NET target framework version" ,
49+ }
50+
4651rootdir = path .getabsolute (" ../" )
4752srcdir = path .join (rootdir , " src" );
4853incdir = path .join (rootdir , " include" );
@@ -61,7 +66,17 @@ msvc_cpp_defines = { }
6166default_gcc_version = " 9.0.0"
6267generate_build_config = true
6368premake .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 ()
6580
6681function string .starts (str , start )
6782 if str == nil then return end
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ vs=vs2019
66configuration=Release
77build_only=false
88ci=false
9+ target_framework=
910verbosity=minimal
1011rootdir=" $builddir /.."
1112bindir=" $rootdir /bin"
@@ -46,18 +47,18 @@ build()
4647
4748generate_config ()
4849{
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
5051}
5152
5253generate ()
5354{
5455 download_llvm
5556
5657 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 " $@ "
5859 fi
5960
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
6162}
6263
6364restore ()
@@ -194,6 +195,11 @@ while [[ $# > 0 ]]; do
194195 os=$2
195196 shift
196197 ;;
198+ -target-framework)
199+ target_framework=$2
200+ echo $target_framework
201+ shift
202+ ;;
197203 -ci)
198204 ci=true
199205 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.
4444 < sh> build.sh generate -configuration Release -platform x64
4545 ```
4646
47+ > :information_source: You can use the ` -target-framework` option to target any valid .NET target framework.
48+
47492. Compile the VS projects
4850
4951 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
8284 ./build.sh generate -configuration Release -platform x64
8385 ```
8486
87+ > :information_source: You can use the `-target-framework` option to target any valid .NET target framework.
88+
85892. Compile the csproj files and makefiles
8690
8791 ```
Original file line number Diff line number Diff line change 11<Project Sdk =" Microsoft.NET.Sdk" >
22 <PropertyGroup >
33 <OutputType >Exe</OutputType >
4- <TargetFramework >net6.0</TargetFramework >
54 </PropertyGroup >
65
76 <ItemGroup >
You can’t perform that action at this time.
0 commit comments