Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSharp - Update for conan V2 and build for 3.8.0 (+ add arm64) #5211

Merged
merged 17 commits into from
May 22, 2024
Merged

Conversation

jmarrec
Copy link
Collaborator

@jmarrec jmarrec commented May 21, 2024

Pull request overview

Pull Request Author

  • Model API Changes / Additions
  • Any new or modified fields have been implemented in the EnergyPlus ForwardTranslator (and ReverseTranslator as appropriate)
  • Model API methods are tested (in src/model/test)
  • EnergyPlus ForwardTranslator Tests (in src/energyplus/Test)
  • If a new object or method, added a test in NREL/OpenStudio-resources: Add Link
  • If needed, added VersionTranslation rules for the objects (src/osversion/VersionTranslator.cpp)
  • Verified that C# bindings built fine on Windows, partial classes used as needed, etc.
  • All new and existing tests passes
  • If methods have been deprecated, update rest of code to use the new methods

Labels:

  • If change to an IDD file, add the label IDDChange
  • If breaking existing API, add the label APIChange
  • If deemed ready, add label Pull Request - Ready for CI so that CI builds your PR

Review Checklist

This will not be exhaustively relevant to every PR.

  • Perform a Code Review on GitHub
  • Code Style, strip trailing whitespace, etc.
  • All related changes have been implemented: model changes, model tests, FT changes, FT tests, VersionTranslation, OS App
  • Labeling is ok
  • If defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix
  • If feature, test running new feature, try creative ways to break it
  • CI status: all green or justified

@jmarrec
Copy link
Collaborator Author

jmarrec commented May 21, 2024

Gonna close this PR temporarily so I don't get the cppcheck/clangformat running for no reason on it

@jmarrec jmarrec closed this May 21, 2024
@jmarrec jmarrec reopened this May 22, 2024
@jmarrec jmarrec marked this pull request as ready for review May 22, 2024 06:32
@jmarrec jmarrec requested review from kbenne and wenyikuang May 22, 2024 06:33
@jmarrec
Copy link
Collaborator Author

jmarrec commented May 22, 2024

Alright 3.8.0 packages, including the new osx-arm64 are available on this run: https://github.com/NREL/OpenStudio/actions/runs/9189117111/job/25275666930

@kbenne I hosted the windows (that contains both win32 and x64) on https://www.nuget.org/packages/OpenStudio/3.8.0

@MingboPeng FYI if you want to upload them to your nuget packages per platform.

@@ -5,7 +5,7 @@
"websocketpp/0.8.2#842a0419153a8aa52f3ea3a1da557d38%1695972005.713",
"tinygltf/2.5.0#65c28d0a4c3cbd4ef92b08b59df769da%1701621757.442",
"termcap/1.3.1#1986f84bf21dd07ea774b027a3201fcb%1678542508.75",
"swig/4.1.1#8f418438101ef7712d52a9fe739d32f9%1707838298.077707",
"swig/4.1.1#2bb5c79321cbb05bcab525c690d9bf74%1716336914.081294",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tweaked and built from jmarrec/conan-center-index@52e12ba

Comment on lines +25 to +27
"with_ruby": True,
"with_python": True,
"with_csharp": False,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New options to allow disabling ruby (won't build on win32), and tweak the cmake vars as well.

Comment on lines +28 to +33
// Ignore Json::Value return type (toJSON / fromJSON / valueAsJSON are globally ignored already)
%ignore openstudio::measure::OSArgument::defaultValueAsJSON;
%ignore openstudio::measure::OSArgument::domainAsJSON;
%ignore openstudio::measure::OSRunner::getArgumentValues;
%ignore openstudio::measure::OSRunner::getPastStepValuesForMeasure;
%ignore openstudio::measure::OSRunner::getPastStepValuesForName;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore new Json::Value returns

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New

Comment on lines +61 to +98
<Message Text="DEBUGGING: OS=$(OS) TargetFramework=$(TargetFramework) Architecture=$(Architecture) Platform=$(Platform) RID=$(Rid)" />
<Message Text="DEBUGGING: is_osx1=$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX))) is_osx2=$([MSBuild]::IsOsPlatform('OSX'))" />
<Message Text="DEBUGGING: System.Runtime.InteropServices.RuntimeInformation: OSArchitecture=$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture), RuntimeIdentifier=$([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier), OSDescription=$([System.Runtime.InteropServices.RuntimeInformation]::OSDescription)" />
<PropertyGroup>
<Rid>$([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier)</Rid>
<IsLinux>$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))</IsLinux>
<IsDarwin>$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))</IsDarwin>
<IsWindows>$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))</IsWindows>
<IsArm64>False</IsArm64>
<IsArm64 Condition=" '$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)' == 'Arm64' ">true</IsArm64>
</PropertyGroup>
<Message Text="DEBUGGING: Rid=$(Rid), IsLinux=$(IsLinux), IsDarwin=$(IsDarwin), IsWindows=$(IsWindows), IsArm64=$(IsArm64), IsNotArm64=$(IsNotArm64)" />
<Message Condition=" $(IsDarwin) And !$(IsArm64) " Text="Darwin not arm64" />
<Message Condition=" $(IsDarwin) And $(IsArm64) " Text="Darwin arm64" />
<!-- for Windows -->
<ItemGroup Condition="'$(OS)' == 'Windows_NT'">
<ItemGroup Condition=" $(IsWindows) ">
<TfmSpecificPackageFile Include="../Products/Release/openstudio*csharp.dll" PackagePath="lib/$(TargetFramework)" />
<TfmSpecificPackageFile Include="../Products/Release/openstudiolib.dll" PackagePath="lib/$(TargetFramework)" />
</ItemGroup>

<!-- for Linux -->
<ItemGroup Condition=" '$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' ">
<ItemGroup Condition=" $(IsLinux) ">
<TfmSpecificPackageFile Include="../Products/*openstudio*csharp.so" PackagePath="runtimes/linux-x64/native" />
<TfmSpecificPackageFile Include="../Products/*openstudiolib.so" PackagePath="runtimes/linux-x64/native" />
<TfmSpecificPackageFile Include="../Products/OpenStudio-linux-x64.targets" PackagePath="build/OpenStudio.targets" />
</ItemGroup>

<!-- for Mac -->
<ItemGroup Condition=" '$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' ">
<ItemGroup Condition=" $(IsDarwin) And !$(IsArm64) ">
<TfmSpecificPackageFile Include="../Products/*openstudio*csharp.dylib" PackagePath="runtimes/osx-x64/native" />
<TfmSpecificPackageFile Include="../Products/*openstudiolib.dylib" PackagePath="runtimes/osx-x64/native" />
<TfmSpecificPackageFile Include="../Products/OpenStudio-osx-x64.targets" PackagePath="build/OpenStudio.targets" />
</ItemGroup>
<ItemGroup Condition=" $(IsDarwin) And $(IsArm64) ">
<TfmSpecificPackageFile Include="../Products/*openstudio*csharp.dylib" PackagePath="runtimes/$(Rid)/native" />
<TfmSpecificPackageFile Include="../Products/*openstudiolib.dylib" PackagePath="runtimes/$(Rid)/native" />
<TfmSpecificPackageFile Include="../Products/OpenStudio-$(Rid).targets" PackagePath="build/OpenStudio.targets" />
</ItemGroup>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New to support osx-arm64

<TfmSpecificPackageFile Include="../Products/*openstudio*csharp.dylib" PackagePath="runtimes/osx-x64/native" />
<TfmSpecificPackageFile Include="../Products/*openstudiolib.dylib" PackagePath="runtimes/osx-x64/native" />
<TfmSpecificPackageFile Include="../Products/OpenStudio-osx-x64.targets" PackagePath="build/OpenStudio.targets" />
</ItemGroup>
<ItemGroup Condition=" $(IsDarwin) And $(IsArm64) ">
<TfmSpecificPackageFile Include="../Products/*openstudio*csharp.dylib" PackagePath="runtimes/$(Rid)/native" />
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that for mac, I could just use a single block... But I was wary of maybe breaking something, and after about 25 runs of the C# workflow (some of which I have to wait almost 2 hours to see if breaks), I just didn't want to risk it

    <ItemGroup Condition=" $(IsDarwin) ">
      <TfmSpecificPackageFile Include="../Products/*openstudio*csharp.dylib" PackagePath="runtimes/$(Rid)/native" />
      <TfmSpecificPackageFile Include="../Products/*openstudiolib.dylib" PackagePath="runtimes/$(Rid)/native" />
      <TfmSpecificPackageFile Include="../Products/OpenStudio-$(Rid).targets" PackagePath="build/OpenStudio.targets" />
    </ItemGroup>

@@ -5,6 +5,7 @@
// ignores toJSON/fromJSON globally
%rename("$ignore", regextarget=1, fullname=1) "openstudio::.*::toJSON$";
%rename("$ignore", regextarget=1, fullname=1) "openstudio::.*::fromJSON$";
%rename("$ignore", regextarget=1, fullname=1) "openstudio::.*::valueAsJSON$";
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New global ignore

@jmarrec jmarrec merged commit cdee54c into develop May 22, 2024
@jmarrec jmarrec deleted the CSharp branch May 22, 2024 12:17
@MingboPeng
Copy link
Contributor

Alright 3.8.0 packages, including the new osx-arm64 are available on this run: https://github.com/NREL/OpenStudio/actions/runs/9189117111/job/25275666930

@kbenne I hosted the windows (that contains both win32 and x64) on https://www.nuget.org/packages/OpenStudio/3.8.0

@MingboPeng FYI if you want to upload them to your nuget packages per platform.

Thanks @jmarrec, done! The new NuGet packages are added per platform including arm64 for mac.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants