add new thirdparty library, freetype

This commit is contained in:
falsycat 2022-11-04 14:28:57 +09:00
parent fe7531260f
commit c5337f69c2
3 changed files with 49 additions and 0 deletions

View File

@ -73,6 +73,7 @@ target_sources(nf7
common/file_base.hh
common/file_holder.hh
common/file_holder.cc
common/font_queue.hh
common/future.hh
common/generic_context.hh
common/generic_history.hh
@ -161,6 +162,7 @@ target_sources(nf7
)
target_link_libraries(nf7
PRIVATE
freetype
glew
glfw
imgui

29
common/font_queue.hh Normal file
View File

@ -0,0 +1,29 @@
#pragma once
#include <functional>
#include <memory>
#include <ft2build.h>
#include FT_FREETYPE_H
#include "nf7.hh"
namespace nf7::font {
class Queue : public nf7::File::Interface {
public:
using Task = std::function<void(FT_Library)>;
Queue() = default;
Queue(const Queue&) = delete;
Queue(Queue&&) = delete;
Queue& operator=(const Queue&) = delete;
Queue& operator=(Queue&&) = delete;
// thread-safe
virtual void Push(const std::shared_ptr<nf7::Context>&, Task&&) noexcept = 0;
virtual std::shared_ptr<Queue> self() noexcept = 0;
};
} // namespace nf7::font

View File

@ -10,6 +10,24 @@ else()
endif()
# ---- FreeType ----
# repository:
# license : The FreeType License
FetchContent_Declare(
freetype
URL "https://gitlab.freedesktop.org/freetype/freetype/-/archive/VER-2-12-1/freetype-VER-2-12-1.zip"
)
set(FT_DISABLE_ZLIB ON)
set(FT_DISABLE_BZIP2 ON)
set(FT_DISABLE_PNG ON)
set(FT_DISABLE_HARFBUZZ ON)
set(FT_DISABLE_BROTLI ON)
set(FT_ENABLE_ERROR_STRINGS ON)
FetchContent_MakeAvailable(freetype)
# ---- GLEW ----
# repository: https://github.com/Perlmint/glew-cmake
# license : Modified BSD License, the Mesa 3-D License (MIT) and the Khronos License (MIT).