Skip to content

添加 stbiw 库 #108

New issue

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

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

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

添加 stbiw 库 #108

wants to merge 1 commit into from

Conversation

Dizww
Copy link

@Dizww Dizww commented Jan 3, 2023

关于stbi 宏定义设计:
这是一种heard only 的设计方式。用IMPLEMENTATION宏来控制是否导入函数的定义。
没有定义IMPLEMENTATION宏时,导入stbi头文件,只有函数的声明。

我们只在stbiw的stb_image_write.cpp中,导入IMPLEMENTATION宏,以启用stbi函数的定义。

#define STB_IMAGE_WRITE_IMPLEMENTATION
#include <stb_image_write.h>

然后将stbiw编译成一个静态库

add_library(stbiw STATIC stb_image_write.cpp stb_image_write.h)
target_include_directories(stbiw PUBLIC .)

其他项目通过add_subdirectory就可以使用stbiw库了

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant