Skip to content

Hunterized version 2023.10.12 #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 205 commits into
base: hunter-0.0.0-80c8f6a
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
205 commits
Select commit Hold shift + click to select a range
f0f2533
closes #1063; Fixed files with no comments emitting outofmemory errors
anthofoxo Dec 16, 2020
b038c11
updated contributor list
anthofoxo Dec 16, 2020
4882970
vorbis comment list setup_malloc call is guarded
anthofoxo Jan 26, 2021
2d82cd1
Rename arraddnoff -> arraddnindex
t-mw Mar 2, 2021
b7b2aaa
fixed vorbis comments causing outofmem
anthofoxo Apr 13, 2021
05e1efa
Move stb.h to deprecated.
rygorous Jul 1, 2021
40d7e47
stb_sprintf: add attribute format to variadic functions
aganm Jun 14, 2021
d84beee
stb_dxt: Initialize tables at compile time
fahickman Apr 24, 2021
425c4d8
stb_dxt: Better error calc for single-color table
rygorous Jul 1, 2021
9a9c937
stb_dxt: Remove dithering support.
rygorous Jul 1, 2021
073114d
stb_sprintf.h: stdlib.h is not needed
Oct 28, 2020
0cc6060
Fix compilation warnings in the s390x architeture. Fixes #1082.
rsachetto Jan 27, 2021
6931571
Note GL blend state for stb_truetype
jcwkroeze Mar 11, 2021
0755e6a
stb_sprintf: fix stbsp_ddtoS64 macro
visualdoj Jan 27, 2021
309322a
stb_truetype: Turn codepoint assert into error check
rygorous Jul 2, 2021
1cacac0
stb_textedit: Docs fix.
rygorous Jul 2, 2021
bc4e96b
stb_image: Fix issue #994.
rygorous Jul 2, 2021
3a7dcdd
stb_image: Better docs for stbi_info.
rygorous Jul 2, 2021
655b2b1
stb_image.h: Suppress warnings about out_size, delay_size
jackodirks Aug 15, 2020
8befa75
Adds 16-bit support for pnm files.
sbreuss May 18, 2021
b4891ba
stb_image: Update credits, change log
rygorous Jul 2, 2021
67b247b
README: updated supported stb_image and stb_image_write formats
rygorous Jul 2, 2021
99e905e
Merge branch 'pull_req' of https://github.com/anthofoxo/stb into working
Jul 2, 2021
52ad6bd
update stb_vorbis version
Jul 2, 2021
8e51be0
Merge branch 'master' of https://github.com/nothings/stb
Jul 2, 2021
50072f6
stb_image: Check results of all mallocs.
rygorous Jul 3, 2021
a3f2897
stb_image: Fix bug on JPEGs with malformed DC deltas
rygorous Jul 3, 2021
1d7bf85
stb_image: Fix lrot definition, small extend_receive tweak
rygorous Jul 3, 2021
4d067e8
stb_image, stb_image_write: Fix compare sign warnings
rygorous Jul 3, 2021
0260135
stb_image: Avoid shift of signed values in extend_receive
rygorous Jul 3, 2021
48632c1
stb_image: Avoid left-shifts of signed values
rygorous Jul 3, 2021
cf00c67
stb_image: Update comment
rygorous Jul 3, 2021
41e9383
stb_image: UB fix in stbi__get32le
rygorous Jul 3, 2021
d343a29
stb_image: Erorr in BMP should error, not assert.
rygorous Jul 3, 2021
ba739e5
readme: Add "how to use these libs" section
rygorous Jul 3, 2021
e795306
stb_image: Document image size limits
rygorous Jul 3, 2021
3870fb6
stb_image: Reorder format test sequence
rygorous Jul 3, 2021
e3a63f3
stb_image: Fix wrong buffer sizes passed to MultiByteToWideChar
rygorous Jul 3, 2021
a0231a9
stb_image: Key Win32 UTF-8 support off _WIN32 not _MSC_VER
rygorous Jul 3, 2021
69a7dd3
stb_image: fix building by MSVC for Windows 10 on ARM
eugenegff Oct 1, 2020
5c0cc31
stb_image: Update credits
rygorous Jul 3, 2021
6294c6c
Move stb.h to deprecated.
rygorous Jul 1, 2021
696cb03
stb_sprintf: add attribute format to variadic functions
aganm Jun 14, 2021
98623b9
stb_dxt: Initialize tables at compile time
fahickman Apr 24, 2021
ae3ed90
stb_dxt: Better error calc for single-color table
rygorous Jul 1, 2021
dc2aa37
stb_dxt: Remove dithering support.
rygorous Jul 1, 2021
2de22bd
stb_sprintf.h: stdlib.h is not needed
Oct 28, 2020
0257892
Fix compilation warnings in the s390x architeture. Fixes #1082.
rsachetto Jan 27, 2021
04007a0
Note GL blend state for stb_truetype
jcwkroeze Mar 11, 2021
0676559
stb_sprintf: fix stbsp_ddtoS64 macro
visualdoj Jan 27, 2021
0afc39f
stb_truetype: Turn codepoint assert into error check
rygorous Jul 2, 2021
a49749a
stb_textedit: Docs fix.
rygorous Jul 2, 2021
1203eb5
stb_image: Fix issue #994.
rygorous Jul 2, 2021
448bb13
stb_image: Better docs for stbi_info.
rygorous Jul 2, 2021
c62af85
stb_image.h: Suppress warnings about out_size, delay_size
jackodirks Aug 15, 2020
8c15cc9
Adds 16-bit support for pnm files.
sbreuss May 18, 2021
8e8f7d9
stb_image: Update credits, change log
rygorous Jul 2, 2021
6199b71
README: updated supported stb_image and stb_image_write formats
rygorous Jul 2, 2021
6ab6303
stb_image: Check results of all mallocs.
rygorous Jul 3, 2021
86b7570
stb_image: Fix bug on JPEGs with malformed DC deltas
rygorous Jul 3, 2021
265b73b
stb_image: Fix lrot definition, small extend_receive tweak
rygorous Jul 3, 2021
6d85793
stb_image, stb_image_write: Fix compare sign warnings
rygorous Jul 3, 2021
43b32c7
stb_image: Avoid shift of signed values in extend_receive
rygorous Jul 3, 2021
bb09317
stb_image: Avoid left-shifts of signed values
rygorous Jul 3, 2021
d6ab7fa
stb_image: Update comment
rygorous Jul 3, 2021
31ba943
stb_image: UB fix in stbi__get32le
rygorous Jul 3, 2021
4d3b93f
stb_image: Erorr in BMP should error, not assert.
rygorous Jul 3, 2021
55a1806
readme: Add "how to use these libs" section
rygorous Jul 3, 2021
618dbd0
stb_image: Document image size limits
rygorous Jul 3, 2021
56a7113
stb_image: Reorder format test sequence
rygorous Jul 3, 2021
991f1f6
stb_image: Fix wrong buffer sizes passed to MultiByteToWideChar
rygorous Jul 3, 2021
2506215
stb_image: Key Win32 UTF-8 support off _WIN32 not _MSC_VER
rygorous Jul 3, 2021
db864a1
stb_image: fix building by MSVC for Windows 10 on ARM
eugenegff Oct 1, 2020
82f9950
stb_image: Update credits
rygorous Jul 3, 2021
81bcfa9
stb_image_write: Remove tabs
rygorous Jul 4, 2021
76f55ac
stb_image_write: STBI_WINDOWS_UTF8 -> STBIW_WINDOWS_UTF8
rygorous Jul 4, 2021
ba3ba9b
stb_image_write: Disable HDR writer completely in NO_STDIO build
rygorous Jul 4, 2021
a5e4073
stb_image_write: Fix define tested for sprintf_s
rygorous Jul 4, 2021
3f671b8
stb_vorbis: rename BUFFER_SIZE macro to STB_BUFFER_SIZE
sagamusix Jan 16, 2021
2e3a6e8
stb_vorbis: Move asserts around a bit
rygorous Jul 4, 2021
6fe0536
stb_vorbis: Fix memory leak in stb_vorbis
morlad Mar 12, 2021
5300d55
stb_vorbis: Include alloca.h on Sun targets
rygorous Jul 4, 2021
904ecbf
stb_vorbis: Remove spurious assignment to val
rygorous Jul 4, 2021
e31da43
stb_vorbis: Fix unused parameter warnings.
rygorous Jul 4, 2021
c817c96
stb_vorbis: Add missing cast to uint to avoid UB
rygorous Jul 4, 2021
d5613c9
stb_vorbis: A few UB fixes.
rygorous Jul 4, 2021
39a0641
stb_vorbis: Clarify lifetime of pushdata *output buffers
rygorous Jul 4, 2021
0def11a
stb_vorbis: Fix some unused variables.
rygorous Jul 4, 2021
0d47d17
stb_vorbis: Set error on open_memory with NULL data
rygorous Jul 5, 2021
70136cd
stb_vorbis: Change imdct_step3_inner_s_loop_ld654
rygorous Jul 5, 2021
e5fd7f6
stb: Remove stua entirely
rygorous Jul 5, 2021
ab18d9b
stb_image: Fix two bugs found via VC++ /analyze
rygorous Jul 5, 2021
17bc84e
stb_image: stbi__bmp_info only rewind stream on error
rygorous Jul 5, 2021
1e82fd4
stb_image: BMP v4/v5 header parsing fixes
rygorous Jul 5, 2021
a5d989c
stb_truetype: Tabs->spaces
rygorous Jul 7, 2021
ba5cc43
stb_truetype: Fix stbtt__solve_cubic comment
rygorous Jul 7, 2021
e817b4a
stb_ds: Fix typos in docs.
rygorous Jul 7, 2021
76a0a00
stb.h: _MSC_VER in readdir_raw -> _WIN32
rygorous Jul 7, 2021
85bc806
Support for Page Up/Down
Xipiryon Nov 19, 2020
eb677dd
stb_textedit: Update credit, version history
rygorous Jul 7, 2021
44f046a
stb_textedit: Fix paste failure handling breaking undo stack
ocornut Jul 5, 2021
b691fc4
stb_truetype: Remove dead assignments
rygorous Jul 7, 2021
2c8cd33
stb_image: make unpremultiply and de-iPhone flags thread_local.
mosra Apr 6, 2020
7e10880
stb_image: Update credits
rygorous Jul 7, 2021
b18c989
stb_tilemap_editor: Fix variable usage
RobLoach Apr 16, 2021
21bfcbb
stb_tilemap_editor: Update version, credits
rygorous Jul 7, 2021
77eedd4
stb_tilemap_editor: Several fixes.
wernsey Apr 9, 2021
15d2dc5
stb_tilemap_editor: Update contributors
rygorous Jul 7, 2021
6ca560c
stb_image: Update documentation for de-iPhone flag
rygorous Jul 7, 2021
9f98546
Travis-ci: added support for ppc64le
dthadi3 Nov 25, 2020
b771927
oss-fuzz: integrate with CIFuzz
randy408 Nov 25, 2020
dcb1116
ossfuzz: improve code coverage
randy408 Nov 26, 2020
95372dc
stb.h: fix bug in stb_readdir caused by change to stb_strncpy
Jul 7, 2021
a32aeef
Merge branch 'patch-1' of https://github.com/t-mw/stb into dev
Jul 7, 2021
08e4b18
Merge branch 'dev' of https://github.com/nothings/stb into dev
Jul 7, 2021
84e7a4a
stb_c_lexer: fix NUL eof test so it compiles
Jul 7, 2021
ca0e6d0
stb_c_lexer: don't define default macro definitions on non-implementa…
Jul 7, 2021
fc5b791
stb_truetype: fix SDF handling of multiple move_to commands in a row
Jul 7, 2021
c38ec91
stb_divide: Fix integer overflow issues
rygorous Jul 7, 2021
ab69a04
Merge branch 'dev' of github.com:nothings/stb into dev
rygorous Jul 7, 2021
e7f9f92
stb_divide: Update changelog
rygorous Jul 7, 2021
14c224c
stb_image_resize: Remove ill-advised asserts.
rygorous Jul 7, 2021
db6e91b
Store uncompressed if compression was worse
a-e-k Jul 4, 2021
e590505
stb_truetype: GCC warning fix
rygorous Jul 7, 2021
1252a3e
stb_truetype: GPOS parsing fixes
rygorous Jul 7, 2021
9fe3b4b
stb_truetype: GPOS handling formatting changes
rygorous Jul 7, 2021
46c259f
stb_sprintf: PUBLICDEC on declarations, as intended
rygorous Jul 7, 2021
afc9c16
stb_truetype: Change spelling of fallthrough comment
rygorous Jul 7, 2021
8af4d40
stb_c_lexer: Move token enum defn to header portion
rygorous Jul 7, 2021
315e979
stb_truetype: Add protoype for stbtt_FindSVGDoc
rygorous Jul 7, 2021
b14a807
stb_image_write: Support writing BMPs with alpha
rygorous Jul 7, 2021
2af2e69
stb_ds: Fix addn when n=0
rygorous Jul 7, 2021
013884b
stb_sprintf: Fix string length calc
rygorous Jul 7, 2021
3be65f1
stb_sprintf: Small simplification
rygorous Jul 7, 2021
06b6009
stb_sprintf: Fix unused variable warning with STB_SPRINTF_NOFLOAT
rygorous Jul 7, 2021
d2476c3
stb_sprintf: GCC compilation fix
rygorous Jul 8, 2021
1e1efbd
stb_image_write: Make globals extern "C" in C++
rygorous Jul 8, 2021
2b667e4
stb_rect_pack: Several minor fixes
rygorous Jul 8, 2021
4bb337d
test including stb_c_lexer header independnet of implementation
Jul 9, 2021
99e1321
Merge branch 'dev' of https://github.com/nothings/stb into dev
Jul 9, 2021
5bf78b8
stb_truetype: fix bad declaration
Jul 9, 2021
c8e3d30
stb_truetype: Small tweaks to make PVS Studio happy
rygorous Jul 10, 2021
818ac26
stb_rect_pack: making functions cdecl for msvc qsort
ocornut Jul 9, 2021
a0a8653
attempt to fix issue with CIFuzz
randy408 Jul 10, 2021
af4c673
change directory for seed corpus downloads
randy408 Jul 10, 2021
38c15ee
Merge pull request #1165 from randy408/dev-fix
nothings Jul 11, 2021
e05ecc0
Fix compiling-as-C-pre-C99 issues
Jul 11, 2021
0be82e4
stb_truetype: fix incorrect antialiasing computation in v2 rasterizer…
Jul 11, 2021
fd7807e
stb_c_lexer: allow including stb_c_lexer.h without defining overrides…
Jul 11, 2021
1ee679c
update version numbers
Jul 12, 2021
3cfb892
stb_dxt: Fix bug in table generator
rygorous Jul 12, 2021
5324597
README: update stb_dxt version for fix
rygorous Jul 12, 2021
7023e27
fix stb_dxt version
Jul 12, 2021
c4ef8e1
fix version date
Jul 12, 2021
5a0bb8b
update readme
Jul 12, 2021
a0a9390
update README
Jul 12, 2021
cd6b6f7
fix compiling with NO_HDR NO_LINEAR
Jul 12, 2021
4adb57a
clean up project file
Jul 12, 2021
3a11740
opengl stb_truetype demo app
Jul 13, 2021
7de8f79
Merge branch 'master' into dev
Jul 13, 2021
be90195
stb_truetype: fix sample code drawing characters upside-down
Jul 13, 2021
7c65d56
fix compiling with NO_HDR NO_LINEAR
Jul 12, 2021
1401f22
clean up project file
Jul 12, 2021
c404b78
stb_truetype: fix sample code drawing characters upside-down
Jul 13, 2021
5ba0baa
stb_image: Reject fractional JPEG component subsampling ratios
rygorous Jul 26, 2021
08e8952
Merge branch 'dev' of https://github.com/nothings/stb into dev
Aug 13, 2021
59e7dec
delete file covered by patents
Aug 13, 2021
ef86142
stb.h: stb_splitpath correctly handles relative paths with explicit d…
Aug 28, 2021
c0c9826
stb_truetype 1.26: fix rendering glitches
Aug 28, 2021
b1826c9
Update issue templates
nothings Sep 10, 2021
b9e1d86
Create config.yml
nothings Sep 10, 2021
37e21f1
Update bug_report.md
nothings Sep 10, 2021
af1a5bc
Update bug_report.md
nothings Sep 10, 2021
4af130e
stb_perlin.h: restore file now that patent is expired
Sep 8, 2022
bc00c17
Merge branch 'master' of https://github.com/nothings/stb
Sep 8, 2022
8b5f1f3
update readme
Sep 8, 2022
2a02ff7
Fixes two stb_image issues that could occur with specially constructe…
NBickford-NV Oct 7, 2021
84b9401
Add checks for PNM integer read overflows, add a 1GB limit on IDAT ch…
NBickford-NV Feb 23, 2022
96fe76c
Add range checks to fix a few crash issues in stb_image issues 1289 a…
NBickford-NV Feb 23, 2022
47164e4
Add checks for signed integer overflow; further guard against cases w…
NBickford-NV Feb 24, 2022
5cfc2a7
Zero-initialize stbi__jpeg to avoid intermittent errors found by fuzz…
NBickford-NV Feb 25, 2022
9f22cc9
stb_image PNG: Checks for invalid DEFLATE codes.
NBickford-NV Oct 15, 2021
e5da6ac
Merge branch 'neilbickford/image_hdr_pgm_fixes' into dev
rygorous Jan 22, 2023
4d160de
stb_image: Fix name of stbi_set_unpremultiply_on_load_thread impl
rygorous Jan 22, 2023
b15b043
Merge branch 'NeilBickford-NV-neilbickford/additional-image-fixes' in…
rygorous Jan 22, 2023
038b6ab
stb_image: Avoid stdint.h on 32-bit Symbian.
rygorous Jan 22, 2023
51d295e
stb_image: Add trailing semicolon to usage example
rygorous Jan 23, 2023
1096389
stb_image: Accept some extra data between BMP header and payload
rygorous Jan 23, 2023
0613e9c
stb_image: Tweak end-of-JPEG junk scanning loop.
rygorous Jan 23, 2023
24fa1ff
stb_image: Fix broken indenting introduced earlier
rygorous Jan 23, 2023
40eb865
stb_image: header scan mode always needs to check for tRNS
rygorous Jan 23, 2023
1891060
a fix
Jan 29, 2023
7c14c47
Merge branch 'sean_image'
Jan 29, 2023
6199bf7
update stb_image to 2.28
Jan 29, 2023
3ecc60f
add version history update for stb_image
Jan 29, 2023
5736b15
re-add perlin noise again
Jan 29, 2023
c4bbb6e
stb_image_resize2.h 2.00
Oct 10, 2023
e81f294
stb_image_resize: switch GNU/clang from "asm" to "__asm__" for -c99 c…
Oct 12, 2023
beebb24
README.md: fix reference to stb_image_resize2.h
Oct 12, 2023
10b1293
Rename file (it's header!)
ruslo Dec 5, 2017
ea6c521
Add CMakeLists.txt
ruslo Dec 5, 2017
edee282
exporting every available stb headers
mean-ui-thread Dec 9, 2018
5ed904a
Discard most external STB*_IMPLEMENTATION inputs and generate a libra…
rbsheth Jun 24, 2021
c3c9b4e
Resolve compilation errors
Nov 1, 2023
10beb04
CMake updates
Nov 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Bug report
about: if you're having trouble using a library, try the support forum instead
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.
4 changes: 4 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
contact_links:
- name: support forum
url: https://github.com/nothings/stb/discussions/categories/q-a
about: having trouble using an stb library? don't create an issue, post in the forum
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: 4 enhancement
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
23 changes: 23 additions & 0 deletions .github/workflows/ci-fuzz.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: CIFuzz
on: [pull_request]
jobs:
Fuzzing:
runs-on: ubuntu-latest
steps:
- name: Build Fuzzers
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
with:
oss-fuzz-project-name: 'stb'
dry-run: false
- name: Run Fuzzers
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
with:
oss-fuzz-project-name: 'stb'
fuzz-seconds: 900
dry-run: false
- name: Upload Crash
uses: actions/upload-artifact@v1
if: failure()
with:
name: artifacts
path: ./out/artifacts
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
language: C
arch:
- AMD64
- ppc64le
install: true
script:
- cd tests
Expand Down
126 changes: 126 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# Copyright (c) 2017-2023, Ruslan Baratov, Rahul Sheth
# All rights reserved.

cmake_minimum_required(VERSION 3.5)
project(stb VERSION 20231012)

set(STBCC_GRID_COUNT_X_LOG2 "10" CACHE STRING "STBCC_GRID_COUNT_X_LOG2")
set(STBCC_GRID_COUNT_Y_LOG2 "10" CACHE STRING "STBCC_GRID_COUNT_Y_LOG2")

set(STBDIV_C_INTEGER_DIVISION_TRUNCATES OFF CACHE BOOL "C_INTEGER_DIVISION_TRUNCATES")
set(STBDIV_C_INTEGER_DIVISION_FLOORS OFF CACHE BOOL "C_INTEGER_DIVISION_FLOORS")

set(STBVOX_CONFIG_MODE "0" CACHE STRING "STBVOX_CONFIG_MODE")
set(STBVOX_CONFIG_PREFER_TEXBUFFER OFF CACHE BOOL "STBVOX_CONFIG_PREFER_TEXBUFFER")

add_library(stb STATIC)

# Installation (https://github.com/forexample/package-example) {

set(config_install_dir "lib/cmake/${PROJECT_NAME}")
set(include_install_dir "include")

set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
set(version_config "${generated_dir}/${PROJECT_NAME}ConfigVersion.cmake")
set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake")
set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
set(namespace "${PROJECT_NAME}::")

include(CMakePackageConfigHelpers)

# Use:
# * PROJECT_VERSION
write_basic_package_version_file(
"${version_config}" COMPATIBILITY SameMajorVersion
)

# Use:
# * 'TARGETS_EXPORT_NAME'
configure_package_config_file(
"cmake/Config.cmake.in"
"${project_config}"
INSTALL_DESTINATION "${config_install_dir}"
)

function(GenerateHeader header_name defines)
file(READ "${header_name}" HEADER_STRING)
get_filename_component(header_prefix ${header_name} NAME_WE)
set(GENERATED_HEADER "${generated_dir}/${header_prefix}.h")
set(HEADER_DEFS "")
set(HEADER_UNDEFS "")
foreach(define IN LISTS defines)
string(APPEND HEADER_DEFS "#define ${define}\n")
string(REGEX REPLACE "(.*)\ .*" "\\1" undefine "${define}")
string(APPEND HEADER_UNDEFS "#undef ${undefine}\n")
endforeach()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/header.template.in" "${GENERATED_HEADER}")
install(FILES "${GENERATED_HEADER}" DESTINATION "${include_install_dir}/${PROJECT_NAME}")

list(LENGTH defines define_count)
if(define_count GREATER 0)
string(PREPEND HEADER_STRING "${HEADER_DEFS}")
file(WRITE "${generated_dir}/${header_prefix}.c" "${HEADER_STRING}")
target_sources(stb PRIVATE "${generated_dir}/${header_prefix}.c")
endif()
endfunction()

GenerateHeader(deprecated/stb.h "STB_DEFINE")
GenerateHeader(stb_c_lexer.h "STB_C_LEXER_IMPLEMENTATION")
GenerateHeader(stb_connected_components.h "STBCC_GRID_COUNT_X_LOG2 ${STBCC_GRID_COUNT_X_LOG2};STBCC_GRID_COUNT_Y_LOG2 ${STBCC_GRID_COUNT_Y_LOG2};STB_CONNECTED_COMPONENTS_IMPLEMENTATION")
set(STB_DIVIDE_DEFINES "STB_DIVIDE_IMPLEMENTATION")
if(STBDIV_C_INTEGER_DIVISION_TRUNCATES)
list(APPEND STB_DIVIDE_DEFINES "C_INTEGER_DIVISION_TRUNCATES")
target_compile_definitions(stb PUBLIC "C_INTEGER_DIVISION_TRUNCATES")
endif()
if(STBDIV_C_INTEGER_DIVISION_FLOORS)
list(APPEND STB_DIVIDE_DEFINES "C_INTEGER_DIVISION_FLOORS")
target_compile_definitions(stb PUBLIC "C_INTEGER_DIVISION_FLOORS")
endif()
GenerateHeader(stb_divide.h "${STB_DIVIDE_DEFINES}")
GenerateHeader(stb_ds.h "STB_DS_IMPLEMENTATION")
GenerateHeader(stb_dxt.h "STB_DXT_IMPLEMENTATION")
GenerateHeader(stb_easy_font.h "")
GenerateHeader(stb_herringbone_wang_tile.h "STB_HERRINGBONE_WANG_TILE_IMPLEMENTATION")
GenerateHeader(stb_hexwave.h "STB_HEXWAVE_IMPLEMENTATION")
GenerateHeader(stb_image.h "STB_IMAGE_IMPLEMENTATION")
GenerateHeader(stb_image_resize2.h "STB_IMAGE_RESIZE_IMPLEMENTATION")
GenerateHeader(stb_image_write.h "STB_IMAGE_WRITE_IMPLEMENTATION")
GenerateHeader(stb_include.h "STB_INCLUDE_IMPLEMENTATION")
GenerateHeader(stb_leakcheck.h "STB_LEAKCHECK_IMPLEMENTATION")
GenerateHeader(stb_perlin.h "STB_PERLIN_IMPLEMENTATION")
GenerateHeader(stb_rect_pack.h "")
GenerateHeader(stb_sprintf.h "")
# stb_textedit has way too many configurable options, bypass implementation generation for now.
install(FILES stb_textedit.h DESTINATION "${include_install_dir}/${PROJECT_NAME}")
# stb_tilemap_editor requires functions to be defined
install(FILES stb_tilemap_editor.h DESTINATION "${include_install_dir}/${PROJECT_NAME}")
GenerateHeader(stb_truetype.h "STB_TRUETYPE_IMPLEMENTATION")
GenerateHeader(stb_vorbis.h "")

set(STBVOX_DEFINES "STB_VOXEL_RENDER_IMPLEMENTATION;STBVOX_CONFIG_MODE ${STBVOX_CONFIG_MODE}")
if(STBVOX_CONFIG_PREFER_TEXBUFFER)
list(APPEND STBVOX_DEFINES "STBVOX_CONFIG_PREFER_TEXBUFFER")
target_compile_definitions(stb PUBLIC "STBVOX_CONFIG_PREFER_TEXBUFFER")
endif()
GenerateHeader(stb_voxel_render.h "${STBVOX_DEFINES}")

target_compile_definitions(stb PUBLIC STB_USE_HUNTER)

install(
TARGETS stb
EXPORT "${TARGETS_EXPORT_NAME}"
INCLUDES DESTINATION "${include_install_dir}"
)

install(
FILES "${project_config}" "${version_config}"
DESTINATION "${config_install_dir}"
)

install(
EXPORT "${TARGETS_EXPORT_NAME}"
NAMESPACE "${namespace}"
DESTINATION "${config_install_dir}"
)

# }
52 changes: 35 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Noteworthy:

* image loader: [stb_image.h](stb_image.h)
* image writer: [stb_image_write.h](stb_image_write.h)
* image resizer: [stb_image_resize.h](stb_image_resize.h)
* image resizer: [stb_image_resize2.h](stb_image_resize2.h)
* font text rasterizer: [stb_truetype.h](stb_truetype.h)
* typesafe containers: [stb_ds.h](stb_ds.h)

Expand All @@ -20,30 +20,30 @@ by Jorge L. "VinoBS" Rodriguez, and stb_sprintf by Jeff Roberts.

library | lastest version | category | LoC | description
--------------------- | ---- | -------- | --- | --------------------------------
**[stb_vorbis.c](stb_vorbis.c)** | 1.20 | audio | 5563 | decode ogg vorbis files from file/memory to float/16-bit signed output
**[stb_image.h](stb_image.h)** | 2.26 | graphics | 7762 | image loading/decoding from file/memory: JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC
**[stb_truetype.h](stb_truetype.h)** | 1.24 | graphics | 5011 | parse, decode, and rasterize characters from truetype fonts
**[stb_image_write.h](stb_image_write.h)** | 1.15 | graphics | 1690 | image writing to disk: PNG, TGA, BMP
**[stb_image_resize.h](stb_image_resize.h)** | 0.96 | graphics | 2631 | resize images larger/smaller with good quality
**[stb_rect_pack.h](stb_rect_pack.h)** | 1.00 | graphics | 628 | simple 2D rectangle packer with decent quality
**[stb_ds.h](stb_ds.h)** | 0.66 | utility | 1893 | typesafe dynamic array and hash tables for C, will compile in C++
**[stb_sprintf.h](stb_sprintf.h)** | 1.09 | utility | 1879 | fast sprintf, snprintf for C/C++
**[stb_textedit.h](stb_textedit.h)** | 1.13 | user interface | 1404 | guts of a text editor for games etc implementing them from scratch
**[stb_vorbis.c](stb_vorbis.c)** | 1.22 | audio | 5584 | decode ogg vorbis files from file/memory to float/16-bit signed output
**[stb_hexwave.h](stb_hexwave.h)** | 0.5 | audio | 680 | audio waveform synthesizer
**[stb_image.h](stb_image.h)** | 2.28 | graphics | 7987 | image loading/decoding from file/memory: JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC
**[stb_truetype.h](stb_truetype.h)** | 1.26 | graphics | 5077 | parse, decode, and rasterize characters from truetype fonts
**[stb_image_write.h](stb_image_write.h)** | 1.16 | graphics | 1724 | image writing to disk: PNG, TGA, BMP
**[stb_image_resize2.h](stb_image_resize2.h)** | 2.01 | graphics | 10303 | resize images larger/smaller with good quality
**[stb_rect_pack.h](stb_rect_pack.h)** | 1.01 | graphics | 623 | simple 2D rectangle packer with decent quality
**[stb_perlin.h](stb_perlin.h)** | 0.5 | graphics | 428 | perlin's revised simplex noise w/ different seeds
**[stb_ds.h](stb_ds.h)** | 0.67 | utility | 1895 | typesafe dynamic array and hash tables for C, will compile in C++
**[stb_sprintf.h](stb_sprintf.h)** | 1.10 | utility | 1906 | fast sprintf, snprintf for C/C++
**[stb_textedit.h](stb_textedit.h)** | 1.14 | user interface | 1429 | guts of a text editor for games etc implementing them from scratch
**[stb_voxel_render.h](stb_voxel_render.h)** | 0.89 | 3D graphics | 3807 | Minecraft-esque voxel rendering "engine" with many more features
**[stb_dxt.h](stb_dxt.h)** | 1.10 | 3D graphics | 753 | Fabian "ryg" Giesen's real-time DXT compressor
**[stb_perlin.h](stb_perlin.h)** | 0.5 | 3D graphics | 428 | revised Perlin noise (3D input, 1D output)
**[stb_dxt.h](stb_dxt.h)** | 1.12 | 3D graphics | 719 | Fabian "ryg" Giesen's real-time DXT compressor
**[stb_easy_font.h](stb_easy_font.h)** | 1.1 | 3D graphics | 305 | quick-and-dirty easy-to-deploy bitmap font for printing frame rate, etc
**[stb_tilemap_editor.h](stb_tilemap_editor.h)** | 0.41 | game dev | 4161 | embeddable tilemap editor
**[stb_tilemap_editor.h](stb_tilemap_editor.h)** | 0.42 | game dev | 4187 | embeddable tilemap editor
**[stb_herringbone_wa...](stb_herringbone_wang_tile.h)** | 0.7 | game dev | 1221 | herringbone Wang tile map generator
**[stb_c_lexer.h](stb_c_lexer.h)** | 0.11 | parsing | 966 | simplify writing parsers for C-like languages
**[stb_divide.h](stb_divide.h)** | 0.93 | math | 430 | more useful 32-bit modulus e.g. "euclidean divide"
**[stb_c_lexer.h](stb_c_lexer.h)** | 0.12 | parsing | 940 | simplify writing parsers for C-like languages
**[stb_divide.h](stb_divide.h)** | 0.94 | math | 433 | more useful 32-bit modulus e.g. "euclidean divide"
**[stb_connected_comp...](stb_connected_components.h)** | 0.96 | misc | 1049 | incrementally compute reachability on grids
**[stb.h](stb.h)** | 2.37 | misc | 14454 | helper functions for C, mostly redundant in C++; basically author's personal stuff
**[stb_leakcheck.h](stb_leakcheck.h)** | 0.6 | misc | 194 | quick-and-dirty malloc/free leak-checking
**[stb_include.h](stb_include.h)** | 0.02 | misc | 295 | implement recursive #include support, particularly for GLSL

Total libraries: 21
Total lines of C code: 56524
Total lines of C code: 50786


FAQ
Expand All @@ -59,6 +59,24 @@ They are also licensed under the MIT open source license, if you have lawyers
who are unhappy with public domain. Every source file includes an explicit
dual-license for you to choose from.

#### How do I use these libraries?

The idea behind single-header file libraries is that they're easy to distribute and deploy
because all the code is contained in a single file. By default, the .h files in here act as
their own header files, i.e. they declare the functions contained in the file but don't
actually result in any code getting compiled.

So in addition, you should select _exactly one_ C/C++ source file that actually instantiates
the code, preferably a file you're not editing frequently. This file should define a
specific macro (this is documented per-library) to actually enable the function definitions.
For example, to use stb_image, you should have exactly one C/C++ file that doesn't
include stb_image.h regularly, but instead does

#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"

The right macro to define is pointed out right at the top of each of these libraries.

#### <a name="other_libs"></a> Are there other single-file public-domain/open source libraries with minimal dependencies out there?

[Yes.](https://github.com/nothings/single_file_libs)
Expand Down
4 changes: 4 additions & 0 deletions cmake/Config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@PACKAGE_INIT@

include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")
check_required_components("@PROJECT_NAME@")
5 changes: 5 additions & 0 deletions cmake/header.template.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#ifdef STB_USE_HUNTER
@HEADER_UNDEFS@
#endif

@HEADER_STRING@
Loading