opencv icon indicating copy to clipboard operation
opencv copied to clipboard

Make sure openmp include dir is added to compiler include dirs

Open themightyoarfish opened this issue 3 years ago • 5 comments

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • [x] I agree to contribute to the project under Apache 2 License.
  • [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV
  • [x] The PR is proposed to proper branch
  • [x] There is reference to original bug report and related work
  • [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name.
  • [ ] The feature is well documented and sample code can be built with the project CMake

Fixes #18478

themightyoarfish avatar Jan 12 '22 08:01 themightyoarfish

I'm not sure where to link to OpenMP_CXX_LIBRARIES. This variable doesn't seem to be required everywhere, but it is on macos, linking to the OpenMP::OpenMP_CXX target brings in compiler options I think, but apparently not the libomp runtime library, not on macos anyways.

I tried adding it in modules/core/cmake/parallel/detect_openmp.cmake to ocv_add_external_target(), but it seems to do nothing, the file is not even used (tried fatal-erroring inside to no effect).

themightyoarfish avatar Jan 13 '22 11:01 themightyoarfish

modules/core/misc/plugins/parallel_openmp/CMakeLists.txt seemingly also unused. OpenMP gets enabled apparently anyhow, though the process is mysterious to me.

themightyoarfish avatar Jan 13 '22 11:01 themightyoarfish

I find no place to link to OpenMP_CXX_LIBRARIES that would actually make its contents (/usr/local/lib/libomp.dylib for me) appear in the verbose make output, so it seems like it's never getting linked.

themightyoarfish avatar Jan 13 '22 12:01 themightyoarfish

@themightyoarfish Friendly reminder.

asmorkalov avatar May 20 '22 07:05 asmorkalov

Awaiting feedback.

On May 20, 2022 9:49:14 AM GMT+02:00, Alexander Smorkalov @.> wrote: @. Friendly reminder.

-- Reply to this email directly or view it on GitHub: https://github.com/opencv/opencv/pull/21427#issuecomment-1132590395 You are receiving this because you were mentioned.

Message ID: @.***>

themightyoarfish avatar May 20 '22 19:05 themightyoarfish

I've update this to hopefully work with old cmake as well. OpenMP_CXX_INCLUDE_DIRS will simply be empty, which is ok, and I am checking for the OpenMP:: library target to exist before linking to it.

themightyoarfish avatar Aug 21 '22 10:08 themightyoarfish

superseded by #23095

alalek avatar Jan 16 '23 07:01 alalek