Skip to content

Commit

Permalink
Add stock STB.
Browse files Browse the repository at this point in the history
  • Loading branch information
kring committed Nov 7, 2024
1 parent e2411f7 commit eabc089
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 0 deletions.
29 changes: 29 additions & 0 deletions extern/vcpkg-overlays/stb/FindStb.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Distributed under the OSI-approved BSD 3-Clause License.

#.rst:
# FindStb
# ------------
#
# Find the Stb include headers.
#
# Result Variables
# ^^^^^^^^^^^^^^^^
#
# This module defines the following variables:
#
# ``Stb_FOUND``
# True if Stb library found
#
# ``Stb_INCLUDE_DIR``
# Location of Stb headers
#

include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
include(${CMAKE_ROOT}/Modules/SelectLibraryConfigurations.cmake)

if(NOT Stb_INCLUDE_DIR)
find_path(Stb_INCLUDE_DIR NAMES stb_image.h PATHS ${Stb_DIR} PATH_SUFFIXES include)
endif()

find_package_handle_standard_args(Stb DEFAULT_MSG Stb_INCLUDE_DIR)
mark_as_advanced(Stb_INCLUDE_DIR)
16 changes: 16 additions & 0 deletions extern/vcpkg-overlays/stb/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO nothings/stb
REF f75e8d1cad7d90d72ef7a4661f1b994ef78b4e31 # committed on 2024-07-29
SHA512 4a733aefb816a366c999663e3d482144616721b26c321ee5dd0dce611a34050b6aef97d46bd2c4f8a9631d83b097491a7ce88607fd9493d880aaa94567a68cce
HEAD_REF master
)

file(GLOB HEADER_FILES "${SOURCE_PATH}/*.h" "${SOURCE_PATH}/stb_vorbis.c")
file(COPY ${HEADER_FILES} DESTINATION "${CURRENT_PACKAGES_DIR}/include")

file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/FindStb.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
4 changes: 4 additions & 0 deletions extern/vcpkg-overlays/stb/usage
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
The package stb provides CMake targets:

find_package(Stb REQUIRED)
target_include_directories(main PRIVATE ${Stb_INCLUDE_DIR})
6 changes: 6 additions & 0 deletions extern/vcpkg-overlays/stb/vcpkg-cmake-wrapper.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
set(STB_PREV_MODULE_PATH ${CMAKE_MODULE_PATH})
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})

_find_package(${ARGS})

set(CMAKE_MODULE_PATH ${STB_PREV_MODULE_PATH})
8 changes: 8 additions & 0 deletions extern/vcpkg-overlays/stb/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "stb",
"version-date": "2024-07-29",
"port-version": 1,
"description": "public domain header-only libraries",
"homepage": "https://github.com/nothings/stb",
"license": "MIT OR CC-PDDC"
}

0 comments on commit eabc089

Please sign in to comment.