### Install Doxygen HTML Output Source: https://github.com/autodesk/arnold-usd/blob/master/docs/CMakeLists.txt Installs the generated HTML documentation from the build directory to the `docs` destination in the final installation. This makes the documentation accessible after installation. ```cmake install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/out/html" DESTINATION docs) ``` -------------------------------- ### Install Executable and Assets Source: https://github.com/autodesk/arnold-usd/blob/master/tools/turntable/CMakeLists.txt Installs the turntable executable to the binary directory and copies the 'hdri' directory. For static USD builds, it also installs USD-related plugins. ```cmake install(TARGETS turntable DESTINATION "${PREFIX_BIN}") install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/hdri" DESTINATION "${PREFIX_BIN}") if (BUILD_WITH_USD_STATIC) install(DIRECTORY "${USD_LIBRARY_DIR}/usd" DESTINATION "${PREFIX_BIN}") # Also install USD_LOCATION/plugin/usd (contains adskAssetResolver and other USD-distribution plugins). if (EXISTS "${USD_LOCATION}/plugin/usd") install(DIRECTORY "${USD_LOCATION}/plugin/usd" DESTINATION "${PREFIX_BIN}") endif () endif () ``` -------------------------------- ### Install and Run Test Suite Command Source: https://github.com/autodesk/arnold-usd/blob/master/testsuite/CMakeLists.txt This command installs the CMake build, copies schemas, and then executes the test suite using 'abuild'. It configures various environment variables like plugin paths and library paths to ensure the test suite runs correctly. ```cmake add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/testsuite" # First we install our cmake build as we want to test the install. We use the scons build folder as it should be there. COMMAND ${CMAKE_COMMAND} --install ${CMAKE_BINARY_DIR} --prefix="${CMAKE_INSTALL_PREFIX}" # We copy the schemas in the procedural # TODO: the install should do that ? shouldn't it ? COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_INSTALL_PREFIX}/schema/usdArnold" "${CMAKE_INSTALL_PREFIX}/procedural/usd" # Run the scons testsuite pointing to our install. # TODO: add a way to run a set of tests instead of the whole testsuite # change the environment variable depending on the usd lib we build with (shared would need /plugin in PATH) COMMAND ${CMAKE_COMMAND} -E env "USDIMAGINGGL_ENGINE_ENABLE_SCENE_INDEX=1" "TESTSUITE_ARNOLD_PLUGIN_PATH=$" "TESTSUITE_PXR_PLUGINPATH_NAME=$" "DYLD_LIBRARY_PATH=$" "PYTHONPATH=$" "LD_LIBRARY_PATH=$" "PATH=$" $,abuild.bat,./abuild>> USD_PATH="$" BOOST_INCLUDE="$" ARNOLD_PATH="$" BUILD_NDR_PLUGIN=0 BUILD_USD_IMAGING_PLUGIN=0 BUILD_RENDER_DELEGATE=0 BUILD_SCENE_INDEX_PLUGIN=1 BUILD_USD_WRITER=0 BUILD_PROCEDURAL=0 BUILD_SCHEMAS=0 BUILD_DOCS=0 BUILD_TESTSUITE=1 testsuite WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} ) ``` -------------------------------- ### Configure Linux Build with USD and Arnold Source: https://github.com/autodesk/arnold-usd/blob/master/docs/building.md Use this configuration for building on Linux against a USD built using official scripts. Ensure Arnold, USD, and Google Test are installed in the specified locations. ```bash cmake .. \ -DCMAKE_BUILD_TYPE=Release \ -DARNOLD_LOCATION=/opt/arnold \ -DUSD_LOCATION=/opt/USD \ -DBUILD_UNIT_TESTS=ON \ -DGOOGLETEST_LOCATION=/opt/googletest \ -DCMAKE_CXX_STANDARD=14 \ -DCMAKE_INSTALL_PREFIX=/opt/arnold-usd ``` -------------------------------- ### Configure Windows Build with USD and Google Test Source: https://github.com/autodesk/arnold-usd/blob/master/docs/building.md Use this configuration for building on Windows with a stock build of USD and Google Test. Ensure Arnold, USD, and Google Test are installed in the specified Windows paths. The generator is set to Visual Studio 2019. ```bash cmake .. \ -G "Visual Studio 16 2019" \ -DCMAKE_INSTALL_PREFIX=C:\\arnold-usd \ -DCMAKE_CXX_STANDARD=14 \ -DARNOLD_LOCATION=C:\\arnold \ -DUSD_LOCATION=C:\\USD \ -DBUILD_SCHEMAS=OFF \ -DBUILD_UNIT_TESTS=ON \ -DGOOGLETEST_LOCATION=C:\\googletest ``` -------------------------------- ### C++ Doxygen Comment Example Source: https://github.com/autodesk/arnold-usd/blob/master/docs/documenting.md Illustrates the standard Doxygen comment style for documenting C++ functions, including a brief description, detailed explanation, parameter descriptions, and return value. ```cpp /// Short description in one phrase (in this case: Add two numbers together). /// /// Optionally, here goes a much more detailed description of the function. /// This longer description can spawn multiple lines, include code samples, etc. /// /// @param a This is the first floating point number to be added /// @param b And this is the second number /// @return The sum a + b float myAddFunction(float a, float b) { // ... } ``` -------------------------------- ### Configure Linux Build with Houdini Source: https://github.com/autodesk/arnold-usd/blob/master/docs/building.md This configuration is for building on Linux against a standard Houdini installation. Arnold must be installed in the specified location. ```bash cmake .. \ -DCMAKE_BUILD_TYPE=Release \ -DARNOLD_LOCATION=/opt/arnold \ -DHOUDINI_LOCATION=/opt/hfs18.0 \ -DBUILD_SCHEMAS=OFF \ -DBUILD_DISABLE_CXX11_ABI=ON \ -DCMAKE_CXX_STANDARD=14 \ -DCMAKE_INSTALL_PREFIX=/opt/arnold-usd ``` -------------------------------- ### Configure Windows Build with Houdini 18.0 Source: https://github.com/autodesk/arnold-usd/blob/master/docs/building.md This configuration is for building on Windows with Houdini 18.0.499. Note that custom schemas generation is disabled due to missing usdgenschema in this Houdini version. Arnold must be installed in the specified path. ```bash cmake .. \ -G "Visual Studio 15 2017 Win64" \ -DCMAKE_INSTALL_PREFIX="C:\\dist\\arnold-usd" \ -DARNOLD_LOCATION="C:\\arnold" \ -DHOUDINI_LOCATION="C:\\Program Files\\Side Effects Software\\Houdini 18.0.499" \ -DBUILD_SCHEMAS=OFF ``` -------------------------------- ### Class Naming Conventions Source: https://github.com/autodesk/arnold-usd/blob/master/docs/conventions.md Classes should be named in CamelCase, starting with a module-specific prefix. Structs are used for data aggregation without member functions and only require a prefix if exposed in a header. ```cpp // Base library class HdArnoldLight; // OK class MyClass; // WRONG class myClass; // WRONG struct MyStruct : public HdRenderDelegate { // ... }; // WRONG struct MyOtherStruct { float a; int b; double c; } // OK ``` -------------------------------- ### Define Source and Header Files Source: https://github.com/autodesk/arnold-usd/blob/master/plugins/usd_imaging/CMakeLists.txt Lists the source (.cpp) and header (.h) files for the plugin. ```cmake set(SRC arnold_options_adapter.cpp material_param_utils.cpp node_graph_adapter.cpp usd_lux_light_filter_adapter.cpp procedural_custom_adapter.cpp shape_adapter.cpp ) set(HDR api.h arnold_options_adapter.h material_param_utils.h node_graph_adapter.h usd_lux_light_filter_adapter.h shape_adapter.h ) ``` -------------------------------- ### Build Configuration for USD 20.05+ on Linux Source: https://github.com/autodesk/arnold-usd/blob/master/docs/building.md Configure the build for USD 20.05 and later on CentOS 7, requiring GCC 6.3.1 and C++-14. Adjust the SHCXX path for other operating systems. ```python SHCXX='/opt/rh/devtoolset-6/root/usr/bin/g++' CXX_STANDARD='14' DISABLE_CXX11_ABI=True ``` -------------------------------- ### Copy USD Configuration Files Source: https://github.com/autodesk/arnold-usd/blob/master/tools/usdgenschema/CMakeLists.txt Sets up a custom command to copy the 'usd' configuration directory from the USD library path to the build output directory, ensuring the executable can find its configuration. ```cmake add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/usd" COMMAND ${CMAKE_COMMAND} -E copy_directory "${USD_LIBRARY_DIR}/usd" "$/usd" ) ``` -------------------------------- ### Link Libraries for Static USD Build Source: https://github.com/autodesk/arnold-usd/blob/master/tools/turntable/CMakeLists.txt Handles linking for static USD builds, including special handling for Windows using '-WHOLEARCHIVE' and for Linux/macOS using linker options. This ensures all necessary static libraries are correctly linked. ```cmake if (BUILD_WITH_USD_STATIC) set(_staticlibs ${USD_usd_m_LIBRARY}) list(APPEND _staticlibs ${USD_TRANSITIVE_STATIC_LIBS}) list(REMOVE_DUPLICATES _staticlibs) if (WIN32) foreach(USD_M_LIB ${_staticlibs}) if(EXISTS ${USD_M_LIB}) target_link_options(turntable PRIVATE "-WHOLEARCHIVE:${USD_M_LIB}") else() target_link_libraries(turntable PRIVATE ${USD_M_LIB}) endif() endforeach() else () list(JOIN _staticlibs "," _staticlibs) if (LINUX) target_link_libraries(turntable PRIVATE dl pthread) target_link_options(turntable PRIVATE "-Wl,--whole-archive,${_staticlibs},--no-whole-archive") else () # APPLE target_link_options(turntable PRIVATE "-Wl,-all_load,${_staticlibs}") endif () endif () else () # USD shared lib build if (USD_MONOLITHIC_BUILD) target_link_libraries(turntable PRIVATE usd_ms) else () if (LINUX) target_link_libraries(turntable PRIVATE dl pthread) endif () target_link_libraries(turntable PRIVATE tf;sdf;usd;usdGeom;usdLux;usdRender;usdShade) endif () endif () ``` -------------------------------- ### File Naming Conventions Source: https://github.com/autodesk/arnold-usd/blob/master/docs/conventions.md Use snake_case for file and folder names. Header files should use the 'h' extension, and source files should use 'cpp'. Avoid 'cxx' for source files. ```text contrib // OK renderDelegate.h // WRONG render_delegate.cpp // OK render_delegate.cxx // WRONG ``` -------------------------------- ### Build Arnold-USD with abuild on Linux Source: https://github.com/autodesk/arnold-usd/blob/master/docs/building.md Pass build configuration variables directly to the 'abuild' command for building Arnold-USD. ```bash abuild ARNOLD_PATH='/opt/autodesk/arnold-5.4.0.0' USD_PATH='/opt/pixar/USD' USD_BUILD_MODE='monolithic' BOOST_INCLUDE='/usr/include' PYTHON_INCLUDE='/usr/include/python2.7' PYTHON_LIB='/usr/lib' PYTHON_LIB_NAME='python2.7' PREFIX='/opt/autodesk/arnold-usd' ``` -------------------------------- ### Create Custom Target for Configurations Source: https://github.com/autodesk/arnold-usd/blob/master/tools/usdgenschema/CMakeLists.txt Creates a custom target 'usdGenSchemaConfigs' that depends on the copied USD configuration files. This ensures configurations are available when needed. ```cmake add_custom_target(usdGenSchemaConfigs DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/usd" ) add_dependencies(usdGenSchemaArnold usdGenSchemaConfigs) ``` -------------------------------- ### Link Static USD Libraries Source: https://github.com/autodesk/arnold-usd/blob/master/tools/usdgenschema/CMakeLists.txt Configures linking for static USD builds, handling platform-specific options like WHOLEARCHIVE or -all_load for static libraries. ```cmake if (BUILD_WITH_USD_STATIC) set(_staticlibs ${USD_usd_m_LIBRARY}) list(APPEND _staticlibs ${USD_TRANSITIVE_STATIC_LIBS}) list(REMOVE_DUPLICATES _staticlibs) if (WIN32) foreach(USD_M_LIB ${_staticlibs}) if(EXISTS ${USD_M_LIB}) target_link_options(usdGenSchemaArnold PRIVATE "-WHOLEARCHIVE:${USD_M_LIB}") else() target_link_libraries(usdGenSchemaArnold PRIVATE ${USD_M_LIB}) endif() endforeach() else () list(JOIN _staticlibs "," _staticlibs) if (LINUX) target_link_libraries(usdGenSchemaArnold PRIVATE dl pthread) target_link_options(usdGenSchemaArnold PRIVATE "-Wl,--whole-archive,${_staticlibs},--no-whole-archive") else () # APPLE target_link_options(usdGenSchemaArnold PRIVATE "-Wl,-all_load,${_staticlibs}") endif () endif () else () # USD shared lib build if (USD_MONOLITHIC_BUILD) target_link_libraries(usdGenSchemaArnold PRIVATE usd_ms) else () if (LINUX) target_link_libraries(usdGenSchemaArnold PRIVATE dl pthread) endif () target_link_libraries(usdGenSchemaArnold PRIVATE vt;arch;usd;usdShade;tf) endif () endif () ``` -------------------------------- ### Build USD Imaging Arnold Shared Plugin Source: https://github.com/autodesk/arnold-usd/blob/master/plugins/usd_imaging/CMakeLists.txt Configures and builds the shared USD Imaging Arnold plugin if not building statically. ```cmake add_library(usdImagingArnold SHARED ${SRC} "${CMAKE_CURRENT_BINARY_DIR}/shape_adapters.cpp") if (BUILD_HEADERS_AS_SOURCES) target_sources(usdImagingArnold PRIVATE ${HDR}) endif () set(USDIMAGING_LIBS ar;arch;plug;tf;trace;vt;gf;work;sdf;sdr;hf;hd;hdsi;usd;usdGeom;usdImaging;usdLux;usdShade) if (${USD_VERSION} VERSION_LESS "0.25.05") list(APPEND USDIMAGING_LIBS ndr) endif () add_common_dependencies( TARGET_NAME usdImagingArnold USD_DEPENDENCIES ${USDIMAGING_LIBS}) target_link_libraries(usdImagingArnold PRIVATE common) target_compile_definitions(usdImagingArnold PRIVATE "USDIMAGINGARNOLD_EXPORTS=1") if (BUILD_SCENE_INDEX_PLUGIN) target_compile_definitions(usdImagingArnold PUBLIC ENABLE_SCENE_INDEX=1) endif () # For the generated shape adapters to find headers here. target_include_directories(usdImagingArnold PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") install(TARGETS usdImagingArnold DESTINATION "${PREFIX_PLUGINS}") set(PLUGINFO "${CMAKE_CURRENT_BINARY_DIR}/plug/plugInfo.json") install_usdimaging_arnold_pluginfo( ../usdImagingArnold "${PLUGINFO}" ${PREFIX_PLUGINS}) # We replicate the layout of the plugin installation inside the build dir for running the testsuite without installing. generate_plug_info_for_testsuite(TARGET_NAME usdImagingArnold TARGET_PLUGINFO "${PLUGINFO}") ``` -------------------------------- ### Include File Notation Source: https://github.com/autodesk/arnold-usd/blob/master/docs/conventions.md Use C++ style include directives with angle brackets for standard library headers and double quotes for project-specific headers. Avoid using `.h` extensions for C++ standard library headers. ```cpp #include // OK #include // WRONG ``` -------------------------------- ### Build Configuration Variables for Arnold-USD on Linux Source: https://github.com/autodesk/arnold-usd/blob/master/docs/building.md Set these environment variables to configure the build of Arnold-USD against system Python libraries and a monolithic USD build. ```python ARNOLD_PATH='/opt/autodesk/arnold-5.4.0.0' USD_PATH='/opt/pixar/USD' USD_BUILD_MODE='monolithic' BOOST_INCLUDE='/usr/include' PYTHON_INCLUDE='/usr/include/python2.7' PYTHON_LIB='/usr/lib' PYTHON_LIB_NAME='python2.7' PREFIX='/opt/autodesk/arnold-usd' ``` -------------------------------- ### Configure Doxygen Input and Output Source: https://github.com/autodesk/arnold-usd/blob/master/docs/CMakeLists.txt Sets the paths for the Doxygen configuration file and the output directory. The `configure_file` command processes the Doxygen input file, substituting variables. ```cmake find_package(Doxygen REQUIRED dot) set(DOXYGEN_IN "${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile") set(DOXYGEN_OUT "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile") set(OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/out") configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY) ``` -------------------------------- ### Configure Include Directories Source: https://github.com/autodesk/arnold-usd/blob/master/tools/turntable/CMakeLists.txt Specifies private include directories for the turntable target, including USD, TBB, Boost, and the current source directory. These are necessary for compiling the executable. ```cmake target_include_directories(turntable PRIVATE "${USD_INCLUDE_DIR}" "${USD_TRANSITIVE_INCLUDE_DIRS}" "${TBB_INCLUDE_DIRS}" "${Boost_INCLUDE_DIRS}" "${CMAKE_CURRENT_SOURCE_DIR}" ) ``` -------------------------------- ### Define Executable and Post-Build Command Source: https://github.com/autodesk/arnold-usd/blob/master/tools/turntable/CMakeLists.txt Defines the turntable executable and a custom command to copy the 'hdri' directory after the build. This ensures assets are available with the executable. ```cmake set(SRC main.cpp) add_executable(turntable ${SRC}) add_custom_command(TARGET turntable POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/hdri" "$/hdri") ``` -------------------------------- ### Configure Arnold USD Bundle Plugin (Dynamic USD) Source: https://github.com/autodesk/arnold-usd/blob/master/plugins/bundle/CMakeLists.txt This snippet configures the build for the Arnold USD bundle plugin when dynamically linking to a shared USD library. It sets the library name, sources, compile definitions, include directories, and links necessary libraries. ```cmake if (NOT BUILD_WITH_USD_STATIC) set(BUNDLE_NAME "ArnoldUsdBundle") add_library(${BUNDLE_NAME} SHARED) # or usdbundle_proc # should not start with "lib", so set the prefix to "" set_target_properties(${BUNDLE_NAME} PROPERTIES PREFIX "") target_sources(${BUNDLE_NAME} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/../render_delegate/renderer_plugin.cpp ${CMAKE_CURRENT_LIST_DIR}/../procedural/main.cpp ${CMAKE_CURRENT_LIST_DIR}/../procedural/asset_utils.cpp ) target_compile_definitions(${BUNDLE_NAME} PRIVATE USD_PROCEDURAL_NAME=${USD_PROCEDURAL_NAME}) if (${BUILD_PROC_SCENE_FORMAT}) target_compile_definitions(${BUNDLE_NAME} PRIVATE ARNOLD_HAS_SCENE_FORMAT_API) endif() target_include_directories(${BUNDLE_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../libs/translator/reader") target_include_directories(${BUNDLE_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../libs/translator/writer") target_include_directories(${BUNDLE_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../libs/render_delegate") target_compile_definitions(${BUNDLE_NAME} PRIVATE "HDARNOLD_EXPORTS=1") target_compile_definitions(${BUNDLE_NAME} PUBLIC ENABLE_HYDRA_IN_USD_PROCEDURAL=1) if (ENABLE_SCENE_INDEX_IN_BUNDLE) target_compile_definitions(${BUNDLE_NAME} PUBLIC ENABLE_SCENE_INDEX=1) endif() if (MTOA_BUILD) target_compile_definitions(${BUNDLE_NAME} PUBLIC MTOA_BUILD=1) endif() target_link_libraries(${BUNDLE_NAME} PRIVATE translator common usdImaging ndrObjects usdImagingArnoldObjects) target_link_libraries(${BUNDLE_NAME} PRIVATE "$") if (${USD_VERSION} VERSION_GREATER_EQUAL "0.25.5") target_link_libraries(${BUNDLE_NAME} PRIVATE hdsi;ts) endif() if (ENABLE_SCENE_INDEX_IN_BUNDLE) target_link_libraries(${BUNDLE_NAME} PRIVATE sceneIndexArnoldObjects) endif() # Install the Bundle inside a new directory to avoid any collision with other installed plugins install(TARGETS ${BUNDLE_NAME} DESTINATION "${PREFIX_BUNDLE}") # Install procedural usd directory as well - we shouldn't need to install this directory #install(DIRECTORY "${USD_LIBRARY_DIR}/usd" # DESTINATION "${PREFIX_BUNDLE}") # Install each bundle plugins in different directory, reusing installation code install_ndr_arnold_pluginfo( ../${BUNDLE_NAME} "${CMAKE_CURRENT_BINARY_DIR}/nodeRegistryArnold/resources/plugInfo.json" "${PREFIX_BUNDLE}") # install the usd imaging arnold pluginfo install_usdimaging_arnold_pluginfo( ../${BUNDLE_NAME} "${CMAKE_CURRENT_BINARY_DIR}/usdImagingArnold/resources/plugInfo.json" "${PREFIX_BUNDLE}") # install the render delegate arnold pluginfo set(LIB_EXTENSION ${CMAKE_SHARED_LIBRARY_SUFFIX}) install_hdarnold_arnold_pluginfo( ../${BUNDLE_NAME} "${CMAKE_CURRENT_BINARY_DIR}/hdArnold/resources/plugInfo.json" "${PREFIX_BUNDLE}") # install the scene index if we include it message(STATUS "USDVERSION ${USD_VERSION}") if (ENABLE_SCENE_INDEX_IN_BUNDLE) install_sceneindex_arnold_pluginfo( ../${BUNDLE_NAME} "${CMAKE_CURRENT_BINARY_DIR}/sceneIndexArnold/resources/plugInfo.json" "${PREFIX_BUNDLE}") endif () endif() # NOT BUILD_WITH_USD_STATIC ``` -------------------------------- ### Define Executable and Dependencies Source: https://github.com/autodesk/arnold-usd/blob/master/tools/usdgenschema/CMakeLists.txt Defines the main source file and the executable target 'usdGenSchemaArnold'. It also adds common include directories and libraries required for the build. ```cmake set(SRC main.cpp) add_executable(usdGenSchemaArnold ${SRC}) add_common_includes(TARGET_NAME usdGenSchemaArnold DEPENDENCIES vt;arch;usd;usdShade;tf) ``` -------------------------------- ### Define plugInfo Source Files Source: https://github.com/autodesk/arnold-usd/blob/master/plugins/CMakeLists.txt Sets the source file paths for plugInfo.json.in templates used for different Arnold USD components. ```cmake set(NDRARNOLD_PLUGINFO_SRC ${CMAKE_CURRENT_SOURCE_DIR}/node_registry/plugInfo.json.in) set(HDARNOLD_PLUGINFO_SRC ${CMAKE_CURRENT_SOURCE_DIR}/render_delegate/plugInfo.json.in) set(USDIMAGINGARNOLD_PLUGINFO_SRC ${CMAKE_CURRENT_SOURCE_DIR}/usd_imaging/plugInfo.json.in) set(SCENEINDEXARNOLD_PLUGINFO_SRC ${CMAKE_CURRENT_SOURCE_DIR}/scene_index/plugInfo.json.in) ``` -------------------------------- ### Windows Custom Build Configuration for Houdini Source: https://github.com/autodesk/arnold-usd/blob/master/docs/building.md This Python script configures Arnold-USD build settings for Windows with Houdini. It specifies paths for Arnold, USD, Boost, and Python, tailored for a Windows environment. ```python ARNOLD_PATH=r'C:\\solidAngle\\arnold' USD_PATH='./' USD_BIN='./' USD_INCLUDE=r'C:\\Program Files\\Side Effects Software\\Houdini 18.0.287\\toolkit\\include' USD_LIB=r'C:\\Program Files\\Side Effects Software\\Houdini 18.0.287\\custom\\houdini\\dsolib' USD_LIB_PREFIX='libpxr_' BOOST_INCLUDE=r'C:\\Program Files\\Side Effects Software\\Houdini 18.0.287\\toolkit\\include\\hboost' BOOST_LIB=r'C:\\Program Files\\Side Effects Software\\Houdini 18.0.287\\custom\\houdini\\dsolib' BOOST_LIB_NAME='hboost_%s-mt' PYTHON_INCLUDE=r'C:\\Program Files\\Side Effects Software\\Houdini 18.0.287\\toolkit\\include\\python2.7' PYTHON_LIB=r'c:\\Program Files\\Side Effects Software\\Houdini 18.0.287\\python27\\libs' PYTHON_LIB_NAME='python27' USD_BUILD_MODE='shared_libs' BUILD_SCHEMAS=False BUILD_RENDER_DELEGATE=True BUILD_PROCEDURAL=True BUILD_TESTSUITE=True BUILD_DOCS=False PREFIX=r'C:\\solidAngle\\arnold-usd' ``` -------------------------------- ### Namespace Usage Source: https://github.com/autodesk/arnold-usd/blob/master/docs/conventions.md Avoid explicit use of the 'pxr' namespace. Use the PXR_NAMESPACE_OPEN_SCOPE, PXR_NAMESPACE_CLOSE_SCOPE, and PXR_NAMESPACE_USING_DIRECTIVE macros for namespace management. ```cpp pxr::TfToken myToken; // Not OK PXR_NAMESPACE_OPEN_SCOPE TfToken mySecondToken; // OK PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_USING_DIRECTIVE TfToken myThirdToken; // OK ``` -------------------------------- ### Generate Shape Adapters Source: https://github.com/autodesk/arnold-usd/blob/master/plugins/usd_imaging/CMakeLists.txt Generates C++ source files for adapter classes based on a list of Arnold USD imaging classes. ```cmake set(CREATE_ADAPTER_CLASSES "") set(REGISTER_ADAPTER_CLASSES "") set(REGISTER_ARNOLD_TYPES "") foreach (each ${ARNOLD_USDIMAGING_CLASSES}) set(CREATE_ADAPTER_CLASSES "${CREATE_ADAPTER_CLASSES}\nCREATE_ADAPTER_CLASS(${each});") set(REGISTER_ADAPTER_CLASSES "${REGISTER_ADAPTER_CLASSES}\nREGISTER_ADAPTER_CLASS(${each})") endforeach () configure_file("${CMAKE_CURRENT_SOURCE_DIR}/shape_adapters.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/shape_adapters.cpp") ``` -------------------------------- ### Null Pointer Usage Source: https://github.com/autodesk/arnold-usd/blob/master/docs/conventions.md Always use `nullptr` to represent null pointers. Avoid using `0` or `NULL` for pointer initialization or comparison. ```cpp A* a = nullptr; // OK B* b = 0; // WRONG C* c = NULL; // WRONG ``` -------------------------------- ### Define Doxygen Custom Command Source: https://github.com/autodesk/arnold-usd/blob/master/docs/CMakeLists.txt Creates a custom command to run Doxygen. It specifies output files, dependencies (including source files and markdown documents), the command to execute, and a comment for build output. ```cmake set(DOXYGEN_INDEX "${CMAKE_CURRENT_BINARY_DIR}/out/html/index.html") add_custom_command(OUTPUT ${DOXYGEN_INDEX} DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/../README.md" "${CMAKE_CURRENT_SOURCE_DIR}/building.md" "${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile" "${CMAKE_CURRENT_SOURCE_DIR}/conventions.md" "${CMAKE_CURRENT_SOURCE_DIR}/documenting.md" "${CMAKE_CURRENT_SOURCE_DIR}/naming_conventions.md" ${DELEGATE_HDRS} ${NDR_HDRS} ${TRANSLATOR_HDRS} COMMAND ${DOXYGEN_EXECUTABLE} "${DOXYGEN_OUT}" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/.." COMMENT "Generating API documentation with Doxygen" VERBATIM) ``` -------------------------------- ### Create Arnold Objects Library Source: https://github.com/autodesk/arnold-usd/blob/master/plugins/usd_imaging/CMakeLists.txt Creates an object library for Hydra procedural components, including generated shape adapters. ```cmake add_library(usdImagingArnoldObjects OBJECT ${SRC} "${CMAKE_CURRENT_BINARY_DIR}/shape_adapters.cpp") target_compile_definitions(usdImagingArnoldObjects PRIVATE "USDIMAGINGARNOLD_EXPORTS=1") add_common_includes(TARGET_NAME usdImagingArnoldObjects DEPENDENCIES common) if (BUILD_SCENE_INDEX_PLUGIN OR ENABLE_SCENE_INDEX_IN_BUNDLE) target_compile_definitions(usdImagingArnoldObjects PUBLIC ENABLE_SCENE_INDEX=1) endif() ``` -------------------------------- ### Source Grouping Source: https://github.com/autodesk/arnold-usd/blob/master/plugins/usd_imaging/CMakeLists.txt Organizes source files into logical groups within the build system. ```cmake source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SRC} ${HDR} shape_adapters.cpp.in) source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/../common PREFIX common FILES ${COMMON_SRC} ${COMMON_HDR}) ``` -------------------------------- ### Create Doxygen Documentation Target Source: https://github.com/autodesk/arnold-usd/blob/master/docs/CMakeLists.txt Defines a custom target `docs_doxygen` that depends on the Doxygen index file. This allows the documentation generation to be triggered as part of the build process. ```cmake add_custom_target(docs_doxygen ALL DEPENDS ${DOXYGEN_INDEX}) ``` -------------------------------- ### Add Arnold USD Subdirectories Source: https://github.com/autodesk/arnold-usd/blob/master/plugins/CMakeLists.txt Includes subdirectories for various Arnold USD plugin components into the build. ```cmake add_subdirectory(node_registry) add_subdirectory(usd_imaging) add_subdirectory(scene_index) add_subdirectory(render_delegate) ``` -------------------------------- ### Linux Custom Build Configuration for Houdini Source: https://github.com/autodesk/arnold-usd/blob/master/docs/building.md Configure Arnold-USD build settings for Linux with Houdini using this Python script. It includes paths for Arnold, USD, Boost, and Python, and specifies compiler settings for GCC 6.3.1+ and C++ 14. ```python ARNOLD_PATH='/opt/solidAngle/arnold' USD_PATH='./' USD_BIN='./' USD_INCLUDE='/opt/hfs18.0/toolkit/include' USD_LIB='/opt/hfs18.0/dsolib' USD_LIB_PREFIX='libpxr_' PREFIX='/opt/solidAngle/arnold-usd' BOOST_INCLUDE='/opt/hfs18.0/toolkit/include/hboost' BOOST_LIB='/opt/hfs18.0/dsolib' BOOST_LIB_NAME='hboost_%s' PYTHON_INCLUDE='/usr/include/python2.7' PYTHON_LIB='/usr/lib' PYTHON_LIB_NAME='python2.7' USD_BUILD_MODE='shared_libs' SHCXX='/opt/rh/devtoolset-6/root/usr/bin/g++' CXX_STANDARD='14' DISABLE_CXX11_ABI=True BUILD_SCHEMAS=False BUILD_RENDER_DELEGATE=True BUILD_NDR_PLUGIN=True BUILD_PROCEDURAL=True BUILD_TESTSUITE=True BUILD_DOCS=True ``` -------------------------------- ### macOS Custom Build Configuration for Houdini Source: https://github.com/autodesk/arnold-usd/blob/master/docs/building.md Use this Python script to configure build settings for Arnold-USD on macOS when integrating with Houdini. It specifies paths for Arnold, USD, Boost, and Python, along with build flags. ```python ARNOLD_PATH='/opt/solidAngle/arnold' WARN_LEVEL='warn-only' USD_PATH='./' USD_LIB='/Applications/Houdini/Houdini18.0.287/Frameworks/Houdini.framework/Versions/Current/Libraries' USD_INCLUDE='/Applications/Houdini/Houdini18.0.287/Frameworks/Houdini.framework/Versions/Current/Resources/toolkit/include' USD_BIN='/Applications/Houdini/Houdini18.0.287/Frameworks/Houdini.framework/Versions/Current/Resources/bin' USD_BUILD_MODE='shared_libs' USD_LIB_PREFIX='libpxr_' BOOST_INCLUDE='/Applications/Houdini/Houdini18.0.287/Frameworks/Houdini.framework/Versions/Current/Resources/toolkit/include/hboost' BOOST_LIB='/Applications/Houdini/Houdini18.0.287/Frameworks/Houdini.framework/Versions/Current/Libraries' BOOST_LIB_NAME='hboost_%s' PYTHON_INCLUDE='/Applications/Houdini/Houdini18.0.287/Frameworks/Python.framework/Versions/2.7/include/python2.7' PYTHON_LIB='/Applications/Houdini/Houdini18.0.287/Frameworks/Python.framework/Versions/2.7/lib' PYTHON_LIB_NAME='python2.7' BUILD_SCHEMAS=False BUILD_RENDER_DELEGATE=True BUILD_PROCEDURAL=True BUILD_TESTSUITE=True BUILD_DOCS=True PREFIX='/opt/solidAngle/arnold-usd' ``` -------------------------------- ### Function Call Formatting Source: https://github.com/autodesk/arnold-usd/blob/master/docs/conventions.md Ensure no space between the function name and its parentheses, and no space between the parentheses and arguments. This applies to all function and method calls. ```cpp myFunction(a, b); // OK myFunction (a, b); // wrong myFunction( a, b ); // wrong ``` -------------------------------- ### Comment Style Source: https://github.com/autodesk/arnold-usd/blob/master/docs/conventions.md Use C++ style comments (`//`) with a space following the slashes. Avoid C-style block comments (`/* ... */`). ```cpp // I am a nice comment. //But I am not. /* I'm ugly too. */ ``` -------------------------------- ### Source-Only Functions and Structs Source: https://github.com/autodesk/arnold-usd/blob/master/docs/conventions.md Source-only functions and structs should be placed in an anonymous namespace. Source-only functions are prefixed with an underscore (_). Anonymous namespaces do not increase indentation. ```cpp // Source file namespace { void MyFunction() { // ... } // WRONG void _MyFunction() { // ... } // OK } ``` -------------------------------- ### Virtual Function Override Source: https://github.com/autodesk/arnold-usd/blob/master/docs/conventions.md Use the `override` keyword for functions in derived classes that override a virtual function from a base class. This improves clarity and helps catch errors. ```cpp class Parent { public: virtual void MyFunc() = 0; virtual void MyOtherFunc() = 0; }; class Child : public Parent { public: void MyFunc() override; // OK void MyOtherFunc(); // WRONG }; ``` -------------------------------- ### Macro and Enum Naming Conventions Source: https://github.com/autodesk/arnold-usd/blob/master/docs/conventions.md Macros and enumerator values should be in all uppercase. ```cpp #define UPDATE_UNDEFINED 0 #define UPDATE_CAMERA 1 enum PartitionType { POINTS = 0, PRIMITIVES, DETAIL }; ``` -------------------------------- ### Glob Headers for Doxygen Source: https://github.com/autodesk/arnold-usd/blob/master/docs/CMakeLists.txt Uses `file(GLOB_RECURSE)` to find all header files in specified subdirectories. These headers will be included as dependencies for the Doxygen generation. ```cmake file(GLOB_RECURSE DELEGATE_HDRS CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/render_delegate/*.h") file(GLOB_RECURSE NDR_HDRS CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/ndr/*.h") file(GLOB_RECURSE TRANSLATOR_HDRS CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/translator/*.h") ``` -------------------------------- ### Define Arnold Shaders as UsdShade Shader Prims Source: https://github.com/autodesk/arnold-usd/blob/master/docs/naming_conventions.md Arnold shaders are represented as UsdShade Shader prims. The 'info:id' attribute must be the Arnold shader name prefixed with 'arnold:', and parameters are placed in the 'inputs' scope. ```usd def Shader "my_shader" { uniform token info:id = "arnold:standard_surface" color3f inputs:base_color = (0,0,1) } ``` -------------------------------- ### Custom Target for Test Suite Source: https://github.com/autodesk/arnold-usd/blob/master/testsuite/CMakeLists.txt Defines a custom target named 'testsuite' that depends on the output of the 'add_custom_command' for test execution. It also declares a dependency on the 'usd_proc' target. ```cmake add_custom_target(testsuite DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/testsuite" ) add_dependencies(testsuite usd_proc) ``` -------------------------------- ### Const and Constexpr Usage Source: https://github.com/autodesk/arnold-usd/blob/master/docs/conventions.md Use `const` for variables that do not change after initialization and `constexpr` for compile-time constants. Avoid non-`const` variables if their value remains fixed. ```cpp float a = 5.0f; // WRONG if a does not change. const std::vector vec { 5.0f, 3.0f }; // OK const float b = 5.0f; // OK constexpr float b = 5.0f; // OK ``` -------------------------------- ### Set Arnold Attributes on USD Prims Source: https://github.com/autodesk/arnold-usd/blob/master/docs/naming_conventions.md Use the 'arnold' namespace for custom Arnold attributes on native USD prims like geometry and lights. These are set as primvars and converted to user data or built-in attributes. ```usd def DomeLight "my_light" { float intensity=2 int primvars:arnold:max_bounces=99 } ``` -------------------------------- ### Conditionally Add Bundle Subdirectory Source: https://github.com/autodesk/arnold-usd/blob/master/plugins/CMakeLists.txt Adds the 'bundle' subdirectory to the build if the BUILD_BUNDLE CMake variable is set to true. ```cmake if (BUILD_BUNDLE) add_subdirectory(bundle) endif() ``` -------------------------------- ### Represent Arnold Nodes in USD Source: https://github.com/autodesk/arnold-usd/blob/master/docs/naming_conventions.md Any Arnold node can be represented in USD by using a camel-cased node type prefixed with 'Arnold'. Attributes for these nodes correspond directly to Arnold parameter names. ```usd def ArnoldStandardSurface "my_shader" {} ``` ```usd def ArnoldSetOperator "my_operator" {} ``` ```usd def ArnoldPolymesh "my_mesh" {} ``` ```usd def ArnoldSkydomeLight "my_light" {} ``` -------------------------------- ### C++ Style Casting Source: https://github.com/autodesk/arnold-usd/blob/master/docs/conventions.md Employ C++ style casts such as `static_cast`, `reinterpret_cast`, or `const_cast` as appropriate. Avoid C-style casts like `(int) a`. ```cpp constexpr int a = 5; constexpr float b = (int) a; // WRONG constexpr float c = static_cast(a); // OK ``` -------------------------------- ### Function Naming Conventions Source: https://github.com/autodesk/arnold-usd/blob/master/docs/conventions.md Functions are named in CamelCase. Private and protected functions within classes are prefixed with an underscore (_). ```cpp // Header file void MyFunction(); // OK void myFunction(); // WRONG void my_function(); // WRONG class HdArnoldRenderDelegate { public: void MyFunction(); // OK private: void MyOtherFunction(); // WRONG void _MyFunction(); // OK }; ``` -------------------------------- ### Conditionally Add Procedural Subdirectory Source: https://github.com/autodesk/arnold-usd/blob/master/plugins/CMakeLists.txt Adds the 'procedural' subdirectory to the build if the BUILD_PROCEDURAL CMake variable is set to true. ```cmake if (BUILD_PROCEDURAL) add_subdirectory(procedural) endif () ``` -------------------------------- ### Code Block Braces Source: https://github.com/autodesk/arnold-usd/blob/master/docs/conventions.md Always use curly braces `{}` to enclose blocks of code, even for single statements within `if`, `for`, `while`, etc. This prevents errors when code is added or modified later. ```cpp if (statement) OneLineFunction(); // WRONG if (statement) { OneLineFunction(); // OK } #define MY_SILLY_MACRO() \ DoSomething(); \ DoSomething2(); if (statement) MY_SILLY_MACRO(); // WRONG, DoSomething2 will always run if (statement) { MY_SILLY_MACRO(); // OK, both functions only run when statement is true. } ``` -------------------------------- ### Variable Naming Conventions Source: https://github.com/autodesk/arnold-usd/blob/master/docs/conventions.md Variables are named in camelCase. Class member variables are prefixed with an underscore (_), while struct member variables are not. ```cpp int myVariable; // OK int my_variable; // WRONG class HdArnoldRenderDelegate { private: int myVariable; // WRONG int _myVariable; // OK }; struct MyStruct { int _myVariable; // WRONG int myVariable; // OK }; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.