Skip to content

[opennurbs] add new port - #21521

Closed
Amin Ya (aminya) wants to merge 11 commits into
microsoft:masterfrom
aminya:opennurbs
Closed

[opennurbs] add new port#21521
Amin Ya (aminya) wants to merge 11 commits into
microsoft:masterfrom
aminya:opennurbs

Conversation

@aminya

@aminya Amin Ya (aminya) commented Nov 18, 2021

Copy link
Copy Markdown
Contributor

Describe the pull request

  • What does your PR fix?

    Adds opennurbs

  • Which triplets are supported/not supported? Have you updated the CI baseline?

all other than:
opennurbs:x64-uwp=fail
opennurbs:arm-uwp=fail

  • Does your PR follow the maintainer guide?

    Yes

  • If you have added/updated a port: Have you run ./vcpkg x-add-version --all and committed the result?

    Yes

If you are still working on the PR, open it as a Draft: https://github.blog/2019-02-14-introducing-draft-pull-requests/

No

@aminya
Amin Ya (aminya) force-pushed the opennurbs branch 3 times, most recently from 8cd4b35 to 4ef629e Compare November 18, 2021 21:16
@aminya
Amin Ya (aminya) force-pushed the opennurbs branch 6 times, most recently from a20c832 to c567a9a Compare November 18, 2021 23:02
@JonLiu1993 JonLiu1993 self-assigned this Nov 19, 2021
@JonLiu1993 JonLiu1993 added the category:new-port The issue is requesting a new library to be added; consider making a PR! label Nov 19, 2021
@JonLiu1993 JonLiu1993 changed the title [opennurbs] add opennurbs [opennurbs] add new port Nov 19, 2021
Comment thread ports/opennurbs/vcpkg.json Outdated
Comment thread ports/opennurbs/portfile.cmake Outdated
Comment thread ports/opennurbs/vcpkg.json Outdated
Co-Authored-By: JonLiu1993 <63675417+JonLiu1993@users.noreply.github.com>
@aminya

Copy link
Copy Markdown
Contributor Author

I tested this on my Mac VM and it built successfully. I don't have access to the error logs that fail the CI. So, not sure how to debug this. Note that there is a uuid/uuid.h dependency that is handled inside the CMake file:
mcneel/opennurbs@bce8191

@dalefugier

Copy link
Copy Markdown

Hey Billy O'Neal (@BillyONeal), I’ve created an issue, in our tracking system, so we can consider this.

https://mcneel.myjetbrains.com/youtrack/issue/RH-66553.

@sbaer

Copy link
Copy Markdown

Billy O'Neal (@BillyONeal) does making a project vcpkg compatible amount to getting it build with cmake or are there other requirements? We're getting hit a bit out of left field with a large pull request that I will not accept and want to better understand what is needed

@ras0219-msft

Robert Schumacher (ras0219-msft) commented Dec 2, 2021

Copy link
Copy Markdown
Contributor

It is not necessary to adopt CMake to build in vcpkg (we intend to support all C++ buildsystems), however there are other requirements:

  1. No downloading during your build
  2. No vendored dependencies -- third party libraries should be listed as dependencies in vcpkg and the library should build against the vcpkg versions. This doesn't mean you need to make your default "build from source" not use vendored dependencies, we just need an option to disable that behavior.

I'd like to suggest more, but I can't find a way to browse the OpenNURBS source online. What buildsystem do you currently use? We have existing examples for autotools, MSBuild, meson, bazel, qmake, as well as custom scripts.

(Also, thanks for reaching out! I'm really excited to have OpenNURBS available in vcpkg :))

@dalefugier

Copy link
Copy Markdown

but I can't find a way to browse the OpenNURBS source online

Can you see this? - https://github.com/mcneel/opennurbs

@sbaer

Copy link
Copy Markdown

We have

  • visual studio .sln/.vcxproj files for Windows compiles (see opennurbs_public.sln)
  • xcode proj files for Mac
  • makefile for everything else

@ras0219-msft

Copy link
Copy Markdown
Contributor

Can you see...

I can! Sorry that I wasn't able to find it via search engine before :)

visual studio .sln/.vcxproj files for Windows compiles (see opennurbs_public.sln)
xcode proj files for Mac
makefile for everything else

Cool. We can handle .vcxproj via vcpkg_install_msbuild()1 and Makefile via vcpkg_build_make()2. I don't think we currently have any libraries that use XCode though; would it be possible to use the Makefiles for Mac?

We'll also need to patch out the checked-in copies of zlib/freetype in the build3, preferring to instead use the copies you get from vcpkg install zlib freetype. We can do this via a patch file, but it would be nice to instead have a simple make option that says "Hey, don't worry about the dependencies, we'll set up your CFLAGS/CCFLAGS/LDFLAGS such that they are available".

@dalefugier

Copy link
Copy Markdown

Is patching zlib and freetype required? Currently, openNURBS does not use freetype . But it does use zlib. There are millions of opennurbs compressed meshes in 3dm data sets going back to Rhino 2.0 3dm files. This isn't a change we'd take lightly, needless to say.

@ras0219-msft

Copy link
Copy Markdown
Contributor

Sorry, I think I wasn't clear enough.

We need to build OpenNURBS against a prebuilt copy of zlib instead of the copy checked in. That doesn't mean you need to delete it from your sources and it doesn't mean you need to make that even the default behavior of your buildsystem. We can easily make this change via a dozen or so lines of patching, which would simply remove the zlib objects from your lib and instead add -I/path/to/our/includes to your compile line and -L/path/to/our/libs -lz to your link line. You'll still have 100% of zlib available, so all your meshes and existing functionality will still work.

I see that there's a commented-out option to build with freetype -- is that deprecated functionality that just hasn't been fully removed yet?

@sbaer

Copy link
Copy Markdown

Our version of zlib is also very old. We do plan to update to a new version of zlib at some point, but we want to run through a large set of regression tests before even considering this. It is also something we don't have a high priority for doing at the moment since what we have works and we have many other projects that customers are more willing to pay us for.

@ras0219-msft

Robert Schumacher (ras0219-msft) commented Dec 3, 2021

Copy link
Copy Markdown
Contributor

That's fine -- customers using vcpkg accept and expect that they will be getting more recent versions of dependencies than what various projects were initially developed against. This is the same policy that essentially every Linux distribution follows; for example if Debian added OpenNURBS they would apply the same changes[1].

I want to also stress that not doing this is not an option -- if a user wants to use Boost and OpenNURBS at the same time, it is imperative that both Boost and OpenNURBS were built against the same copy of zlib. If each brought their own, that would violate the One Definition Rule, causing undefined behavior by the C/C++ standard.

If you are especially concerned, we can add a warning message during the build that explains to users about the situation and informs them that if they experience issues they should first reproduce them with the originally tested version of zlib before reporting upstream.

[1] https://www.debian.org/doc/debian-policy/ch-source.html#embedded-code-copies

@aminya

Copy link
Copy Markdown
Contributor Author

I cherry-picked the CMake part of my pull request based on their request. Now, I am awaiting Robert McNeel & Associates (@mcneel) to review the smaller pull requests.
mcneel/opennurbs#29

@sbaer

Copy link
Copy Markdown

I'm pretty concerned about this rule and am not ready to just let anyone choose which version of zlib they want without us performing many tests. This IS our file format for Rhino and I am not willing to allow incorrect versions of our files to be created just so we can participate in vcpkg. It very well may not be an issue, but this requires thorough testing.

@ras0219-msft

Robert Schumacher (ras0219-msft) commented Dec 3, 2021

Copy link
Copy Markdown
Contributor

An alternative option that avoids ODR (but is more work and I wouldn't recommend) would be to give all the zlib symbols internal linkage. Since you compile as C++, this should actually be not terrible to do by creating a .cpp file with the contents:

namespace {
    #include "zlib.c"
    #include "zlib2.c"
    // the rest of the zlib implementation files
}

// declare your own functions with unique names (not the zlib ones!) that the rest of the application uses.

Then remove the individual zlib files from your buildsystem. This arrangement means that nobody outside your one cpp file will be able to see the zlib symbols, so it won't conflict with any other copies of zlib a user might link into their process. I notice that you already have a file opennurbs_zlib.cpp[1] which might be usable for this purpose.

This would meet our needs in vcpkg since our strict requirement is not violating ODR, though we'd still recommend adopting an external copy for better security, maintainability, and performance.

[1] https://github.com/mcneel/opennurbs/blob/7.x/opennurbs_zlib.cpp

@PhoebeHui
Phoebe (PhoebeHui) marked this pull request as draft June 9, 2022 08:09
@JonLiu1993 JonLiu1993 closed this Jun 24, 2022
@JonLiu1993 JonLiu1993 reopened this Jun 24, 2022

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You have modified or added at least one vcpkg.json where you should check the license field.

Details

If you feel able to do so, please consider adding a "license" field to the following files:

  • ports/opennurbs/vcpkg.json

Valid values for the license field can be found in the documentation

@JonLiu1993

Copy link
Copy Markdown
Contributor

Closing this PR since it seems that no progress is being made. Please reopen if work is still being done.

@JonLiu1993 JonLiu1993 closed this Jun 24, 2022
@aminya

Amin Ya (aminya) commented Jun 24, 2022

Copy link
Copy Markdown
Contributor Author

The upstream repo has been very slow to review the contributions.
mcneel/opennurbs#29

Should I add the CMake file to the port here?

@JonLiu1993

Copy link
Copy Markdown
Contributor

The upstream repo has been very slow to review the contributions. mcneel/opennurbs#29

Should I add the CMake file to the port here?

Ok, after Upstream merges your dispatcher, we can delete Cmake in the process of updating the version later

@JonLiu1993 JonLiu1993 reopened this Jun 24, 2022

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You have modified or added at least one vcpkg.json where you should check the license field.

Details

If you feel able to do so, please consider adding a "license" field to the following files:

  • ports/opennurbs/vcpkg.json

Valid values for the license field can be found in the documentation

@xarthurx

Copy link
Copy Markdown

Is there any update on this PR?
It seems based on here: https://discourse.mcneel.com/t/opennurbs-pre-builds-for-github-action/146973/2
McNeel does not have a lot of interest in integrating opennurbs into vcpkg.

@aminya

Copy link
Copy Markdown
Contributor Author

I'll add my changes (including the CMake support) as patch files in the following week.

@JonLiu1993

Copy link
Copy Markdown
Contributor

Closing this PR since it seems that no progress is being made. Please ping us to reopen if work is still being done.

@JonLiu1993 JonLiu1993 closed this Sep 9, 2022
@xarthurx

Copy link
Copy Markdown

Is there any updates on this topic?

@sbaer

Copy link
Copy Markdown

We have recently updated the zlib project that will ship with opennurbs in Rhino 9. This is the next step needed to allow for vcpkg support. We aren't planning on doing this for Rhino 8 version of opennurbs

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

Labels

category:new-port The issue is requesting a new library to be added; consider making a PR! depends:upstream-changes Waiting on a change to the upstream project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants