|
1 # GRAPHITE2 LICENSING |
|
2 # |
|
3 # Copyright 2010, SIL International |
|
4 # All rights reserved. |
|
5 # |
|
6 # This library is free software; you can redistribute it and/or modify |
|
7 # it under the terms of the GNU Lesser General Public License as published |
|
8 # by the Free Software Foundation; either version 2.1 of License, or |
|
9 # (at your option) any later version. |
|
10 # |
|
11 # This program is distributed in the hope that it will be useful, |
|
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
14 # Lesser General Public License for more details. |
|
15 # |
|
16 # You should also have received a copy of the GNU Lesser General Public |
|
17 # License along with this library in the file named "LICENSE". |
|
18 # If not, write to the Free Software Foundation, 51 Franklin Street, |
|
19 # Suite 500, Boston, MA 02110-1335, USA or visit their web page on the |
|
20 # internet at http://www.fsf.org/licenses/lgpl.html. |
|
21 |
|
22 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR) |
|
23 project(graphite2_core) |
|
24 cmake_policy(SET CMP0012 NEW) |
|
25 INCLUDE(CheckCXXSourceCompiles) |
|
26 |
|
27 set(GRAPHITE_API_CURRENT 3) |
|
28 set(GRAPHITE_API_REVISION 0) |
|
29 set(GRAPHITE_API_AGE 1) |
|
30 set(GRAPHITE_VERSION ${GRAPHITE_API_CURRENT}.${GRAPHITE_API_REVISION}.${GRAPHITE_API_AGE}) |
|
31 set(GRAPHITE_SO_VERSION ${GRAPHITE_API_CURRENT}) |
|
32 |
|
33 include(TestBigEndian) |
|
34 |
|
35 include_directories(${PROJECT_SOURCE_DIR}) |
|
36 |
|
37 set(SEGCACHE SegCache.cpp SegCacheEntry.cpp SegCacheStore.cpp) |
|
38 if (GRAPHITE2_NSEGCACHE) |
|
39 add_definitions(-DGRAPHITE2_NSEGCACHE) |
|
40 set(SEGCACHE) |
|
41 endif (GRAPHITE2_NSEGCACHE) |
|
42 |
|
43 set(FILEFACE FileFace.cpp) |
|
44 if (GRAPHITE2_NFILEFACE) |
|
45 add_definitions(-DGRAPHITE2_NFILEFACE) |
|
46 set(FILEFACE) |
|
47 endif (GRAPHITE2_NFILEFACE) |
|
48 |
|
49 set(TRACING json.cpp) |
|
50 if (GRAPHITE2_NTRACING) |
|
51 add_definitions(-DGRAPHITE2_NTRACING) |
|
52 set(TRACING) |
|
53 endif (GRAPHITE2_NTRACING) |
|
54 |
|
55 if (GRAPHITE2_TELEMETRY) |
|
56 add_definitions(-DGRAPHITE2_TELEMETRY) |
|
57 endif (GRAPHITE2_TELEMETRY) |
|
58 |
|
59 set(GRAPHITE_HEADERS |
|
60 ../include/graphite2/Font.h |
|
61 ../include/graphite2/Segment.h |
|
62 ../include/graphite2/Types.h |
|
63 ../include/graphite2/Log.h |
|
64 ) |
|
65 |
|
66 file(GLOB PRIVATE_HEADERS inc/*.h) |
|
67 |
|
68 add_library(graphite2 SHARED |
|
69 ${GRAPHITE2_VM_TYPE}_machine.cpp |
|
70 gr_char_info.cpp |
|
71 gr_features.cpp |
|
72 gr_face.cpp |
|
73 gr_font.cpp |
|
74 gr_logging.cpp |
|
75 gr_segment.cpp |
|
76 gr_slot.cpp |
|
77 Bidi.cpp |
|
78 CachedFace.cpp |
|
79 CmapCache.cpp |
|
80 Code.cpp |
|
81 Face.cpp |
|
82 FeatureMap.cpp |
|
83 Font.cpp |
|
84 GlyphFace.cpp |
|
85 GlyphCache.cpp |
|
86 Justifier.cpp |
|
87 NameTable.cpp |
|
88 Pass.cpp |
|
89 Rule.cpp |
|
90 Segment.cpp |
|
91 Silf.cpp |
|
92 Slot.cpp |
|
93 Sparse.cpp |
|
94 TtfUtil.cpp |
|
95 UtfCodec.cpp |
|
96 ${FILEFACE} |
|
97 ${SEGCACHE} |
|
98 ${TRACING}) |
|
99 |
|
100 set_target_properties(graphite2 PROPERTIES PUBLIC_HEADER "${GRAPHITE_HEADERS}" |
|
101 SOVERSION ${GRAPHITE_SO_VERSION} |
|
102 VERSION ${GRAPHITE_VERSION} |
|
103 LT_VERSION_CURRENT ${GRAPHITE_API_CURRENT} |
|
104 LT_VERSION_REVISION ${GRAPHITE_API_REVISION} |
|
105 LT_VERSION_AGE ${GRAPHITE_API_AGE}) |
|
106 |
|
107 if (${CMAKE_BUILD_TYPE} STREQUAL "ClangASN") |
|
108 set(GRAPHITE_LINK_FLAGS "-fsanitize=address") |
|
109 else (${CMAKE_BUILD_TYPE} STREQUAL "ClangASN") |
|
110 set(GRAPHITE_LINK_FLAGS "") |
|
111 endif (${CMAKE_BUILD_TYPE} STREQUAL "ClangASN") |
|
112 |
|
113 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") |
|
114 set_target_properties(graphite2 PROPERTIES |
|
115 COMPILE_FLAGS "-Wall -Wextra -Wno-unknown-pragmas -Wendif-labels -Wshadow -Wctor-dtor-privacy -Wnon-virtual-dtor -fno-rtti -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden -fno-stack-protector" |
|
116 LINK_FLAGS "-nodefaultlibs ${GRAPHITE_LINK_FLAGS}" |
|
117 LINKER_LANGUAGE C) |
|
118 if (${CMAKE_CXX_COMPILER} MATCHES ".*mingw.*") |
|
119 target_link_libraries(graphite2 kernel32 msvcr90 mingw32 gcc user32) |
|
120 else (${CMAKE_CXX_COMPILER} MATCHES ".*mingw.*") |
|
121 if (GRAPHITE2_ASAN) |
|
122 target_link_libraries(graphite2 c gcc_s) |
|
123 else (GRAPHITE2_ASAN) |
|
124 target_link_libraries(graphite2 c gcc) |
|
125 endif (GRAPHITE2_ASAN) |
|
126 include(Graphite) |
|
127 nolib_test(stdc++ $<TARGET_SONAME_FILE:graphite2>) |
|
128 endif (${CMAKE_CXX_COMPILER} MATCHES ".*mingw.*") |
|
129 set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "") |
|
130 CREATE_LIBTOOL_FILE(graphite2 "/lib${LIB_SUFFIX}") |
|
131 endif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") |
|
132 |
|
133 if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") |
|
134 set_target_properties(graphite2 PROPERTIES |
|
135 COMPILE_FLAGS "-Wall -Wextra -Wno-unknown-pragmas -Wendif-labels -Wshadow -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -fno-rtti -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden -fno-stack-protector" |
|
136 LINK_FLAGS "-nodefaultlibs" |
|
137 LINKER_LANGUAGE C) |
|
138 target_link_libraries(graphite2 c) |
|
139 include(Graphite) |
|
140 nolib_test(stdc++ $<TARGET_SONAME_FILE:graphite2>) |
|
141 set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "") |
|
142 CREATE_LIBTOOL_FILE(graphite2 "/lib${LIB_SUFFIX}") |
|
143 endif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") |
|
144 |
|
145 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") |
|
146 set_target_properties(graphite2 PROPERTIES |
|
147 COMPILE_DEFINITIONS "_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;UNICODE;GRAPHITE2_EXPORTING") |
|
148 endif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") |
|
149 |
|
150 |
|
151 install(TARGETS graphite2 EXPORT graphite2 LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX} PUBLIC_HEADER DESTINATION include/graphite2 RUNTIME DESTINATION bin) |
|
152 install(EXPORT graphite2 DESTINATION share/graphite2 NAMESPACE gr2_) |