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

MATX-344 : Ensure CMake config relocatability #1350

Conversation

JGamache-autodesk
Copy link
Collaborator

All install paths must be relative for CMake to generate a relocatable
config file. This means removing all those CMAKE_INSTALL_PREFIX
path components that point to an absolute path.

For an install in /dev/MaterialX/staging
The difference will be in the generated file:
/dev/MaterialX/staging/lib/cmake/MaterialX/MaterialXTargets.cmake
Where, without this fix, you will find:

set(_IMPORT_PREFIX "/dev/MaterialX/staging")

and, with the fix, the results will be:

get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
if(_IMPORT_PREFIX STREQUAL "/")
  set(_IMPORT_PREFIX "")
endif()

which makes the install area packageable and relocatable.

All install paths *must* be relative for CMake to generate a relocatable
config file. This means removing all those CMAKE_INSTALL_PREFIX
path components that point to an absolute path.

For an install in `/dev/MaterialX/staging`
The difference will be in the generated file:
`/dev/MaterialX/staging/lib/cmake/MaterialX/MaterialXTargets.cmake`
Where, without this fix, you will find:
```
set(_IMPORT_PREFIX "/dev/MaterialX/staging")
```
and, with the fix, the results will be:
```
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
if(_IMPORT_PREFIX STREQUAL "/")
  set(_IMPORT_PREFIX "")
endif()
```
which makes the install area packageable and relocatable.
@kwokcb kwokcb changed the title Ensure CMake config relocatability MATX-344 : Ensure CMake config relocatability Jan 4, 2022
@kwokcb
Copy link
Collaborator

kwokcb commented Jan 4, 2022

Is this correct in understanding the change:

  1. CMAKE_INSTALL_PREFIX is automatically prepended so all installs should be relative to whatever this is set to.
  2. If the default location is set to this, we still override the location to be the install location (relative to where the build occurs).
  3. The appropriate expansion is performed when creating the MaterialXTargets.cmake file.
    Thanks.

Copy link
Collaborator

@kwokcb kwokcb left a comment

Choose a reason for hiding this comment

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

LGTM. But want to check my understanding.

@JGamache-autodesk
Copy link
Collaborator Author

JGamache-autodesk commented Jan 4, 2022

@kwokcb you are correct on all 3 points. Setting the default location in CMake is done by adding

-DCMAKE_INSTALL_PREFIX=C:\Ws\staging

to the command line, so basically the same variable name.

@JGamache-autodesk JGamache-autodesk merged commit 8d2bf11 into adsk_contrib/dev Jan 4, 2022
@JGamache-autodesk JGamache-autodesk deleted the t_gamaj/MATX-344/ensure_relocatable_cmake_generation branch January 4, 2022 21:13
@kwokcb kwokcb removed the request for review from bernardkwok January 4, 2022 21:42
jstone-lucasfilm pushed a commit that referenced this pull request Jul 11, 2023
Fixes triplanar node's blending, so the corner's are not bright. Also adds a blend control for users to adjust the blending between maps. The default blend value of 1.0 matches the original behavior (apart from the brightness bug).
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.

2 participants