Skip to content

Commit

Permalink
cmake: improvements and fixes, readme: updated contributors list
Browse files Browse the repository at this point in the history
  • Loading branch information
3cky committed Dec 5, 2017
1 parent 401750b commit d8b3b24
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 18 deletions.
13 changes: 7 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ endif()
check_function_exists(time HAVE_TIME)
check_function_exists(localtime HAVE_LOCALTIME)
if(HAVE_TIME AND HAVE_LOCALTIME)
message("passing HRDATE to compiler space")
message(STATUS "Passing HRDATE to compiler space")
add_definitions(-DHRDATE)
endif()

find_library(LIB_UTIL NAMES libutil util)
check_library_exists(util tty_get_name LIB_UTIL HAVE_TTY_GET_NAME)
check_library_exists(util uu_lock LIB_UTIL 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)
endif()

Expand Down Expand Up @@ -82,11 +82,11 @@ install(
)

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
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()
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mbusd@.service DESTINATION ${SYSTEMD_SERVICES_INSTALL_DIR} OPTIONAL)

# uninstall target
configure_file(
Expand All @@ -96,6 +96,7 @@ configure_file(
add_custom_target(uninstall
${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
)

# unittest target
option(TESTS "Enable unittests" OFF)
if(TESTS)
Expand Down Expand Up @@ -127,13 +128,13 @@ if(rpmBuilder_FOUND)
set(CPACK_GENERATOR "RPM")
endif()

set(CPACK_PACKAGE_NAME "modbusd")
set(CPACK_PACKAGE_NAME "mbusd")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Victor Antonovich") #required
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_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_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_SOURCE_STRIP_FILES TRUE)
Expand Down
28 changes: 16 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Configuring and compilation:
Installation instructions:
----------------------------

Compilation using cmake
<pre>
```
$ git clone https://github.com/3cky/mbusd.git mbusd.git
$ cd mbusd.git
$ mkdir -p output.dir && cd output.dir
$ mkdir -p build && cd build
$ cmake ../
$ make
</pre>
$ sudo make install
```

***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
* cmake-gui - usually in the package cmake-qt-gui

Usage:
------

mbusd [-h] [-d] [-t] [-v level] [-L logfile] [-p device] [-s speed] [-m mode] \
[-P port] [-C maxconn] [-N retries] [-R pause] [-W wait] [-T timeout]
mbusd [-h] [-d] [-L logfile] [-v level] [-c cfgfile] [-p device] [-s speed] [-m mode]
[-t] [-y file] [-Y file] [-P port] [-C maxconn] [-N retries]
[-R pause] [-W wait] [-T timeout]

-h Usage help.
-d Instruct mbusd not to fork itself (non-daemonize).
Expand All @@ -67,15 +68,15 @@ Usage:
Specifies serial port speed.
-m mode
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).
-y file
Enable RS-485 direction data direction control by writing '1' to file
for transmitter enable and '0' to file for transmitter disable
-Y file
Enable RS-485 direction data direction control by writing '0' to file
for transmitter enable and '1' to file for transmitter disable
-P port
Specifies TCP port number (default 502).
-C maxconn
Specifies maximum number of simultaneous TCP connections.
-N retries
Expand Down Expand Up @@ -150,8 +151,8 @@ Author:

Victor Antonovich (<v.antonovich@gmail.com>)

Credits:
--------
Contributors:
-------------

Andrew Denysenko (<nitr0@seti.kr.ua>):
- RTS RS-485 data direction control
Expand All @@ -163,6 +164,9 @@ James Jarvis (<jj@aprsworld.com>):
Luuk Loeffen (<luukloeffen@hotmail.com>):
- systemd support

Nick Mayerhofer (<nick.mayerhofer@enchant.at>):
- CMake build system

License:
--------

Expand Down

0 comments on commit d8b3b24

Please sign in to comment.