Add app name and reason to config header

This commit is contained in:
King_DuckZ 2020-08-16 14:34:19 +01:00
parent d1716a0c91
commit cef5060eb2
3 changed files with 14 additions and 1 deletions

View file

@ -19,6 +19,8 @@
namespace duck {
constexpr const char g_project_name[] = @PROJECT_NAME@;
constexpr const char g_build_purpose[] = @BUILD_PURPOSE@;
constexpr const char g_base_url[] = @BASE_URL@;
constexpr const char g_config_file_path[] = @CONFIG_FILE_PATH@;
constexpr const char g_def_sqlite_db_name[] = @DEF_SQLITE_DB_NAME@;

View file

@ -44,7 +44,12 @@ int main(int argc, char* argv[]) {
try {
duck::AppConfig app_conf;
std::string_view api_key = (2 == argc ? std::string_view(argv[1]) : app_conf.api_key());
oro::Api oro_api(duck::g_base_url, std::string(api_key), "RESTC_CPP", "Testing");
oro::Api oro_api(
duck::g_base_url,
std::string(api_key),
duck::g_project_name,
duck::g_build_purpose
);
print_ping(oro_api);

View file

@ -23,6 +23,12 @@ conf = configuration_data()
conf.set_quoted('BASE_URL', base_url)
conf.set_quoted('CONFIG_FILE_PATH', get_option('prefix') / get_option('sysconfdir') / meson.project_name() + '.conf')
conf.set_quoted('DEF_SQLITE_DB_NAME', get_option('def_sqlite_db_name'))
conf.set_quoted('PROJECT_NAME', meson.project_name())
if get_option('buildtype') == 'debug'
conf.set_quoted('BUILD_PURPOSE', 'Debugging')
else
conf.set_quoted('BUILD_PURPOSE', 'Production')
endif
project_config_file = configure_file(
input: 'config.hpp.in',
output: meson.project_name() + '_config.hpp',