90d013695d
- Replace window class with cbt::opengl::context - Add buffer resource (VBO, EBO, UBO, SSBO) with move semantics - Add texture resource with format/type enums and filtering - Add descriptor_set for Vulkan-style resource binding - All resources use RAII with proper cleanup
63 lines
2.5 KiB
CMake
63 lines
2.5 KiB
CMake
# ==============================================================================
|
|
# Findmvt.cmake
|
|
# ==============================================================================
|
|
# This module provides the Mapbox Vector Tile Specification (v2.1) for use
|
|
# with protozero. The .proto file is downloaded as a reference; actual decoding
|
|
# is done manually via protozero (no code generation step required).
|
|
#
|
|
# Targets provided:
|
|
# mvt::mvt - Interface target (pulls in protozero)
|
|
#
|
|
# Variables set:
|
|
# mvt_FOUND - TRUE if mvt is available
|
|
# mvt_LIBRARIES - The library target (mvt::mvt)
|
|
# mvt_PROTO_FILE - Path to the downloaded vector_tile.proto
|
|
# ==============================================================================
|
|
|
|
if (DEFINED _FINDMVT_INCLUDED)
|
|
return()
|
|
endif()
|
|
set(_FINDMVT_INCLUDED TRUE)
|
|
|
|
# ------------------------------------------------------------------------------
|
|
# Protozero (the actual parsing library)
|
|
# ------------------------------------------------------------------------------
|
|
find_package(protozero REQUIRED)
|
|
|
|
# ------------------------------------------------------------------------------
|
|
# Download .proto file (reference only — no code generation)
|
|
# ------------------------------------------------------------------------------
|
|
set(_MVT_PROTO_DIR "${CMAKE_CURRENT_BINARY_DIR}/mvt_proto")
|
|
set(_MVT_PROTO_FILE "${_MVT_PROTO_DIR}/vector_tile.proto")
|
|
|
|
file(MAKE_DIRECTORY "${_MVT_PROTO_DIR}")
|
|
|
|
if (NOT EXISTS "${_MVT_PROTO_FILE}")
|
|
message(STATUS "Downloading vector_tile.proto")
|
|
file(DOWNLOAD
|
|
"https://raw.githubusercontent.com/mapbox/vector-tile-spec/refs/heads/master/2.1/vector_tile.proto"
|
|
"${_MVT_PROTO_FILE}"
|
|
STATUS _download_status
|
|
)
|
|
list(GET _download_status 0 _download_code)
|
|
if (NOT _download_code EQUAL 0)
|
|
list(GET _download_status 1 _download_error)
|
|
message(FATAL_ERROR "Failed to download vector_tile.proto: ${_download_error}")
|
|
endif()
|
|
endif()
|
|
|
|
message(STATUS "MVT proto: ${_MVT_PROTO_FILE}")
|
|
|
|
# ------------------------------------------------------------------------------
|
|
# Interface target
|
|
# ------------------------------------------------------------------------------
|
|
if (NOT TARGET mvt::mvt)
|
|
add_library(mvt INTERFACE)
|
|
target_link_libraries(mvt INTERFACE protozero::protozero)
|
|
add_library(mvt::mvt ALIAS mvt)
|
|
endif()
|
|
|
|
set(mvt_FOUND TRUE)
|
|
set(mvt_LIBRARIES mvt::mvt)
|
|
set(mvt_PROTO_FILE "${_MVT_PROTO_FILE}" CACHE FILEPATH "Path to vector_tile.proto")
|