Skip to content

Commit cb7c2d9

Browse files
committed
Revert "Fix src_root and src_location tests (#164)"
This reverts commit 2f5f71d.
1 parent 51947a0 commit cb7c2d9

File tree

1 file changed

+2
-65
lines changed

1 file changed

+2
-65
lines changed

Diff for: util/CMakeLists.txt

+2-65
Original file line numberDiff line numberDiff line change
@@ -696,73 +696,10 @@ elseif (WIN32 AND CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64")
696696
)
697697
endif()
698698

699-
#[=============================================================================[
700-
Since in certain circumstances the __FILE__ macro expands to a relative path,
701-
some internal macros that trims the source or binary prefix of the file path
702-
may not work properly, if we pass these prefixes as absolute paths via
703-
ARCADIA_ROOT and ARCADIA_BUILD_ROOT. This function deduces the proper arcadia
704-
root paths, either relative or absolute, and put them in the cached variables
705-
ARCADIA_ROOT and ARCADIA_BUILD_ROOT.
706-
#]=============================================================================]
707-
function(deduce_arcadia_roots)
708-
if (DEFINED CACHE{ARCADIA_ROOT} AND DEFINED CACHE{ARCADIA_BUILD_ROOT})
709-
return()
710-
endif()
711-
712-
set(helperDir "${YDB_SDK_BINARY_DIR}/arcadia_roots_helper")
713-
set(sourceFile "arcadia_roots_helper.cpp")
714-
set(cxxSrcFilePath "${helperDir}/src_cxx_file_path.txt")
715-
set(cxxBinFilePath "${helperDir}/bin_cxx_file_path.txt")
716-
717-
if (NOT EXISTS "${helperDir}/${sourceFile}")
718-
set(sourceContent
719-
[=[
720-
#include <fstream>
721-
int main() {
722-
std::ofstream file("@cxxFilePath@");
723-
file << __FILE__;
724-
}
725-
]=]
726-
)
727-
file(WRITE "${helperDir}/${sourceFile}" "${sourceContent}")
728-
endif()
729-
730-
foreach (varList
731-
"${cxxSrcFilePath};${YDB_SDK_SOURCE_DIR};ARCADIA_ROOT"
732-
"${cxxBinFilePath};${YDB_SDK_BINARY_DIR};ARCADIA_BUILD_ROOT"
733-
)
734-
list(GET varList 0 cxxFilePath)
735-
list(GET varList 1 sourceDir)
736-
list(GET varList 2 arcadiaCacheVariableName)
737-
738-
configure_file(
739-
"${helperDir}/${sourceFile}"
740-
"${sourceDir}/${sourceFile}"
741-
@ONLY
742-
)
743-
744-
try_run(runResultVar compileResultVar
745-
"${helperDir}/build" "${sourceDir}/${sourceFile}"
746-
)
747-
if ((NOT runResultVar EQUAL "0") OR NOT compileResultVar)
748-
message(FATAL_ERROR "Deducing ${arcadiaCacheVariableName} failed.")
749-
endif()
750-
751-
file(READ "${cxxFilePath}" cxxFilePathContent)
752-
file(TO_CMAKE_PATH "${cxxFilePathContent}" cxxFilePathContent)
753-
get_filename_component(rootDir "${cxxFilePathContent}" DIRECTORY)
754-
set(${arcadiaCacheVariableName} "${rootDir}" CACHE INTERNAL "")
755-
756-
file(REMOVE "${sourceDir}/${sourceFile}")
757-
endforeach()
758-
endfunction()
759-
760-
deduce_arcadia_roots()
761-
762699
# These definitions are needed to `util/system/src_root.h` works properly
763700
target_compile_definitions(yutil PUBLIC
764-
ARCADIA_ROOT=${ARCADIA_ROOT}
765-
ARCADIA_BUILD_ROOT=${ARCADIA_BUILD_ROOT}
701+
ARCADIA_ROOT=${YDB_SDK_SOURCE_DIR}
702+
ARCADIA_BUILD_ROOT=${YDB_SDK_BINARY_DIR}
766703
)
767704

768705
_ydb_sdk_install_targets(TARGETS yutil)

0 commit comments

Comments
 (0)