1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
# Copyright Contributors to the OpenVDB Project
# SPDX-License-Identifier: MPL-2.0
#
#[=======================================================================[
CMake Configuration for VDB Render
#]=======================================================================]
cmake_minimum_required(VERSION 3.18)
project(VDBRender LANGUAGES CXX)
include(GNUInstallDirs)
if(USE_PNG)
find_package(PNG REQUIRED)
endif()
if(USE_IMATH_HALF)
find_package(Imath CONFIG)
if (NOT TARGET Imath::Imath)
if(USE_EXR)
find_package(IlmBase ${MINIMUM_ILMBASE_VERSION} REQUIRED COMPONENTS Half Iex IlmThread Imath)
else()
find_package(IlmBase ${MINIMUM_ILMBASE_VERSION} REQUIRED COMPONENTS Half)
endif()
endif()
endif()
if(USE_EXR)
if (NOT TARGET Imath::Imath)
find_package(OpenEXR ${MINIMUM_OPENEXR_VERSION} REQUIRED COMPONENTS IlmImf)
else()
find_package(OpenEXR CONFIG REQUIRED)
endif()
endif()
set(SOURCE_FILES main.cc)
add_executable(vdb_render ${SOURCE_FILES})
if(USE_EXR)
target_compile_definitions(vdb_render PRIVATE -DOPENVDB_USE_EXR)
endif()
if(USE_PNG)
target_compile_definitions(vdb_render PRIVATE -DOPENVDB_USE_PNG)
endif()
# Set deps. Note that the order here is important. If we're building against
# Houdini 17.5 we must include OpenEXR and IlmBase deps first to ensure the
# users chosen namespaced headers are correctly prioritized. Otherwise other
# include paths from shared installs (including houdini) may pull in the wrong
# headers
target_link_libraries(vdb_render
# For Imath/OpenEXR v3.X
$<TARGET_NAME_IF_EXISTS:Imath::Imath>
$<TARGET_NAME_IF_EXISTS:OpenEXR::OpenEXR>
$<TARGET_NAME_IF_EXISTS:OpenEXR::OpenEXRUtil>
$<TARGET_NAME_IF_EXISTS:OpenEXR::IlmThread>
$<TARGET_NAME_IF_EXISTS:OpenEXR::Iex>
# For IlmBase/OpenEXR v2.X
$<TARGET_NAME_IF_EXISTS:IlmBase::Half>
$<TARGET_NAME_IF_EXISTS:OpenEXR::IlmImf>
$<TARGET_NAME_IF_EXISTS:OpenEXR::IlmImfUtil>
$<TARGET_NAME_IF_EXISTS:IlmBase::IlmThread>
$<TARGET_NAME_IF_EXISTS:IlmBase::Iex>
$<TARGET_NAME_IF_EXISTS:IlmBase::Imath>
${OPENVDB_BINARIES_DEPENDENT_LIBS}
$<TARGET_NAME_IF_EXISTS:PNG::PNG>
)
if(WIN32)
# @note OPENVDB_OPENEXR_STATICLIB is old functionality and should be removed
if (TARGET Imath::Imath)
get_target_property(ILMBASE_LIB_TYPE Imath::Imath TYPE)
else()
get_target_property(ILMBASE_LIB_TYPE IlmBase::Half TYPE)
endif()
if(OPENEXR_USE_STATIC_LIBS OR (${ILMBASE_LIB_TYPE} STREQUAL STATIC_LIBRARY))
target_compile_definitions(vdb_render PUBLIC -DOPENVDB_OPENEXR_STATICLIB)
endif()
endif()
install(TARGETS vdb_render RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|