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

Adding X11 in find_package before MaterialX, as required for MaterialX #19

Merged
merged 1 commit into from
Sep 9, 2024

Conversation

ScatteredRay
Copy link
Contributor

@ScatteredRay ScatteredRay commented Sep 7, 2024

On Linux, I was getting the error during CMake configure:

CMake Error at /lib/cmake/MaterialX/MaterialXTargets.cmake:124 (set_target_properties):
  The link interface of target "MaterialXRenderHw" contains:

    X11::X11

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

The generated MaterialXTargets.cmake locally contains

set_target_properties(MaterialXRenderHw PROPERTIES
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
  INTERFACE_LINK_LIBRARIES "MaterialXRender;dl;X11::X11;X11::Xt"
)

Which seems to come from here in MaterialX: https://github.com/AcademySoftwareFoundation/MaterialX/blob/093b8195db3386f5d2f19dfdfee6eb9165116b09/source/MaterialXRenderHw/CMakeLists.txt#L10

So, this adds the same find_package before MaterialX if UNIX is defined.

@cpichard
Copy link
Owner

cpichard commented Sep 8, 2024

Thanks @ScatteredRay ! It's fixing #17 indeed.
This patch is really helpful to compile usdtweak on linux even though the MaterialX package should be self contained and we should not have to add additional dependencies they should export.
At the moment the patch won't compile on macos which is UNIX but doesn't have the X11 libs.
Happy to merge it when you update it such that it compiles on mac.
Cheers,

@ScatteredRay
Copy link
Contributor Author

Thanks, I don't have a Mac to test it on, so wasn't really sure what to do about Mac (Or that Mac qualified as Unix under CMake)

Based on the MaterialX, it seems like it might be most appropriate to add find_library(COCOA_FRAMEWORK Cocoa) on Mac? But maybe untill we can Confirm, I'lll just exclude that from this case.

Updated the patch to exclude APPLE

@cpichard cpichard merged commit 34f3ea9 into cpichard:develop Sep 9, 2024
@cpichard
Copy link
Owner

cpichard commented Sep 9, 2024

Works on mac, thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants