Skip to content

Commit

Permalink
gtest: add submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
tobtoht committed Jan 19, 2025
1 parent 1bd57c8 commit e38c175
Show file tree
Hide file tree
Showing 50 changed files with 11 additions and 34,326 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@
path = external/supercop
url = https://github.com/monero-project/supercop
branch = monero
[submodule "external/gtest"]
path = external/gtest
url = https://github.com/google/googletest.git
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,12 @@ sudo apt update && sudo apt install build-essential cmake pkg-config libssl-dev

Install all dependencies at once on Arch:
```
sudo pacman -Syu --needed base-devel cmake boost openssl zeromq unbound libsodium libunwind xz readline expat gtest python3 ccache doxygen graphviz qt5-tools hidapi libusb protobuf systemd
sudo pacman -Syu --needed base-devel cmake boost openssl zeromq unbound libsodium libunwind xz readline expat python3 ccache doxygen graphviz qt5-tools hidapi libusb protobuf systemd
```

Install all dependencies at once on Fedora:
```
sudo dnf install gcc gcc-c++ cmake pkgconf boost-devel openssl-devel zeromq-devel unbound-devel libsodium-devel libunwind-devel xz-devel readline-devel expat-devel gtest-devel ccache doxygen graphviz qt5-linguist hidapi-devel libusbx-devel protobuf-devel protobuf-compiler systemd-devel
sudo dnf install gcc gcc-c++ cmake pkgconf boost-devel openssl-devel zeromq-devel unbound-devel libsodium-devel libunwind-devel xz-devel readline-devel expat-devel ccache doxygen graphviz qt5-linguist hidapi-devel libusbx-devel protobuf-devel protobuf-compiler systemd-devel
```

Install all dependencies at once on openSUSE:
Expand Down
39 changes: 0 additions & 39 deletions contrib/depends/packages/gtest.mk

This file was deleted.

4 changes: 0 additions & 4 deletions contrib/depends/packages/packages.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ ifneq ($(host_os),mingw32)
packages += ncurses readline
endif

ifeq ($(build_tests),ON)
packages += gtest
endif

linux_native_packages :=
linux_packages := eudev

Expand Down
1 change: 1 addition & 0 deletions external/gtest
Submodule gtest added at b514bd
36 changes: 5 additions & 31 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,37 +40,11 @@ if (WIN32 AND STATIC)
add_definitions(-DMINIUPNP_STATICLIB)
endif ()

find_package(GTest)

if (GTest_FOUND)
include_directories(SYSTEM ${GTEST_INCLUDE_DIRS})
else ()
message(STATUS "GTest not found on the system: will use GTest bundled with this source")

include(ExternalProject)
ExternalProject_Add(googletest
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/gtest
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/gtest
DOWNLOAD_COMMAND ""
UPDATE_COMMAND ""
INSTALL_COMMAND ""
)
add_library(gtest UNKNOWN IMPORTED)
add_library(gtest_main UNKNOWN IMPORTED)
set_target_properties(gtest PROPERTIES
IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/gtest/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}"
)
set_target_properties(gtest_main PROPERTIES
IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/gtest/${CMAKE_STATIC_LIBRARY_PREFIX}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX}"
)
add_dependencies(gtest googletest)
add_dependencies(gtest_main googletest)

# Emulate the FindGTest module's variable.
set(GTEST_LIBRARIES gtest gtest_main)
set(GTEST_BOTH_LIBRARIES gtest gtest_main)
include_directories(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/gtest/include")
endif (GTest_FOUND)
set(BUILD_GMOCK OFF CACHE BOOL "Don't build GMock" FORCE)
set(INSTALL_GTEST OFF CACHE BOOL "Don't install GTest" FORCE)
add_subdirectory("${CMAKE_SOURCE_DIR}/external/gtest" ${CMAKE_BINARY_DIR}/googletest)
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/external/gtest/googletest/include")
set(GTEST_LIBRARIES gtest gtest_main)

message(STATUS "Copying test data directory...")
file(COPY data DESTINATION .) # Copy data directory from source root to build root
Expand Down
157 changes: 0 additions & 157 deletions tests/gtest/CHANGES

This file was deleted.

Loading

0 comments on commit e38c175

Please sign in to comment.