2014-04-29 14:11:27 +00:00
|
|
|
# preamble
|
|
|
|
project( Lsyncd )
|
|
|
|
cmake_minimum_required( VERSION 2.8 )
|
2018-03-12 10:50:08 +00:00
|
|
|
set( LSYNCD_VERSION 3.0.0-devel )
|
2014-04-29 14:11:27 +00:00
|
|
|
set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/" )
|
|
|
|
|
|
|
|
|
|
|
|
# finding Lua
|
2016-12-13 13:53:01 +00:00
|
|
|
find_package( Lua REQUIRED )
|
2014-04-29 14:11:27 +00:00
|
|
|
include_directories ( ${LUA_INCLUDE_DIR} )
|
|
|
|
|
|
|
|
|
|
|
|
# setting Lsyncd sources
|
2018-03-13 15:09:41 +00:00
|
|
|
set( LSYNCD_SRC core/core.c luacode.c )
|
2014-04-29 14:11:27 +00:00
|
|
|
|
2018-03-12 11:51:52 +00:00
|
|
|
# tell systemd via the sd-daemon library about the status of Lsyncd
|
|
|
|
option( WITH_SYSTEMD "Communicate Lsyncd status to systemd" ON )
|
2014-04-29 14:11:27 +00:00
|
|
|
|
|
|
|
# selecting the file notification mechanisms to compile against
|
|
|
|
option( WITH_INOTIFY "Compile with inotify file notifications (Linux)" ON )
|
|
|
|
|
|
|
|
if( WITH_INOTIFY )
|
2018-03-13 15:09:41 +00:00
|
|
|
set( LSYNCD_SRC ${LSYNCD_SRC} core/inotify.c )
|
2014-04-29 14:11:27 +00:00
|
|
|
endif( WITH_INOTIFY )
|
|
|
|
|
2018-03-13 15:09:41 +00:00
|
|
|
|
2014-04-29 14:11:27 +00:00
|
|
|
# generating the config.h file
|
|
|
|
configure_file (
|
|
|
|
"${PROJECT_SOURCE_DIR}/config.h.in"
|
|
|
|
"${PROJECT_BINARY_DIR}/config.h"
|
|
|
|
)
|
|
|
|
include_directories("${PROJECT_BINARY_DIR}")
|
|
|
|
|
|
|
|
|
|
|
|
# building and compiling the part of lsyncd written in Lua
|
|
|
|
|
2018-03-12 16:03:56 +00:00
|
|
|
set( LUA_CODE
|
2018-03-14 16:50:51 +00:00
|
|
|
${PROJECT_SOURCE_DIR}/mantle/array.lua
|
|
|
|
${PROJECT_SOURCE_DIR}/mantle/counter.lua
|
|
|
|
${PROJECT_SOURCE_DIR}/mantle/queue.lua
|
|
|
|
${PROJECT_SOURCE_DIR}/mantle/lock.lua
|
|
|
|
${PROJECT_SOURCE_DIR}/mantle/delay.lua
|
|
|
|
${PROJECT_SOURCE_DIR}/mantle/inotify.lua
|
|
|
|
${PROJECT_SOURCE_DIR}/mantle/combiner.lua
|
|
|
|
${PROJECT_SOURCE_DIR}/mantle/inlet.lua
|
|
|
|
${PROJECT_SOURCE_DIR}/mantle/filter.lua
|
2018-03-13 15:42:31 +00:00
|
|
|
${PROJECT_SOURCE_DIR}/mantle/lsyncd.lua
|
2018-03-14 08:57:49 +00:00
|
|
|
${PROJECT_SOURCE_DIR}/mantle/wrapup.lua
|
2018-03-13 15:09:41 +00:00
|
|
|
${PROJECT_SOURCE_DIR}/default/default.lua
|
|
|
|
${PROJECT_SOURCE_DIR}/default/rsync.lua
|
|
|
|
${PROJECT_SOURCE_DIR}/default/rsyncssh.lua
|
|
|
|
${PROJECT_SOURCE_DIR}/default/direct.lua
|
2014-04-29 14:11:27 +00:00
|
|
|
)
|
|
|
|
|
2018-03-12 16:03:56 +00:00
|
|
|
add_custom_command( OUTPUT luacode.c
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E echo "Generating luacode linkable"
|
|
|
|
COMMAND ${LUA_EXECUTABLE} ${PROJECT_SOURCE_DIR}/bin2carray.lua luacode.out luacode luacode.c
|
|
|
|
DEPENDS luacode.out
|
|
|
|
)
|
|
|
|
|
|
|
|
add_custom_command( OUTPUT luacode.out
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E echo "Compiling luacode"
|
|
|
|
COMMAND ${LUA_COMPILER} -o luacode.out ${LUA_CODE}
|
|
|
|
DEPENDS ${LUA_CODE}
|
2016-11-25 14:09:27 +00:00
|
|
|
)
|
2014-04-29 14:11:27 +00:00
|
|
|
|
2014-04-29 14:38:25 +00:00
|
|
|
# the manpage
|
2017-01-04 09:59:01 +00:00
|
|
|
add_custom_target( manpage
|
2016-11-25 14:09:27 +00:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E echo "Updating the manpage"
|
2016-05-30 14:23:14 +00:00
|
|
|
COMMAND a2x --format=manpage doc/manpage/lsyncd.1.txt
|
2016-11-25 14:09:27 +00:00
|
|
|
DEPENDS doc/manpage/lsyncd.1.txt
|
2014-04-29 14:38:25 +00:00
|
|
|
)
|
2014-04-29 14:11:27 +00:00
|
|
|
|
2018-03-13 15:09:41 +00:00
|
|
|
# the test suite
|
2017-01-05 09:37:43 +00:00
|
|
|
add_custom_target( tests
|
|
|
|
COMMAND echo "Running the tests"
|
|
|
|
COMMAND echo "Note you are expected to:"
|
|
|
|
COMMAND echo " * have lua-posix installed"
|
|
|
|
COMMAND echo " * have a passwordless ssh access to localhost"
|
2018-03-09 10:07:53 +00:00
|
|
|
COMMAND ${LUA_EXECUTABLE} tests/schedule.lua
|
|
|
|
COMMAND ${LUA_EXECUTABLE} tests/l4rsyncdata.lua
|
2018-03-09 12:05:45 +00:00
|
|
|
COMMAND ${LUA_EXECUTABLE} tests/filter-rsync.lua
|
2018-03-09 10:07:53 +00:00
|
|
|
COMMAND ${LUA_EXECUTABLE} tests/exclude-rsync.lua
|
|
|
|
COMMAND ${LUA_EXECUTABLE} tests/exclude-rsyncssh.lua
|
|
|
|
COMMAND ${LUA_EXECUTABLE} tests/churn-rsync.lua
|
|
|
|
COMMAND ${LUA_EXECUTABLE} tests/churn-rsyncssh.lua
|
|
|
|
COMMAND ${LUA_EXECUTABLE} tests/churn-direct.lua
|
2017-01-05 09:37:43 +00:00
|
|
|
COMMAND echo "Finished all successfull!"
|
|
|
|
)
|
|
|
|
|
2014-04-29 14:11:27 +00:00
|
|
|
# compiling and linking it all together
|
|
|
|
add_executable( lsyncd ${LSYNCD_SRC} )
|
|
|
|
target_link_libraries( lsyncd ${LUA_LIBRARIES} )
|
2014-04-29 14:38:25 +00:00
|
|
|
|
|
|
|
install( TARGETS lsyncd RUNTIME DESTINATION bin )
|
2016-12-13 13:53:01 +00:00
|
|
|
install( FILES doc/manpage/lsyncd.1 DESTINATION man )
|
2018-03-09 09:27:41 +00:00
|
|
|
|