Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/upstream-utils.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ jobs:
run: |
cd upstream_utils
./update_gcem.py
- name: Run update_googletest.py
run: |
cd upstream_utils
./update_googletest.py
- name: Run update_json.py
run: |
cd upstream_utils
Expand Down
1 change: 1 addition & 0 deletions .styleguide
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ cppSrcFileInclude {

modifiableFileExclude {
cmake/toolchains/
thirdparty/
\.patch$
gradlew
}
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ set(CMAKE_SHARED_LINKER_FLAGS_UBSAN

if(WITH_TESTS)
enable_testing()
add_subdirectory(googletest)
add_subdirectory(thirdparty/googletest)
include(GoogleTest)
endif()

Expand Down
2 changes: 1 addition & 1 deletion apriltag/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,5 @@ install(EXPORT apriltag DESTINATION share/apriltag)
if(WITH_TESTS)
wpilib_add_test(apriltag src/test/native/cpp)
target_include_directories(apriltag_test PRIVATE src/test/native/include)
target_link_libraries(apriltag_test apriltag gmock_main)
target_link_libraries(apriltag_test apriltag googletest)
endif()
2 changes: 1 addition & 1 deletion cameraserver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,5 @@ set_property(TARGET multiCameraServer PROPERTY FOLDER "examples")

if(WITH_TESTS)
wpilib_add_test(cameraserver src/test/native/cpp)
target_link_libraries(cameraserver_test cameraserver gtest)
target_link_libraries(cameraserver_test cameraserver googletest)
endif()
2 changes: 1 addition & 1 deletion crossConnIntegrationTests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ model {
components {
crossConnIntegrationTests(NativeExecutableSpec) {
targetBuildTypes 'debug'
nativeUtils.useRequiredLibrary(it, 'googletest_static')
binaries.all { binary ->
if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) {
if (binary.buildType.name == 'debug') {
Expand All @@ -88,6 +87,7 @@ model {
project(':hal').addHalJniDependency(binary)
lib project: ':wpinet', library: 'wpinet', linkage: 'shared'
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
lib project: ':thirdparty:googletest', library: 'googletest', linkage: 'static'
if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) {
nativeUtils.useRequiredLibrary(binary, 'ni_link_libraries', 'ni_runtime_libraries')
}
Expand Down
2 changes: 1 addition & 1 deletion cscore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,5 +148,5 @@ endif()

if(WITH_TESTS)
wpilib_add_test(cscore src/test/native/cpp)
target_link_libraries(cscore_test cscore gmock)
target_link_libraries(cscore_test cscore googletest)
endif()
24 changes: 0 additions & 24 deletions googletest/CMakeLists.txt

This file was deleted.

2 changes: 1 addition & 1 deletion hal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,5 @@ endif()

if(WITH_TESTS)
wpilib_add_test(hal src/test/native/cpp)
target_link_libraries(hal_test hal gtest)
target_link_libraries(hal_test hal googletest)
endif()
2 changes: 1 addition & 1 deletion ntcore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,5 @@ target_link_libraries(ntcoredev ntcore)
if(WITH_TESTS)
wpilib_add_test(ntcore src/test/native/cpp)
target_include_directories(ntcore_test PRIVATE src/main/native/cpp)
target_link_libraries(ntcore_test ntcore gmock_main wpiutil_testlib)
target_link_libraries(ntcore_test ntcore googletest wpiutil_testlib)
endif()
2 changes: 1 addition & 1 deletion romiVendordep/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,5 @@ install(EXPORT romivendordep DESTINATION share/romiVendordep)
if(WITH_TESTS)
wpilib_add_test(romiVendordep src/test/native/cpp)
target_include_directories(romiVendordep_test PRIVATE src/test/native/include)
target_link_libraries(romiVendordep_test romiVendordep gmock_main)
target_link_libraries(romiVendordep_test romiVendordep googletest)
endif()
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ include 'msvcruntime'
include 'ntcoreffi'
include 'apriltag'
include 'processstarter'
include 'thirdparty:googletest'

buildCache {
def cred = {
Expand Down
1 change: 0 additions & 1 deletion shared/config.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ nativeUtils {
googleTestYear = "frc2024"
niLibVersion = "2024.2.1"
opencvVersion = "4.8.0-4"
googleTestVersion = "1.14.0-1"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion shared/googletest.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
model {
binaries {
withType(GoogleTestTestSuiteBinarySpec).all {
nativeUtils.useRequiredLibrary(it, 'googletest_static')
lib project: ':thirdparty:googletest', library: 'googletest', linkage: 'static'
}
}
}
2 changes: 1 addition & 1 deletion sysid/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ if(WITH_TESTS)
target_compile_options(sysid_test PRIVATE /utf-8)
endif()
target_include_directories(sysid_test PRIVATE src/main/native/cpp src/main/native/include)
target_link_libraries(sysid_test wpimath libglassnt libglass gtest)
target_link_libraries(sysid_test wpimath libglassnt libglass googletest)
endif()
3 changes: 2 additions & 1 deletion sysid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ model {
it.linker.args << '-lGL'
}
}
nativeUtils.useRequiredLibrary(it, "googletest_static")

lib project: ':thirdparty:googletest', library: 'googletest', linkage: 'static'
it.cppCompiler.define("RUNNING_SYSID_TESTS")
}
}
Expand Down
33 changes: 33 additions & 0 deletions thirdparty/googletest/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
project(googletest)

include(CompileWarnings)

file(
GLOB_RECURSE googletest_src
src/googlemock/src/*.cpp
src/googletest/src/*.cpp
)

add_library(googletest ${googletest_src})
set_target_properties(googletest PROPERTIES DEBUG_POSTFIX "d")

set_property(TARGET googletest PROPERTY FOLDER "libraries")
target_compile_features(googletest PUBLIC cxx_std_20)

include_directories(
"${CMAKE_CURRENT_SOURCE_DIR}/include"
"${CMAKE_CURRENT_SOURCE_DIR}/src/googletest"
)

target_include_directories(
googletest
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)
set_target_properties(googletest
PROPERTIES
COMPILE_DEFINITIONS "GTEST_CREATE_SHARED_LIBRARY=1")
wpilib_target_warnings(googletest)

install(TARGETS googletest EXPORT googletest)
export(TARGETS googletest FILE googletest.cmake NAMESPACE googletest::)
30 changes: 30 additions & 0 deletions thirdparty/googletest/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@


apply plugin: 'cpp'
apply plugin: 'visual-studio'
apply plugin: 'edu.wpi.first.NativeUtils'

ext {
nativeName = 'googletest'
}

apply from: "${rootDir}/shared/config.gradle"


model {
components {
"${nativeName}"(NativeLibrarySpec) {
sources.cpp {
source {
srcDirs "src/googlemock/src", "src/googletest/src"
include '*.cpp'
}
exportedHeaders {
srcDirs 'include', 'src/googletest', 'src/googlemock'
}
}
}
}
}

apply from: 'publish.gradle'
Loading