[cmake] Add option to build OS X framework.

* CMakeLists.txt: Update accordingly.

* builds/mac/freetype-Info.plist: New file.
This commit is contained in:
Alexey Petruchik 2014-05-16 08:09:43 +02:00 committed by Werner Lemberg
parent d7f4594317
commit 02f2170432
3 changed files with 89 additions and 3 deletions

View File

@ -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

View File

@ -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'.

View File

@ -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>