[HarfBuzz] harfbuzz: Branch 'master' - 2 commits
Behdad Esfahbod
behdad at kemper.freedesktop.org
Tue May 16 21:01:39 UTC 2017
CMakeLists.txt | 70 ++++++++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 55 insertions(+), 15 deletions(-)
New commits:
commit 152736981d5bb9e098c1a8b86fcf8fe577a4a9ec
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date: Sat May 13 21:32:56 2017 +0430
[cmake] Add framework build support (#484)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5f6c3bad..b25cac0d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,20 @@
cmake_minimum_required(VERSION 2.8.0)
project(harfbuzz)
+
+## Limit framework build to Xcode generator
+if (BUILD_FRAMEWORK)
+ # for a framework on macOS, use `cmake .. -DBUILD_FRAMEWORK:BOOL=true -G Xcode`
+ if (NOT "${CMAKE_GENERATOR}" STREQUAL "Xcode")
+ message(FATAL_ERROR
+ "You should use Xcode generator with BUILD_FRAMEWORK enabled")
+ endif ()
+ set(CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD_32_64_BIT)")
+ set(CMAKE_MACOSX_RPATH ON)
+ set(BUILD_SHARED_LIBS ON)
+endif ()
+
+
## Disallow in-source builds, as CMake generated make files can collide with autotools ones
if (NOT MSVC AND "${PROJECT_BINARY_DIR}" STREQUAL "${PROJECT_SOURCE_DIR}")
message(FATAL_ERROR
@@ -55,7 +69,7 @@ if (WIN32 AND NOT MINGW AND BUILD_SHARED_LIBS)
endif ()
-## Detect if cmake is in distribution or regular repository folder
+## Detect if we are running inside a distribution or regular repository folder
set(IN_HB_DIST FALSE)
if (EXISTS "${PROJECT_SOURCE_DIR}/src/hb-version.h")
# perhaps we are on dist directory
@@ -112,8 +126,8 @@ set(HB_VERSION_MINOR ${CMAKE_MATCH_3})
set(HB_VERSION_MICRO ${CMAKE_MATCH_4})
+## Define ragel tasks
if (NOT IN_HB_DIST)
- ## Define ragel tasks
find_program(RAGEL "ragel")
if (RAGEL)
@@ -133,21 +147,23 @@ if (NOT IN_HB_DIST)
endforeach ()
mark_as_advanced(RAGEL)
+endif ()
- ## Generate hb-version.h
+## Generate hb-version.h
+if (NOT IN_HB_DIST)
set(HB_VERSION_H_IN "${PROJECT_SOURCE_DIR}/src/hb-version.h.in")
set(HB_VERSION_H "${PROJECT_BINARY_DIR}/src/hb-version.h")
set_source_files_properties("${HB_VERSION_H}" PROPERTIES GENERATED true)
configure_file("${HB_VERSION_H_IN}" "${HB_VERSION_H}.tmp" @ONLY)
execute_process(COMMAND "${CMAKE_COMMAND}" -E copy_if_different
"${HB_VERSION_H}.tmp"
- "${HB_VERSION_H}")
+ "${HB_VERSION_H}"
+ )
file(REMOVE "${HB_VERSION_H}.tmp")
-
-
endif ()
+
## Define sources and headers of the project
set(project_sources
${HB_BASE_sources}
@@ -214,7 +230,8 @@ if (HB_BUILTIN_UCDN)
list(APPEND project_sources
${PROJECT_SOURCE_DIR}/src/hb-ucdn.cc
- ${LIBHB_UCDN_sources})
+ ${LIBHB_UCDN_sources}
+ )
endif ()
if (HB_HAVE_GLIB)
@@ -329,6 +346,20 @@ add_library(harfbuzz ${project_sources} ${project_headers})
target_link_libraries(harfbuzz ${THIRD_PARTY_LIBS})
+## Additional framework build configs
+if (BUILD_FRAMEWORK)
+ set(CMAKE_MACOSX_RPATH ON)
+ set_target_properties(harfbuzz PROPERTIES
+ FRAMEWORK TRUE
+ PUBLIC_HEADER "${project_headers}"
+ XCODE_ATTRIBUTE_INSTALL_PATH "@rpath"
+ )
+ set(MACOSX_FRAMEWORK_IDENTIFIER "harfbuzz")
+ set(MACOSX_FRAMEWORK_SHORT_VERSION_STRING "${HB_VERSION}")
+ set(MACOSX_FRAMEWORK_BUNDLE_VERSION "${HB_VERSION}")
+endif ()
+
+
## Additional harfbuzz build artifacts
if (HB_BUILD_UTILS)
# https://github.com/WebKit/webkit/blob/master/Source/cmake/FindCairo.cmake
@@ -365,5 +396,6 @@ if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
+ FRAMEWORK DESTINATION Library/Frameworks
)
endif ()
commit bf50ddaf2b416bd80ae8849593bc745b578193d9
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date: Thu May 4 20:31:42 2017 +0430
[cmake] minor (#482)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 91e7eca0..5f6c3bad 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,8 +1,8 @@
cmake_minimum_required(VERSION 2.8.0)
project(harfbuzz)
-## Disallow in-source builds
-if ("${PROJECT_BINARY_DIR}" STREQUAL "${PROJECT_SOURCE_DIR}")
+## Disallow in-source builds, as CMake generated make files can collide with autotools ones
+if (NOT MSVC AND "${PROJECT_BINARY_DIR}" STREQUAL "${PROJECT_SOURCE_DIR}")
message(FATAL_ERROR
"
In-source builds are not permitted! Make a separate folder for"
@@ -14,7 +14,7 @@ Before that, remove the files created by this failed run with"
"
rm -rf CMakeCache.txt CMakeFiles")
endif ()
-##
+
## HarfBuzz build configurations
option(HB_HAVE_FREETYPE "Enable freetype interop helpers" OFF)
@@ -53,8 +53,9 @@ endif ()
if (WIN32 AND NOT MINGW AND BUILD_SHARED_LIBS)
add_definitions("-DHB_EXTERN=__declspec(dllexport) extern")
endif ()
-##
+
+## Detect if cmake is in distribution or regular repository folder
set(IN_HB_DIST FALSE)
if (EXISTS "${PROJECT_SOURCE_DIR}/src/hb-version.h")
# perhaps we are on dist directory
@@ -62,6 +63,7 @@ if (EXISTS "${PROJECT_SOURCE_DIR}/src/hb-version.h")
set(HB_VERSION_H "${PROJECT_SOURCE_DIR}/src/hb-version.h")
endif ()
+
## Extract variables from Makefile files
# http://stackoverflow.com/a/27630120/1414809
function (prepend var prefix)
@@ -108,7 +110,7 @@ set(HB_VERSION ${CMAKE_MATCH_1})
set(HB_VERSION_MAJOR ${CMAKE_MATCH_2})
set(HB_VERSION_MINOR ${CMAKE_MATCH_3})
set(HB_VERSION_MICRO ${CMAKE_MATCH_4})
-##
+
if (NOT IN_HB_DIST)
## Define ragel tasks
@@ -131,7 +133,7 @@ if (NOT IN_HB_DIST)
endforeach ()
mark_as_advanced(RAGEL)
- ##
+
## Generate hb-version.h
set(HB_VERSION_H_IN "${PROJECT_SOURCE_DIR}/src/hb-version.h.in")
@@ -142,7 +144,8 @@ if (NOT IN_HB_DIST)
"${HB_VERSION_H}.tmp"
"${HB_VERSION_H}")
file(REMOVE "${HB_VERSION_H}.tmp")
- ##
+
+
endif ()
## Define sources and headers of the project
@@ -161,6 +164,8 @@ set(project_headers
${HB_OT_headers}
)
+
+## Find and include needed header folders and libraries
if (HB_HAVE_FREETYPE)
add_definitions(-DHAVE_FREETYPE=1 -DHAVE_FT_FACE_GETCHARVARIANTINDEX=1)
@@ -285,7 +290,7 @@ if (WIN32 AND HB_HAVE_DIRECTWRITE)
list(APPEND THIRD_PARTY_LIBS dwrite rpcrt4)
endif ()
-##
+
## Atomic ops availability detection
file(WRITE "${PROJECT_BINARY_DIR}/try_compile_intel_atomic_primitives.c"
@@ -317,11 +322,14 @@ try_compile(HB_HAVE_SOLARIS_ATOMIC_OPS
if (HB_HAVE_SOLARIS_ATOMIC_OPS)
add_definitions(-DHAVE_SOLARIS_ATOMIC_OPS)
endif ()
-##
+
+## Define harfbuzz library
add_library(harfbuzz ${project_sources} ${project_headers})
target_link_libraries(harfbuzz ${THIRD_PARTY_LIBS})
+
+## Additional harfbuzz build artifacts
if (HB_BUILD_UTILS)
# https://github.com/WebKit/webkit/blob/master/Source/cmake/FindCairo.cmake
find_package(PkgConfig)
@@ -343,9 +351,10 @@ if (HB_BUILD_UTILS)
add_executable(hb-ot-shape-closure ${HB_OT_SHAPE_CLOSURE_sources})
target_link_libraries(hb-ot-shape-closure harfbuzz)
- mark_as_advanced(CAIRO_LIBRARIESNAMES)
+ mark_as_advanced(CAIRO_INCLUDE_DIRS CAIRO_LIBRARIESNAMES)
endif ()
+
## Install
if (NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL)
install(FILES ${project_headers} DESTINATION include/harfbuzz)
@@ -358,4 +367,3 @@ if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
RUNTIME DESTINATION bin
)
endif ()
-##
More information about the HarfBuzz
mailing list