Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add HarfBuzz support #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add HarfBuzz support
Closes #3079
h3xx committed Aug 27, 2021
commit 6ff41dd5e8b7230f6b776240328171d79b78db2a
65 changes: 65 additions & 0 deletions cmake/FindHarfBuzz.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# https://raw.githubusercontent.com/SFTtech/openage/master/buildsystem/modules/FindHarfBuzz.cmake
# Copyright 2015-2016 the openage authors. See copying.md for legal info.

# FindHarfBuzz
# ---------
#
# Locate HarfBuzz, the awesome text shaping library.
#
# The module defines the following variables:
#
# ::
#
# HarfBuzz_FOUND - Found HarfBuzz library
# HarfBuzz_INCLUDE_DIRS - HarfBuzz include directories
# HarfBuzz_LIBRARIES - The libraries needed to use HarfBuzz
# HarfBuzz_VERSION_STRING - the version of HarfBuzz found
#
# Example Usage:
#
# ::
#
# find_package(HarfBuzz REQUIRED)
# include_directories(${HarfBuzz_INCLUDE_DIRS})
#
# ::
#
# add_executable(foo foo.cc)
# target_link_libraries(foo ${HarfBuzz_LIBRARIES})

find_path(HarfBuzz_INCLUDE_DIR hb.h
PATH_SUFFIXES
harfbuzz
)

find_library(HarfBuzz_LIBRARY
NAMES harfbuzz libharfbuzz
PATH_SUFFIXES lib64 lib
)

if(HarfBuzz_INCLUDE_DIR)
set(HarfBuzz_VERSION_FILE "${HarfBuzz_INCLUDE_DIR}/harfbuzz/hb-version.h")
if(EXISTS "${HarfBuzz_VERSION_FILE}")
file(STRINGS "${HarfBuzz_VERSION_FILE}" hb_version_str
REGEX "^#define[\t ]+HB_VERSION_STRING[\t ]+\".*\"")

string(REGEX REPLACE "^#define[\t ]+HB_VERSION_STRING[\t ]+\"([^\"]*)\".*" "\\1"
HarfBuzz_VERSION_STRING "${hb_version_str}")
unset(hb_version_str)
endif()
unset(HarfBuzz_VERSION_FILE)
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(HarfBuzz
FOUND_VAR HarfBuzz_FOUND
REQUIRED_VARS HarfBuzz_LIBRARY HarfBuzz_INCLUDE_DIR
VERSION_VAR HarfBuzz_VERSION_STRING
)

if(HarfBuzz_FOUND)
set(HarfBuzz_INCLUDE_DIRS "${HarfBuzz_INCLUDE_DIR}")
set(HarfBuzz_LIBRARIES "${HarfBuzz_LIBRARY}")
endif()

mark_as_advanced(HarfBuzz_INCLUDE_DIR HarfBuzz_LIBRARY)
1 change: 1 addition & 0 deletions cmake/FindPango.cmake
Original file line number Diff line number Diff line change
@@ -30,6 +30,7 @@
find_package(PkgConfig)

set(Pango_DEPS
HarfBuzz
GLib)

if(PKG_CONFIG_FOUND)