Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 40 additions & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,6 @@ include(VcpkgSetup)
# NOTE: We can't use PROJECT_IS_TOP_LEVEL here because the project is not yet defined.
string(COMPARE EQUAL "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}" _HVT_PROJECT_IS_TOP_LEVEL)

# RPATH for Linux and macOS
if (_HVT_PROJECT_IS_TOP_LEVEL AND UNIX)
# Set platform-specific RPATH syntax
if (APPLE)
set(_rpath "@loader_path/;@loader_path/../lib/")
set_if_not_defined(CMAKE_MACOSX_RPATH ON "")
else()
# Linux
set(_rpath "$ORIGIN:$ORIGIN/../lib")
endif()

# Common RPATH settings for all UNIX platforms
set_if_not_defined(CMAKE_SKIP_BUILD_RPATH FALSE "")
set_if_not_defined(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE "")
set_if_not_defined(CMAKE_INSTALL_RPATH "${_rpath}" "")
set_if_not_defined(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE "")
endif()

# Apple-specific configuration
if (_HVT_PROJECT_IS_TOP_LEVEL AND APPLE)
set_if_not_defined(CMAKE_OSX_DEPLOYMENT_TARGET "12.0" "Minimum OSX deployment version")
Expand All @@ -70,6 +52,9 @@ if (_HVT_PROJECT_IS_TOP_LEVEL AND APPLE)
endif()
endif()

# Set the default build type.
set_if_not_defined(CMAKE_BUILD_TYPE "Release" "")

# Enable only the typical build types.
set_if_not_defined(CMAKE_CONFIGURATION_TYPES "Debug;Release;MinSizeRel;RelWithDebInfo" "List of build types")
if (NOT "${CMAKE_BUILD_TYPE}" IN_LIST CMAKE_CONFIGURATION_TYPES)
Expand All @@ -78,9 +63,10 @@ endif()

# Declare the project.
project(HydraViewportToolbox
VERSION 0.25.08.0
DESCRIPTION "Utilities to support graphics viewports using OpenUSD Hydra"
LANGUAGES CXX
VERSION 0.25.08.0
DESCRIPTION "Utilities to support graphics viewports using OpenUSD Hydra"
LANGUAGES CXX
HOMEPAGE_URL https://github.com/Autodesk/hydra-viewport-toolbox
)
set(_VERSION "${HydraViewportToolbox_VERSION}")

Expand Down Expand Up @@ -200,12 +186,43 @@ endif()

#---------------------------------------------------------------------------------------------------

# Set the RPATH for Linux and macOS.

if (UNIX)

# Enable RPATH for build tree.
set(CMAKE_SKIP_BUILD_RPATH FALSE)

# Add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH.
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

# Don't use the install RPATH during build.
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)

# Set platform-specific install RPATH.
if (APPLE)
set(_RPATH "@loader_path;@loader_path/../lib")
else()
# Linux
set(_RPATH "$ORIGIN:$ORIGIN/../lib")
endif()

# Set the RPATH to be used when installing.
set(CMAKE_INSTALL_RPATH "${_RPATH}")

# On macOS, enable @rpath.
set(CMAKE_MACOSX_RPATH TRUE)

endif()

#---------------------------------------------------------------------------------------------------

# This section only adds settings applicable to all the projects.

# Set the HVT include (public API) and source (private API) directories, for use by sub-projects.
set(_HVT_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
set(_HVT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/source")
set(_HVT_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}")

if (ENABLE_ADSK_OPENUSD_PENDING)
# By default, set the symbol visibility to hidden (to avoid exporting private symbols by mistake).
Expand All @@ -216,7 +233,7 @@ endif()

# Allowing tbb to work in debug mode in different setups
add_compile_definitions(
$<$<CONFIG:Debug>:TBB_USE_DEBUG>
$<$<CONFIG:Debug>:TBB_USE_DEBUG>
)

# Enable warnings and warnings as errors for all sub-projects.
Expand Down
11 changes: 9 additions & 2 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,16 @@ if (MSVC)
)
endif()

# Link to the targets from the sub-libraries.
# Link to the targets from the sub-libraries i.e., including public OpenUSD libraries
# from the sub-libraries.
target_link_libraries(${_TARGET}
PRIVATE ${_PRIVATE_LIBRARIES}
PUBLIC
hd
hdx
hdSt
usdImaging
PRIVATE
${_PRIVATE_LIBRARIES}
)

# Set the required include directories for consumers of hvt
Expand Down