make it possible to run without a configuration file
This commit is contained in:
parent
806cd60569
commit
a93aa69756
@ -9,17 +9,9 @@ set(CMAKE_CXX_STANDARD 17 CACHE STRING "The C++ standard to use")
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS ON)
|
||||
|
||||
#add_library(support STATIC ext/powerblog/h2o-pp.cc
|
||||
# ext/powerblog/ext/simplesocket/swrappers.cc
|
||||
# ext/powerblog/ext/simplesocket/comboaddress.cc
|
||||
# ext/powerblog/ext/simplesocket/sclasses.cc
|
||||
# ext/fmt-7.1.3/src/format.cc)
|
||||
add_custom_target(Work ALL DEPENDS configs.hh)
|
||||
|
||||
|
||||
|
||||
#target_include_directories(support PUBLIC ext/powerblog/ext/simplesocket ext/powerblog/ext ext/fmt-7.1.3/include/)
|
||||
#target_link_libraries(support PUBLIC -lh2o-evloop -lssl -lcrypto Threads::Threads)
|
||||
|
||||
add_executable(teller teller.cc ext/lpm.c)
|
||||
target_link_libraries(teller -lpcaudio -lpthread)
|
||||
|
||||
@ -29,6 +21,9 @@ target_link_libraries(testrunner -lpcaudio)
|
||||
enable_testing()
|
||||
add_test(testname testrunner)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT configs.hh
|
||||
COMMAND ./make-built-in-config.sh
|
||||
DEPENDS teller.conf trackers.conf
|
||||
)
|
||||
|
||||
enable_testing()
|
||||
add_test(testname testrunner)
|
||||
|
@ -11,6 +11,13 @@ Demo video [in this tweet](https://twitter.com/bert_hu_bert/status/1561466204602
|
||||
|
||||
[Blog post with more videos](https://berthub.eu/articles/posts/tracker-beeper/)
|
||||
|
||||
## Installing on OSX:
|
||||
```
|
||||
brew tap robertjakub/teller
|
||||
brew install --HEAD googerteller
|
||||
sudo tcpdump -nql | teller
|
||||
```
|
||||
|
||||
## How to compile
|
||||
This will currently only work on Unix derived systems (like Linux, OSX and
|
||||
FreeBSD).
|
||||
|
11
make-built-in-config.sh
Executable file
11
make-built-in-config.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
(
|
||||
echo \#pragma once
|
||||
echo 'constexpr char tellertoml[]=R"('
|
||||
cat teller.conf
|
||||
echo ')";'
|
||||
|
||||
echo 'constexpr char trackerstoml[]=R"('
|
||||
cat trackers.conf
|
||||
echo ')";'
|
||||
) > configs.hh
|
@ -7,6 +7,7 @@
|
||||
#include <pcaudiolib/audio.h>
|
||||
#include "ext/toml.hpp"
|
||||
#include "lpmwrapper.hh"
|
||||
#include "configs.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -73,12 +74,12 @@ int main(int argc, char** argv)
|
||||
{
|
||||
trackertbl = toml::parse_file("trackers.conf");
|
||||
conftbl = toml::parse_file("teller.conf");
|
||||
// std::cout << tbl << "\n";
|
||||
}
|
||||
catch (const toml::parse_error& err)
|
||||
{
|
||||
std::cerr << "Parsing failed:\n" << err << "\n";
|
||||
return 1;
|
||||
trackertbl = toml::parse(trackerstoml);
|
||||
conftbl = toml::parse(tellertoml);
|
||||
}
|
||||
|
||||
map<string, TrackerConf> trackerdb;
|
||||
|
Loading…
Reference in New Issue
Block a user