-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CMake: Fixed duplicate compilation of source files #2144
base: master
Are you sure you want to change the base?
Conversation
When the option LITECORE_BUILD_TESTS is on (as it is by default), all the LiteCore source files were compiled twice: once in the regular LiteCoreObjects target and once in LiteCoreUnitTesting. The latter target has the preprocessor symbol `LITECORE_CPPTEST` defined. I've removed the LiteCoreUnitTesting target. Instead, LITECORE_CPPTEST is now defined whenever LITECORE_BUILD_TESTS is on. This means that release builds should use LITECORE_BUILD_TESTS=OFF. If they don't, CMake will issue a warning. I also made LITECORE_BUILD_TESTS default to OFF in release builds. On my MacBook Pro this improved debug build times by ~30%.
Code Coverage Results:
|
13d659d
to
ec9c415
Compare
The Windows build fails when starting the tests, with I confess I don't know why Windows puts the tests in a subdirectory like this, nor why it isn't doing so now. I didn't change anything that should cause that... |
Windows has always done this. It's a side effect of cmake being a multi config generator for Windows by default, as opposed to a single config like on Unix. |
@@ -88,7 +87,13 @@ option(LITECORE_PERF_TESTING_MODE "Build LiteCore with more things public than i | |||
option(BUILD_ENTERPRISE "Set whether or not to build enterprise edition" OFF) | |||
option(LITECORE_DISABLE_ICU "Disables ICU linking" OFF) | |||
option(DISABLE_LTO_BUILD "Disable build with Link-time optimization" OFF) | |||
option(LITECORE_BUILD_TESTS "Builds C4Tests and CppTests" ON) | |||
|
|||
if (CMAKE_BUILD_TYPE MATCHES "Debug") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this is NOT debug by default like you'd think so if no build type is specified it will not enter here.
When the option LITECORE_BUILD_TESTS is on (as it is by default), all the LiteCore source files were compiled twice: once in the regular LiteCoreObjects target and once in LiteCoreUnitTesting. The latter target has the preprocessor symbol
LITECORE_CPPTEST
defined.I've removed the LiteCoreUnitTesting target. Instead, LITECORE_CPPTEST is now defined whenever LITECORE_BUILD_TESTS is on. This means that release builds should use LITECORE_BUILD_TESTS=OFF. If they don't, CMake will issue a warning.
I also made LITECORE_BUILD_TESTS default to OFF in release builds.
On my MacBook Pro this improved debug build times by ~30%.