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
32 lines
736 B
C++
32 lines
736 B
C++
|
|
/*
|
|
* Copyright (C) 2022-present ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#ifndef STRINGIFY
|
|
// We need to levels of indirection
|
|
// to make a string out of the macro name.
|
|
// The outer level expands the macro
|
|
// and the inner level makes a string out of the expanded macro.
|
|
#define STRINGIFY_VALUE(x) #x
|
|
#define STRINGIFY_MACRO(x) STRINGIFY_VALUE(x)
|
|
#endif
|
|
|
|
#define SCYLLA_BUILD_MODE_STR STRINGIFY_MACRO(SCYLLA_BUILD_MODE)
|
|
|
|
#if SCYLLA_BUILD_MODE == release
|
|
#define SCYLLA_BUILD_MODE_RELEASE
|
|
#elif SCYLLA_BUILD_MODE == dev
|
|
#define SCYLLA_BUILD_MODE_DEV
|
|
#elif SCYLLA_BUILD_MODE == debug
|
|
#define SCYLLA_BUILD_MODE_DEBUG
|
|
#elif SCYLLA_BUILD_MODE == sanitize
|
|
#define SCYLLA_BUILD_MODE_SANITIZE
|
|
#endif
|