summaryrefslogtreecommitdiffstats
path: root/AssetLoader/CMakeLists.txt
blob: fd4bf7bbf158711bdbe68913c7618aca66c2c01f (plain)
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
cmake_minimum_required (VERSION 3.6)

project(Diligent-AssetLoader CXX)

set(INCLUDE 
    #include/GLTFLoader.hpp
    #include/GLTFResourceManager.hpp
)

set(INTERFACE
    interface/GLTFLoader.h
    interface/DXSDKMeshLoader.hpp
)

set(SOURCE 
    src/GLTFLoader.cpp
    src/DXSDKMeshLoader.cpp
    src/GLTFResourceManager.cpp
)

add_library(Diligent-AssetLoader STATIC ${SOURCE} ${INCLUDE} ${INTERFACE})
set_common_target_properties(Diligent-AssetLoader)

target_include_directories(Diligent-AssetLoader
PUBLIC
    interface
PRIVATE
    include
)

source_group("source" FILES ${SOURCE})
source_group("include" FILES ${INCLUDE})
source_group("interface" FILES ${INTERFACE})

target_link_libraries(Diligent-AssetLoader 
PRIVATE 
    Diligent-BuildSettings
    Diligent-Common
    Diligent-PlatformInterface
    Diligent-GraphicsEngineInterface
    Diligent-GraphicsAccessories
    Diligent-GraphicsTools
    Diligent-TextureLoader
)

if (TARGET draco)
    target_link_libraries(Diligent-AssetLoader PRIVATE 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(WARNING "Unable to find draco library. Draco support will be disabled")
    endif()
endif()

set_target_properties(Diligent-AssetLoader PROPERTIES
    FOLDER DiligentTools
)

if(DILIGENT_INSTALL_TOOLS)
    install_tools_lib(Diligent-AssetLoader)
endif()