fix: make --help flag work for development builds (#2004)

Before that SOURCE_PATH_FROM_BUILD_ENV define has not been defined
for the development builds.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
Roman Gershman 2023-10-09 19:44:14 +03:00 committed by GitHub
parent 17e331c16c
commit 2876a9ecab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 9 deletions

View File

@ -4,10 +4,11 @@ cxx_link(dragonfly base dragonfly_lib)
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND CMAKE_BUILD_TYPE STREQUAL "Release")
# Add core2 only to this file, thus avoiding instructions in this object file that
# can cause SIGILL.
set_source_files_properties(dfly_main.cc PROPERTIES COMPILE_FLAGS -march=core2 COMPILE_DEFINITIONS
SOURCE_PATH_FROM_BUILD_ENV=${CMAKE_SOURCE_DIR})
set_source_files_properties(dfly_main.cc PROPERTIES COMPILE_FLAGS -march=core2)
endif()
set_property(SOURCE dfly_main.cc APPEND PROPERTY COMPILE_DEFINITIONS
SOURCE_PATH_FROM_BUILD_ENV=${CMAKE_SOURCE_DIR})
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
SET(TX_LINUX_SRCS io_mgr.cc tiered_storage.cc)

View File

@ -46,13 +46,6 @@
#include "util/http/http_client.h"
#include "util/varz.h"
#define STRING_PP_NX(A) #A
#define STRING_MAKE_PP(A) STRING_PP_NX(A)
// This would create a string value from a "defined" location of the source code
// Note that SOURCE_PATH_FROM_BUILD_ENV is taken from the build system
#define BUILD_LOCATION_PATH STRING_MAKE_PP(SOURCE_PATH_FROM_BUILD_ENV)
#ifdef __APPLE__
#include <crt_externs.h>
#define environ (*_NSGetEnviron())
@ -313,6 +306,13 @@ bool HelpFlags(std::string_view f) {
return absl::StartsWith(f, "\033[0;3");
}
#define STRING_PP_NX(A) #A
#define STRING_MAKE_PP(A) STRING_PP_NX(A)
// This would create a string value from a "defined" location of the source code
// Note that SOURCE_PATH_FROM_BUILD_ENV is taken from the build system
#define BUILD_LOCATION_PATH STRING_MAKE_PP(SOURCE_PATH_FROM_BUILD_ENV)
string NormalizePaths(std::string_view path) {
const std::string FULL_PATH = BUILD_LOCATION_PATH;
const std::string FULL_PATH_SRC = FULL_PATH + "/src";