[cmake] Add option to build OS X framework. * CMakeLists.txt: Update accordingly. * builds/mac/freetype-Info.plist: New file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 85e8e18..df77d96 100644
--- 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 @@ cmake_minimum_required(VERSION 2.6)
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 @@ execute_process(
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,7 +143,31 @@ include_directories("src/raster")
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
@@ -138,6 +179,7 @@ install(TARGETS freetype
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
+ FRAMEWORK DESTINATION Library/Frameworks
)
# Packaging
diff --git a/ChangeLog b/ChangeLog
index b9cd440..16c9cfb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2014-05-16 Alexey Petruchik <alexey.petruchik@gmail.com>
+
+ [cmake] Add option to build OS X framework.
+
+ * CMakeLists.txt: Update accordingly.
+
+ * builds/mac/freetype-Info.plist: New file.
+
2014-05-13 Pavel Koshevoy <pkoshevoy@gmail.com>
* CMakeLists.txt (BASE_SRCS): Add missing `ftbdf.c'.
diff --git a/builds/mac/freetype-Info.plist b/builds/mac/freetype-Info.plist
new file mode 100644
index 0000000..b3d114d
--- /dev/null
+++ b/builds/mac/freetype-Info.plist
@@ -0,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>