From c00fdb965a0ce2943f4c339f78025d9b13c6facc Mon Sep 17 00:00:00 2001 From: BigWind Date: Mon, 26 Aug 2024 10:05:32 +0800 Subject: [PATCH] =?UTF-8?q?add=5Flibrary(stbiw=20STATIC=20stb=5Fimage=5Fwr?= =?UTF-8?q?ite.cpp)=20=E8=BF=99=E6=9D=A1=E5=91=BD=E4=BB=A4=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E4=BA=86=E4=B8=80=E4=B8=AA=E5=90=8D=E4=B8=BA=20stbiw?= =?UTF-8?q?=20=E7=9A=84=E9=9D=99=E6=80=81=E5=BA=93=E3=80=82=20STATIC=20?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA=E8=BF=99=E6=98=AF=E4=B8=80=E4=B8=AA=E9=9D=99?= =?UTF-8?q?=E6=80=81=E5=BA=93=E3=80=82=20stb=5Fimage=5Fwrite.cpp=20?= =?UTF-8?q?=E6=98=AF=E8=BF=99=E4=B8=AA=E5=BA=93=E7=9A=84=E6=BA=90=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E3=80=82=20target=5Finclude=5Fdirectories(stbiw=20PUB?= =?UTF-8?q?LIC=20.)=EF=BC=9A=20=E8=BF=99=E6=9D=A1=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E4=B8=BA=E7=9B=AE=E6=A0=87=20stbiw=20=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E4=BA=86=E5=A4=B4=E6=96=87=E4=BB=B6=E6=90=9C=E7=B4=A2=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E3=80=82=20PUBLIC=20=E8=A1=A8=E7=A4=BA=E8=BF=99?= =?UTF-8?q?=E4=B8=AA=E8=B7=AF=E5=BE=84=E4=B8=8D=E4=BB=85=E5=9C=A8=E7=BC=96?= =?UTF-8?q?=E8=AF=91=20stbiw=20=E6=97=B6=E4=BD=BF=E7=94=A8=EF=BC=8C?= =?UTF-8?q?=E8=BF=98=E4=BC=9A=E5=9C=A8=E7=BC=96=E8=AF=91=E4=BB=BB=E4=BD=95?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=20stbiw=20=E7=9A=84=E7=9B=AE=E6=A0=87?= =?UTF-8?q?=E6=97=B6=E4=BD=BF=E7=94=A8=E3=80=82=20.=20=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E5=BD=93=E5=89=8D=E7=9B=AE=E5=BD=95=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit stb设计为头文件库,设计的初衷就是通过一个头文件提供所有功能。通过这种方式,可以简化库的使用和集成。这样,stb_image_write 库的所有函数就会在这个 .cpp 文件中实现,而在其他文件中只需要包含 stb_image_write.h 即可使用这些函数。 pragma once使程序编译只包含一次,可以加快编译速度 --- stbiw/CMakeLists.txt | 4 +++- stbiw/stb_image_write.cpp | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 stbiw/stb_image_write.cpp diff --git a/stbiw/CMakeLists.txt b/stbiw/CMakeLists.txt index b56b853..6738f13 100644 --- a/stbiw/CMakeLists.txt +++ b/stbiw/CMakeLists.txt @@ -1 +1,3 @@ -message(FATAL_ERROR "请修改 stbiw/CMakeLists.txt!要求生成一个名为 stbiw 的库") +#message(FATAL_ERROR "请修改 stbiw/CMakeLists.txt!要求生成一个名为 stbiw 的库") +add_library(stbiw STATIC stb_image_write.cpp) +target_include_directories(stbiw PUBLIC .) \ No newline at end of file diff --git a/stbiw/stb_image_write.cpp b/stbiw/stb_image_write.cpp new file mode 100644 index 0000000..b9adc91 --- /dev/null +++ b/stbiw/stb_image_write.cpp @@ -0,0 +1,3 @@ +#pragma once +#define STB_IMAGE_WRITE_IMPLEMENTATION +#include "stb_image_write.h" \ No newline at end of file