-
Notifications
You must be signed in to change notification settings - Fork 483
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
Revamp CMake support #1118
base: master
Are you sure you want to change the base?
Revamp CMake support #1118
Conversation
Do you think we should wait for this before making SOCI 4.1.0 release or can we leave this change until a later 4.1.x? |
Well, it would probably be nice if 4.1 had this already, but it's more of a nice-to-have. So I guess you don't have to wait for this PR to be done. Unrelated to this PR, I would appreciate if #992 made it into 4.1 though :) |
7815446
to
c8d5da6
Compare
0b83bb8
to
e1e4433
Compare
e4b2e0d
to
39b9037
Compare
6976799
to
1deca3e
Compare
There seems to be a bug in Visual Studio 2015 that leads to a call tp logger_impl::set_stream instead of standard_logger_impl::set_stream in the "basic logging support" test case, which throws a "not supported" exception instead of actually setting the log stream, leading to a test case failure. This hasn't been observed for any other compiler, including more recent versions of Visual Studio. Thus, it was concluded that this was indeed a compiler bug in VS2015. Moving the standard_logger_impl implementation out of the anonymous namespace works around this bug without affecting the behavior of the library in any way.
1deca3e
to
efe3a05
Compare
@vadz Now that I finally worked around the VS2015 bug, I think this PR is ready for review @papoteur-mga I'd appreciate your continued feedback on this too :) |
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.
Thanks again for all your work on this!
Unfortunately I ran out of time for today at 77/104 files viewed, I'll try to finish this a.s.a.p. but I'd like to already publish the existing comments/questions to see what do you think about them.
I'd also like to mention that I had seen in some discussions that you were not sure which directory structure to use for the installation. IMO the answer to this is always "the same one as now for compatibility unless there are some really good reasons to change it", so I hope we're not going to change things if we can avoid it. In fact, if we could avoid all these renamings even internally, it would be nice too, but, of course, it's the externally visible file locations, targets, option values etc that are the most important.
strategy: | ||
fail-fast: false | ||
matrix: | ||
lib_type: [shared, static] |
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.
This doubles the number of builds and I'm not sure if it's worth it... Maybe it would be enough to test just some static builds instead of testing all of them?
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.
Compared to the Windows CI these are really cheap to do. Besides, previously SOCI did this duplication anyway due to building shared and static libraries in a single build. So effectively, this is reproducing the original behavior (plus some extra overhead of these things now actually being different build jobs).
Finally, it is a bit of a hassle to specify that only some combinations shall be built as a static library in GitHub Action syntax. Therefore, I would tend to just keep all tests 👀
# Linking with just soci_core is enough when using shared libraries, as the | ||
# required backends will be loaded dynamically during run-time, but when using | ||
# static libraries you would need to link with all the soci_<backend> libraries | ||
# needed too. |
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.
I would probably also keep this part of the comment too, especially if it's still correct (is it?) and just mention that SOCI::soci
links with everything.
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.
I don't want to encourage people to use different linking strategies depending on whether they want to use SOCI as a shared or static library when the way that works for static lib works just as well for the dynamic case.
This will only cause confusion if people set up their project to use SOCI as a shared library and then at some point switch to static SOCI, just to run into a bunch of errors even though for the dynamic library everything worked as expected.
# | ||
############################################################################### | ||
colormsg(_HIBLUE_ "Configuring SOCI backend libraries:") | ||
set(SOCI_EMPTY ${PROJECT_IS_TOP_LEVEL} CACHE STRING "Include the 'empty' backend. Can be bool-valued or one of 'Enabled', 'Disabled' and 'AsAvailable'") |
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.
Does AsAvailable
really make sense here?
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.
I'm open for better suggestions. This is effectively the current behavior where it would just check whether the dependencies are available and if not, disable the backend. This is annoying if you explicitly enabled that backend because you need it (as the cmake invocation will work fine, even though required dependencies are met).
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.
Sorry but I don't understand why should we support the non-standard Enabled
and Disabled
options in addition to the standard ON
/OFF
ones. Is it for compatibility with the existing cmakefiles (if so, I didn't even know that they supported this...)? If not, I'd strongly prefer to drop them and simplify both the build files and the documentation.
As for AsAvailable
, I'd ideally like to avoid having it too and for things to work like this:
SOCI_FOO
not defined/empty: use backendFOO
if it's available, give a warning if it isn't.SOCI_FOO=OFF
: never use it.SOCI_FOO=ON
: give an error if the backend is not available.
If we really need to use some explicit value for the first case (why?) I'd use something like CHECK
.
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.
I like the general idea, but the this would only be possible, if we don't declare these options as existing in CMake. Because as soon as we do that, they can't be undefined anymore.
Defining options before using them is something that I generally consider good practice and also helps in cases where cmake is used via a GUI that lists all options (cache variables) so that the user sees what can be edited.
If we really need to use some explicit value for the first case (why?) I'd use something like CHECK.
I agree, this is a better choice. Maybe AUTO
would be even better? 👀
|
||
add_library(soci_db2 | ||
${SOCI_LIB_TYPE} | ||
"blob.cpp" |
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.
Inconsistent indentation and why do we quote all these file names? This makes them less readable and doesn't bring anything, it's not like we're ever going to have spaces in the source file names (or at least only over my dead body).
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.
I consider it good practice to quote filenames as they can (in general) contain spaces and I dislike having only selected ones being quoted. But if you have a strong opinion on this, I can remove the quotes.
I'd really like to refactor the tests to avoid having to recompile the entirety of Not sure if I should wait for it to be merged or should make these changes and resolve the conflicts later. |
So effectively you want to do the refactoring that I have already done here? 👀 Personally, I would tend to not create the same change in a different PR while we are already working on getting this PR merged 🤷 |
Yes, I'd like to apply this part (which is, again, something I really wanted to do since a long time, so thanks for finally doing it), except
Would it be possible to do this somehow? |
Which inconveniences?
I guess, but it would be a bit fiddly. Not sure if I personally see the value in having this part of the change a bit earlier given that the current approach has been used for so long (so my question here is: why the sudden hurry?) 🤷 |
Renaming the file complicates its history (even if Git is much better at this than many other VCS). And the real question is anyhow not "why not do it" but "why do it", i.e. do we have any good reason for renaming these files? And I just don't see any, both
No particular hurry, but I'm thinking about this every time I have to modify the tests and I plan on doing this again soon, so I thought it would be nice to finally get it done. |
227e55b
to
be77273
Compare
Fixes #1115
Fixes #1152
Fixes #1122
Fixes #1094
Fixes #1159
Fixes #644