Skip to content
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

Open
wants to merge 115 commits into
base: master
Choose a base branch
from
Open

Revamp CMake support #1118

wants to merge 115 commits into from

Conversation

Krzmbrzl
Copy link
Contributor

@Krzmbrzl Krzmbrzl commented Jan 3, 2024

Fixes #1115
Fixes #1152
Fixes #1122
Fixes #1094
Fixes #1159
Fixes #644
Fixes #1005
Fixes #1111
Fixes #1015
Fixes #929
Fixes #843
Fixes #456
Fixes #394
Fixes #208

@vadz
Copy link
Member

vadz commented Jan 11, 2024

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?

@Krzmbrzl
Copy link
Contributor Author

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.
However, my planned timeline for this PR is to get this finished within the next two to three weeks. Depending on your plans for 4.1, waiting for such a time period would be okay? But as I said: it's optional.


Unrelated to this PR, I would appreciate if #992 made it into 4.1 though :)

@Krzmbrzl Krzmbrzl marked this pull request as ready for review January 26, 2025 19:12
@Krzmbrzl Krzmbrzl requested a review from vadz January 26, 2025 19:12
@Krzmbrzl
Copy link
Contributor Author

I think this is now ready for the next round of review

Copy link
Member

@vadz vadz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, there are just too many changes here for me to really review them :-( I've tried, but this is simply too overwhelming. I guess we'll just have to merge it without any meaningful review, which is not ideal, but I just don't see what else to do.

However I'd like to address the following issues before the merge:

  1. Keep the list of the CI builds as before instead of having both the matrix and the list.
  2. Use non-unity builds for at least some of the CI builds. Maybe use unity for static and normal for shared or vice versa or some mix, but we want to test both.
  3. Avoid adding an almost empty new file for the callbacks.

Also, I think docs/installation.md may need to be updated.

Thanks again for your work on this!

- backend: valgrind
name: Valgrind
- backend: odbc
# There are many leak reports under Ubuntu 22.04, see #1008.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has #1008 been solved too?

strategy:
fail-fast: false
matrix:
lib_type: [shared, static]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still not sure about this, the problem is that we now have both matrix and include and it just seems confusing. Listing all of the builds in include before seemed more clear and it also allowed us to put the longer builds first, which was quite useful in practice.

Unless we really need to do it like this, I'd rather avoid changing this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So could we fix the DLL declaration and avoid adding this file?

option(SOCI_SHARED "Enable building SOCI as a shared library" ${SHARED_DEFAULT})
option(SOCI_TESTS "Enable building SOCI test cases" ${PROJECT_IS_TOP_LEVEL})
cmake_dependent_option(SOCI_LTO "Enable link time optimizations in release builds" ON "LTO_AVAILABLE" OFF)
option(SOCI_VISIBILITY "Make all functions hidden by default - this exposes only explicitly exported functions" ON)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not very important, but I think we could drop this option and just always use hidden visibility if it's supported because I don't see any reason to ever disable this.

@@ -7,20 +7,28 @@

# This is a very simple example of using SOCI in a CMake-based project.

cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
cmake_minimum_required(VERSION 3.23...3.31 FATAL_ERROR)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is 3.23 really needed even for the examples (which don't use FILE_SET)?

Comment on lines -34 to -36
#ifdef SOCI_GCC_WARNING_SUPPRESS
SOCI_GCC_WARNING_SUPPRESS(pedantic)
#endif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I should have also asked why... I don't think the warnings these pragmas suppressed have disappeared from the MySQL headers, so why did you need to remove them?

# Install previously built SOCI library on the system
sudo make install

# This example simulates SOCI sources being embedded in the project dir
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be done before make install.

-DSOCI_TESTS=ON
-DCMAKE_UNITY_BUILD=ON
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So non-unity builds are not tested at all any more?

Sorry but I don't think it's a good idea. I don't have much experience with the unity builds but I can easily imagine some errors that don't happen with them but do happen in normal builds. We really ought to test normal builds — and, ideally, also a unity one.

Comment on lines +37 to +39
if (NOT SOCI_ORACLE)
return()
endif()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed? I.e. what would change if these lines were simply not present?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment