ref: 02f2170432bf9f2c4bfa39d283b7152539edb814
parent: d7f4594317f4c180211a2a15e1909471b3b97a07
author: Alexey Petruchik <[email protected]>
date: Fri May 16 04:09:43 EDT 2014
[cmake] Add option to build OS X framework. * CMakeLists.txt: Update accordingly. * builds/mac/freetype-Info.plist: New file.
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,11 +16,16 @@
#
# cmake CMakeLists.txt
#
-# to create a Makefile that builds a static version of the library. For a
-# dynamic library, use
+# to create a Makefile that builds a static version of the library.
#
+# For a dynamic library, use
+#
# cmake CMakeLists.txt -DBUILD_SHARED_LIBS:BOOL=true
#
+# For a framework on OS X, use
+#
+# cmake CMakeLists.txt -DBUILD_FRAMEWORK:BOOL=true -G Xcode
+#
# instead. Please refer to the cmake manual for further options, in
# particular, how to modify compilation and linking parameters.
#
@@ -39,6 +44,14 @@
project(freetype)
+if (BUILD_FRAMEWORK)
+ 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(BUILD_SHARED_LIBS ON)
+endif ()
+
set(VERSION_MAJOR "2")
set(VERSION_MINOR "5")
set(VERSION_PATCH "3")
@@ -63,6 +76,10 @@
OUTPUT_FILE ${PROJECT_BINARY_DIR}/include/freetype2/ftconfig.h
)
+file(GLOB PUBLIC_HEADERS "include/*.h")
+file(GLOB PUBLIC_CONFIG_HEADERS "include/config/*.h")
+file(GLOB PRIVATE_HEADERS "include/internal/*.h")
+
set(BASE_SRCS
src/autofit/autofit.c
src/base/ftadvanc.c
@@ -126,8 +143,32 @@
include_directories("src/psaux")
include_directories("src/psnames")
-add_library(freetype ${BASE_SRCS})
+if (BUILD_FRAMEWORK)
+ set(BASE_SRCS
+ ${BASE_SRCS}
+ builds/mac/freetype-Info.plist
+ )
+endif ()
+add_library(freetype
+ ${PUBLIC_HEADERS}
+ ${PUBLIC_CONFIG_HEADERS}
+ ${PRIVATE_HEADERS}
+ ${BASE_SRCS}
+)
+
+if (BUILD_FRAMEWORK)
+ set_property(SOURCE ${PUBLIC_CONFIG_HEADERS}
+ PROPERTY MACOSX_PACKAGE_LOCATION Headers/config
+ )
+ set_target_properties(freetype PROPERTIES
+ FRAMEWORK TRUE
+ MACOSX_FRAMEWORK_INFO_PLIST builds/mac/freetype-Info.plist
+ PUBLIC_HEADER "${PUBLIC_HEADERS}"
+ XCODE_ATTRIBUTE_INSTALL_PATH "@rpath"
+ )
+endif ()
+
# Installations
# Note the trailing slash in the argument to the `DIRECTORY' directive
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/
@@ -138,6 +179,7 @@
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
+ FRAMEWORK DESTINATION Library/Frameworks
)
# Packaging
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2014-05-16 Alexey Petruchik <[email protected]>
+
+ [cmake] Add option to build OS X framework.
+
+ * CMakeLists.txt: Update accordingly.
+
+ * builds/mac/freetype-Info.plist: New file.
+
2014-05-13 Pavel Koshevoy <[email protected]>
* CMakeLists.txt (BASE_SRCS): Add missing `ftbdf.c'.
--- /dev/null
+++ b/builds/mac/freetype-Info.plist
@@ -1,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
+ "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+
+<plist version="1.0">
+
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+
+ <key>CFBundleExecutable</key>
+ <string>FreeType</string>
+
+ <key>CFBundleGetInfoString</key>
+ <string>FreeType ${PROJECT_VERSION}</string>
+
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+
+ <key>CFBundleName</key>
+ <string>FreeType</string>
+
+ <key>CFBundlePackageType</key>
+ <string>FMWK</string>
+
+ <key>CFBundleShortVersionString</key>
+ <string>${PROJECT_VERSION}</string>
+
+ <key>CFBundleSignature</key>
+ <string>????</string>
+
+ <key>CFBundleVersion</key>
+ <string>${PROJECT_VERSION}</string>
+</dict>
+
+</plist>