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

tbb: adds better CMake support #70606

Closed
wants to merge 1 commit into from
Closed

tbb: adds better CMake support #70606

wants to merge 1 commit into from

Conversation

santiagoalvarez
Copy link

This adds a FindTBB.cmake file that should help using TBB
in projects that already use CMake to find dependencies

Motivation for this change

TBB is usually not findable by CMake, this makes it so that CMake based packages can more easily find tbb

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • 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 nix-review --run "nix-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.
Notify maintainers

cc @thoughtpolice @DIzFer

This adds a FindTBB.cmake file that should help using TBB
in projects that already use CMake to find dependencies
Copy link
Member

@thoughtpolice thoughtpolice left a comment

Choose a reason for hiding this comment

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

At a first impression, I'm afraid I don't think this is something that we should add to nixpkgs itself. This seems like a file that is better suited to go into TBB upstream itself, so that all packages across distros can benefit from it widely, and the maintainers can correctly care for it. We generally try to have Nix built packages maintain "parity" across distros -- adding things like this means there's something we have that others don't, and this invariably will cause some conflicts or user issues later on (for example if some project includes a copy of this file, and we include this one in the default setupHook, which would CMake load?) "Principle of least surprise" somewhat applies here.

Futhermore, most people packaging CMake projects have an array of extra FindXXX.cmake modules they vendor themselves to handle these things, for various reasons. If upstream doesn't want to accept this kind of maintenance burden, I think the traditional route is for them to copy this file themselves and maintain it. (This file has a copyright date for 2015, so it clearly is from somewhere, like another project?) If that's what the current situation is, and for some reason this FindTBB code cannot find the Nix tbb package in a Nix build environment, we should fix that, not simply include this file into our package.

If this CMake file is widely distributed and in use by tons of other distros (and shipped by them for their packages!) then I'd reconsider this.

Comment on lines +28 to +31
postFixup = ''
substituteAll ${./FindTBB.cmake} $out/FindTBB.cmake
'';

Copy link
Member

Choose a reason for hiding this comment

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

How is this supposed to work? If my memory serves correctly, our CMake setup hooks do not search $out but actually search some path like $out/share/cmake for all buildInputs in order to find .cmake files. You'd have to have some other workaround for this anyway, wouldn't you?

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

2 participants