From e41ee8aa3ccc836f2770cd6e6009c9129de25ac1 Mon Sep 17 00:00:00 2001 From: wangguokun Date: Tue, 19 Mar 2024 02:57:54 +0000 Subject: [PATCH] lib/stb: port lib-stb to tenonos Signed-off-by: wangguokun --- .gitee/PULL_REQUEST_TEMPLATE.zh-CN.md | 8 ----- Config.uk | 3 ++ Makefile.uk | 49 +++++++++++++++++++++++++++ README.md | 22 ++++++++++++ patches/.keep | 0 5 files changed, 74 insertions(+), 8 deletions(-) delete mode 100644 .gitee/PULL_REQUEST_TEMPLATE.zh-CN.md create mode 100644 Config.uk create mode 100644 Makefile.uk create mode 100644 README.md create mode 100644 patches/.keep diff --git a/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md b/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md deleted file mode 100644 index 5beec68..0000000 --- a/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md +++ /dev/null @@ -1,8 +0,0 @@ -##### 修改原因:(目的、解决的问题等) -##### 修改内容:(整体或分文件描述修改内容) -##### 测试场景:(新增或改动可能影响的功能,对测试情况做简要说明。测试截图请贴在PR评论区) -##### 以下内容非必须,如无内容请删除 -##### 相关PR:(若有需列明) -##### 兼容性说明:(是否无法兼容已发布的版本) -##### API/接口变更:(若修改了现有的API/函数定义,需要做出说明) -##### 其他: diff --git a/Config.uk b/Config.uk new file mode 100644 index 0000000..d200fca --- /dev/null +++ b/Config.uk @@ -0,0 +1,3 @@ +menuconfig LIBSTB + bool "libstb: stb single-file public domain libraries for C/C++" + default n diff --git a/Makefile.uk b/Makefile.uk new file mode 100644 index 0000000..64d0a12 --- /dev/null +++ b/Makefile.uk @@ -0,0 +1,49 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright 2024 The TenonOS Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +################################################################################ +# Library registration +################################################################################ +$(eval $(call addlib_s,libstb,$(CONFIG_LIBSTB))) + +################################################################################ +# Sources +################################################################################ +LIBSTB_COMMIT=ae721c50eaf761660b4f90cc590453cdb0c2acd0 +LIBSTB_URL=https://github.com/nothings/stb/archive/$(LIBSTB_COMMIT).zip +LIBSTB_DIRNAME=stb-$(LIBSTB_COMMIT) + +ifeq ($(CONFIG_LIBSTB), y) +$(eval $(call fetch,libstb,$(LIBSTB_URL))) +endif + +################################################################################ +# Helpers +################################################################################ +LIBSTB_SRC = $(LIBSTB_ORIGIN)/$(LIBSTB_DIRNAME) + +GCC_INSTALLDIR_FLAGS := -idirafter $(shell LC_ALL=C $(CC) -v 2>&1 | \ + $(SED) -e '/^COLLECT_LTO_WRAPPER=\(.*\)\/lto-wrapper/!d' -e 's//\1/')/include + +ifeq ($(CONFIG_ARCH_ARM_64), y) +LIBSTB_CFLAGS-$(CONFIG_ARCH_ARM_64) += $(GCC_INSTALLDIR_FLAGS) +LIBSTB_CXXFLAGS-$(CONFIG_ARCH_ARM_64) += $(GCC_INSTALLDIR_FLAGS) +endif + +################################################################################ +# Library includes +################################################################################ +CINCLUDES-$(CONFIG_LIBSTB) += -I$(LIBSTB_SRC)/ +CXXINCLUDES-$(CONFIG_LIBSTB) += -I$(LIBSTB_SRC)/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..8ae64da --- /dev/null +++ b/README.md @@ -0,0 +1,22 @@ +# lib-stb + +## 微库提供的功能与说明 + +stb库是一系列高效的C/C++库,由Sean T. Barrett开发,采用单文件设计,每个stb库都是一个单独的头文件,这使得集成变得非常简单。只需将头文件包含到你的项目中,无需额外的编译步骤或库文件。主要用于图形和音频处理。 + +得益于其实现方式,当仅需要将图像数据载入内存、或进行缩放操作、或保存图像时使用stb会非常方便,因为仅需要include几个头文件即可,不需要额外图像处理库的依赖,如libjpeg、libpng、opencv等。 + +stb支持的详细特性可见其官方文档: https://github.com/nothings/stb + +本仓库将stb作为微库移植到TenonOS,目录结构如下: + +```powershell +. +├── Config.uk ------ 维护微库配置 +├── Makefile.uk ------ 用于微库构建 +└── patches ------ 维护对stb源码的修改 +``` + +## 编译构建与配置说明 + +stb微库不依赖其他微库,默认不启用 diff --git a/patches/.keep b/patches/.keep new file mode 100644 index 0000000..e69de29 -- Gitee