Skip to content

Commit

Permalink
Move install of gtest to DependencyInstaller.sh.
Browse files Browse the repository at this point in the history
  • Loading branch information
titan73 committed Aug 15, 2024
1 parent 14b1cbd commit 1209176
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 39 deletions.
19 changes: 19 additions & 0 deletions etc/DependencyInstaller.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ _installCommonDev() {
cuddVersion=3.0.0
lemonVersion=1.3.1
spdlogVersion=1.8.1
gtestVersion=1.13.0
gtestChecksum="a1279c6fb5bf7d4a5e0d0b2a4adb39ac"


rm -rf "${baseDir}"
mkdir -p "${baseDir}"
Expand Down Expand Up @@ -201,6 +204,22 @@ _installCommonDev() {
echo "spdlog already installed."
fi

# gtest
gtestPrefix=${PREFIX:-"/usr/local"}
if [[ ! -d ${gtestPrefix}/include/gtest ]]; then
cd "${baseDir}"
wget https://github.com/google/googletest/archive/refs/tags/v${gtestVersion}.zip
md5sum -c <(echo "${gtestChecksum} v${gtestVersion}.zip") || exit 1
unzip v${gtestVersion}.zip
cd googletest-${gtestVersion}
${cmakePrefix}/bin/cmake -DCMAKE_INSTALL_PREFIX="${gtestPrefix}" -B build .
# FIXME: The override does not work if a system gtest is present so something more should be done
# Conversely our install will still be used if a system gtest is install afterwards
${cmakePrefix}/bin/cmake --build build --target install
else
echo "gtest already installed."
fi

if [[ ${equivalenceDeps} == "yes" ]]; then
_equivalenceDeps
fi
Expand Down
6 changes: 6 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@ include(UseSWIG)

find_package(Boost REQUIRED)
message(STATUS "boost: ${Boost_VERSION}")

if (ENABLE_TESTS)
find_package(GTest REQUIRED)
message(STATUS "GTest: ${GTest_VERSION}")
endif()

find_package(Python3 COMPONENTS Development REQUIRED)
option(BUILD_PYTHON "Build the Python3 interface" ON)

Expand Down
4 changes: 2 additions & 2 deletions src/cts/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ target_include_directories(cts_unittest
)

target_link_libraries(cts_unittest
gtest
gtest_main
GTest::gtest
GTest::gtest_main
cts_lib
utl_lib
dbSta_lib
Expand Down
6 changes: 3 additions & 3 deletions src/dft/test/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
include("openroad")

set(TEST_LIBS
gtest
gmock
gtest_main
GTest::gtest
GTest::gtest_main
GTest::gmock
odb
dft_base_scan_cell_lib
dft_config_lib
Expand Down
6 changes: 3 additions & 3 deletions src/dpl/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ endforeach()

add_executable(dpl_test dpl_test.cc)

target_link_libraries(dpl_test
gtest
gtest_main
target_link_libraries(dpl_test
GTest::gtest
GTest::gtest_main
dpl_lib
)

Expand Down
4 changes: 2 additions & 2 deletions src/gpl/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ target_include_directories(fft_test
)

target_link_libraries(fft_test
gtest
gtest_main
GTest::gtest
GTest::gtest_main
spdlog::spdlog
)

Expand Down
12 changes: 6 additions & 6 deletions src/mpl2/test/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
include("openroad")

set(TEST_LIBS
gtest
gmock
gtest_main
GTest::gtest
GTest::gtest_main
GTest::gmock
odb
mpl2_lib
)
Expand All @@ -19,9 +19,9 @@ target_link_libraries(TestSnapper ${TEST_LIBS})
gtest_discover_tests(TestSnapper WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

add_executable(mpl2_test mpl2_test.cc)
target_link_libraries(mpl2_test
gtest
gtest_main
target_link_libraries(mpl2_test
GTest::gtest
GTest::gtest_main
mpl2_lib
)
gtest_discover_tests(mpl2_test
Expand Down
7 changes: 4 additions & 3 deletions src/odb/test/cpp/scan/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ set(TEST_LIBS
cdl
${TCL_LIBRARY}
Boost::boost
utl_lib gtest
gmock
gtest_main
utl_lib
GTest::gtest
GTest::gtest_main
GTest::gmock
odb_test_helper
)

Expand Down
6 changes: 3 additions & 3 deletions src/rmp/test/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ include(openroad)
add_executable(RmpGTests TestAbc.cc)
target_link_libraries(RmpGTests
OpenSTA
gtest
gmock
gtest_main
GTest::gtest
GTest::gtest_main
GTest::gmock
rmp_abc_library
dbSta_lib
utl_lib
Expand Down
6 changes: 3 additions & 3 deletions src/rsz/test/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ include(openroad)
add_executable(TestBufRem1 TestBufferRemoval.cc)
target_link_libraries(TestBufRem1
OpenSTA
gtest
gmock
gtest_main
GTest::gtest
GTest::gtest_main
GTest::gmock
dbSta_lib
utl_lib
rsz_lib
Expand Down
4 changes: 2 additions & 2 deletions src/utl/test/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
include("openroad")

set(TEST_LIBS
gtest
gtest_main
GTest::gtest
GTest::gtest_main
utl_lib
)

Expand Down
4 changes: 0 additions & 4 deletions third-party/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@
###############################################################################


if(ENABLE_TESTS)
add_subdirectory(gtest EXCLUDE_FROM_ALL)
endif()

if (NOT USE_SYSTEM_ABC)

set(ABC_USE_NAMESPACE "abc")
Expand Down
8 changes: 0 additions & 8 deletions third-party/gtest/CMakeLists.txt

This file was deleted.

0 comments on commit 1209176

Please sign in to comment.