Add googletest as a git submodule. (#756)

- Add the submodule.
- Update the build to use googletest sources from the submodule.
- Update the github test build checkout action to include submodules.
- Update build instructions to include the submodule update.
This commit is contained in:
Tom Finegan 2021-10-25 11:06:21 -07:00 committed by GitHub
parent 6a947d2b04
commit c880d79457
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 9 deletions

View File

@ -24,6 +24,8 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with:
submodules: true
- run: git clone https://github.com/google/googletest.git ../googletest - run: git clone https://github.com/google/googletest.git ../googletest
- run: mkdir _gh_build - run: mkdir _gh_build
- run: cmake -G "${{ matrix.generator }}" -DENABLE_TESTS=ON .. - run: cmake -G "${{ matrix.generator }}" -DENABLE_TESTS=ON ..

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "third_party/googletest"]
path = third_party/googletest
url = https://github.com/google/googletest.git

View File

@ -114,17 +114,26 @@ $ cmake ../ -DDRACO_SANITIZE=address
Googletest Integration Googletest Integration
---------------------- ----------------------
Draco includes testing support built using Googletest. To enable Googletest unit Draco includes testing support built using Googletest. The Googletest repository
test support the DRACO_TESTS cmake variable must be turned on at cmake is included as a submodule of the Draco git repository. Run the following
generation time: command to clone the Googletest repository:
~~~~~ bash
$ git submodule update --init
~~~~~
To enable Googletest unit test support the DRACO_TESTS cmake variable must be
turned on at cmake generation time:
~~~~~ bash ~~~~~ bash
$ cmake ../ -DDRACO_TESTS=ON $ cmake ../ -DDRACO_TESTS=ON
~~~~~ ~~~~~
When cmake is used as shown in the above example the googletest directory must To run the tests execute `draco_tests` from your build output directory:
be a sibling of the Draco repository root directory. To run the tests execute
`draco_tests` from your build output directory. ~~~~~ bash
$ ./draco_tests
~~~~~
WebAssembly Decoder WebAssembly Decoder
------------------- -------------------

View File

@ -69,14 +69,15 @@ list(
"${draco_src_root}/point_cloud/point_cloud_test.cc") "${draco_src_root}/point_cloud/point_cloud_test.cc")
list(APPEND draco_gtest_all list(APPEND draco_gtest_all
"${draco_root}/../googletest/googletest/src/gtest-all.cc") "${draco_root}/third_party/googletest/googletest/src/gtest-all.cc")
list(APPEND draco_gtest_main list(APPEND draco_gtest_main
"${draco_root}/../googletest/googletest/src/gtest_main.cc") "${draco_root}/third_party/googletest/googletest/src/gtest_main.cc")
macro(draco_setup_test_targets) macro(draco_setup_test_targets)
if(DRACO_TESTS) if(DRACO_TESTS)
if(NOT (EXISTS ${draco_gtest_all} AND EXISTS ${draco_gtest_main})) if(NOT (EXISTS ${draco_gtest_all} AND EXISTS ${draco_gtest_main}))
message(FATAL "googletest must be a sibling directory of ${draco_root}.") message(FATAL_ERROR
"googletest missing, run git submodule update --init")
endif() endif()
list(APPEND draco_test_defines GTEST_HAS_PTHREAD=0) list(APPEND draco_test_defines GTEST_HAS_PTHREAD=0)

1
third_party/googletest vendored Submodule

@ -0,0 +1 @@
Subproject commit 703bd9caab50b139428cea1aaff9974ebee5742e