Skip to content

Commit

Permalink
Revert "Move googletest to the third-party directory"
Browse files Browse the repository at this point in the history
This reverts commit 5905246.

It looks like this patch breaks the build when compiler-rt is passed to
LLVM_ENABLE_PROJECTS instead of LLVM_ENABLE_RUNTIMES.
  • Loading branch information
tstellar committed Nov 9, 2022
1 parent 0b01aeb commit 8a084f6
Show file tree
Hide file tree
Showing 72 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions clang/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ if(CLANG_BUILT_STANDALONE)
set(LLVM_UTILS_PROVIDED ON)
set(CLANG_TEST_DEPS FileCheck count not)
endif()
set(UNITTEST_DIR ${LLVM_THIRD_PARTY_DIR}/unittest)
set(UNITTEST_DIR ${LLVM_MAIN_SRC_DIR}/utils/unittest)
if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h
AND NOT EXISTS ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}
AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt)
add_subdirectory(${UNITTEST_DIR} third-party/unittest)
add_subdirectory(${UNITTEST_DIR} utils/unittest)
endif()
endif()

Expand Down Expand Up @@ -526,7 +526,7 @@ endif()


if( CLANG_INCLUDE_TESTS )
if(EXISTS ${LLVM_THIRD_PARTY_DIR}/unittest/googletest/include/gtest/gtest.h)
if(EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include/gtest/gtest.h)
add_subdirectory(unittests)
list(APPEND CLANG_TEST_DEPS ClangUnitTests)
list(APPEND CLANG_TEST_PARAMS
Expand Down
4 changes: 2 additions & 2 deletions compiler-rt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ elseif (SANITIZER_TEST_CXX_LIBNAME STREQUAL "libstdc++")
endif()

# Unittests support.
set(COMPILER_RT_GTEST_PATH ${LLVM_THIRD_PARTY_DIR}/unittest/googletest)
set(COMPILER_RT_GTEST_PATH ${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest)
set(COMPILER_RT_GTEST_SOURCE ${COMPILER_RT_GTEST_PATH}/src/gtest-all.cc)
set(COMPILER_RT_GTEST_CFLAGS
-DGTEST_NO_LLVM_SUPPORT=1
Expand All @@ -649,7 +649,7 @@ set(COMPILER_RT_GTEST_CFLAGS
)

# Mocking support.
set(COMPILER_RT_GMOCK_PATH ${LLVM_THIRD_PATY_DIR}/unittest/googlemock)
set(COMPILER_RT_GMOCK_PATH ${LLVM_MAIN_SRC_DIR}/utils/unittest/googlemock)
set(COMPILER_RT_GMOCK_SOURCE ${COMPILER_RT_GMOCK_PATH}/src/gmock-all.cc)
set(COMPILER_RT_GMOCK_CFLAGS
-DGTEST_NO_LLVM_SUPPORT=1
Expand Down
4 changes: 2 additions & 2 deletions lld/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ if(LLD_BUILT_STANDALONE)
set(LLVM_UTILS_PROVIDED ON)
set(LLD_TEST_DEPS FileCheck not)
endif()
set(UNITTEST_DIR ${LLVM_THIRD_PARTY_DIR}/unittest)
set(UNITTEST_DIR ${LLVM_MAIN_SRC_DIR}/utils/unittest)
if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h
AND NOT EXISTS ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}
AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt)
add_subdirectory(${UNITTEST_DIR} third-party/unittest)
add_subdirectory(${UNITTEST_DIR} utils/unittest)
endif()
else()
# Seek installed Lit.
Expand Down
4 changes: 2 additions & 2 deletions lldb/cmake/modules/LLDBStandalone.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ include_directories(
if(LLDB_INCLUDE_TESTS)
# Build the gtest library needed for unittests, if we have LLVM sources
# handy.
if (EXISTS ${LLVM_THIRD_PARTY_DIR}/unittest AND NOT TARGET llvm_gtest)
add_subdirectory(${LLVM_THIRD_PARTY_DIR}}/utils/unittest third-party/unittest)
if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest AND NOT TARGET llvm_gtest)
add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/unittest utils/unittest)
endif()
# LLVMTestingSupport library is needed for Process/gdb-remote.
if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
Expand Down
3 changes: 2 additions & 1 deletion llvm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ set(LLVM_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR} ) # --src-root
set(LLVM_MAIN_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/include ) # --includedir
set(LLVM_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} ) # --prefix

set(LLVM_THIRD_PARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../third-party)

# Note: LLVM_CMAKE_DIR does not include generated files
set(LLVM_CMAKE_DIR ${LLVM_MAIN_SRC_DIR}/cmake/modules)
Expand Down Expand Up @@ -1193,7 +1194,7 @@ if( LLVM_INCLUDE_UTILS )
add_subdirectory(utils/yaml-bench)
add_subdirectory(utils/split-file)
if( LLVM_INCLUDE_TESTS )
add_subdirectory(${LLVM_THIRD_PARTY_DIR}/unittest ${CMAKE_CURRENT_BINARY_DIR}/third-party/unittest)
add_subdirectory(utils/unittest)
endif()
else()
if ( LLVM_INCLUDE_TESTS )
Expand Down
3 changes: 0 additions & 3 deletions llvm/cmake/modules/HandleLLVMOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1260,6 +1260,3 @@ if(LLVM_USE_RELATIVE_PATHS_IN_FILES)
append_if(SUPPORTS_FFILE_PREFIX_MAP "-ffile-prefix-map=${source_root}/=${LLVM_SOURCE_PREFIX}" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
add_flag_if_supported("-no-canonical-prefixes" NO_CANONICAL_PREFIXES)
endif()

set(LLVM_THIRD_PARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../third-party CACHE STRING
"Directory containing third party software used by LLVM (e.g. googletest)")
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 5 additions & 3 deletions mlir/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ if(MLIR_STANDALONE_BUILD)

include_directories(${LLVM_INCLUDE_DIRS})

set(UNITTEST_DIR ${LLVM_THIRD_PARTY_DIR}/unittest)
set(LLVM_MAIN_SRC_DIR ${CMAKE_SOURCE_DIR}/../llvm CACHE PATH
"Path to LLVM source tree")
set(UNITTEST_DIR ${LLVM_MAIN_SRC_DIR}/utils/unittest)
if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h)
add_subdirectory(${UNITTEST_DIR} third-party/unittest)
add_subdirectory(${UNITTEST_DIR} utils/unittest)
endif()

set(CMAKE_LIBRARY_OUTPUT_DIRECTORY
Expand Down Expand Up @@ -176,7 +178,7 @@ add_subdirectory(lib/CAPI)
if (MLIR_INCLUDE_TESTS)
add_definitions(-DMLIR_INCLUDE_TESTS)
add_custom_target(MLIRUnitTests)
if (EXISTS ${LLVM_THIRD_PARTY_DIR}/unittest/googletest/include/gtest/gtest.h)
if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include/gtest/gtest.h)
add_subdirectory(unittests)
else()
message(WARNING "gtest not found, unittests will not be available")
Expand Down
4 changes: 2 additions & 2 deletions polly/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ if(POLLY_STANDALONE_BUILD)

# Enable unit tests if available.
set(POLLY_GTEST_AVAIL 0)
set(UNITTEST_DIR ${LLVM_THIRD_PARTY_DIR}/unittest)
set(UNITTEST_DIR ${LLVM_SOURCE_ROOT}/utils/unittest)
if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h)
if (NOT TARGET gtest)
add_subdirectory(${UNITTEST_DIR} third-party/unittest)
add_subdirectory(${UNITTEST_DIR} utils/unittest)
endif()
set(POLLY_GTEST_AVAIL 1)
endif()
Expand Down

0 comments on commit 8a084f6

Please sign in to comment.