@ -1,4 +1,4 @@
cmake_minimum_required ( VERSION 3.1 )
cmake_minimum_required ( VERSION 3.12 )
project ( harfbuzz )
message ( WARN "HarfBuzz has a Meson port and tries to migrate all the other build systems to it, please consider using it as we might remove our cmake port soon." )
@ -107,12 +107,17 @@ if (${HAVE_STDBOOL_H})
add_definitions ( -DHAVE_STDBOOL_H )
endif ( )
# T h e s e w i l l b e u s e d w h i l e m a k i n g p k g - c o n f i g . p c f i l e s
set ( PC_REQUIRES_PRIV "" )
set ( PC_LIBS_PRIV "" )
if ( NOT MSVC )
set ( THREADS_PREFER_PTHREAD_FLAG ON )
find_package ( Threads )
if ( CMAKE_USE_PTHREADS_INIT )
add_definitions ( "-DHAVE_PTHREAD" )
list ( APPEND THIRD_PARTY_LIBS Threads::Threads )
list ( APPEND PC_LIBS_PRIV -pthread )
endif ( )
endif ( )
@ -208,6 +213,10 @@ if (HB_HAVE_FREETYPE AND NOT TARGET freetype)
check_funcs ( FT_Get_Var_Blend_Coordinates FT_Set_Var_Blend_Coordinates FT_Done_MM_Var )
endif ( )
if ( HB_HAVE_FREETYPE )
list ( APPEND PC_REQUIRES_PRIV "freetype2 >= 12.0.6" )
endif ( )
if ( HB_HAVE_GRAPHITE2 )
add_definitions ( -DHAVE_GRAPHITE2 )
@ -220,6 +229,8 @@ if (HB_HAVE_GRAPHITE2)
list ( APPEND THIRD_PARTY_LIBS ${ GRAPHITE2_LIBRARY } )
list ( APPEND PC_REQUIRES_PRIV "graphite2 >= 1.2.0" )
mark_as_advanced ( GRAPHITE2_INCLUDE_DIR GRAPHITE2_LIBRARY )
endif ( )
@ -240,6 +251,8 @@ if (HB_HAVE_GLIB)
list ( APPEND THIRD_PARTY_LIBS ${ GLIB_LIBRARIES } )
list ( APPEND PC_REQUIRES_PRIV "glib-2.0 >= 2.19.1" )
mark_as_advanced ( GLIB_LIBRARIES GLIBCONFIG_INCLUDE_DIR GLIB_INCLUDE_DIR )
endif ( )
@ -272,24 +285,28 @@ if (APPLE AND HB_HAVE_CORETEXT)
find_library ( COREFOUNDATION CoreFoundation )
if ( COREFOUNDATION )
list ( APPEND THIRD_PARTY_LIBS ${ COREFOUNDATION } )
list ( APPEND PC_LIBS_PRIV "-framework CoreFoundation" )
endif ( )
mark_as_advanced ( COREFOUNDATION )
find_library ( CORETEXT CoreText )
if ( CORETEXT )
list ( APPEND THIRD_PARTY_LIBS ${ CORETEXT } )
list ( APPEND PC_LIBS_PRIV "-framework CoreText" )
endif ( )
mark_as_advanced ( CORETEXT )
find_library ( COREGRAPHICS CoreGraphics )
if ( COREGRAPHICS )
list ( APPEND THIRD_PARTY_LIBS ${ COREGRAPHICS } )
list ( APPEND PC_LIBS_PRIV "-framework CoreGraphics" )
endif ( )
mark_as_advanced ( COREGRAPHICS )
else ( )
find_library ( APPLICATION_SERVICES_FRAMEWORK ApplicationServices )
if ( APPLICATION_SERVICES_FRAMEWORK )
list ( APPEND THIRD_PARTY_LIBS ${ APPLICATION_SERVICES_FRAMEWORK } )
list ( APPEND PC_LIBS_PRIV "-framework ApplicationServices" )
endif ( )
mark_as_advanced ( APPLICATION_SERVICES_FRAMEWORK )
@ -300,12 +317,14 @@ if (WIN32 AND HB_HAVE_GDI)
add_definitions ( -DHAVE_GDI )
list ( APPEND project_headers ${ PROJECT_SOURCE_DIR } /src/hb-gdi.h )
list ( APPEND THIRD_PARTY_LIBS gdi32 )
list ( APPEND PC_LIBS_PRIV -lgdi32 )
endif ( )
if ( WIN32 AND HB_HAVE_UNISCRIBE )
add_definitions ( -DHAVE_UNISCRIBE )
list ( APPEND project_headers ${ PROJECT_SOURCE_DIR } /src/hb-uniscribe.h )
list ( APPEND THIRD_PARTY_LIBS usp10 gdi32 rpcrt4 )
list ( APPEND PC_LIBS_PRIV -lusp10 -lgdi32 -lrpcrt4 )
endif ( )
if ( WIN32 AND HB_HAVE_DIRECTWRITE )
@ -701,6 +720,44 @@ if (NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL)
endif ( )
endif ( )
# g e t t h e s e v a r i a b l e s i n t h e r e q u i r e d f o r m a t
list ( REMOVE_DUPLICATES PC_REQUIRES_PRIV )
string ( REPLACE ";" ", " PC_REQUIRES_PRIV "${PC_REQUIRES_PRIV}" )
list ( REMOVE_DUPLICATES PC_LIBS_PRIV )
string ( REPLACE ";" " " PC_LIBS_PRIV "${PC_LIBS_PRIV}" )
# M a c r o t o w r i t e p k g - c o n f i g . p c c o n f i g u r a t i o n f i l e s
macro ( make_pkgconfig_pc_file name )
file ( READ "${PROJECT_SOURCE_DIR}/src/${name}.pc.in" FSTR )
string ( REPLACE "%prefix%" "${CMAKE_INSTALL_PREFIX}" FSTR ${ FSTR } )
string ( REPLACE "%exec_prefix%" "\${prefix}" FSTR ${ FSTR } )
if ( IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}" )
string ( REPLACE "%includedir%" "${CMAKE_INSTALL_INCLUDEDIR}" FSTR ${ FSTR } )
else ( )
string ( REPLACE "%includedir%" "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}" FSTR ${ FSTR } )
endif ( )
if ( IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}" )
string ( REPLACE "%libdir%" "${CMAKE_INSTALL_LIBDIR}" FSTR ${ FSTR } )
else ( )
string ( REPLACE "%libdir%" "\${prefix}/${CMAKE_INSTALL_LIBDIR}" FSTR ${ FSTR } )
endif ( )
string ( REPLACE "%VERSION%" "${HB_VERSION}" FSTR ${ FSTR } )
string ( REPLACE "%requires_private%" "${PC_REQUIRES_PRIV}" FSTR ${ FSTR } )
string ( REPLACE "%libs_private%" "${PC_LIBS_PRIV}" FSTR ${ FSTR } )
file ( WRITE "${PROJECT_BINARY_DIR}/${name}.pc" ${ FSTR } )
install (
F I L E S " $ { P R O J E C T _ B I N A R Y _ D I R } / $ { n a m e } . p c "
D E S T I N A T I O N " $ { C M A K E _ I N S T A L L _ L I B D I R } / p k g c o n f i g "
C O M P O N E N T p k g c o n f i g
)
endmacro ( make_pkgconfig_pc_file )
if ( NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
install ( TARGETS harfbuzz
E X P O R T h a r f b u z z C o n f i g
@ -709,6 +766,7 @@ if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
R U N T I M E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ B I N D I R }
F R A M E W O R K D E S T I N A T I O N L i b r a r y / F r a m e w o r k s
)
make_pkgconfig_pc_file ( "harfbuzz" )
install ( EXPORT harfbuzzConfig
N A M E S P A C E h a r f b u z z : :
D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R } / c m a k e / h a r f b u z z
@ -720,11 +778,13 @@ if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
R U N T I M E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ B I N D I R }
F R A M E W O R K D E S T I N A T I O N L i b r a r y / F r a m e w o r k s
)
make_pkgconfig_pc_file ( "harfbuzz-icu" )
endif ( )
if ( HB_BUILD_SUBSET )
install ( TARGETS harfbuzz-subset
A R C H I V E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
)
)
make_pkgconfig_pc_file ( "harfbuzz-subset" )
endif ( )
if ( HB_BUILD_UTILS )
if ( WIN32 AND BUILD_SHARED_LIBS )
@ -753,6 +813,7 @@ if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
L I B R A R Y D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
R U N T I M E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ B I N D I R }
)
make_pkgconfig_pc_file ( "harfbuzz-gobject" )
if ( HB_HAVE_INTROSPECTION )
if ( "${CMAKE_GENERATOR}" MATCHES "Visual Studio*" )
set ( hb_libpath "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>" )