mirror of
https://github.com/qgis/QGIS.git
synced 2025-11-27 00:07:16 -05:00
Add conditional support for linking draco library
Can be opted out by setting WITH_DRACO cmake option to false
This commit is contained in:
parent
a75694e190
commit
40ecc548d8
@ -293,6 +293,8 @@ if(WITH_CORE)
|
||||
|
||||
set (WITH_COPC TRUE CACHE BOOL "Determines whether Cloud Optimized Point Cloud (COPC) support should be built")
|
||||
|
||||
set (WITH_DRACO TRUE CACHE BOOL "Determines whether Draco support should be built")
|
||||
|
||||
set (WITH_THREAD_LOCAL TRUE CACHE BOOL "Determines whether std::thread_local should be used")
|
||||
mark_as_advanced(WITH_THREAD_LOCAL)
|
||||
|
||||
@ -443,6 +445,12 @@ if(WITH_CORE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (WITH_DRACO)
|
||||
find_package(Draco REQUIRED)
|
||||
message(STATUS "Found Draco: ${DRACO_LIBRARY} (${DRACO_VERSION})")
|
||||
set(HAVE_DRACO TRUE) # used in qgisconfig.h
|
||||
endif()
|
||||
|
||||
#############################################################
|
||||
# search for Qt
|
||||
|
||||
|
||||
92
cmake/FindDraco.cmake
Normal file
92
cmake/FindDraco.cmake
Normal file
@ -0,0 +1,92 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
# based on https://github.com/hlrs-vis/covise/blob/b909e6fad418e23e48726ab44de1bb36e82a24f8/cmake/FindDRACO.cmake#L4
|
||||
|
||||
# - Find DRACO
|
||||
# Find the DRACO includes and library
|
||||
#
|
||||
# DRACO_INCLUDE_DIR - Where to find DRACO includes
|
||||
# DRACO_FOUND - True if DRACO was found
|
||||
|
||||
IF(DRACO_INCLUDE_DIR)
|
||||
SET(DRACO_FIND_QUIETLY TRUE)
|
||||
ENDIF(DRACO_INCLUDE_DIR)
|
||||
|
||||
FIND_PATH(DRACO_INCLUDE_DIR "draco/draco_features.h"
|
||||
PATHS
|
||||
$ENV{DRACO_HOME}/include
|
||||
$ENV{EXTERNLIBS}/DRACO/include
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local
|
||||
/usr
|
||||
/sw # Fink
|
||||
/opt/local # DarwinPorts
|
||||
/opt/csw # Blastwave
|
||||
/opt
|
||||
DOC "DRACO - Headers"
|
||||
)
|
||||
|
||||
SET(DRACO_NAMES draco)
|
||||
SET(DRACO_DBG_NAMES dracod)
|
||||
|
||||
FIND_LIBRARY(DRACO_LIBRARY NAMES ${DRACO_NAMES}
|
||||
PATHS
|
||||
$ENV{DRACO_HOME}
|
||||
$ENV{EXTERNLIBS}/DRACO
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local
|
||||
/usr
|
||||
/sw
|
||||
/opt/local
|
||||
/opt/csw
|
||||
/opt
|
||||
PATH_SUFFIXES lib lib64
|
||||
DOC "DRACO - Library"
|
||||
)
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
|
||||
IF(MSVC)
|
||||
# VisualStudio needs a debug version
|
||||
FIND_LIBRARY(DRACO_LIBRARY_DEBUG NAMES ${DRACO_DBG_NAMES}
|
||||
PATHS
|
||||
$ENV{DRACO_HOME}
|
||||
$ENV{EXTERNLIBS}/DRACO
|
||||
PATH_SUFFIXES lib lib64
|
||||
DOC "DRACO - Library (Debug)"
|
||||
)
|
||||
|
||||
IF(DRACO_LIBRARY_DEBUG AND DRACO_LIBRARY)
|
||||
SET(DRACO_LIBRARIES optimized ${DRACO_LIBRARY} debug ${DRACO_LIBRARY_DEBUG})
|
||||
ENDIF(DRACO_LIBRARY_DEBUG AND DRACO_LIBRARY)
|
||||
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(DRACO DEFAULT_MSG DRACO_LIBRARY DRACO_LIBRARY_DEBUG DRACO_INCLUDE_DIR)
|
||||
|
||||
MARK_AS_ADVANCED(DRACO_LIBRARY DRACO_LIBRARY_DEBUG DRACO_INCLUDE_DIR)
|
||||
|
||||
ELSE(MSVC)
|
||||
# rest of the world
|
||||
SET(DRACO_LIBRARIES ${DRACO_LIBRARY})
|
||||
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Draco DEFAULT_MSG DRACO_LIBRARY DRACO_INCLUDE_DIR)
|
||||
|
||||
MARK_AS_ADVANCED(DRACO_LIBRARY DRACO_INCLUDE_DIR)
|
||||
|
||||
ENDIF(MSVC)
|
||||
|
||||
IF(DRACO_FOUND)
|
||||
SET(DRACO_INCLUDE_DIRS ${DRACO_INCLUDE_DIR})
|
||||
|
||||
set(draco_version_file
|
||||
"${DRACO_INCLUDE_DIR}/draco/core/draco_version.h")
|
||||
file(STRINGS "${draco_version_file}" draco_version REGEX "kDracoVersion")
|
||||
list(GET draco_version 0 draco_version)
|
||||
string(REPLACE "static const char kDracoVersion[] = " "" draco_version
|
||||
"${draco_version}")
|
||||
string(REPLACE ";" "" draco_version "${draco_version}")
|
||||
string(REPLACE "\"" "" draco_version "${draco_version}")
|
||||
set(DRACO_VERSION ${draco_version})
|
||||
|
||||
ENDIF(DRACO_FOUND)
|
||||
@ -112,6 +112,8 @@
|
||||
#define PDAL_VERSION_MINOR "${PDAL_VERSION_MINOR}"
|
||||
#define PDAL_VERSION_MICRO "${PDAL_VERSION_MICRO}"
|
||||
|
||||
#cmakedefine HAVE_DRACO
|
||||
|
||||
#cmakedefine ENABLE_TESTS
|
||||
|
||||
#cmakedefine HAS_KDE_QT5_PDF_TRANSFORM_FIX
|
||||
|
||||
@ -2314,6 +2314,7 @@ target_include_directories(qgis_core PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/external/nmea
|
||||
${CMAKE_SOURCE_DIR}/external/rtree/include
|
||||
${CMAKE_SOURCE_DIR}/external/meshOptimizer
|
||||
${CMAKE_SOURCE_DIR}/external/tinygltf
|
||||
)
|
||||
|
||||
if (WITH_EPT)
|
||||
@ -2418,6 +2419,11 @@ target_link_libraries(qgis_core
|
||||
${ZLIB_LIBRARIES}
|
||||
${EXIV2_LIBRARY}
|
||||
)
|
||||
|
||||
if (WITH_DRACO)
|
||||
target_link_libraries(qgis_core ${DRACO_LIBRARY})
|
||||
endif()
|
||||
|
||||
if (NOT IOS)
|
||||
target_link_libraries(qgis_core ${QT_VERSION_BASE}::PrintSupport)
|
||||
endif()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user