Skip to content

Commit

Permalink
Add multi targeting to projects
Browse files Browse the repository at this point in the history
- Support compiling with WinForms in .NET 7 on Mac
- Add VS debug targets for Rhino 8 netfx/netcore
- Include launch.json/tasks.json for VS Code to make it easier to start debugging on Mac
- Remove VS for Mac build
  • Loading branch information
cwensley committed Aug 26, 2024
1 parent 5f43fb6 commit 8c537be
Show file tree
Hide file tree
Showing 46 changed files with 1,568 additions and 564 deletions.
62 changes: 12 additions & 50 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
types: [ published ]

env:
DotNetVersion: "7.0.107"
DotNetVersion: "8.0.401"
BuildParameters: "/v:Minimal /consoleLoggerParameters:NoSummary /p:Configuration=Release /p:BuildVersion=${{ github.run_id }} /p:BuildBranch=${{ github.ref }}"

jobs:
Expand All @@ -36,69 +36,31 @@ jobs:
run: msbuild /restore ${{ env.BuildParameters }} /p:VSVersion=2022 Rhino.VisualStudio.Windows\Rhino.VisualStudio.Windows.csproj /bl:artifacts/log/Build.Windows.2022.binlog

- name: Upload extensions
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: extensions-windows
path: artifacts/Release/*.vsix

- name: Upload log files
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: log
path: artifacts/log/**/*

build-mac:

runs-on: macos-11

steps:
- uses: actions/checkout@v2
with:
submodules: true

- name: Setup .NET Core
uses: actions/setup-dotnet@v1
- name: Upload templates
uses: actions/upload-artifact@v4
with:
dotnet-version: ${{ env.DotNetVersion }}

- name: Install macos workload
run: sudo dotnet workload install macos --from-rollback-file dotnet-workloads.json

- name: Setup Xamarin and XCode
uses: maxim-lobanov/setup-xamarin@v1
with:
mono-version: latest
xamarin-mac-version: latest
xcode-version: latest

# - name: Build VS2019
# run: msbuild /restore ${{ env.BuildParameters }} /t:PackageAddin /p:VSVersion=2019 src/Eto.DevExtension.VisualStudio.Mac/Eto.DevExtension.VisualStudio.Mac.csproj /bl:artifacts/log/Build.Mac.2019.binlog

- name: Build VS2022
run: dotnet build ${{ env.BuildParameters }} /p:VSVersion=2022 Rhino.VisualStudio.Mac/Rhino.VisualStudio.Mac.csproj /bl:artifacts/log/Build.Mac.2022.binlog

- name: Upload extensions
uses: actions/upload-artifact@v2
with:
name: extensions-mac
path: artifacts/Release/*.mpack
name: templates
path: artifacts/bin/Rhino.Templates/Release/*.nupkg

- name: Upload log files
if: ${{ failure() }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: log
path: |
artifacts/log/**/*
path: artifacts/log/**/*

publish:
needs: [ build-windows-2022, build-mac ]
needs: [ build-windows-2022 ]
runs-on: ubuntu-latest
if: (github.event_name == 'release' && github.event.action == 'published' && startsWith(github.ref, 'refs/tags/'))
steps:
- name: Download artifacts
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4

- name: Display structure of downloaded files
run: ls -R
Expand All @@ -110,4 +72,4 @@ jobs:
fail_on_unmatched_files: true
files: |
extensions-windows/*.vsix
extensions-mac/*.mpack
templates/*.nupkg
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"omnisharp.defaultLaunchSolution": "Rhino.VisualStudio.Mac.sln",
"var": {
"configuration" : "Debug",
"buildProperties" : "/v:Minimal /p:GenerateFullPaths=True /consoleLoggerParameters:NoSummary"
},
"dotnet.defaultSolution": "Rhino.VisualStudio.Mac.sln",
}
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"build",
"/p:Configuration=${input:configuration}",
"/p:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary",
"-clp:NoSummary",
"${workspaceFolder}/Rhino.Templates/Rhino.Templates.csproj"
],
"problemMatcher": "$msCompile",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@
"type": "parameter",
"description": "Version of Rhino",
"datatype": "choice",
"defaultValue": "7",
"defaultValue": "8",
"choices": [
{
"choice": "7",
"description": "Version 7"
},
{
"choice": "8",
"description": "Version 8 (WIP)"
"description": "Version 8"
}
]
},
Expand Down
8 changes: 6 additions & 2 deletions Rhino.Templates/content/CPPRhino/MyRhino.1.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,18 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset Condition="$(RhinoVersion) == '6'">v142</PlatformToolset>
<PlatformToolset Condition="$(RhinoVersion) == '7'">v142</PlatformToolset>
<PlatformToolset Condition="$(RhinoVersion) == '8' || $(RhinoVersion) == ''">v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset Condition="$(RhinoVersion) == '6'">v142</PlatformToolset>
<PlatformToolset Condition="$(RhinoVersion) == '7'">v142</PlatformToolset>
<PlatformToolset Condition="$(RhinoVersion) == '8' || $(RhinoVersion) == ''">v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
"type": "parameter",
"description": "Version of Rhino",
"datatype": "choice",
"defaultValue": "7",
"defaultValue": "8",
"choices": [
{
"choice": "7",
"description": "Version 7"
},
{
"choice": "8",
"description": "Version 8 (WIP)"
"description": "Version 8"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion Rhino.Templates/content/CPPSkin/MySkin.1App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RHINO_PLUG_IN_DECLARE
// TODO: fill in the following developer declarations
// with your company information. When completed,
// delete the following #error directive.
#error Developer declarations block is incomplete!
// #error Developer declarations block is incomplete!
RHINO_PLUG_IN_DEVELOPER_ORGANIZATION( L"My Company Name" );
RHINO_PLUG_IN_DEVELOPER_ADDRESS( L"123 Developer Street\r\nCity State 12345-6789" );
RHINO_PLUG_IN_DEVELOPER_COUNTRY( L"My Country" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@
"UseWinForms": {
"longName": "include-winforms",
"shortName": "wf"
},
"BuildYak": {
"longName": "build-yak",
"shortName": "yak"
},
"IncludeVSCode": {
"longName": "include-vscode-launch",
"shortName": "vscode"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"type": "parameter",
"description": "Version of Rhino",
"datatype": "choice",
"defaultValue": "7",
"defaultValue": "8",
"choices": [
{
"choice": "6",
Expand All @@ -39,18 +39,21 @@
},
{
"choice": "8",
"description": "Version 8 (WIP)"
"description": "Version 8"
}
]
},
"RhinoLocation": {
"BuildYak": {
"type": "parameter",
"description": "Location of Rhino.exe, usually C:\\Program Files\\Rhino 7\\System\\Rhino.exe",
"replaces": "MyExecutablePath",
"forms": {
"global": [ "JsonStringEncode" ]
},
"defaultValue": "C:\\Program Files\\Rhino 7\\System\\Rhino.exe"
"description": "Include target to build yak package(s) for your plugin",
"datatype": "bool",
"defaultValue": "false"
},
"IncludeVSCode": {
"type": "parameter",
"description": "Include tasks.json and launch.json to build/debug in VS Code",
"datatype": "bool",
"defaultValue": "true"
},
"AddonDisplayName": {
"type": "parameter",
Expand Down Expand Up @@ -98,21 +101,21 @@

"UseWpf": {
"type": "parameter",
"description": "Enable to use WPF designer in VS (Windows only)",
"description": "Enable to use WPF (Windows only)",
"datatype": "bool",
"defaultValue": "false"
},
"UseWinForms": {
"type": "parameter",
"description": "Enable to use Windows Forms designer in VS (Windows only)",
"description": "Enable the use of Windows Forms",
"datatype": "bool",
"defaultValue": "false"
"defaultValue": "true"
},
"UseWindowsDesktop": {
"type": "computed",
"value": "UseWpf || UseWinForms"
},

"HostIdentifier": {
"type": "bind",
"binding": "HostIdentifier"
Expand All @@ -126,16 +129,20 @@
}
},
"sources": [
{
"modifiers": [
{
"condition": "ComponentClassName == 'MyGrasshopper__1Component'",
"rename": {
"MyGrasshopper__1Component.cs": "MyGrasshopper.1Component.cs"
}
}
]
}
{
"modifiers": [
{
"condition": "!IncludeVSCode",
"exclude": [ ".vscode/*.*" ]
},
{
"condition": "ComponentClassName == 'MyGrasshopper__1Component'",
"rename": {
"MyGrasshopper__1Component.cs": "MyGrasshopper.1Component.cs"
}
}
]
}
],
"primaryOutputs": [
{ "path": "MyGrasshopper.1.csproj" },
Expand Down
87 changes: 87 additions & 0 deletions Rhino.Templates/content/CSGrasshopper/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Rhino 8",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "",
"osx": {
"program": "/Applications/Rhino 8.app/Contents/MacOS/Rhinoceros"
},
"windows": {
"program": "C:\\Program Files\\Rhino 8\\System\\Rhino.exe",
"targetArchitecture": "x86_64",
},
"args": [],
"env": {
"RHINO_PACKAGE_DIRS": "${workspaceFolder}/bin/Debug"
},
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"console": "internalConsole"
},
//#if (RhinoVersion <= '7')
{
"name": "Launch Rhino 7 Mac",
"type": "rhino",
"request": "launch",
"preLaunchTask": "build",
"program": "/Applications/Rhino 7.app/Contents/MacOS/Rhinoceros",
"args": [],
"env": {
// "RHINO_PLUGIN_PATH": "${workspaceFolder}/bin/Debug/net48/MyGrasshopper.1.rhp",
"GRASSHOPPER_PLUGINS": "${workspaceFolder}/bin/Debug/net48/MyGrasshopper.1.gha"
},
"cwd": "${workspaceFolder}",
"console": "internalConsole"
},
{
"name": "Launch Rhino 7 Windows",
"type": "clr",
"request": "launch",
"preLaunchTask": "build",
"program": "C:\\Program Files\\Rhino 7\\System\\Rhino.exe",
"targetArchitecture": "x86_64",
"args": [
],
"env": {
},
"cwd": "${workspaceFolder}",
"console": "internalConsole"
},
//#endif
//#if (RhinoVersion <= '6')
{
"name": "Launch Rhino 6 Mac",
"type": "rhino",
"request": "launch",
"preLaunchTask": "build",
"program": "/Applications/Rhinoceros.app/Contents/MacOS/Rhinoceros",
"args": [],
"env": {
// "RHINO_PLUGIN_PATH": "${workspaceFolder}/bin/Debug/net45/MyGrasshopper.1.rhp",
"GRASSHOPPER_PLUGINS": "${workspaceFolder}/bin/Debug/net45/MyGrasshopper.1.gha"
},
"cwd": "${workspaceFolder}",
"console": "internalConsole"
},
{
"name": "Launch Rhino 6 Windows",
"type": "clr",
"request": "launch",
"preLaunchTask": "build",
"program": "C:\\Program Files\\Rhino 6\\System\\Rhino.exe",
"targetArchitecture": "x86_64",
"args": [
],
"env": {
},
"cwd": "${workspaceFolder}",
"console": "internalConsole"
},
//#endif
],
"compounds": []
}
Loading

0 comments on commit 8c537be

Please sign in to comment.