Files
scylladb/release.cc
Benny Halevy 765d2f5e46 release: define SCYLLA_BUILD_MODE_STR by stringifying SCYLLA_BUILD_MODE
Currently SCYLLA_BULD_MODE is defined as a string by the cxxflags
generated by configure.py.  This is not very useful since one cannot use
it in a @if preprocessor directive.

Instead, use -DSCYLLA_BULD_MODE=release, for example, and define a
SCYLLA_BULD_MODE_STR as the dtirng representation of it.

In addition define the respective
SCYLLA_BUILD_MODE_{RELEASE,DEV,DEBUG,SANITIZE} macros that can be easily
used in @ifdef (or #ifndef :)) for conditional compilation.

The planned use case for it is to enable a task_manager test module only
in non-release modes.

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>

Closes #11357
2022-08-25 16:50:42 +02:00

31 lines
787 B
C++

/*
* Copyright (C) 2015-present ScyllaDB
*/
/*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#include "version.hh"
#include "build_mode.hh"
#include <seastar/core/print.hh>
static const char scylla_version_str[] = SCYLLA_VERSION;
static const char scylla_release_str[] = SCYLLA_RELEASE;
static const char scylla_build_mode_str[] = SCYLLA_BUILD_MODE_STR;
std::string scylla_version()
{
return seastar::format("{}-{}", scylla_version_str, scylla_release_str);
}
std::string scylla_build_mode()
{
return seastar::format("{}", scylla_build_mode_str);
}
// get the version number into writeable memory, so we can grep for it if we get a core dump
std::string version_stamp_for_core
= "VERSION VERSION VERSION $Id: " + scylla_version() + " $ VERSION VERSION VERSION";