diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 162e2ff..6d63c75 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,6 +24,8 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 + with: + submodules: true - run: git clone https://github.com/google/googletest.git ../googletest - run: mkdir _gh_build - run: cmake -G "${{ matrix.generator }}" -DENABLE_TESTS=ON .. diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..5a4e85a --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "third_party/googletest"] + path = third_party/googletest + url = https://github.com/google/googletest.git diff --git a/BUILDING.md b/BUILDING.md index d33917b..7656947 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -114,17 +114,26 @@ $ cmake ../ -DDRACO_SANITIZE=address Googletest Integration ---------------------- -Draco includes testing support built using Googletest. To enable Googletest unit -test support the DRACO_TESTS cmake variable must be turned on at cmake -generation time: +Draco includes testing support built using Googletest. The Googletest repository +is included as a submodule of the Draco git repository. Run the following +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 $ cmake ../ -DDRACO_TESTS=ON ~~~~~ -When cmake is used as shown in the above example the googletest directory must -be a sibling of the Draco repository root directory. To run the tests execute -`draco_tests` from your build output directory. +To run the tests execute `draco_tests` from your build output directory: + +~~~~~ bash +$ ./draco_tests +~~~~~ WebAssembly Decoder ------------------- diff --git a/cmake/draco_tests.cmake b/cmake/draco_tests.cmake index 29c1b6e..a1b6753 100644 --- a/cmake/draco_tests.cmake +++ b/cmake/draco_tests.cmake @@ -69,14 +69,15 @@ list( "${draco_src_root}/point_cloud/point_cloud_test.cc") 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 - "${draco_root}/../googletest/googletest/src/gtest_main.cc") + "${draco_root}/third_party/googletest/googletest/src/gtest_main.cc") macro(draco_setup_test_targets) if(DRACO_TESTS) 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() list(APPEND draco_test_defines GTEST_HAS_PTHREAD=0) diff --git a/third_party/googletest b/third_party/googletest new file mode 160000 index 0000000..703bd9c --- /dev/null +++ b/third_party/googletest @@ -0,0 +1 @@ +Subproject commit 703bd9caab50b139428cea1aaff9974ebee5742e