Skip to content

Commit

Permalink
Fix installing imgui
Browse files Browse the repository at this point in the history
  • Loading branch information
lilleyse committed Mar 29, 2023
1 parent c17191a commit 318a3ae
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 9 deletions.
30 changes: 22 additions & 8 deletions cmake/Macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function(setup_lib)
""
""
"TARGET_NAME;TYPE"
"SOURCES;INCLUDE_DIRS;PRIVATE_INCLUDE_DIRS;LIBRARIES;DEPENDENCIES;CXX_FLAGS;CXX_FLAGS_DEBUG;CXX_DEFINES;CXX_DEFINES_DEBUG"
"SOURCES;INCLUDE_DIRS;PRIVATE_INCLUDE_DIRS;LIBRARIES;ADDITIONAL_LIBRARIES;DEPENDENCIES;CXX_FLAGS;CXX_FLAGS_DEBUG;CXX_DEFINES;CXX_DEFINES_DEBUG"
${ARGN})

if(_TYPE)
Expand Down Expand Up @@ -52,6 +52,17 @@ function(setup_lib)
COMMAND_EXPAND_LISTS)
endif()

if(WIN32 AND _ADDITIONAL_LIBRARIES)
# TARGET_RUNTIME_DLLS only works for IMPORTED targets. In some cases we can't create IMPORTED targets
# because there's no import library (.lib) just a shared library (.dll)
# We need to copy these to the build folder manually
add_custom_command(
TARGET ${_TARGET_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${_ADDITIONAL_LIBRARIES} $<TARGET_FILE_DIR:${_TARGET_NAME}>
COMMAND_EXPAND_LISTS)
endif()

endfunction(setup_lib)

# Set up a python module
Expand Down Expand Up @@ -155,14 +166,16 @@ function(setup_usd_python_lib)

target_compile_options(${_PREFIXED_TARGET_NAME} PRIVATE ${_CXX_FLAGS} "$<$<CONFIG:DEBUG>:${_CXX_FLAGS_DEBUG}>")

target_compile_definitions(${_PREFIXED_TARGET_NAME} PRIVATE ${_CXX_DEFINES} "$<$<CONFIG:DEBUG>:${_CXX_DEFINES_DEBUG}>")
target_compile_definitions(${_PREFIXED_TARGET_NAME} PRIVATE ${_CXX_DEFINES}
"$<$<CONFIG:DEBUG>:${_CXX_DEFINES_DEBUG}>")

# cmake-format: off
target_compile_definitions(${_PREFIXED_TARGET_NAME}
PRIVATE
MFB_PACKAGE_NAME=${_TARGET_NAME}
MFB_ALT_PACKAGE_NAME=${_TARGET_NAME}
MFB_PACKAGE_MODULE=${_TARGET_NAME}.${_PYTHON_MODULE_NAME}
)
PRIVATE
MFB_PACKAGE_NAME=${_TARGET_NAME}
MFB_ALT_PACKAGE_NAME=${_TARGET_NAME}
MFB_PACKAGE_MODULE=${_TARGET_NAME}.${_PYTHON_MODULE_NAME})
# cmake-format: on

target_link_libraries(${_PREFIXED_TARGET_NAME} PRIVATE ${_LIBRARIES})

Expand Down Expand Up @@ -198,7 +211,8 @@ function(setup_usd_python_lib)
add_custom_command(
TARGET ${_PREFIXED_TARGET_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_RUNTIME_DLLS:${_PREFIXED_TARGET_NAME}> $<TARGET_FILE_DIR:${_PREFIXED_TARGET_NAME}>
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_RUNTIME_DLLS:${_PREFIXED_TARGET_NAME}>
$<TARGET_FILE_DIR:${_PREFIXED_TARGET_NAME}>
COMMAND_EXPAND_LISTS)
endif()

Expand Down
3 changes: 2 additions & 1 deletion extern/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ else()
endif()

# cmake-format: off
# omni.ui gives us access to DynamicTextureProvider.h
add_prebuilt_project(
RELEASE_INCLUDE_DIR
"${KIT_SDK_ROOT}/dev/include"
Expand All @@ -325,7 +326,7 @@ add_prebuilt_project(
# cmake-format: on

# cmake-format: off
# rtx_plugin headers are used by DynamicTextureProvider.h in omni.ui
# DynamicTextureProvider.h includes IImaging.h which only exists in the rtx_plugin package
add_prebuilt_project_header_only(
INCLUDE_DIR
"${RTX_PLUGINS_ROOT}/include"
Expand Down
3 changes: 3 additions & 0 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ setup_lib(
rtx_plugins
pybind11
python37
ADDITIONAL_LIBRARIES
"${PROJECT_SOURCE_DIR}/extern/nvidia/_build/target-deps/kit-sdk/extscore/omni.kit.renderer.imgui/bin/deps/imgui.dll"
"${PROJECT_SOURCE_DIR}/extern/nvidia/_build/target-deps/kit-sdk/extscore/omni.kit.renderer.imgui/bin/deps/freetype.dll"
DEPENDENCIES
cesium-native-external
CXX_FLAGS
Expand Down
5 changes: 5 additions & 0 deletions src/public/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ setup_lib(
"${PROJECT_SOURCE_DIR}/include"
LIBRARIES
CesiumOmniverseCore
ADDITIONAL_LIBRARIES
# Unfortunately we need this in both cesium.omniverse.plugin and CesiumOmniverseCore because we're bypassing
# CMake's built-in dependency system
"${PROJECT_SOURCE_DIR}/extern/nvidia/_build/target-deps/kit-sdk/extscore/omni.kit.renderer.imgui/bin/deps/imgui.dll"
"${PROJECT_SOURCE_DIR}/extern/nvidia/_build/target-deps/kit-sdk/extscore/omni.kit.renderer.imgui/bin/deps/freetype.dll"
CXX_FLAGS
${CESIUM_OMNI_CXX_FLAGS}
CXX_FLAGS_DEBUG
Expand Down

0 comments on commit 318a3ae

Please sign in to comment.