This repository was archived by the owner on Nov 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
233 lines (196 loc) · 8.8 KB
/
CMakeLists.txt
File metadata and controls
233 lines (196 loc) · 8.8 KB
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# Copyright (C) 2007-20013 LuaDist.
# Created by Peter Kapec
# Redistribution and use of this file is allowed according to the terms of the MIT license.
# For details see the COPYRIGHT file distributed with LuaDist.
# Please note that the package source code is licensed under its own license.
project ( qtlua C CXX )
cmake_minimum_required ( VERSION 2.8 )
include ( cmake/dist.cmake )
include ( lua )
# Find Qt4
set ( QT_USE_QTUITOOLS 1 )
find_package ( Qt4 REQUIRED )
include ( ${QT_USE_FILE} )
# Find Lua
find_package ( Lua51 REQUIRED )
include_directories ( ${LUA_INCLUDE_DIR} )
###########################################################################
# generating config.h file:
message ( "Configure: qtlua - generating config.hh:" )
include ( CheckIncludeFiles )
include ( CheckFunctionExists )
include ( CheckSymbolExists )
include ( CheckLibraryExists )
check_include_files ( dlfcn.h HAVE_DLFCN_H )
check_include_files ( inttypes.h HAVE_INTTYPES_H )
check_library_exists ( dl "" "" HAVE_LIDL )
check_library_exists ( m "" "" HAVE_LIBM )
check_include_files ( memory.h HAVE_MEMORY_H )
check_include_files ( stdint.h HAVE_STDINT_H )
check_include_files ( stdlib.h HAVE_STDLIB_H )
check_include_files ( strings.h HAVE_STRINGS_H )
check_include_files ( string.h HAVE_STRING_H )
check_include_files ( "sys/stat.h" HAVE_SYS_STAT_H )
check_include_files ( "sys/types.h" HAVE_SYS_TYPES_H )
check_include_files ( unistd.h HAVE_UNISTD_H )
set ( CMAKE_REQUIRED_INCLUDES ${LUA_INCLUDE_DIR} )
set ( CMAKE_REQUIRED_LIBRARIES ${LUA_LIBRARIES} )
check_function_exists ( lua_gc HAVE_LUA_GC )
check_function_exists ( luaL_openlib HAVE_LUA_OPENLIBS )
check_function_exists ( luaopen_os HAVE_LUA_OSLIB )
check_function_exists ( luaopen_package HAVE_LUA_PACKAGELIB )
check_include_files ( "stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS )
set ( SHLIBEXT ${CMAKE_SHARED_LIBRARY_SUFFIX} )
# LT_OBJDIR
set(PACKAGE_NAME "\"libqtlua\"")
set(PACKAGE_TARNAME "\"libqtlua\"")
set(PACKAGE_VERSION "\"1.4\"")
set(PACKAGE_STRING "\"libqtlua 1.4\"")
set(PACKAGE_BUGREPORT "\"\"")
set(PACKAGE_URL "\"http://www.nongnu.org/libqtlua/\"")
# all is defined, so generate config.hh
configure_file ( ${CMAKE_CURRENT_SOURCE_DIR}/config.hh.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.hh )
message ( "Configure: qtlua - done." )
# end of generating config.hh file
###########################################################################
add_definitions(-DHAVE_CONFIG_H)
add_definitions(-DQT_NO_CAST_FROM_BYTEARRAY)
add_definitions(-DQTLUAREF_DEBUG)
include_directories (${CMAKE_CURRENT_BINARY_DIR})
include_directories( src )
set(QTLUA_LIB_SRCS src/qtluaconsole.cc src/qtluaenum.cc
src/qtluaenumiterator.cc src/qtluafunction.cc
src/qtluaitem.cc src/qtluaitemmodel.cc
src/qtluaitemselectionmodel.cc src/qtlualistitem.cc
src/qtlualistiterator.cc src/qtluamember.cc
src/qtluametacache.cc src/qtluamethod.cc
src/qtluaplugin.cc src/qtluaproperty.cc
src/qtluaqmetaobjecttable.cc
src/qtluaqmetaobjectwrapper.cc
src/qtluaqobjectiterator.cc src/qtluaqobjectwrapper.cc
src/qtluaqtlib.cc src/qtluastate.cc
src/qtluatabledialog.cc src/qtluatablegridmodel.cc
src/qtluatableiterator.cc src/qtluatabletreekeys.cc
src/qtluatabletreemodel.cc src/qtluauserdata.cc
src/qtluavalue.cc src/qtluavalueref.cc src/qtluadispatchproxy.cc )
# Generate moc files
set(MOC_HEADERS
src/QtLua/qtluaconsole.hh src/QtLua/qtluaitemselectionmodel.hh
src/QtLua/qtluaitemmodel.hh src/QtLua/qtluatabletreemodel.hh
src/QtLua/qtluatabledialog.hh src/QtLua/qtluastate.hh
src/QtLua/qtluatablegridmodel.hh
src/qtluaqtlib.hh
)
qt4_wrap_cpp ( MOC_OUTFILES ${MOC_HEADERS} )
# qtlua library
add_library ( qtlua ${QTLUA_LIB_SRCS} ${MOC_OUTFILES} )
target_link_libraries ( qtlua ${QT_LIBRARIES} ${LUA_LIBRARIES} )
# qtlua app
add_executable ( qtlua_app tools/qtlua/qtlua.cc )
target_link_libraries ( qtlua_app qtlua )
set_target_properties ( qtlua_app PROPERTIES OUTPUT_NAME qtlua CLEAN_DIRECT_OUTPUT 1 )
###########################################################################
#### tests ####
include_directories ( test )
add_executable ( test_value test/test_value.cc )
target_link_libraries ( test_value qtlua )
add_executable ( test_table test/test_table.cc )
target_link_libraries ( test_table qtlua )
# Generate moc files
qt4_wrap_cpp ( MOC_OUTFILES_TEST test/test_qobject_arg.hh )
add_executable ( test_qobject_arg test/test_qobject_arg.cc ${MOC_OUTFILES_TEST} )
target_link_libraries ( test_qobject_arg qtlua )
add_executable ( test_item test/test_item.cc )
target_link_libraries ( test_item qtlua )
#### examples ####
# console
qt4_wrap_cpp ( MOC_OUTFILES_CONSOLE examples/cpp/console/console.hh )
add_executable ( console examples/cpp/console/console_fcn.cc ${MOC_OUTFILES_CONSOLE} )
target_link_libraries ( console qtlua )
# mvc
qt4_wrap_cpp ( MOC_OUTFILES_TREEVIEW examples/cpp/mvc/itemtreeview.hh )
add_executable ( itemtreeview examples/cpp/mvc/itemtreeview.cc ${MOC_OUTFILES_TREEVIEW} )
target_link_libraries ( itemtreeview qtlua )
qt4_wrap_cpp ( MOC_OUTFILES_TABLEGRIDVIEW examples/cpp/mvc/tablegridview.hh )
add_executable ( tablegridview examples/cpp/mvc/tablegridview.cc ${MOC_OUTFILES_TABLEGRIDVIEW} )
target_link_libraries ( tablegridview qtlua )
qt4_wrap_cpp ( MOC_OUTFILES_TABLETREEVIEW examples/cpp/mvc/tabletreeview.hh )
add_executable ( tabletreeview examples/cpp/mvc/tabletreeview.cc ${MOC_OUTFILES_TABLETREEVIEW} )
target_link_libraries ( tabletreeview qtlua )
qt4_wrap_cpp ( MOC_OUTFILES_PLUGIN examples/cpp/plugin/plugin.hh )
add_library ( plugin MODULE examples/cpp/plugin/plugin.cc ${MOC_OUTFILES_PLUGIN} )
set_target_properties ( plugin PROPERTIES PREFIX "" )
# plugin
add_executable ( plugin_app examples/cpp/plugin/plugin_load.cc )
target_link_libraries ( plugin_app qtlua )
set_target_properties ( plugin_app PROPERTIES OUTPUT_NAME plugin CLEAN_DIRECT_OUTPUT 1 )
# proxy
add_executable ( arrayproxy_string examples/cpp/proxy/arrayproxy_string.cc )
target_link_libraries ( arrayproxy_string qtlua )
add_executable ( dispatchproxy_string examples/cpp/proxy/dispatchproxy_string.cc )
target_link_libraries ( dispatchproxy_string qtlua )
add_executable ( qhashproxy_value examples/cpp/proxy/qhashproxy_value.cc )
target_link_libraries ( qhashproxy_value qtlua )
add_executable ( qhashproxy_variant examples/cpp/proxy/qhashproxy_variant.cc )
target_link_libraries ( qhashproxy_variant qtlua )
add_executable ( qlinkedlistproxy_string examples/cpp/proxy/qlinkedlistproxy_string.cc )
target_link_libraries ( qlinkedlistproxy_string qtlua )
add_executable ( qlistproxy_string examples/cpp/proxy/qlistproxy_string.cc )
target_link_libraries ( qlistproxy_string qtlua )
add_executable ( qmapproxy_string examples/cpp/proxy/qmapproxy_string.cc )
target_link_libraries ( qmapproxy_string qtlua )
add_executable ( qvectorproxy_string examples/cpp/proxy/qvectorproxy_string.cc )
target_link_libraries ( qvectorproxy_string qtlua )
add_executable ( qvectorproxy_userdata examples/cpp/proxy/qvectorproxy_userdata.cc )
target_link_libraries ( qvectorproxy_userdata qtlua )
# qobject
add_executable ( qobject_iter examples/cpp/qobject/qobject_iter.cc )
target_link_libraries ( qobject_iter qtlua )
add_executable ( qobject_owner examples/cpp/qobject/qobject_owner.cc )
target_link_libraries ( qobject_owner qtlua )
# types
qt4_wrap_cpp ( MOC_OUTFILES_META examples/cpp/types/myobject.hh )
add_executable ( meta examples/cpp/types/meta.cc ${MOC_OUTFILES_META})
target_link_libraries ( meta qtlua )
# userdata
add_executable ( function examples/cpp/userdata/function.cc )
target_link_libraries ( function qtlua )
add_executable ( ref examples/cpp/userdata/ref.cc )
target_link_libraries ( ref qtlua )
add_executable ( userobject examples/cpp/userdata/userobject.cc )
target_link_libraries ( userobject qtlua )
add_executable ( userobject2 examples/cpp/userdata/userobject2.cc )
target_link_libraries ( userobject2 qtlua )
# value
add_executable ( global examples/cpp/value/global.cc )
target_link_libraries ( global qtlua )
add_executable ( iterate examples/cpp/value/iterate.cc )
target_link_libraries ( iterate qtlua )
###########################################################################
# install
install_executable ( qtlua_app )
install_library ( qtlua )
install_header( src/QtLua )
install_example ( examples/lua/hello INTO lua )
install_doc ( doc/manual )
install ( TARGETS test_value test_table test_qobject_arg test_item DESTINATION ${INSTALL_TEST} COMPONENT Test )
install ( TARGETS
#console
console
# mvc
itemtreeview tablegridview tabletreeview plugin plugin_app
# plugin
plugin plugin_app
# proxy
arrayproxy_string dispatchproxy_string qhashproxy_value qhashproxy_variant
qlinkedlistproxy_string qlistproxy_string
qmapproxy_string qvectorproxy_string qvectorproxy_userdata
# qobject
qobject_iter qobject_owner
#types
meta
# userdata
function ref userobject userobject2
# value
global iterate
DESTINATION ${INSTALL_EXAMPLE}/cpp COMPONENT Example )