conda-forge / vtk-feedstock

A conda-smithy repository for vtk.
BSD 3-Clause "New" or "Revised" License
13 stars 64 forks source link

Fix VTK::opengl linking on OSX #184

Closed Tobias-Fischer closed 3 years ago

Tobias-Fischer commented 3 years ago

Checklist

Currently downstream packages fail to link to vtk::opengl, as can be seen in https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=311003&view=logs&jobId=58ac6aab-c4bc-5de2-2894-98e408cc8ec9&j=58ac6aab-c4bc-5de2-2894-98e408cc8ec9&t=933f325c-924e-533d-4d95-e93b5843ce8b

CMake Error in tools/CMakeLists.txt:
  Imported target "VTK::opengl" includes non-existent path

    "/Applications/Xcode_12.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/OpenGL.framework"

  in its INTERFACE_INCLUDE_DIRECTORIES.

This PR includes a patch (kudos to @traversaro) to remove OPENGL_INCLUDE_DIR from the exported include directories, as it is not relocatable. I have tested it locally and it solves the compile issues with PCL on OSX.

conda-forge-linter commented 3 years ago

Hi! This is the friendly automated conda-forge-linting service.

I just wanted to let you know that I linted all conda-recipes in your PR (recipe) and found it was in an excellent condition.

Tobias-Fischer commented 3 years ago

@conda-forge-admin, please rerender

Tobias-Fischer commented 3 years ago

This PR is ready to be merged @conda-forge/vtk

The main change is adding this to the conda_build_config:

    - tag: 'CMake build metadata OSX'
      glob_patterns:
        - '*.cmake'
      regex_re: '([^;\s"]+/MacOSX\d*\.?\d*\.sdk)'
      replacement_re: '$ENV{CONDA_BUILD_SYSROOT}'

There is already a similar patch in place for Linux:

    - tag: 'CMake build metadata'
      glob_patterns:
        - '*.cmake'
      regex_re: '([^;\s"]+/sysroot)'
      replacement_re: '$ENV{CONDA_BUILD_SYSROOT}'

I have locally tested building PCL after applying this PR, and it solves the current problem.

Tobias-Fischer commented 3 years ago

Ping @conda-forge/vtk - it would be great if someone could have a look at this PR :)

grlee77 commented 3 years ago

I am not familiar with those type of regex replacements in recipes, but the addition seems consistent with the existing Linux case and it seems you have already verified that it works, so I will go ahead and merge

Tobias-Fischer commented 3 years ago

Thanks @grlee77