diff --git a/CMakeLists.txt b/CMakeLists.txt index 01f79a9c..c9034152 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ else() set(DILIGENT_INSTALL_FX OFF) endif() -target_link_libraries(DiligentFX +target_link_libraries(DiligentFX PRIVATE Diligent-BuildSettings PUBLIC @@ -36,7 +36,7 @@ add_subdirectory(Components) add_subdirectory(PostProcess) add_subdirectory(PBR) -if(DILIGENT_USD_PATH) +if(DILIGENT_USD_PATH OR pxr_FOUND) add_subdirectory(Hydrogent) endif() @@ -46,7 +46,7 @@ endif() get_target_property(SOURCE DiligentFX SOURCES) -foreach(FILE ${SOURCE}) +foreach(FILE ${SOURCE}) # Get the directory of the source file get_filename_component(PARENT_DIR "${FILE}" DIRECTORY) @@ -112,8 +112,8 @@ set_source_files_properties( PROPERTIES GENERATED TRUE ) target_sources(DiligentFX PRIVATE - # A target created in the same directory (CMakeLists.txt file) that specifies any output of the - # custom command as a source file is given a rule to generate the file using the command at build time. + # A target created in the same directory (CMakeLists.txt file) that specifies any output of the + # custom command as a source file is given a rule to generate the file using the command at build time. ${SHADERS_INC_LIST} ) source_group("generated" FILES diff --git a/Hydrogent/CMakeLists.txt b/Hydrogent/CMakeLists.txt index 674104b8..4002c01b 100644 --- a/Hydrogent/CMakeLists.txt +++ b/Hydrogent/CMakeLists.txt @@ -35,9 +35,17 @@ add_library(Diligent-Hydrogent STATIC README.md ${SOURCE} ${INCLUDE} ${INTERFACE set_common_target_properties(Diligent-Hydrogent) -find_package(Python3 COMPONENTS Interpreter Development REQUIRED) +if(NOT PLATFORM_EMSCRIPTEN) + find_package(Python3 COMPONENTS Interpreter Development REQUIRED) +endif() -if(${CMAKE_GENERATOR} MATCHES "Visual Studio") +if(pxr_FOUND) + # PXR is already loaded, so we can use its variables. + target_include_directories(Diligent-Hydrogent + PRIVATE + ${PXR_INCLUDE_DIRS} + ) +elseif(${CMAKE_GENERATOR} MATCHES "Visual Studio") # Boost version depends on Visual Studio version. Since we can't use wildcards in # generator expressions, we have to find boost directory for each configuration file(GLOB BOOST_INCLUDE_DEBUG "${DILIGENT_USD_PATH}/Debug/include/boost-*") @@ -85,22 +93,11 @@ PUBLIC # We need to enable RTTI for USD add_library(EnableRTTI INTERFACE) -target_compile_options(EnableRTTI INTERFACE /GR) +if(${CMAKE_GENERATOR} MATCHES "Visual Studio") + target_compile_options(EnableRTTI INTERFACE /GR) +endif() target_link_libraries(Diligent-Hydrogent -PUBLIC - usd_gf - usd_ar - usd_sdf - usd_tf - usd_usd - usd_plug - usd_hd - usd_usdImaging - usd_vt - usd_hio - usd_sdr - usd_ndr PRIVATE NO_WERROR EnableRTTI # USD requires RTTI @@ -112,6 +109,41 @@ PRIVATE DiligentFX ) +if(pxr_FOUND) + target_link_libraries(Diligent-Hydrogent + PUBLIC + gf + ar + sdf + tf + usd + plug + hd + usdImaging + vt + hio + sdr + ndr + ) +else() + target_link_libraries(Diligent-Hydrogent + PUBLIC + usd_gf + usd_ar + usd_sdf + usd_tf + usd_usd + usd_plug + usd_hd + usd_usdImaging + usd_vt + usd_hio + usd_sdr + usd_ndr + ) +endif() + + if(PLATFORM_WIN32 OR PLATFORM_UNIVERSAL_WINDOWS) target_compile_definitions(Diligent-Hydrogent PRIVATE NOMINMAX) endif() diff --git a/Hydrogent/readme.md b/Hydrogent/README.md similarity index 100% rename from Hydrogent/readme.md rename to Hydrogent/README.md diff --git a/Hydrogent/include/HnMaterialNetwork.hpp b/Hydrogent/include/HnMaterialNetwork.hpp index 2d1d18e7..9f383c67 100644 --- a/Hydrogent/include/HnMaterialNetwork.hpp +++ b/Hydrogent/include/HnMaterialNetwork.hpp @@ -27,7 +27,7 @@ #pragma once // NoteL tbb.h must be included first to avoid compilation errors in tbb headers. -#include "tbb/tbb.h" +// #include "tbb/tbb.h" #include "pxr/base/vt/dictionary.h" #include "pxr/usd/sdf/path.h" diff --git a/Hydrogent/include/HnMesh.hpp b/Hydrogent/include/HnMesh.hpp index c799f485..34357c47 100644 --- a/Hydrogent/include/HnMesh.hpp +++ b/Hydrogent/include/HnMesh.hpp @@ -31,7 +31,7 @@ #include // NoteL tbb.h must be included before mesh.h to avoid compilation errors in tbb headers. -#include "tbb/tbb.h" +// #include "tbb/tbb.h" #include "pxr/imaging/hd/mesh.h" #include "pxr/base/tf/token.h"