Skip to content

Commit

Permalink
Build for emscripten
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve J. Cai committed Oct 3, 2023
1 parent 97c24ea commit 33be57f
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 20 deletions.
64 changes: 46 additions & 18 deletions Hydrogent/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,19 @@ 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()

add_library(USD_LIBS INTERFACE)

if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
if(pxr_FOUND)
# PXR is already loaded, so we can use its variables.
target_include_directories(USD_LIBS
INTERFACE
${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-*")
Expand Down Expand Up @@ -82,21 +90,39 @@ if(MSVC)
target_compile_options(USD_LIBS INTERFACE /wd4244 /wd4305 /wd4127 /wd4267)
endif()

target_link_libraries(USD_LIBS
INTERFACE
usd_gf
usd_ar
usd_sdf
usd_tf
usd_usd
usd_plug
usd_hd
usd_usdImaging
usd_vt
usd_hio
usd_sdr
usd_ndr
)
if(pxr_FOUND)
target_link_libraries(USD_LIBS
INTERFACE
gf
ar
sdf
tf
usd
plug
hd
usdImaging
vt
hio
sdr
ndr
)
else()
target_link_libraries(USD_LIBS
INTERFACE
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()

target_include_directories(Diligent-Hydrogent
PUBLIC
Expand All @@ -112,7 +138,9 @@ PUBLIC

# We need to enable RTTI for USD
add_library(EnableRTTI INTERFACE)
target_compile_options(EnableRTTI INTERFACE /GR)
if(MSVC)
target_compile_options(EnableRTTI INTERFACE /GR)
endif()

target_link_libraries(Diligent-Hydrogent
PRIVATE
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion Hydrogent/include/HnMaterialNetwork.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion Hydrogent/include/HnMesh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <unordered_map>

// 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"

Expand Down
2 changes: 2 additions & 0 deletions Hydrogent/include/HnRendererImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ class HnRendererImpl final : public ObjectBase<IHnRenderer>
GPUCompletionAwaitQueue<RefCntAutoPtr<ITexture>> m_MeshIdReadBackQueue;
};

constexpr INTERFACE_ID HnRendererImpl::IID_Impl; // Needed only for C++ 14

} // namespace USD

} // namespace Diligent

0 comments on commit 33be57f

Please sign in to comment.