Skip to content

Commit 5905246

Browse files
committed
Move googletest to the third-party directory
This will help improve the project's layering, so that sub-projects that don't actually need any llvm code can still use googletest without having to reference code in the llvm directory. This will also make it easier to consolidate and simplify the standalone build configurations. Reviewed By: stellaraccident, lattner, probinson, phosek Differential Revision: https://reviews.llvm.org/D131919
1 parent 4d5a9c1 commit 5905246

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+18
-18
lines changed

clang/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,11 @@ if(CLANG_BUILT_STANDALONE)
111111
set(LLVM_UTILS_PROVIDED ON)
112112
set(CLANG_TEST_DEPS FileCheck count not)
113113
endif()
114-
set(UNITTEST_DIR ${LLVM_MAIN_SRC_DIR}/utils/unittest)
114+
set(UNITTEST_DIR ${LLVM_THIRD_PARTY_DIR}/unittest)
115115
if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h
116116
AND NOT EXISTS ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}
117117
AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt)
118-
add_subdirectory(${UNITTEST_DIR} utils/unittest)
118+
add_subdirectory(${UNITTEST_DIR} third-party/unittest)
119119
endif()
120120
endif()
121121

@@ -526,7 +526,7 @@ endif()
526526

527527

528528
if( CLANG_INCLUDE_TESTS )
529-
if(EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include/gtest/gtest.h)
529+
if(EXISTS ${LLVM_THIRD_PARTY_DIR}/unittest/googletest/include/gtest/gtest.h)
530530
add_subdirectory(unittests)
531531
list(APPEND CLANG_TEST_DEPS ClangUnitTests)
532532
list(APPEND CLANG_TEST_PARAMS

compiler-rt/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ elseif (SANITIZER_TEST_CXX_LIBNAME STREQUAL "libstdc++")
639639
endif()
640640

641641
# Unittests support.
642-
set(COMPILER_RT_GTEST_PATH ${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest)
642+
set(COMPILER_RT_GTEST_PATH ${LLVM_THIRD_PARTY_DIR}/unittest/googletest)
643643
set(COMPILER_RT_GTEST_SOURCE ${COMPILER_RT_GTEST_PATH}/src/gtest-all.cc)
644644
set(COMPILER_RT_GTEST_CFLAGS
645645
-DGTEST_NO_LLVM_SUPPORT=1
@@ -649,7 +649,7 @@ set(COMPILER_RT_GTEST_CFLAGS
649649
)
650650

651651
# Mocking support.
652-
set(COMPILER_RT_GMOCK_PATH ${LLVM_MAIN_SRC_DIR}/utils/unittest/googlemock)
652+
set(COMPILER_RT_GMOCK_PATH ${LLVM_THIRD_PATY_DIR}/unittest/googlemock)
653653
set(COMPILER_RT_GMOCK_SOURCE ${COMPILER_RT_GMOCK_PATH}/src/gmock-all.cc)
654654
set(COMPILER_RT_GMOCK_CFLAGS
655655
-DGTEST_NO_LLVM_SUPPORT=1

lld/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ if(LLD_BUILT_STANDALONE)
6868
set(LLVM_UTILS_PROVIDED ON)
6969
set(LLD_TEST_DEPS FileCheck not)
7070
endif()
71-
set(UNITTEST_DIR ${LLVM_MAIN_SRC_DIR}/utils/unittest)
71+
set(UNITTEST_DIR ${LLVM_THIRD_PARTY_DIR}/unittest)
7272
if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h
7373
AND NOT EXISTS ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}
7474
AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt)
75-
add_subdirectory(${UNITTEST_DIR} utils/unittest)
75+
add_subdirectory(${UNITTEST_DIR} third-party/unittest)
7676
endif()
7777
else()
7878
# Seek installed Lit.

lldb/cmake/modules/LLDBStandalone.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ include_directories(
100100
if(LLDB_INCLUDE_TESTS)
101101
# Build the gtest library needed for unittests, if we have LLVM sources
102102
# handy.
103-
if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest AND NOT TARGET llvm_gtest)
104-
add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/unittest utils/unittest)
103+
if (EXISTS ${LLVM_THIRD_PARTY_DIR}/unittest AND NOT TARGET llvm_gtest)
104+
add_subdirectory(${LLVM_THIRD_PARTY_DIR}}/utils/unittest third-party/unittest)
105105
endif()
106106
# LLVMTestingSupport library is needed for Process/gdb-remote.
107107
if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Support

llvm/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,6 @@ set(LLVM_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR} ) # --src-root
401401
set(LLVM_MAIN_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/include ) # --includedir
402402
set(LLVM_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} ) # --prefix
403403

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

406405
# Note: LLVM_CMAKE_DIR does not include generated files
407406
set(LLVM_CMAKE_DIR ${LLVM_MAIN_SRC_DIR}/cmake/modules)
@@ -1194,7 +1193,7 @@ if( LLVM_INCLUDE_UTILS )
11941193
add_subdirectory(utils/yaml-bench)
11951194
add_subdirectory(utils/split-file)
11961195
if( LLVM_INCLUDE_TESTS )
1197-
add_subdirectory(utils/unittest)
1196+
add_subdirectory(${LLVM_THIRD_PARTY_DIR}/unittest ${CMAKE_CURRENT_BINARY_DIR}/third-party/unittest)
11981197
endif()
11991198
else()
12001199
if ( LLVM_INCLUDE_TESTS )

llvm/cmake/modules/HandleLLVMOptions.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,3 +1260,6 @@ if(LLVM_USE_RELATIVE_PATHS_IN_FILES)
12601260
append_if(SUPPORTS_FFILE_PREFIX_MAP "-ffile-prefix-map=${source_root}/=${LLVM_SOURCE_PREFIX}" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
12611261
add_flag_if_supported("-no-canonical-prefixes" NO_CANONICAL_PREFIXES)
12621262
endif()
1263+
1264+
set(LLVM_THIRD_PARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../third-party CACHE STRING
1265+
"Directory containing third party software used by LLVM (e.g. googletest)")

mlir/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,9 @@ if(MLIR_STANDALONE_BUILD)
2525

2626
include_directories(${LLVM_INCLUDE_DIRS})
2727

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

3533
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY
@@ -178,7 +176,7 @@ add_subdirectory(lib/CAPI)
178176
if (MLIR_INCLUDE_TESTS)
179177
add_definitions(-DMLIR_INCLUDE_TESTS)
180178
add_custom_target(MLIRUnitTests)
181-
if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include/gtest/gtest.h)
179+
if (EXISTS ${LLVM_THIRD_PARTY_DIR}/unittest/googletest/include/gtest/gtest.h)
182180
add_subdirectory(unittests)
183181
else()
184182
message(WARNING "gtest not found, unittests will not be available")

polly/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ if(POLLY_STANDALONE_BUILD)
2828

2929
# Enable unit tests if available.
3030
set(POLLY_GTEST_AVAIL 0)
31-
set(UNITTEST_DIR ${LLVM_SOURCE_ROOT}/utils/unittest)
31+
set(UNITTEST_DIR ${LLVM_THIRD_PARTY_DIR}/unittest)
3232
if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h)
3333
if (NOT TARGET gtest)
34-
add_subdirectory(${UNITTEST_DIR} utils/unittest)
34+
add_subdirectory(${UNITTEST_DIR} third-party/unittest)
3535
endif()
3636
set(POLLY_GTEST_AVAIL 1)
3737
endif()

0 commit comments

Comments
 (0)