cmake: improvements and fixes, readme: updated contributors list

This commit is contained in:
Victor Antonovich 2017-12-05 18:10:46 +03:00
parent 401750b793
commit d8b3b24b7b
2 changed files with 23 additions and 18 deletions

View File

@ -42,7 +42,7 @@ endif()
check_function_exists(time HAVE_TIME) check_function_exists(time HAVE_TIME)
check_function_exists(localtime HAVE_LOCALTIME) check_function_exists(localtime HAVE_LOCALTIME)
if(HAVE_TIME AND HAVE_LOCALTIME) if(HAVE_TIME AND HAVE_LOCALTIME)
message("passing HRDATE to compiler space") message(STATUS "Passing HRDATE to compiler space")
add_definitions(-DHRDATE) add_definitions(-DHRDATE)
endif() endif()
@ -50,7 +50,7 @@ find_library(LIB_UTIL NAMES libutil util)
check_library_exists(util tty_get_name LIB_UTIL HAVE_TTY_GET_NAME) check_library_exists(util tty_get_name LIB_UTIL HAVE_TTY_GET_NAME)
check_library_exists(util uu_lock LIB_UTIL HAVE_UU_LOCK) check_library_exists(util uu_lock LIB_UTIL HAVE_UU_LOCK)
if(LIB_UTIL AND HAVE_TTY_GET_NAME AND HAVE_UU_LOCK) if(LIB_UTIL AND HAVE_TTY_GET_NAME AND HAVE_UU_LOCK)
message("passing HAVE_LIBUTIL to compiler space") message(STATUS "Passing HAVE_LIBUTIL to compiler space")
add_definitions(-DHAVE_LIBUTIL) add_definitions(-DHAVE_LIBUTIL)
endif() endif()
@ -82,11 +82,11 @@ install(
) )
if(SYSTEMD_FOUND) if(SYSTEMD_FOUND)
message("Systemd found at ${SYSTEMD_SERVICES_INSTALL_DIR}") message(STATUS "Systemd service file will be installed to ${SYSTEMD_SERVICES_INSTALL_DIR}")
# aggregate mbusd@.service from its template # aggregate mbusd@.service from its template
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/systemd-units/mbusd@.service.in mbusd@.service) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/systemd-units/mbusd@.service.in mbusd@.service)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mbusd@.service DESTINATION ${SYSTEMD_SERVICES_INSTALL_DIR})
endif() endif()
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mbusd@.service DESTINATION ${SYSTEMD_SERVICES_INSTALL_DIR} OPTIONAL)
# uninstall target # uninstall target
configure_file( configure_file(
@ -96,6 +96,7 @@ configure_file(
add_custom_target(uninstall add_custom_target(uninstall
${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
) )
# unittest target # unittest target
option(TESTS "Enable unittests" OFF) option(TESTS "Enable unittests" OFF)
if(TESTS) if(TESTS)
@ -127,13 +128,13 @@ if(rpmBuilder_FOUND)
set(CPACK_GENERATOR "RPM") set(CPACK_GENERATOR "RPM")
endif() endif()
set(CPACK_PACKAGE_NAME "modbusd") set(CPACK_PACKAGE_NAME "mbusd")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Victor Antonovich") #required set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Victor Antonovich") #required
set(CPACK_PACKAGE_CONTACT "Victor Antonovich <v.antonovich@gmail.com>") set(CPACK_PACKAGE_CONTACT "Victor Antonovich <v.antonovich@gmail.com>")
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}-${GIT_BRANCH}-g${GIT_COMMIT_HASH}) set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}-${GIT_BRANCH}-g${GIT_COMMIT_HASH})
set(CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME}-${CMAKE_SYSTEM_NAME}_${CMAKE_SYSTEM_PROCESSOR}-v${PROJECT_VERSION}) set(CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME}-${CMAKE_SYSTEM_NAME}_${CMAKE_SYSTEM_PROCESSOR}-v${PROJECT_VERSION})
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md") set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Modbus serial to TCP/UDP transceiver") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Modbus TCP to Modbus RTU gateway")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_SOURCE_STRIP_FILES TRUE) set(CPACK_SOURCE_STRIP_FILES TRUE)

View File

@ -27,28 +27,29 @@ Supported function codes:
Please note all other function codes (including vendor-specific extensions) are supported on a "best-effort" basis and most likely will fail. Please note all other function codes (including vendor-specific extensions) are supported on a "best-effort" basis and most likely will fail.
Configuring and compilation: Installation instructions:
---------------------------- ----------------------------
Compilation using cmake ```
<pre>
$ git clone https://github.com/3cky/mbusd.git mbusd.git $ git clone https://github.com/3cky/mbusd.git mbusd.git
$ cd mbusd.git $ cd mbusd.git
$ mkdir -p output.dir && cd output.dir $ mkdir -p build && cd build
$ cmake ../ $ cmake ../
$ make $ make
</pre> $ sudo make install
```
***Compile time options*** ***Compile time options***
can be altered in many ways, e.g. by using the following tools in the output.dir: can be altered in many ways, e.g. by using the following tools in the `build` dir:
* ccmake - usually in the package cmake-curses-gui * ccmake - usually in the package cmake-curses-gui
* cmake-gui - usually in the package cmake-qt-gui * cmake-gui - usually in the package cmake-qt-gui
Usage: Usage:
------ ------
mbusd [-h] [-d] [-t] [-v level] [-L logfile] [-p device] [-s speed] [-m mode] \ mbusd [-h] [-d] [-L logfile] [-v level] [-c cfgfile] [-p device] [-s speed] [-m mode]
[-P port] [-C maxconn] [-N retries] [-R pause] [-W wait] [-T timeout] [-t] [-y file] [-Y file] [-P port] [-C maxconn] [-N retries]
[-R pause] [-W wait] [-T timeout]
-h Usage help. -h Usage help.
-d Instruct mbusd not to fork itself (non-daemonize). -d Instruct mbusd not to fork itself (non-daemonize).
@ -67,8 +68,6 @@ Usage:
Specifies serial port speed. Specifies serial port speed.
-m mode -m mode
Specifies serial port mode (like 8N1). Specifies serial port mode (like 8N1).
-P port
Specifies TCP port number (default 502).
-t Enable RTS RS-485 data direction control (if not disabled while compile). -t Enable RTS RS-485 data direction control (if not disabled while compile).
-y file -y file
Enable RS-485 direction data direction control by writing '1' to file Enable RS-485 direction data direction control by writing '1' to file
@ -76,6 +75,8 @@ Usage:
-Y file -Y file
Enable RS-485 direction data direction control by writing '0' to file Enable RS-485 direction data direction control by writing '0' to file
for transmitter enable and '1' to file for transmitter disable for transmitter enable and '1' to file for transmitter disable
-P port
Specifies TCP port number (default 502).
-C maxconn -C maxconn
Specifies maximum number of simultaneous TCP connections. Specifies maximum number of simultaneous TCP connections.
-N retries -N retries
@ -150,8 +151,8 @@ Author:
Victor Antonovich (<v.antonovich@gmail.com>) Victor Antonovich (<v.antonovich@gmail.com>)
Credits: Contributors:
-------- -------------
Andrew Denysenko (<nitr0@seti.kr.ua>): Andrew Denysenko (<nitr0@seti.kr.ua>):
- RTS RS-485 data direction control - RTS RS-485 data direction control
@ -163,6 +164,9 @@ James Jarvis (<jj@aprsworld.com>):
Luuk Loeffen (<luukloeffen@hotmail.com>): Luuk Loeffen (<luukloeffen@hotmail.com>):
- systemd support - systemd support
Nick Mayerhofer (<nick.mayerhofer@enchant.at>):
- CMake build system
License: License:
-------- --------