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

opencascade: enable macOS build and add features #97661

Merged
merged 1 commit into from Sep 20, 2020

Conversation

hannesweisbach
Copy link
Contributor

enable/fix macOS build and add options for TBB and GL2PS dependencies

VTK integration needed a patch because implicit conversions in initializer
lists are an error in C++11, which is the default in clang 7 used by nix.

Motivation for this change

I'm currently working on KiCad for macOS in nix. KiCad depends on Opencascade. Opencascade-occt works fine, but opencascade (OCE) was only enabled to build on Linux. I've enabled the build on macOS and it "works for me" on macOS 10.15.6, both building opencascade and using it as dependency in KiCad.

VTK-integration of opencascade threw 2 errors for me, both had to do with (implicit) conversions happening in initializer lists, which is illegal in C++11 (or 14?), which is the default in clang-7 (the compiler used by my nix). Upstream opencascade seemed to not have fixed that yet, but does also not include a specific C++ standard to compile with. I assumed this is a bug though and included a patch to make both those implicit conversion explicit, so it compiles fine. I'm not sure if this is the correct thing to do here, though, but, again it seems to work for me. I've enabled this patch only for macOS, since this seems to be not an issue on Linux for some reason, again, I'm not sure why.

I've also added options to build with TBB as parallelization/multithreading library, as well as GL2PS, which is an optional dependency of opencascade. Scripts to build KiCad had these options for opencascade enabled, which is why I added those options. The options are defaulted to false, to be backward compatible.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Copy link
Member

@veprbl veprbl left a comment

Choose a reason for hiding this comment

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

LGTM. Please mark as ready for review.

Could replace meta = with stdenv.lib; { with meta = { now.

@hannesweisbach
Copy link
Contributor Author

LGTM. Please mark as ready for review.

Thanks.

Could replace meta = with stdenv.lib; { with meta = { now.

Done.

@hannesweisbach hannesweisbach marked this pull request as ready for review September 17, 2020 07:26
@gebner
Copy link
Member

gebner commented Sep 20, 2020

LGTM (aside from the fetchpatch failure).

Opencascade-occt works fine, but opencascade (OCE) was only enabled to build on Linux.

I'm not 100% sure I understand you. opencascade-occt is the new, preferred, upstream version. Our kicad package uses it by default. If possible, you should use it on mac as well.

@hannesweisbach
Copy link
Contributor Author

@gebner I do, I wasn't sure which opencascade to choose so I made it so it compiled and worked with both. Default is OCCT though. Thanks for letting me know OCCT is preferred though. OCE might still be used for other software though.

enable/fix macOS build and add options for TBB and GL2PS dependencies

VTK integration needed a patch because implicit conversions in initializer
lists are an error in C++11, which is the default in clang 7 used by nix.
@gebner gebner merged commit 088ddf7 into NixOS:master Sep 20, 2020
@hannesweisbach hannesweisbach deleted the opencascade-oce branch September 20, 2020 14:36
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.

None yet

3 participants