Initial support for building installers (RPM and DEB). Some minor code cleanup.
This commit is contained in:
+2
-8
@@ -1,5 +1,7 @@
|
|||||||
cmake_minimum_required(VERSION 2.8)
|
cmake_minimum_required(VERSION 2.8)
|
||||||
project(syslog-bulk-uploader)
|
project(syslog-bulk-uploader)
|
||||||
|
set(SLBU_DESC "Syslog Bulk Uploader")
|
||||||
|
set(SLBU_VER "1.0.0-alpha.1")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror")
|
||||||
add_definitions(-std=c++11)
|
add_definitions(-std=c++11)
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
@@ -10,11 +12,3 @@ add_test(NAME SyslogMessageTests COMMAND SyslogMessageTests)
|
|||||||
add_test(NAME RFC3164FormattedSyslogMessageTests COMMAND RFC3164FormattedSyslogMessageTests)
|
add_test(NAME RFC3164FormattedSyslogMessageTests COMMAND RFC3164FormattedSyslogMessageTests)
|
||||||
add_test(NAME FrequencyLimitTests COMMAND FrequencyLimitTests)
|
add_test(NAME FrequencyLimitTests COMMAND FrequencyLimitTests)
|
||||||
|
|
||||||
set(VER_NAME "Syslog Bulk Uploader")
|
|
||||||
set(VER_MAJOR 1)
|
|
||||||
set(VER_MINOR 0)
|
|
||||||
set(VER_PATCH 0)
|
|
||||||
set(VER_PRERELEASE "alpha.1")
|
|
||||||
set(VER_BUILD "")
|
|
||||||
|
|
||||||
configure_file("src/config.h.in" "src/config.h")
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
find_package(Boost COMPONENTS date_time filesystem system thread program_options REQUIRED)
|
find_package(Boost COMPONENTS date_time filesystem system thread program_options REQUIRED)
|
||||||
find_package(Threads)
|
find_package(Threads)
|
||||||
|
|
||||||
|
configure_file("config.h.in" "config.h")
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
${PROJECT_BINARY_DIR}
|
${PROJECT_BINARY_DIR}
|
||||||
${Boost_INLUDE_DIRS}
|
${Boost_INLUDE_DIRS}
|
||||||
@@ -26,3 +28,22 @@ target_link_libraries(syslog-bulk-uploader
|
|||||||
${Boost_PROGRAM_OPTIONS_LIBRARY}
|
${Boost_PROGRAM_OPTIONS_LIBRARY}
|
||||||
slbu-lib
|
slbu-lib
|
||||||
)
|
)
|
||||||
|
|
||||||
|
install(TARGETS syslog-bulk-uploader DESTINATION bin )
|
||||||
|
|
||||||
|
##
|
||||||
|
## Installers configuration
|
||||||
|
##
|
||||||
|
include(InstallRequiredSystemLibraries)
|
||||||
|
set(CPACK_GENERATOR "RPM;DEB")
|
||||||
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${VER_NAME}")
|
||||||
|
set(CPACK_PACKAGE_VENDOR "Marko Zivanovic <marko@zivanovic.in.rs>")
|
||||||
|
set(CPACK_PACKAGE_CONTACT "${CPACK_PACKAGE_VENDOR}")
|
||||||
|
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/../README.md")
|
||||||
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Utility to send messages from file to remote syslog server")
|
||||||
|
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/../LICENSE")
|
||||||
|
set(CPACK_PACKAGE_VERSION "${SLBU_VER}")
|
||||||
|
set(CPACK_SOURCE_STRIP_FILES TRUE)
|
||||||
|
set(CPACK_STRIP_FILES TRUE)
|
||||||
|
set(CPACK_RPM_PACKAGE_LICENSE "MIT")
|
||||||
|
include(CPack)
|
||||||
|
|||||||
+2
-6
@@ -1,7 +1,3 @@
|
|||||||
#cmakedefine VER_NAME "${VER_NAME}"
|
#cmakedefine SLBU_DESC "${SLBU_DESC}"
|
||||||
#cmakedefine VER_MAJOR "${VER_MAJOR}"
|
#cmakedefine SLBU_VER "${SLBU_VER}"
|
||||||
#cmakedefine VER_MINOR "${VER_MINOR}"
|
|
||||||
#cmakedefine VER_PATCH "${VER_PATCH}"
|
|
||||||
#cmakedefine VER_PRERELEASE "${VER_PRERELEASE}"
|
|
||||||
#cmakedefine VER_BUILD "${VER_BUILD}"
|
|
||||||
|
|
||||||
|
|||||||
+10
-24
@@ -34,6 +34,7 @@ SOFTWARE.
|
|||||||
namespace po = boost::program_options;
|
namespace po = boost::program_options;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
po::options_description desc("Supported options");
|
||||||
size_t mps;
|
size_t mps;
|
||||||
string dest;
|
string dest;
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
@@ -41,34 +42,19 @@ vector<string> files;
|
|||||||
|
|
||||||
string version() {
|
string version() {
|
||||||
stringstream ss;
|
stringstream ss;
|
||||||
ss << VER_NAME << " version " << VER_MAJOR << ".";
|
ss << SLBU_DESC << " version " << SLBU_VER;
|
||||||
#ifdef VER_MINOR
|
|
||||||
ss << VER_MINOR;
|
|
||||||
#else
|
|
||||||
ss << "0";
|
|
||||||
#endif
|
|
||||||
ss << ".";
|
|
||||||
#ifdef VER_PATCH
|
|
||||||
ss << VER_PATCH;
|
|
||||||
#else
|
|
||||||
ss << "0";
|
|
||||||
#endif
|
|
||||||
#ifdef VER_PRERELEASE
|
|
||||||
ss << "-" << VER_PRERELEASE;
|
|
||||||
#endif
|
|
||||||
#ifdef VER_BUILD
|
|
||||||
ss << "+" << VER_BUILD;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void help() {
|
||||||
|
desc.print(cout);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
po::options_description desc("Supported options");
|
|
||||||
desc.add_options()
|
desc.add_options()
|
||||||
("help,h", "display help message")
|
("help,h", "display help message")
|
||||||
("version,v", "display version information")
|
("version,v", "display version information")
|
||||||
("mps,m", po::value<size_t>(&mps)->default_value(1000), "try to maintain this rate of messages-per-second")
|
("mps,m", po::value<size_t>(&mps)->default_value(1000), "send messages at specified rate per second")
|
||||||
("dest,d", po::value<string>(&dest), "destination host name")
|
("dest,d", po::value<string>(&dest), "destination host name")
|
||||||
("port,p", po::value<uint16_t>(&port)->default_value(514), "destination port")
|
("port,p", po::value<uint16_t>(&port)->default_value(514), "destination port")
|
||||||
("files,f", po::value<vector < string >> (&files), "input file(s)")
|
("files,f", po::value<vector < string >> (&files), "input file(s)")
|
||||||
@@ -86,7 +72,7 @@ int main(int argc, char** argv) {
|
|||||||
po::notify(vars);
|
po::notify(vars);
|
||||||
|
|
||||||
if (vars.count("help")) {
|
if (vars.count("help")) {
|
||||||
desc.print(std::cout);
|
help();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,13 +83,13 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
if (!vars.count("dest")) {
|
if (!vars.count("dest")) {
|
||||||
cout << "ERROR: You must specify destination hostname" << endl;
|
cout << "ERROR: You must specify destination hostname" << endl;
|
||||||
desc.print(cout);
|
help();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!vars.count("files")) {
|
if (!vars.count("files")) {
|
||||||
cout << "ERROR: You must specify at least one input file" << endl;
|
cout << "ERROR: You must specify at least one input file" << endl;
|
||||||
desc.print(cout);
|
help();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user