author | Mikael Berthe <mikael@lilotux.net> |
Sun, 27 Mar 2011 22:03:30 +0200 | |
changeset 113 | 3d4f0415c8f8 |
parent 103 | 2cb96eae301a |
child 115 | 47bed161e3b0 |
permissions | -rw-r--r-- |
72 | 1 |
|
2 |
## Copyright 2009 Myhailo Danylenko |
|
83
794e54ea1022
Package/module name change
Myhailo Danylenko <isbear@ukrpost.net>
parents:
79
diff
changeset
|
3 |
# This file is part of lua. |
72 | 4 |
# |
83
794e54ea1022
Package/module name change
Myhailo Danylenko <isbear@ukrpost.net>
parents:
79
diff
changeset
|
5 |
# lua is free software: you can redistribute it and/or modify |
72 | 6 |
# it under the terms of the GNU General Public License as published by |
7 |
# the Free Software Foundation, either version 2 of the License, or |
|
8 |
# (at your option) any later version. |
|
9 |
# |
|
10 |
# This program is distributed in the hope that it will be useful, |
|
11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
# GNU General Public License for more details. |
|
14 |
# |
|
15 |
# You should have received a copy of the GNU General Public License |
|
16 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
0 | 17 |
|
18 |
cmake_minimum_required(VERSION 2.6) |
|
83
794e54ea1022
Package/module name change
Myhailo Danylenko <isbear@ukrpost.net>
parents:
79
diff
changeset
|
19 |
project(lua C) |
95
f2f4c7810a72
Use new module struct with api version
Myhailo Danylenko <isbear@ukrpost.net>
parents:
93
diff
changeset
|
20 |
set(PROJECT_VERSION "0.0.1") |
0 | 21 |
|
22 |
## User options |
|
23 |
option(DEBUG "Enable debugging output" ON) |
|
78 | 24 |
option(LLM_CONNECTION_ENABLE "Enable exposing of mcabber loudmouth connection to lua" ON) |
3
a5f864d4207f
Fixes for build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
1
diff
changeset
|
25 |
option(LLM_LOG_HANDLER "Enable registration of log messages handler for lua-loudmouth library's messages" ON) |
30
2cf24aced294
Definitions moved to cmake options
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
26 |
set(ML_SOURCE_PRIORITY G_PRIORITY_HIGH_IDLE CACHE STRING "Glib event source priority for timeout and bgread") |
2cf24aced294
Definitions moved to cmake options
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
27 |
set(ML_BGREAD_BUFFER 4096 CACHE STRING "Background pipe reading buffer size") |
0 | 28 |
|
90
3102f7def87b
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
88
diff
changeset
|
29 |
## Gather information about system |
3102f7def87b
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
88
diff
changeset
|
30 |
find_package(Lua51 REQUIRED) |
3102f7def87b
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
88
diff
changeset
|
31 |
find_package(PkgConfig REQUIRED) |
3102f7def87b
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
88
diff
changeset
|
32 |
pkg_check_modules(GLIB REQUIRED glib-2.0) |
3102f7def87b
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
88
diff
changeset
|
33 |
pkg_check_modules(GMODULE REQUIRED gmodule-2.0) |
93
0a10228296c1
New module loading scheme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
91
diff
changeset
|
34 |
pkg_check_modules(MCABBER REQUIRED mcabber) |
90
3102f7def87b
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
88
diff
changeset
|
35 |
find_package(Perl) |
3102f7def87b
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
88
diff
changeset
|
36 |
link_directories(${GLIB_LIBRARY_DIRS} |
3102f7def87b
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
88
diff
changeset
|
37 |
${GMODULE_LIBRARY_DIRS} |
93
0a10228296c1
New module loading scheme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
91
diff
changeset
|
38 |
${MCABBER_LIBRARY_DIRS}) |
90
3102f7def87b
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
88
diff
changeset
|
39 |
|
0 | 40 |
## Define targets |
103 | 41 |
add_library(lua MODULE lua.c util.c) |
0 | 42 |
|
90
3102f7def87b
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
88
diff
changeset
|
43 |
## Set up compiler |
3102f7def87b
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
88
diff
changeset
|
44 |
configure_file(config.h.in config.h ESCAPE_QUOTES) |
3102f7def87b
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
88
diff
changeset
|
45 |
include_directories(SYSTEM ${LUA_INCLUDE_DIR} |
3102f7def87b
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
88
diff
changeset
|
46 |
${GLIB_INCLUDE_DIRS} |
3102f7def87b
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
88
diff
changeset
|
47 |
${GMODULE_INCLUDE_DIRS} |
93
0a10228296c1
New module loading scheme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
91
diff
changeset
|
48 |
${MCABBER_INCLUDE_DIRS}) |
90
3102f7def87b
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
88
diff
changeset
|
49 |
target_link_libraries(lua ${LUA_LIBRARIES} |
3102f7def87b
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
88
diff
changeset
|
50 |
${GLIB_LIBRARIES} |
93
0a10228296c1
New module loading scheme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
91
diff
changeset
|
51 |
${GMODULE_LIBRARIES} |
0a10228296c1
New module loading scheme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
91
diff
changeset
|
52 |
${MCABBER_LIBRARRIES}) |
90
3102f7def87b
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
88
diff
changeset
|
53 |
include_directories(${lua_SOURCE_DIR} |
3102f7def87b
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
88
diff
changeset
|
54 |
${lua_BINARY_DIR}) |
96
270ce1cfc823
Enable compiler warnings
Myhailo Danylenko <isbear@ukrpost.net>
parents:
95
diff
changeset
|
55 |
set_target_properties(lua PROPERTIES COMPILE_FLAGS "-Wall") |
90
3102f7def87b
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
88
diff
changeset
|
56 |
|
3102f7def87b
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
88
diff
changeset
|
57 |
## Extra targets |
3102f7def87b
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
88
diff
changeset
|
58 |
if(PERL_FOUND) |
93
0a10228296c1
New module loading scheme
Myhailo Danylenko <isbear@ukrpost.net>
parents:
91
diff
changeset
|
59 |
get_target_property(lua_SOURCES lua SOURCES) |
90
3102f7def87b
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
88
diff
changeset
|
60 |
add_custom_command(OUTPUT ${lua_BINARY_DIR}/lua.html COMMAND ${PERL_EXECUTABLE} ${lua_SOURCE_DIR}/docgen.pl ${lua_SOURCES} > ${lua_BINARY_DIR}/lua.html DEPENDS ${lua_SOURCE_DIR}/docgen.pl ${lua_SOURCES} WORKING_DIRECTORY ${lua_SOURCE_DIR}) |
3102f7def87b
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
88
diff
changeset
|
61 |
add_custom_target(doc ALL DEPENDS ${lua_BINARY_DIR}/lua.html) |
3102f7def87b
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
88
diff
changeset
|
62 |
endif() |
3102f7def87b
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
88
diff
changeset
|
63 |
|
0 | 64 |
## Packaging information |
83
794e54ea1022
Package/module name change
Myhailo Danylenko <isbear@ukrpost.net>
parents:
79
diff
changeset
|
65 |
set(CPACK_PACKAGE_NAME libmcabber-lua) |
95
f2f4c7810a72
Use new module struct with api version
Myhailo Danylenko <isbear@ukrpost.net>
parents:
93
diff
changeset
|
66 |
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) |
0 | 67 |
set(CPACK_PACKAGE_VENDOR "IsBear") |
68 |
set(CPACK_PACKAGE_CONTACT "Myhailo Danylenko <isbear@ukrpost.net>") |
|
69 |
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Mcabber lua module") |
|
83
794e54ea1022
Package/module name change
Myhailo Danylenko <isbear@ukrpost.net>
parents:
79
diff
changeset
|
70 |
set(CPACK_PACKAGE_DESCRIPTION_FILE ${lua_SOURCE_DIR}/README) |
794e54ea1022
Package/module name change
Myhailo Danylenko <isbear@ukrpost.net>
parents:
79
diff
changeset
|
71 |
set(CPACK_RESOURCE_FILE_LICENSE ${lua_SOURCE_DIR}/COPYING) |
794e54ea1022
Package/module name change
Myhailo Danylenko <isbear@ukrpost.net>
parents:
79
diff
changeset
|
72 |
set(CPACK_RESOURCE_FILE_README ${lua_SOURCE_DIR}/README) |
794e54ea1022
Package/module name change
Myhailo Danylenko <isbear@ukrpost.net>
parents:
79
diff
changeset
|
73 |
set(CPACK_RESOURCE_FILE_WELCOME ${lua_SOURCE_DIR}/README) |
78 | 74 |
set(CPACK_SOURCE_GENERATOR TBZ2) |
75 |
set(CPACK_GENERATOR DEB CACHE STRING "Binary package generator, eg DEB, RPM, TGZ, NSIS...") |
|
76 |
# XXX |
|
77 |
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6, liblua5.1-0, libglib2.0-0") |
|
78 |
set(CPACK_DEBIAN_PACKAGE_RECOMMENDS "mcabber-lm | mcabber") |
|
79 |
set(CPACK_DEBIAN_PACKAGE_SUGGESTS "liblua5.1-posix1, liblua5.1-base64-0, liblua5.1-sha1-0") |
|
0 | 80 |
set(CPACK_DEBIAN_PACKAGE_SECTION libs) |
78 | 81 |
find_program(DPKG_EXECUTABLE dpkg) |
82 |
if(DPKG_EXECUTABLE) |
|
83 |
execute_process(COMMAND ${DPKG_EXECUTABLE} --print-architecture OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE) |
|
84 |
else() |
|
85 |
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386 CACHE STRING "Architecture of package") |
|
86 |
endif() |
|
87 |
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}") |
|
0 | 88 |
# XXX: Set package name directly to get rid of -Sources? |
89 |
set(CPACK_SOURCE_IGNORE_FILES "/\\\\..*;\\\\.swp;~$;/build/;\\\\.tar\\\\.;\\\\.deb;\\\\.so") |
|
90 |
include(CPack) |
|
91 |
||
91
37968123db86
Fix documentation installation path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
90
diff
changeset
|
92 |
## Set up installer |
37968123db86
Fix documentation installation path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
90
diff
changeset
|
93 |
install(TARGETS lua DESTINATION lib/mcabber) |
37968123db86
Fix documentation installation path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
90
diff
changeset
|
94 |
if(PERL_FOUND) |
37968123db86
Fix documentation installation path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
90
diff
changeset
|
95 |
install(FILES ${lua_BINARY_DIR}/lua.html DESTINATION share/doc/${CPACK_PACKAGE_NAME}) |
37968123db86
Fix documentation installation path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
90
diff
changeset
|
96 |
endif() |
37968123db86
Fix documentation installation path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
90
diff
changeset
|
97 |
install(DIRECTORY examples DESTINATION share/doc/${CPACK_PACKAGE_NAME} PATTERN "*~" EXCLUDE) |
37968123db86
Fix documentation installation path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
90
diff
changeset
|
98 |
install(FILES README DESTINATION share/doc/${CPACK_PACKAGE_NAME}) |
37968123db86
Fix documentation installation path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
90
diff
changeset
|
99 |
install(FILES TODO DESTINATION share/doc/${CPACK_PACKAGE_NAME}) |
37968123db86
Fix documentation installation path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
90
diff
changeset
|
100 |
install(FILES COPYING DESTINATION share/doc/${CPACK_PACKAGE_NAME}) |
37968123db86
Fix documentation installation path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
90
diff
changeset
|
101 |
|
0 | 102 |
## The End ## vim: se ts=4: ## |