author | Myhailo Danylenko <isbear@ukrpost.net> |
Mon, 16 Feb 2009 01:32:12 +0200 | |
changeset 5 | e617c9cf6dd3 |
parent 3 | 4fd19a188509 |
child 6 | 90073cbb535d |
permissions | -rw-r--r-- |
2 | 1 |
|
2 |
cmake_minimum_required(VERSION 2.6) |
|
5
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
3 |
project(lua-lm C) |
2 | 4 |
|
5
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
5 |
## User options |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
6 |
option(DEBUG "Enable debugging output" OFF) |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
7 |
|
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
8 |
## Define targets |
2 | 9 |
add_library(loudmouth MODULE util.c lm_types.c lm_proxy.c lm_ssl.c lm_connection.c lm_message.c lm_message_node.c lm_message_handler.c lm.c) |
5
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
10 |
get_target_property(lua-lm_SOURCES loudmouth SOURCES) |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
11 |
configure_file(config.h.in config.h) |
2 | 12 |
|
5
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
13 |
## Packaging information |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
14 |
set(CPACK_PACKAGE_NAME liblua5.1-loudmouth) |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
15 |
set(CPACK_PACKAGE_VERSION_MAJOR 0) |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
16 |
set(CPACK_PACKAGE_VERSION_MINOR 0) |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
17 |
set(CPACK_PACKAGE_VERSION_PATCH 0) |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
18 |
set(CPACK_PACKAGE_VENDOR "IsBear") |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
19 |
set(CPACK_PACKAGE_CONTACT "Myhailo Danylenko <isbear@ukrpost.net>") |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
20 |
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Loudmouth XMPP client library lua interface") |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
21 |
set(CPACK_PACKAGE_DESCRIPTION_FILE ${lua-lm_SOURCE_DIR}/README) |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
22 |
set(CPACK_RESOURCE_FILE_LICENSE ${lua-lm_SOURCE_DIR}/COPYING) |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
23 |
set(CPACK_RESOURCE_FILE_README ${lua-lm_SOURCE_DIR}/README) |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
24 |
set(CPACK_RESOURCE_FILE_WELCOME ${lua-lm_SOURCE_DIR}/README) |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
25 |
set(CPACK_DEBIAN_PACKAGE_SECTION libs) |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
26 |
set(CPACK_SOURCE_GENERATOR TBZ2) |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
27 |
set(CPACK_GENERATOR DEB) |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
28 |
# FIXME: Detect architecture. How? Though, it anyway produces nonconformant deb names... |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
29 |
set(CPACK_SYSTEM_NAME i386) |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
30 |
# XXX: Set package name directly to get rid of -Sources? |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
31 |
set(CPACK_SOURCE_IGNORE_FILES "/\\\\..*;\\\\.swp;~$;/build/;\\\\.tar\\\\.;\\\\.deb;\\\\.so") |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
32 |
include(CPack) |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
33 |
|
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
34 |
## Gather information about system |
2 | 35 |
find_package(Lua51 REQUIRED) |
5
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
36 |
execute_process(COMMAND lua -e "print ( package.path )" OUTPUT_VARIABLE LUA_PATH OUTPUT_STRIP_TRAILING_WHITESPACE) |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
37 |
execute_process(COMMAND lua -e "print ( package.cpath )" OUTPUT_VARIABLE LUA_CPATH OUTPUT_STRIP_TRAILING_WHITESPACE) |
2 | 38 |
find_package(PkgConfig REQUIRED) |
5
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
39 |
pkg_check_modules(GLIB REQUIRED glib-2.0) |
2 | 40 |
pkg_check_modules(LM REQUIRED loudmouth-1.0) |
41 |
||
5
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
42 |
## Set up compiler |
2 | 43 |
include_directories(SYSTEM ${LUA_INCLUDE_DIR} ${GLIB_INCLUDE_DIRS} ${LM_INCLUDE_DIRS}) |
44 |
target_link_libraries(loudmouth ${LUA_LIBRARIES} ${GLIB_LIBRARIES} ${LM_LIBRARIES}) |
|
5
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
45 |
include_directories(${lua-lm_SOURCE_DIR} ${lua-lm_BINARY_DIR}) |
3 | 46 |
set_target_properties(loudmouth PROPERTIES PREFIX "") |
2 | 47 |
|
5
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
48 |
## Extra targets |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
49 |
add_custom_command(OUTPUT ${lua-lm_BINARY_DIR}/loudmouth.html COMMAND ${lua-lm_SOURCE_DIR}/docgen.pl ${lua-lm_SOURCES} > ${lua-lm_BINARY_DIR}/loudmouth.html DEPENDS ${lua-lm_SOURCE_DIR}/docgen.pl ${lua-lm_SOURCES} WORKING_DIRECTORY ${lua-lm_SOURCE_DIR}) |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
50 |
add_custom_target(doc ALL DEPENDS ${lua-lm_BINARY_DIR}/loudmouth.html) |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
51 |
add_custom_target(test COMMAND env "LUA_PATH=${lua-lm_SOURCE_DIR}/?.lua;${LUA_PATH}" "LUA_CPATH=${lua-lm_SOURCE_DIR}/?.so;${lua-lm_BINARY_DIR}/?.so;${LUA_CPATH}" lua ${lua-lm_SOURCE_DIR}/test.lua DEPENDS loudmouth VERBATIM) |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
52 |
|
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
53 |
## Set up installer |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
54 |
install(TARGETS loudmouth DESTINATION lib/lua/5.1) |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
55 |
install(FILES lm.lua DESTINATION share/lua/5.1) |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
56 |
install(FILES test.lua DESTINATION share/doc/${CPACK_PACKAGE_NAME}/examples) |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
57 |
install(FILES ${lua-lm_BINARY_DIR}/loudmouth.html DESTINATION share/doc/${CPACK_PACKAGE_NAME}) |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
58 |
install(FILES README DESTINATION share/doc/${CPACK_PACKAGE_NAME}) |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
59 |
install(FILES TODO DESTINATION share/doc/${CPACK_PACKAGE_NAME}) |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
60 |
install(FILES COPYING DESTINATION share/doc/${CPACK_PACKAGE_NAME}) |
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
61 |
|
e617c9cf6dd3
Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents:
3
diff
changeset
|
62 |
## The End ## vim: se ts=4: ## |