-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
133 lines (110 loc) · 3.63 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
PROJECT(osgCairo)
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_C_FLAGS "-Wall -Wextra -Wno-unused-parameter ${CMAKE_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-unused-parameter ${CMAKE_CXX_FLAGS}")
ENDIF(NOT WIN32)
IF(NOT WIN32)
INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(CAIRO REQUIRED cairo)
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(SRC_FILES
"src/Image.cpp"
"src/LibraryWrapper.cpp"
"src/ReadFile.cpp"
"src/Util.cpp"
"ext/cairocks/src/distance-field.c"
"ext/cairocks/src/emboss.c"
"ext/cairocks/src/gaussian-blur.c"
"ext/cairocks/src/invert.c"
"ext/cairocks/src/map-path-onto.c"
"ext/cairocks/src/rounded.c"
)
SET(HEADER_PATH ${osgCairo_SOURCE_DIR}/include/osgCairo)
SET(HEADER_FILES
"${HEADER_PATH}/Export"
"${HEADER_PATH}/Image"
"${HEADER_PATH}/ReadFile"
"${HEADER_PATH}/Util"
"${HEADER_PATH}/Version"
)
# "${PROJECT_SOURCE_DIR}/ext/cairocks/src/cairocks.h"
SOURCE_GROUP("Header Files" FILES ${HEADER_FILES})
SOURCE_GROUP("Source Files" FILES ${SRC_FILES})
INCLUDE_DIRECTORIES(
include
ext/cairocks/src
${OPENSCENEGRAPH_INCLUDE_DIR}
${CAIRO_INCLUDE_DIRS}
)
LINK_DIRECTORIES(
${OPENSCENEGRAPH_LIB_DIR}
${CAIRO_LIBRARY_DIRS}
)
ADD_LIBRARY(osgCairo SHARED ${HEADER_FILES} ${SRC_FILES})
# Add debug postfix to OSG libraries so we link to the right ones in debug.
# Cairo is a C-only library so the same one (release) can be linked to both
# debug and release without problems.
TARGET_LINK_LIBRARIES(osgCairo
debug OpenThreads${CMAKE_DEBUG_POSTFIX}
optimized OpenThreads
debug osg${CMAKE_DEBUG_POSTFIX}
optimized osg
debug osgDB${CMAKE_DEBUG_POSTFIX}
optimized osgDB
debug cairo
optimized cairo
)
# The archive/runtime part is so that the lib/dll pair goes into lib and bin
# respectively on Windows.
INSTALL(TARGETS osgCairo
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 ${osgCairo_SOURCE_DIR}/include/osgCairo ${INCLUDEFILE})
GET_FILENAME_COMPONENT(REL_INCLUDE_PATH ${REL_INCLUDEFILE} PATH)
INSTALL(
FILES ${INCLUDEFILE}
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/osgCairo/${REL_INCLUDE_PATH}
)
ENDFOREACH(INCLUDEFILE)
ADD_SUBDIRECTORY(examples/osgcairodistancefield)
ADD_SUBDIRECTORY(examples/osgcairodrawspeed)
# ADD_SUBDIRECTORY(examples/osgcairoroads)
ADD_SUBDIRECTORY(examples/osgcairotests)
ADD_SUBDIRECTORY(examples/osgcairoutil)
ADD_SUBDIRECTORY(examples/osgcairoviewer)
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(OSGCAIRO_VERSION "1.5.0")
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "osgCairo-${OSGCAIRO_VERSION}")
INCLUDE(CPack)