-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
184 lines (151 loc) · 5.72 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
project(vartypes)
cmake_minimum_required(VERSION 2.4)
find_package(Qt4 REQUIRED)
include(${QT_USE_FILE})
include_directories(${src_dir}/vartypes)
include_directories(${src_dir}/vartypes/primitives)
include_directories(${src_dir}/vartypes/enhanced)
include_directories(${src_dir}/vartypes/gui)
include_directories(${src_dir}/vartypes/xml)
set(src_dir .)
set(SRCS
${src_dir}/vartypes/VarBase64.cpp
${src_dir}/vartypes/VarNotifier.cpp
${src_dir}/vartypes/VarTypes.cpp
${src_dir}/vartypes/VarXML.cpp
${src_dir}/vartypes/VarTypesInstance.cpp
${src_dir}/vartypes/VarTypesFactory.cpp
${src_dir}/vartypes/xml/xmlParser.cpp
${src_dir}/vartypes/primitives/VarStringVal.cpp
${src_dir}/vartypes/primitives/VarBoolVal.cpp
${src_dir}/vartypes/primitives/VarVal.cpp
${src_dir}/vartypes/primitives/VarIntVal.cpp
${src_dir}/vartypes/primitives/VarDoubleVal.cpp
${src_dir}/vartypes/primitives/VarType.cpp
${src_dir}/vartypes/primitives/VarBlob.cpp
${src_dir}/vartypes/primitives/VarBool.cpp
${src_dir}/vartypes/primitives/VarDouble.cpp
${src_dir}/vartypes/primitives/VarExternal.cpp
${src_dir}/vartypes/primitives/VarInt.cpp
${src_dir}/vartypes/primitives/VarList.cpp
${src_dir}/vartypes/primitives/VarQWidget.cpp
${src_dir}/vartypes/primitives/VarSelection.cpp
${src_dir}/vartypes/primitives/VarString.cpp
${src_dir}/vartypes/primitives/VarStringEnum.cpp
${src_dir}/vartypes/primitives/VarTrigger.cpp
${src_dir}/vartypes/gui/VarItem.cpp
${src_dir}/vartypes/gui/VarItemDelegate.cpp
${src_dir}/vartypes/gui/VarTreeModel.cpp
${src_dir}/vartypes/gui/VarTreeView.cpp
${src_dir}/vartypes/gui/VarTreeViewOptions.cpp
${src_dir}/vartypes/primitives/VarProtoBufferVal.cpp
${src_dir}/vartypes/primitives/VarProtoBuffer.cpp
)
include_directories(${src_dir}/vartypes)
include_directories(${src_dir}/vartypes/primitives)
include_directories(${src_dir}/vartypes/gui)
include_directories(${src_dir}/vartypes/xml)
#only ones that need to be moc'ed
set (HEADERS
${src_dir}/vartypes/primitives/VarType.h
${src_dir}/vartypes/primitives/VarBlob.h
${src_dir}/vartypes/primitives/VarBool.h
${src_dir}/vartypes/primitives/VarDouble.h
${src_dir}/vartypes/primitives/VarExternal.h
${src_dir}/vartypes/primitives/VarInt.h
${src_dir}/vartypes/primitives/VarList.h
${src_dir}/vartypes/primitives/VarQWidget.h
${src_dir}/vartypes/primitives/VarSelection.h
${src_dir}/vartypes/primitives/VarString.h
${src_dir}/vartypes/primitives/VarStringEnum.h
${src_dir}/vartypes/primitives/VarTrigger.h
${src_dir}/vartypes/gui/VarItem.h
${src_dir}/vartypes/gui/VarItemDelegate.h
${src_dir}/vartypes/gui/VarTreeModel.h
${src_dir}/vartypes/gui/VarTreeView.h
${src_dir}/vartypes/VarNotifier.h
)
set (INSTALLABLE_HEADERS
${HEADERS}
${src_dir}/vartypes/DllDefines.h
${src_dir}/vartypes/VarTypes.h
${src_dir}/vartypes/VarTypesFactory.h
${src_dir}/vartypes/gui/VarTreeViewOptions.h
${src_dir}/vartypes/xml/xmlParser.h
${src_dir}/vartypes/primitives/VarVal.h
${src_dir}/vartypes/primitives/VarStringVal.h
${src_dir}/vartypes/primitives/VarIntVal.h
${src_dir}/vartypes/primitives/VarDoubleVal.h
${src_dir}/vartypes/primitives/VarBoolVal.h
${src_dir}/vartypes/VarXML.h
${src_dir}/vartypes/VarTypesInstance.h
${src_dir}/vartypes/VarBase64.h
${src_dir}/vartypes/primitives/VarProtoBufferVal.h
${src_dir}/vartypes/primitives/VarProtoBuffer.h
)
set (INSTALLABLE_DOCFILES
${src_dir}/README
${src_dir}/COPYING
)
set (INSTALLABLE_EXAMPLE
${src_dir}/README
${src_dir}/COPYING
)
set (RC
${src_dir}/vartypes/gui/icons/icons.qrc
)
qt4_wrap_cpp (MOC_SRCS
${HEADERS}
)
qt4_add_resources(RC_SRCS
${RC}
)
if(NOT MSVC)
#flags to set in debug mode
set (CMAKE_CXX_FLAGS_DEBUG "-g")
#flags to set in release mode
#set (CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3 -march=native")
set (CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3")
endif()
set (libs ${QT_LIBRARIES})
set(CMAKE_DEBUG_POSTFIX d)
SET(CMAKE_INSTALL_LIBDIR lib CACHE PATH "Output directory for libraries")
SET(CMAKE_INSTALL_INCLUDEDIR include CACHE PATH "Output directory for header files")
SET(CMAKE_INSTALL_DOCDIR share/doc CACHE PATH "Output directory for documentation and license files")
set (target vartypes)
add_library(${target} SHARED ${MOC_SRCS} ${SRCS} ${RC_SRCS})
set_target_properties(${target} PROPERTIES VERSION 0.7.0 SOVERSION 1)
target_link_libraries(${target} ${libs})
install(FILES ${INSTALLABLE_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/vartypes)
install(FILES ${INSTALLABLE_DOCFILES} DESTINATION ${CMAKE_INSTALL_DOCDIR}/vartypes)
install(TARGETS ${target}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION bin
)
file(COPY README COPYING DESTINATION ${CMAKE_BINARY_DIR})
file(RENAME ${CMAKE_BINARY_DIR}/README ${CMAKE_BINARY_DIR}/README.txt)
file(RENAME ${CMAKE_BINARY_DIR}/COPYING ${CMAKE_BINARY_DIR}/COPYING.txt)
# Generate packages
if(UNIX)
execute_process(COMMAND uname -p OUTPUT_VARIABLE ARCH)
string(STRIP ${ARCH} ARCH)
if(APPLE)
set(ARCH "osx-universal")
endif()
endif()
set(CPACK_PACKAGE_CONTACT "Jan Segre <jan@segre.in>")
set(CPACK_PACKAGE_NAME "vartypes")
# Note that we're not the author of the package
# but merley packagers who may do some patches
set(CPACK_PACKAGE_VENDOR "RoboIME")
string(TOLOWER ${CPACK_PACKAGE_VENDOR} FLAVOR)
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_BINARY_DIR}/COPYING.txt")
set(CPACK_RESOURCE_FILE_README "${CMAKE_BINARY_DIR}/README.txt")
set(CPACK_PACKAGE_VERSION "0.7.0")
set(CPACK_OUTPUT_FILE_PREFIX ${PROJECT_SOURCE_DIR}/dist)
# Debian specific
#TODO: find out what components of qt are required, list them here:
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt4-core")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}-${FLAVOR}_${ARCH}")
include(CPack)