-
Notifications
You must be signed in to change notification settings - Fork 8
/
CMakeLists.txt
208 lines (183 loc) · 6.11 KB
/
CMakeLists.txt
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
PROJECT(osgPango)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/etc/")
# Use a debug postfix to distinguish build products. Mostly important on
# Windows, because linking a debug library into a release executable (or
# vice-versa, or just mixing C++ runtime versions) on Windows will lead
# to crashes if the libraries use the C++ runtime.
SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Add a postfix, usually d on windows")
# On GCC, we need to set these compiler flags.
IF(NOT WIN32)
SET(CMAKE_CXX_FLAGS "-W -Wall -Wno-unused")
ENDIF(NOT WIN32)
IF(NOT WIN32)
INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(CAIRO REQUIRED cairo)
PKG_CHECK_MODULES(PANGO REQUIRED pango)
PKG_CHECK_MODULES(PANGOCAIRO REQUIRED pangocairo)
ELSE(NOT WIN32)
FIND_PACKAGE(Win32GTKBundle)
ENDIF(NOT WIN32)
SET(OPENSCENEGRAPH_INCLUDE_DIR "" CACHE PATH "Location of the OSG include headers.")
SET(OPENSCENEGRAPH_LIB_DIR "" CACHE PATH "Location of the the OSG library objects.")
SET(OSGCAIRO_INCLUDE_DIR "" CACHE PATH "Location of the osgCairo include headers.")
SET(OSGCAIRO_LIB_DIR "" CACHE PATH "Location of the osgCairo library objects.")
SET(SRC_FILES
"src/Context.cpp"
"src/DistanceFieldText.cpp"
"src/Glyph.cpp"
"src/GlyphLayerInterface.cpp"
"src/GlyphLayer.cpp"
"src/GlyphRenderer.cpp"
"src/ShaderGenerator.cpp"
"src/ShaderManager.cpp"
"src/Text.cpp"
"src/TextTransform.cpp"
"src/Util.cpp"
"src/VerticalText.cpp"
)
SET(SRC_LAYER_FILES
"src/layers/Bitmap.cpp"
"src/layers/Bevel.cpp"
"src/layers/DistanceField.cpp"
"src/layers/Outline.cpp"
"src/layers/ShadowBlur.cpp"
"src/layers/ShadowInset.cpp"
"src/layers/Shadow.cpp"
)
SET(SRC_RENDERER_FILES
"src/renderers/Default.cpp"
"src/renderers/DistanceField.cpp"
"src/renderers/Outline.cpp"
"src/renderers/ShadowBlur.cpp"
"src/renderers/ShadowInset.cpp"
"src/renderers/Shadow.cpp"
)
SET(SRC_SERIALIZER_FILES
"src/serializers/Glyph.cpp"
"src/serializers/GlyphRenderer.cpp"
"src/serializers/LibraryWrapper.cpp"
"src/serializers/renderers/Default.cpp"
"src/serializers/renderers/Outline.cpp"
"src/serializers/renderers/Shadow.cpp"
)
SET(HEADER_FILES
"${osgPango_SOURCE_DIR}/include/osgPango/Context"
"${osgPango_SOURCE_DIR}/include/osgPango/Export"
"${osgPango_SOURCE_DIR}/include/osgPango/Glyph"
"${osgPango_SOURCE_DIR}/include/osgPango/GlyphLayerInterface"
"${osgPango_SOURCE_DIR}/include/osgPango/GlyphLayer"
"${osgPango_SOURCE_DIR}/include/osgPango/GlyphRenderer"
"${osgPango_SOURCE_DIR}/include/osgPango/Serialize"
"${osgPango_SOURCE_DIR}/include/osgPango/ShaderGenerator"
"${osgPango_SOURCE_DIR}/include/osgPango/ShaderManager"
"${osgPango_SOURCE_DIR}/include/osgPango/String"
"${osgPango_SOURCE_DIR}/include/osgPango/Text"
"${osgPango_SOURCE_DIR}/include/osgPango/TextTransform"
"${osgPango_SOURCE_DIR}/include/osgPango/Util"
"${osgPango_SOURCE_DIR}/include/osgPango/Version"
"${osgPango_SOURCE_DIR}/include/osgPango/VerticalText"
)
SOURCE_GROUP("Header Files" FILES ${HEADER_FILES})
SOURCE_GROUP("Source Files" FILES ${SRC_FILES})
SOURCE_GROUP("Source Files\\Layers" FILES ${SRC_LAYER_FILES})
SOURCE_GROUP("Source Files\\Renderers" FILES ${SRC_RENDERER_FILES})
SOURCE_GROUP("Source Files\\Serializers" FILES ${SRC_SERIALIZER_FILES})
INCLUDE_DIRECTORIES(include
${OPENSCENEGRAPH_INCLUDE_DIR}
${OSGCAIRO_INCLUDE_DIR}
${CAIRO_INCLUDE_DIRS}
${PANGOCAIRO_INCLUDE_DIRS}
${GLIB_INCLUDE_DIRS}
${GLIBCONFIG_INCLUDE_DIRS}
${FONTCONFIG_INCLUDE_DIRS}
)
LINK_DIRECTORIES(
${OPENSCENEGRAPH_LIB_DIR}
${OSGCAIRO_LIB_DIR}
${PANGOCAIRO_LIBRARY_DIRS}
)
ADD_LIBRARY(osgPango SHARED
${SRC_FILES}
${SRC_LAYER_FILES}
${SRC_RENDERER_FILES}
${SRC_SERIALIZER_FILES}
${HEADER_FILES}
)
# Add debug postfix to OSG libraries so we link to the right ones in debug.
# Cairo, pango, pangocairo and the gtk libs are C-only libraries so the same
# one (release) can be linked to both debug and release without problems.
TARGET_LINK_LIBRARIES(osgPango
debug OpenThreads${CMAKE_DEBUG_POSTFIX}
optimized OpenThreads
debug osg${CMAKE_DEBUG_POSTFIX}
optimized osg
debug osgText${CMAKE_DEBUG_POSTFIX}
optimized osgText
debug osgDB${CMAKE_DEBUG_POSTFIX}
optimized osgDB
debug osgUtil${CMAKE_DEBUG_POSTFIX}
optimized osgUtil
debug osgCairo${CMAKE_DEBUG_POSTFIX}
optimized osgCairo
debug cairo
optimized cairo
debug pango-1.0
optimized pango-1.0
debug pangocairo-1.0
optimized pangocairo-1.0
debug gobject-2.0
optimized gobject-2.0
debug glib-2.0
optimized glib-2.0
debug fontconfig
optimized fontconfig
)
# The archive/runtime part is so that the lib/dll pair goes into lib and bin
# respectively on Windows.
INSTALL(TARGETS osgPango
ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
)
FOREACH(INCLUDEFILE ${HEADER_FILES})
FILE(RELATIVE_PATH REL_INCLUDEFILE ${osgPango_SOURCE_DIR}/include/osgPango ${INCLUDEFILE})
GET_FILENAME_COMPONENT(REL_INCLUDE_PATH ${REL_INCLUDEFILE} PATH)
INSTALL(
FILES ${INCLUDEFILE}
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/osgPango/${REL_INCLUDE_PATH}
)
ENDFOREACH(INCLUDEFILE)
ADD_SUBDIRECTORY(applications/osgpango-gr-cache)
ADD_SUBDIRECTORY(examples/osgpangoanimation)
ADD_SUBDIRECTORY(examples/osgpangocomplexrenderer)
ADD_SUBDIRECTORY(examples/osgpangodistancefield)
ADD_SUBDIRECTORY(examples/osgpangofonts)
ADD_SUBDIRECTORY(examples/osgpangoglsl)
#ADD_SUBDIRECTORY(examples/osgpangoguiviewer)
ADD_SUBDIRECTORY(examples/osgpangosimplerenderer)
#ADD_SUBDIRECTORY(examples/osgpangothreaded)
ADD_SUBDIRECTORY(examples/osgpangoupdatecb)
ADD_SUBDIRECTORY(examples/osgpangovertical)
ADD_SUBDIRECTORY(examples/osgpangoviewer)
CONFIGURE_FILE(
"${CMAKE_CURRENT_SOURCE_DIR}/etc/uninstall.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/uninstall.cmake"
IMMEDIATE @ONLY
)
ADD_CUSTOM_TARGET(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/uninstall.cmake"
)
# Packaging information.
SET(CPACK_GENERATOR TGZ)
SET(CPACK_SOURCE_GENERATOR TGZ)
SET(CPACK_SOURCE_IGNORE_FILES
"~$"
".*.svn"
".*build/"
".*debug/"
".*release/"
)
SET(OSGPANGO_VERSION "2.2.0")
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "osgPango-${OSGPANGO_VERSION}")
INCLUDE(CPack)