mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 09:23:03 -04:00
CMake: Detect and use HarfBuzz when available
This commit is contained in:
parent
f701e36aa5
commit
15a78c55bc
29
cmake/modules/FindHarfBuzz.cmake
Normal file
29
cmake/modules/FindHarfBuzz.cmake
Normal file
@ -0,0 +1,29 @@
|
||||
# Filename: FindHarfBuzz.cmake
|
||||
# Authors: CFSworks (2 Nov, 2018)
|
||||
#
|
||||
# Usage:
|
||||
# find_package(HarfBuzz [REQUIRED] [QUIET])
|
||||
#
|
||||
# Once done this will define:
|
||||
# HARFBUZZ_FOUND - system has HarfBuzz
|
||||
# HARFBUZZ_INCLUDE_DIR - the include directory containing hb.h
|
||||
# HARFBUZZ_LIBRARY - the path to the HarfBuzz library
|
||||
#
|
||||
|
||||
if(NOT HARFBUZZ_INCLUDE_DIR)
|
||||
find_path(HARFBUZZ_INCLUDE_DIR
|
||||
NAMES "hb.h"
|
||||
PATH_SUFFIXES "harfbuzz")
|
||||
|
||||
mark_as_advanced(HARFBUZZ_INCLUDE_DIR)
|
||||
endif()
|
||||
|
||||
if(NOT HARFBUZZ_LIBRARY)
|
||||
find_library(HARFBUZZ_LIBRARY
|
||||
NAMES "harfbuzz")
|
||||
|
||||
mark_as_advanced(HARFBUZZ_LIBRARY)
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(HarfBuzz DEFAULT_MSG HARFBUZZ_INCLUDE_DIR HARFBUZZ_LIBRARY)
|
@ -308,12 +308,24 @@ endif()
|
||||
find_package(Freetype QUIET)
|
||||
|
||||
package_option(FREETYPE
|
||||
"This enables support for the FreeType font-rendering library. If disabled,
|
||||
"This enables support for the FreeType font-rendering library. If disabled,
|
||||
Panda3D will only be able to read fonts specially made with egg-mkfont."
|
||||
IMPORTED_AS freetype)
|
||||
|
||||
config_package(FREETYPE "FreeType")
|
||||
|
||||
# HarfBuzz
|
||||
|
||||
# Some versions of harfbuzz-config.cmake contain an endless while loop, so we
|
||||
# force MODULE mode here.
|
||||
find_package(HarfBuzz MODULE QUIET)
|
||||
|
||||
package_option(HARFBUZZ
|
||||
"This enables support for the HarfBuzz text shaping library."
|
||||
IMPORTED_AS harfbuzz::harfbuzz)
|
||||
|
||||
config_package(HARFBUZZ "HarfBuzz")
|
||||
|
||||
# GTK2
|
||||
|
||||
# Find and configure GTK
|
||||
|
@ -21,6 +21,9 @@
|
||||
/* Define if we have Freetype 2.0 or better available. */
|
||||
#cmakedefine HAVE_FREETYPE
|
||||
|
||||
/* Define if we have HarfBuzz available. */
|
||||
#cmakedefine HAVE_HARFBUZZ
|
||||
|
||||
/* Define if we want to compile in a default font. */
|
||||
#cmakedefine COMPILE_IN_DEFAULT_FONT
|
||||
|
||||
|
@ -36,7 +36,8 @@ set(P3TEXT_SOURCES
|
||||
composite_sources(p3text P3TEXT_SOURCES)
|
||||
add_component_library(p3text SYMBOL BUILDING_PANDA_TEXT
|
||||
${P3TEXT_HEADERS} ${P3TEXT_SOURCES})
|
||||
target_link_libraries(p3text p3parametrics)
|
||||
target_link_libraries(p3text p3parametrics
|
||||
PKG::HARFBUZZ)
|
||||
if(HAVE_FREETYPE)
|
||||
target_link_libraries(p3text p3pnmtext)
|
||||
endif()
|
||||
|
Loading…
x
Reference in New Issue
Block a user