google / s2geometry

Computational geometry and spatial indexing on the sphere
http://s2geometry.io/
Apache License 2.0
2.29k stars 302 forks source link

Add a CMake option BUILD_TESTS to decide whether to build S2 unit tests #333

Closed acelyc111 closed 9 months ago

acelyc111 commented 9 months ago

In the use case of using s2geometry as a thirdparty library of a project, it's not needed to build S2 unit tests, but it's possible to use test utilities in src/s2/s2testing. In this case, s2testing has to be exported, but unit tests are not necessary to build. This patch adds an option BUILD_TESTS to decide whether to build S2 unit tests.

google-cla[bot] commented 9 months ago

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

smcallis commented 9 months ago

Is the intention to not build the unit tests themselves or just not build the google test/google mock subdirectories? I think this would only do the latter.

acelyc111 commented 9 months ago

Is the intention to not build the unit tests themselves or just not build the google test/google mock subdirectories? I think this would only do the latter.

@smcallis Both of them will not be built. As the code shows in: https://github.com/google/s2geometry/pull/333/files#diff-1e7de1ae2d059d21e1dd75d5812d5a34b0222cef273b7c3a2af62eb747f9d20aR441, the unit tests will not be added.

jmr commented 9 months ago

Thanks!