From 4ed217af70ac8d94f1595db8747abeb9fc00775e Mon Sep 17 00:00:00 2001 From: assiduous Date: Mon, 24 Feb 2020 14:15:23 -0800 Subject: Asset loader: added option to enable draco using DRACO_PATH --- AssetLoader/CMakeLists.txt | 9 +++++++++ README.md | 1 + 2 files changed, 10 insertions(+) diff --git a/AssetLoader/CMakeLists.txt b/AssetLoader/CMakeLists.txt index 1b4a74b..1994ab3 100644 --- a/AssetLoader/CMakeLists.txt +++ b/AssetLoader/CMakeLists.txt @@ -46,6 +46,15 @@ if (TARGET draco) target_compile_definitions(Diligent-AssetLoader PRIVATE TINYGLTF_ENABLE_DRACO) get_target_property(DRACO_SOURCE_DIR draco SOURCE_DIR) target_include_directories(Diligent-AssetLoader PRIVATE "${DRACO_SOURCE_DIR}/src" "${CMAKE_BINARY_DIR}") +elseif (DRACO_PATH) + find_library(DRACO_LIBRARY NAMES draco PATHS "${DRACO_PATH}/lib") + if(DRACO_LIBRARY) + target_link_libraries(Diligent-AssetLoader PRIVATE ${DRACO_LIBRARY}) + target_include_directories(Diligent-AssetLoader PRIVATE "${DRACO_PATH}/include") + target_compile_definitions(Diligent-AssetLoader PRIVATE TINYGLTF_ENABLE_DRACO) + else() + message("Unable to find draco library. Draco support will be disabled") + endif() endif() set_target_properties(Diligent-AssetLoader PROPERTIES diff --git a/README.md b/README.md index 8239cc1..e8f3e92 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ and contains the following libraries: * [Asset Loader](AssetLoader): an asset loading libary. The library currently supports GLTF 2.0. * To enable Draco compression, download [Draco repository](https://github.com/google/draco) and include it into your project. Make sure that Draco source folder is processed by CMake *before* DiligentTools folder. + Alternatively, you can specify a path to the Draco installation folder using `DRACO_PATH` CMake variable. * [Imgui](Imgui): implementation of [dear imgui](https://github.com/ocornut/imgui) with Diligent API. * [NativeApp](NativeApp): implementation of native application on supported platforms. -- cgit v1.2.3