Skip to content

Commit

Permalink
Fixes from code review from Sean.
Browse files Browse the repository at this point in the history
  • Loading branch information
lanierd-adsk committed Jan 26, 2024
1 parent 27b9a7a commit 7a7afb1
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 35 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ else()
message(STATUS "UFE not found.")
endif()

find_package(MayaUsd OPTIONAL_COMPONENTS)
find_package(MayaUsd)
if(MayaUsd_FOUND)
message(STATUS "Building with MayaUsd.")
else()
Expand Down
31 changes: 3 additions & 28 deletions cmake/modules/FindMayaUsd.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
# It searches for MayaUsd's libraries and include header files.
#
# Variables that will be defined:
# MAYAUSD_FOUND Defined if a MayaUsd installation has been detected
# MAYAUSD_LIBRARY_DIR Path to MayaUsd libraries directory
# MayaUsd_FOUND Defined if a MayaUsd installation has been detected
# MAYAUSD_INCLUDE_DIR Path to the MayaUsd include directory
# MAYAUSDAPI_LIBRARY Path to MayaUsdAPI library
# MAYAUSD_MOD_PATH Path to mayaUSD.mod file
Expand All @@ -22,23 +21,11 @@ find_path(MAYAUSD_INCLUDE_DIR
"MayaUsd header path"
)

find_path(MAYAUSD_LIBRARY_DIR
mayaUsd.lib
HINTS
${MAYAUSD_LOCATION}
PATH_SUFFIXES
lib/
DOC
"MayaUsd libraries path"
)

find_library(MAYAUSDAPI_LIBRARY
NAMES
mayaUsdAPI
HINTS
${MAYAUSD_LOCATION}
PATHS
${MAYAUSD_LIBRARY_DIR}
PATH_SUFFIXES
lib/
DOC
Expand All @@ -62,26 +49,14 @@ include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MAYAUSD
REQUIRED_VARS
MAYAUSD_INCLUDE_DIR
MAYAUSD_LIBRARY_DIR
MAYAUSDAPI_LIBRARY
)

if(MAYAUSD_FOUND)
message(STATUS "MayaUsd found : ${MAYAUSD_LOCATION}")
message(STATUS "MayaUsd include dir: ${MAYAUSD_INCLUDE_DIR}")
message(STATUS "MayaUsd libraries dir: ${MAYAUSD_LIBRARY_DIR}")
message(STATUS "MayaUsdAPI.lib fullpath : ${MAYAUSDAPI_LIBRARY}")
message(STATUS "MayaUsdAPI library fullpath : ${MAYAUSDAPI_LIBRARY}")
message(STATUS "MAYAUSD_MOD_PATH : ${MAYAUSD_MOD_PATH}")

#Add MAYAUSD_MOD_PATH (the path where maya USD .mod file is) to the MAYA_MODULE_PATH

# Get the current value of the environment variable
set(CURRENT_MAYA_MODULE_PATH $ENV{MAYA_MODULE_PATH})

# Append the new path to the current value
set(MAYA_MODULE_PATH "${CURRENT_MAYA_MODULE_PATH}:${MAYAUSD_MOD_PATH}")

# Export the new value to the environment
set(ENV{MAYA_MODULE_PATH} ${MAYA_MODULE_PATH})
else()
if(DEFINED MAYAUSD_LOCATION)
message(WARNING "Could not find MayaUsd library and include directories in the folder provided : ${MAYAUSD_LOCATION}")
Expand Down
10 changes: 10 additions & 0 deletions cmake/test.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
set(MAYA_USD_DIR ${CMAKE_CURRENT_SOURCE_DIR})

if(MAYAUSD_FOUND)
#Add MAYAUSD_MOD_PATH (the path where maya USD .mod file is) to the MAYA_MODULE_PATH
# Get the current value of the environment variable
set(CURRENT_MAYA_MODULE_PATH $ENV{MAYA_MODULE_PATH})
# Append the new path to the current value
set(MAYA_MODULE_PATH "${CURRENT_MAYA_MODULE_PATH}:${MAYAUSD_MOD_PATH}")
# Export the new value to the environment
set(ENV{MAYA_MODULE_PATH} ${MAYA_MODULE_PATH})
endif()

function(mayaUsd_get_unittest_target unittest_target unittest_basename)
get_filename_component(unittest_name ${unittest_basename} NAME_WE)
set(${unittest_target} "${unittest_name}" PARENT_SCOPE)
Expand Down
6 changes: 3 additions & 3 deletions lib/mayaHydra/hydraExtensions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ set(HEADERS
target_compile_definitions(${TARGET_NAME}
PRIVATE
MAYAHYDRALIB_EXPORT
$<$<BOOL:${MAYAUSDAPI_LIBRARY}>:MAYAHYDRALIB_MAYAUSDAPI_ENABLED>
$<$<BOOL:${MayaUsd_FOUND}>:MAYAHYDRALIB_MAYAUSDAPI_ENABLED>
$<$<BOOL:${IS_MACOSX}>:OSMac_>
# Copy-pasted from lib/mayaUsd/CMakeLists.txt
)
Expand All @@ -52,7 +52,7 @@ target_include_directories(${TARGET_NAME}
${CMAKE_BINARY_DIR}/include
PRIVATE
$<$<BOOL:${UFE_FOUND}>:${UFE_INCLUDE_DIR}>
$<$<BOOL:${MAYAUSDAPI_LIBRARY}>:${MAYAUSD_INCLUDE_DIR}>
$<$<BOOL:${MayaUsd_FOUND}>:${MAYAUSD_INCLUDE_DIR}>
)

target_compile_definitions(${TARGET_NAME}
Expand Down Expand Up @@ -123,7 +123,7 @@ target_link_libraries(${TARGET_NAME}
$<$<BOOL:${USD_001905_BUILD}>:hio>
${PYTHON_LIBRARIES}
$<$<BOOL:${UFE_FOUND}>:${UFE_LIBRARY}>
$<$<BOOL:${MAYAUSDAPI_LIBRARY}>:${MAYAUSDAPI_LIBRARY}>
$<$<BOOL:${MayaUsd_FOUND}>:${MAYAUSDAPI_LIBRARY}>
)

# -----------------------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions test/lib/mayaUsd/render/mayaToHydra/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ set(TEST_SCRIPT_FILES
cpp/testFlowViewportAPIFilterPrims.py
)

#Add this test only if the MAYAUSDAPI_LIBRARY has been found during compile time.
if(MAYAUSDAPI_LIBRARY)
#Add this test only if the MayaUsd_FOUND (so also MAYAUSDAPI_LIBRARY) has been found during compile time.
if(MayaUsd_FOUND)
list(APPEND TEST_SCRIPT_FILES testMayaUsdAPIUsage.py)
endif(MAYAUSDAPI_LIBRARY)
endif(MayaUsd_FOUND)

# Test use of mesh adapter code for mesh support, using environment variable.
# As of 13-Jun-2023, if a test in this list is identical to a test in
Expand Down

0 comments on commit 7a7afb1

Please sign in to comment.