Last active
August 30, 2021 06:32
-
-
Save mikedld/75b07f050ed804186177958409de801e to your computer and use it in GitHub Desktop.
freetype + harfbuzz cmake example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.0) | |
project(freetype_harfbuzz) | |
message(STATUS "-------------------------------------------------------------------") | |
execute_process( | |
COMMAND git init . | |
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}) | |
execute_process( | |
COMMAND git submodule add https://github.com/freetype/freetype third-party/freetype | |
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}) | |
set(FREETYPE_INCLUDE_DIR_ft2build ${CMAKE_CURRENT_LIST_DIR}/third-party/freetype/include CACHE PATH "") | |
set(FREETYPE_INCLUDE_DIR_freetype2 ${CMAKE_CURRENT_LIST_DIR}/third-party/freetype/include CACHE PATH "") | |
set(FREETYPE_LIBRARY freetype CACHE PATH "") | |
execute_process( | |
COMMAND git submodule add https://github.com/harfbuzz/harfbuzz third-party/harfbuzz | |
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}) | |
set(HarfBuzz_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/third-party/harfbuzz/src CACHE PATH "") | |
set(HarfBuzz_LIBRARY harfbuzz CACHE PATH "") | |
message(STATUS "-------------------------------------------------------------------") | |
set(FT_REQUIRE_HARFBUZZ ON CACHE BOOL "") | |
add_subdirectory(third-party/freetype) | |
message(STATUS "-------------------------------------------------------------------") | |
set(HB_HAVE_FREETYPE ON CACHE BOOL "") | |
set(HB_BUILD_SUBSET OFF CACHE BOOL "") | |
add_subdirectory(third-party/harfbuzz) | |
message(STATUS "-------------------------------------------------------------------") | |
file(WRITE ${CMAKE_CURRENT_LIST_DIR}/main.c [==[ | |
#include <freetype/freetype.h> | |
#include <hb.h> | |
#include <hb-ft.h> | |
int main() { | |
FT_New_Face(NULL, NULL, 0, NULL); | |
hb_ft_face_create(NULL, NULL); | |
} | |
]==]) | |
add_executable(freetype_harfbuzz main.c) | |
target_link_libraries(freetype_harfbuzz PRIVATE freetype harfbuzz) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment