diff --git a/configure.py b/configure.py index 12ec3c042c..1b1520b5e5 100755 --- a/configure.py +++ b/configure.py @@ -535,7 +535,12 @@ defines = ['XXH_PRIVATE_API', 'SEASTAR_TESTING_MAIN', ] -extra_cxxflags = {} +extra_cxxflags = { + 'debug': {}, + 'dev': {}, + 'release': {}, + 'sanitize': {} +} scylla_core = (['database.cc', 'absl-flat_hash_map.cc', @@ -1293,7 +1298,9 @@ scylla_release = file.read().strip() file = open(f'{outdir}/SCYLLA-PRODUCT-FILE', 'r') scylla_product = file.read().strip() -extra_cxxflags["release.cc"] = "-DSCYLLA_VERSION=\"\\\"" + scylla_version + "\\\"\" -DSCYLLA_RELEASE=\"\\\"" + scylla_release + "\\\"\"" +for m in ['debug', 'release', 'sanitize', 'dev']: + cxxflags = "-DSCYLLA_VERSION=\"\\\"" + scylla_version + "\\\"\" -DSCYLLA_RELEASE=\"\\\"" + scylla_release + "\\\"\" -DSCYLLA_BUILD_MODE=\"\\\"" + m + "\\\"\"" + extra_cxxflags[m]["release.cc"] = cxxflags for m in ['debug', 'release', 'sanitize']: modes[m]['cxxflags'] += ' ' + dbgflag @@ -1750,8 +1757,8 @@ with open(buildfile_tmp, 'w') as f: for obj in compiles: src = compiles[obj] f.write('build {}: cxx.{} {} || {} {}\n'.format(obj, mode, src, seastar_dep, gen_headers_dep)) - if src in extra_cxxflags: - f.write(' cxxflags = {seastar_cflags} $cxxflags $cxxflags_{mode} {extra_cxxflags}\n'.format(mode=mode, extra_cxxflags=extra_cxxflags[src], **modeval)) + if src in extra_cxxflags[mode]: + f.write(' cxxflags = {seastar_cflags} $cxxflags $cxxflags_{mode} {extra_cxxflags}\n'.format(mode=mode, extra_cxxflags=extra_cxxflags[mode][src], **modeval)) for swagger in swaggers: hh = swagger.headers(gen_dir)[0] cc = swagger.sources(gen_dir)[0] diff --git a/main.cc b/main.cc index d7fab93074..aadeb51fab 100644 --- a/main.cc +++ b/main.cc @@ -433,6 +433,7 @@ int main(int ac, char** av) { init("version", bpo::bool_switch(), "print version number and exit"); init("build-id", bpo::bool_switch(), "print build-id and exit"); + init("build-mode", bpo::bool_switch(), "print build mode and exit"); bpo::options_description deprecated("Deprecated options - ignored"); deprecated.add_options() @@ -455,11 +456,14 @@ int main(int ac, char** av) { fmt::print("{}\n", scylla_version()); return 0; } - if (vm["build-id"].as()) { fmt::print("{}\n", get_build_id()); return 0; } + if (vm["build-mode"].as()) { + fmt::print("{}\n", scylla_build_mode()); + return 0; + } print_starting_message(ac, av, parsed_opts); diff --git a/release.cc b/release.cc index a23e0348e2..57f05c9af1 100644 --- a/release.cc +++ b/release.cc @@ -25,12 +25,18 @@ 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; std::string scylla_version() { return format("{}-{}", scylla_version_str, scylla_release_str); } +std::string scylla_build_mode() +{ + return 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"; diff --git a/release.hh b/release.hh index a6482ebe6c..0eac1068cd 100644 --- a/release.hh +++ b/release.hh @@ -24,3 +24,5 @@ #include std::string scylla_version(); + +std::string scylla_build_mode();