1 ## Copyright 2009 Myhailo Danylenko |
1 ## Copyright 2009,2011 Myhailo Danylenko |
2 # This file is part of lua-lm |
2 # This file is part of lua-lm |
3 # |
3 # |
4 # lua-lm is free software: you can redistribute it and/or modify |
4 # lua-lm is free software: you can redistribute it and/or modify |
5 # it under the terms of the GNU General Public License as published by |
5 # it under the terms of the GNU General Public License as published by |
6 # the Free Software Foundation, either version 2 of the License, or |
6 # the Free Software Foundation, either version 2 of the License, or |
14 # You should have received a copy of the GNU General Public License |
14 # You should have received a copy of the GNU General Public License |
15 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
15 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 |
16 |
17 cmake_minimum_required(VERSION 2.6) |
17 cmake_minimum_required(VERSION 2.6) |
18 project(lua-lm C) |
18 project(lua-lm C) |
|
19 set(PROJECT_VERSION "0.9.1") |
19 |
20 |
20 ## User options |
21 ## User options |
21 option(DEBUG "Enable debugging output" OFF) |
22 option(DEBUG "Enable debugging output" OFF) |
22 set(TEST_USER "test@jabber.org" CACHE STRING "Testing: Your jabber account name") |
23 set(TEST_USER "test@jabber.org" CACHE STRING "Testing: Your jabber account name") |
23 set(TEST_PASSWORD "greatsecret" CACHE STRING "Testing: Password for your jabber account") |
24 set(TEST_PASSWORD "greatsecret" CACHE STRING "Testing: Password for your jabber account") |
44 # (this should be before targets definitions) |
45 # (this should be before targets definitions) |
45 link_directories(${LUA_LIBRARY_DIRS} ${GLIB_LIBRARY_DIRS} ${LM_LIBRARY_DIRS}) |
46 link_directories(${LUA_LIBRARY_DIRS} ${GLIB_LIBRARY_DIRS} ${LM_LIBRARY_DIRS}) |
46 |
47 |
47 ## Define targets |
48 ## Define targets |
48 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) |
49 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) |
49 get_target_property(lua-lm_SOURCES loudmouth SOURCES) |
50 get_target_property(loudmouth_SOURCES loudmouth SOURCES) |
50 |
51 |
51 ## Set up compiler |
52 ## Set up compiler |
|
53 if(DEBUG) |
|
54 set(DEBUG_COMPILE_FLAGS "-g") |
|
55 endif() |
52 configure_file(config.h.in config.h) |
56 configure_file(config.h.in config.h) |
53 include_directories(SYSTEM ${LUA_INCLUDE_DIR} ${GLIB_INCLUDE_DIRS} ${LM_INCLUDE_DIRS}) |
57 include_directories(SYSTEM ${LUA_INCLUDE_DIR} ${GLIB_INCLUDE_DIRS} ${LM_INCLUDE_DIRS}) |
54 target_link_libraries(loudmouth ${LUA_LIBRARIES} ${GLIB_LIBRARIES} ${LM_LIBRARIES}) |
58 target_link_libraries(loudmouth ${LUA_LIBRARIES} ${GLIB_LIBRARIES} ${LM_LIBRARIES}) |
55 include_directories(${lua-lm_SOURCE_DIR} ${lua-lm_BINARY_DIR}) |
59 include_directories(${lua-lm_SOURCE_DIR} ${lua-lm_BINARY_DIR}) |
56 set_target_properties(loudmouth PROPERTIES PREFIX "") |
60 set_target_properties(loudmouth PROPERTIES |
|
61 PREFIX "" |
|
62 COMPILE_FLAGS "-Wall ${DEBUG_COMPILE_FLAGS}") |
57 |
63 |
58 ## Extra targets |
64 ## Extra targets |
59 if(PERL_FOUND) |
65 if(PERL_FOUND) |
60 add_custom_command(OUTPUT ${lua-lm_BINARY_DIR}/loudmouth.html COMMAND ${PERL_EXECUTABLE} ${lua-lm_SOURCE_DIR}/docgen.pl -f html -t "Lua-loudmouth API reference" -o ${lua-lm_BINARY_DIR}/loudmouth.html -- ${lua-lm_SOURCES} DEPENDS ${lua-lm_SOURCE_DIR}/docgen.pl ${lua-lm_SOURCES} WORKING_DIRECTORY ${lua-lm_SOURCE_DIR}) |
66 add_custom_command(OUTPUT ${lua-lm_BINARY_DIR}/loudmouth.html COMMAND ${PERL_EXECUTABLE} ${lua-lm_SOURCE_DIR}/docgen.pl -f html -t "Lua-loudmouth API reference" -o ${lua-lm_BINARY_DIR}/loudmouth.html -- ${loudmouth_SOURCES} DEPENDS ${lua-lm_SOURCE_DIR}/docgen.pl ${loudmouth_SOURCES} WORKING_DIRECTORY ${lua-lm_SOURCE_DIR}) |
61 add_custom_target(doc ALL DEPENDS ${lua-lm_BINARY_DIR}/loudmouth.html) |
67 add_custom_target(doc ALL DEPENDS ${lua-lm_BINARY_DIR}/loudmouth.html) |
62 endif() |
68 endif() |
63 if(LUA_EXECUTABLE) |
69 if(LUA_EXECUTABLE) |
64 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_EXECUTABLE}" "${lua-lm_SOURCE_DIR}/test.lua" "${TEST_USER}" "${TEST_PASSWORD}" "${TEST_TO}" "${TEST_FINGERPRINT}" DEPENDS loudmouth VERBATIM) |
70 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_EXECUTABLE}" "${lua-lm_SOURCE_DIR}/test.lua" "${TEST_USER}" "${TEST_PASSWORD}" "${TEST_TO}" "${TEST_FINGERPRINT}" DEPENDS loudmouth VERBATIM) |
65 endif() |
71 endif() |
66 |
72 |
67 ## Packaging information |
73 ## Packaging information |
68 set(CPACK_PACKAGE_NAME liblua5.1-loudmouth) |
74 set(CPACK_PACKAGE_NAME liblua5.1-loudmouth) |
69 set(CPACK_PACKAGE_VERSION "0.9.0") |
75 set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) |
70 set(CPACK_PACKAGE_VENDOR "IsBear") |
76 set(CPACK_PACKAGE_VENDOR "IsBear") |
71 set(CPACK_PACKAGE_CONTACT "Myhailo Danylenko <isbear@ukrpost.net>") |
77 set(CPACK_PACKAGE_CONTACT "Myhailo Danylenko <isbear@ukrpost.net>") |
72 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Loudmouth XMPP client library lua interface") |
78 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Loudmouth XMPP client library lua interface") |
73 set(CPACK_PACKAGE_DESCRIPTION_FILE ${lua-lm_SOURCE_DIR}/README) |
79 set(CPACK_PACKAGE_DESCRIPTION_FILE ${lua-lm_SOURCE_DIR}/README) |
74 set(CPACK_RESOURCE_FILE_LICENSE ${lua-lm_SOURCE_DIR}/COPYING) |
80 set(CPACK_RESOURCE_FILE_LICENSE ${lua-lm_SOURCE_DIR}/COPYING) |