1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-04 18:06:22 +03:00
occt/adm/cmake/draco.cmake
ichesnok 3a2ca49b6d 0032867: Data Exchange - Implement Draco compression for writing glTF
Draco compression added in RWGltf_CafWriter class.
2022-07-06 19:15:56 +03:00

97 lines
3.9 KiB
CMake

# Draco - a library for a lossy vertex data compression, used as extension to glTF format.
# https://github.com/google/draco
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
if (NOT DEFINED INSTALL_DRACO)
set (INSTALL_DRACO OFF CACHE BOOL "${INSTALL_DRACO_DESCR}")
endif()
if (NOT DEFINED 3RDPARTY_DRACO_DIR)
set (3RDPARTY_DRACO_DIR "" CACHE PATH "The directory containing Draco")
endif()
if (NOT DEFINED 3RDPARTY_DRACO_INCLUDE_DIR)
set (3RDPARTY_DRACO_INCLUDE_DIR "" CACHE PATH "The directory containing headers of the Draco")
endif()
if (NOT DEFINED 3RDPARTY_DRACO_LIBRARY OR NOT 3RDPARTY_DRACO_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_DRACO_LIBRARY_DIR}")
set (3RDPARTY_DRACO_LIBRARY "" CACHE FILEPATH "Draco library" FORCE)
endif()
if (NOT DEFINED 3RDPARTY_DRACO_LIBRARY_DIR)
set (3RDPARTY_DRACO_LIBRARY_DIR "" CACHE PATH "The directory containing Draco library")
endif()
if (3RDPARTY_DIR AND EXISTS "${3RDPARTY_DIR}")
if (NOT 3RDPARTY_DRACO_DIR OR NOT EXISTS "${3RDPARTY_DRACO_DIR}")
FIND_PRODUCT_DIR("${3RDPARTY_DIR}" draco DRACO_DIR_NAME)
if (DRACO_DIR_NAME)
set (3RDPARTY_DRACO_DIR "${3RDPARTY_DIR}/${DRACO_DIR_NAME}" CACHE PATH "The directory containing Draco" FORCE)
endif()
endif()
endif()
if (3RDPARTY_DRACO_DIR AND EXISTS "${3RDPARTY_DRACO_DIR}")
set (DRACO_INCLUDE_PATH "${3RDPARTY_DRACO_DIR}/include")
set (DRACO_LIBRARY_PATH "${3RDPARTY_DRACO_DIR}/lib")
endif()
if (NOT 3RDPARTY_DRACO_INCLUDE_DIR)
if (DRACO_INCLUDE_PATH AND EXISTS "${DRACO_INCLUDE_PATH}")
set (3RDPARTY_DRACO_INCLUDE_DIR "${DRACO_INCLUDE_PATH}" CACHE FILEPATH "The directory containing headers of DRACO" FORCE)
endif()
endif()
if (NOT 3RDPARTY_DRACO_LIBRARY_DIR)
if (DRACO_LIBRARY_PATH AND EXISTS "${DRACO_LIBRARY_PATH}")
set (3RDPARTY_DRACO_LIBRARY_DIR "${DRACO_LIBRARY_PATH}" CACHE FILEPATH "The directory containing DRACO library" FORCE)
endif()
endif()
if (3RDPARTY_DRACO_INCLUDE_DIR AND EXISTS "${3RDPARTY_DRACO_INCLUDE_DIR}")
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_DRACO_INCLUDE_DIR}")
else()
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_DRACO_INCLUDE_DIR)
endif()
if (3RDPARTY_DRACO_DIR AND EXISTS "${3RDPARTY_DRACO_DIR}")
if (NOT 3RDPARTY_DRACO_LIBRARY OR NOT EXISTS "${3RDPARTY_DRACO_LIBRARY}")
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib .a)
set (3RDPARTY_DRACO_LIBRARY "3RDPARTY_DRACO_LIBRARY-NOTFOUND" CACHE FILEPATH "The path to Draco library" FORCE)
find_library (3RDPARTY_DRACO_LIBRARY NAMES ${CSF_Draco}
PATHS "${3RDPARTY_DRACO_LIBRARY_DIR}"
PATH_SUFFIXES lib
CMAKE_FIND_ROOT_PATH_BOTH
NO_DEFAULT_PATH)
if (3RDPARTY_DRACO_LIBRARY AND EXISTS "${3RDPARTY_DRACO_LIBRARY}")
get_filename_component (3RDPARTY_DRACO_LIBRARY_DIR "${3RDPARTY_DRACO_LIBRARY}" PATH)
set (3RDPARTY_DRACO_LIBRARY_DIR "${3RDPARTY_DRACO_LIBRARY_DIR}" CACHE FILEPATH "The directory containing Draco library" FORCE)
endif()
endif()
endif()
if (3RDPARTY_DRACO_LIBRARY_DIR AND EXISTS "${3RDPARTY_DRACO_LIBRARY_DIR}")
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_DRACO_LIBRARY_DIR}")
else()
list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_DRACO_LIBRARY_DIR)
endif()
if (INSTALL_DRACO)
get_filename_component(3RDPARTY_DRACO_LIBRARY_REALPATH ${3RDPARTY_DRACO_LIBRARY} REALPATH)
if (SINGLE_GENERATOR)
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH} DESTINATION "${INSTALL_DIR_LIB}")
else()
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH}
CONFIGURATIONS Release
DESTINATION "${INSTALL_DIR_LIB}")
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH}
CONFIGURATIONS RelWithDebInfo
DESTINATION "${INSTALL_DIR_LIB}i")
install (FILES ${3RDPARTY_DRACO_LIBRARY_REALPATH}
CONFIGURATIONS Debug
DESTINATION "${INSTALL_DIR_LIB}d")
endif()
endif()