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 128 commits into
base: master
Choose a base branch
from
Open

Revamp CMake support #1118

wants to merge 128 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 :)

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!

.github/workflows/ci.yml Show resolved Hide resolved
.github/workflows/ci.yml Outdated Show resolved Hide resolved
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?

CMakeLists.txt Outdated Show resolved Hide resolved
examples/connect/CMakeLists.txt Outdated Show resolved Hide resolved
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?

scripts/ci/build_empty.sh Outdated Show resolved Hide resolved
scripts/ci/common.sh Outdated Show resolved Hide resolved
src/backends/oracle/CMakeLists.txt Show resolved Hide resolved
@Krzmbrzl Krzmbrzl force-pushed the revamp-cmake branch 4 times, most recently from 4ca0dd9 to ed0ceab Compare February 6, 2025 19:42
Some library is said to be missing when running on 24.04. Might be an
artifact of the specific container image we're using.
@Krzmbrzl
Copy link
Contributor Author

Krzmbrzl commented Feb 7, 2025

@vadz as the Windows CI demonstrates, CI will fail if I don't separate out the callback implementation. I think the most straightforward thing to do here would be to keep the separate implementation for this PR and then it can be removed after #1192 has been merged.

Otherwise, I believe I have addressed all remaining review comments 👀

@vadz
Copy link
Member

vadz commented Feb 7, 2025

But AFAICS you didn't remove SOCI_DECL for failover_callback? You have to do it if you inline these functions.

@vadz
Copy link
Member

vadz commented Feb 7, 2025

I won't have time to do it today, but if I can get back to this during the week-end: would you prefer to make a real merge or squash merge all the changes together (or something in between — but in this case you will need to do the rebase yourself)?

@Krzmbrzl
Copy link
Contributor Author

Krzmbrzl commented Feb 7, 2025

But AFAICS you didn't remove SOCI_DECL for failover_callback? You have to do it if you inline these functions.

No I didn't, because that's what #1192 already does and I didn't want to introduce partial mixing of PR changes.

would you prefer to make a real merge or squash merge all the changes together (or something in between — but in this case you will need to do the rebase yourself)?

I think given the magnitude of this PR, a real merge would be good as the commit history might turn out to be useful when blaming any of the touched code in the future (to get a feeling for why a given change was introduced).

@vadz
Copy link
Member

vadz commented Feb 7, 2025

But AFAICS you didn't remove SOCI_DECL for failover_callback? You have to do it if you inline these functions.

No I didn't, because that's what #1192 already does and I didn't want to introduce partial mixing of PR changes.

I'd rather do it here than add a new source file only to immediately delete it later. Any conflicts will just have to be resolved when applying the other PR later.

would you prefer to make a real merge or squash merge all the changes together (or something in between — but in this case you will need to do the rebase yourself)?

I think given the magnitude of this PR, a real merge would be good as the commit history might turn out to be useful when blaming any of the touched code in the future (to get a feeling for why a given change was introduced).

Yes, true, it's just that there are a lot of commits here and it seems like at least some of them are changed/replaced by later ones... But I guess we'll just have to live with this too.

@Krzmbrzl
Copy link
Contributor Author

Krzmbrzl commented Feb 7, 2025

I'd rather do it here than add a new source file only to immediately delete it later. Any conflicts will just have to be resolved when applying the other PR later.

Alright, will do 👍

Yes, true, it's just that there are a lot of commits here and it seems like at least some of them are changed/replaced by later ones... But I guess we'll just have to live with this too.

True. But sometimes this is the exact history of a changeset that one needs to see in order to understand why code lokks as it does today. So there is an upside as well :)

@vadz
Copy link
Member

vadz commented Feb 8, 2025

Thanks for the update!

I've tested this on my own system and I see a few (small?) problems:

  1. The names of FIREBIRD_INCLUDE_DIR has changes to FIREBIRD_INCLUDE_DIRS, according to the documentation. I'd like to revert this because there seems to be no need to break the previously working builds using the existing variable name, but also because both this variable and FIREBIRD_LIBRARIES don't work anyhow: the actually working names are Firebird_INCLUDE_DIRS and Firebird_LIBRARIES. AFAICS this just needs to be renamed in cmake/find_modules/FindFirebird.cmake.
  2. Configuration said Found MySQL: -L/usr/lib/x86_64-linux-gnu/ -lmariadb (found version "10.11.6") but the build failed due to mysql/mysql.h not being found and I only have /usr/include/mariadb/mysql.h here. I don't care much about MySQL, but the logic in cmake/find_modules/FindMySQL.cmake is wrong, it should define SOCI_MYSQL_DIRECT_INCLUDE if necessary when using CONFIG_EXE branch too (in fact, I'd rather drop SOCI_MYSQL_DIRECT_INCLUDE entirely and just set up the paths for #include <mysql.h> to always work but, again, I don't care enough about MySQL to feel strongly about this one way or the other).
  3. The names of all tests have changed from soci_backend_test[_odbcdriver] to soci_backend[_odbcdriver]_tests. I can at least understand putting ODBC driver after the backend, but why change "test" to "tests"? I'd like to undo this too, I have a couple of scripts I use for running the tests for all the backends and I don't see why should they be changed and personally I also find "test" more suitable than "tests".

@phetdam
Copy link

phetdam commented Feb 9, 2025

  1. Configuration said Found MySQL: -L/usr/lib/x86_64-linux-gnu/ -lmariadb (found version "10.11.6") but the build failed due to mysql/mysql.h not being found and I only have /usr/include/mariadb/mysql.h here. I don't care much about MySQL, but the logic in cmake/find_modules/FindMySQL.cmake is wrong, it should define SOCI_MYSQL_DIRECT_INCLUDE if necessary when using CONFIG_EXE branch too (in fact, I'd rather drop SOCI_MYSQL_DIRECT_INCLUDE entirely and just set up the paths for #include <mysql.h> to always work but, again, I don't care enough about MySQL to feel strongly about this one way or the other).

Did some poking around and agree here; seems the MySQL header should be included directly with #include <mysql.h>.

On my (Ubuntu 22.04) I'm seeing the following from pkg-config --cflags mysqlclient:

-I/usr/include/mysql

The /usr/include/mysql directory contains mysql.h. Also other sample programs I've seen will include mysql.h directly, e.g. this example from the MariaDB docs as well as some others I've seen on the Internet.

I've noticed that both MySQL and MariaDB usage from C would directly #include <mysql.h> as MariaDB is supposed to still be compatible with MySQL for the most part post-fork. Probably because a proper MySQL program should also work with MariaDB; the client library and sever being used however would of course be different.

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