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

Windows improved support (meson) #354

Merged
merged 5 commits into from
Jul 24, 2022
Merged

Windows improved support (meson) #354

merged 5 commits into from
Jul 24, 2022

Conversation

UnixY2K
Copy link
Contributor

@UnixY2K UnixY2K commented Apr 20, 2022

this PR is an improvement of #352, managing to compile statically and run unit tests successfully on windows.
a summary of the changes in this PR:

  • Meson file
    • use c++14 on windows(due to an error with xstddef)
    • add a preprocessor definition ('NON_AMBIGOUS_OVERLOAD') to use int instead of long to prevent ambiguous overload when compiling with clang++, it does not affect cmake and it only is enabled on meson
  • Unit tests
    • tests/Statement_test.cpp -> use "int64_t"(supported on c++11) instead of "long long" to prevent ambiguous overload errors (tested both on Arch Linux & Windows w clang)
    • tests/Statement_test.cpp -> check if NON_AMBIGOUS_OVERLOAD is defined and use int instead of long if is the case (to prevent ambiguous overload on windows)

the library still does not compile dynamically (as windows does not export the functions by default), so that should be fixed on an 3rd PR potentially fixing #280 and #53 for both meson and cmake, but this is a start before working on adding a macro for that feature.

after the dynamic compilation on windows is fixed, we could put the package on wrapdb so more users can use it easily.

using long long may be ambigous for the compiler in the call of bind()
using a fixed type(int64_t) solves this issue
this issue was replicated on both Arch Linux&Windows
with clang 13.0.1/14.0.1
define NON_AMBIGOUS_OVERLOAD to prevent ambiguous overload
and use int instead of long to prevent ambiguous overload errors
on windows may show an error in xstddef if c++11 is used
this is a workarround for that issue
"deduced return types are a C++14 extension"
make the meson file link statically the library when building the unit tests
executable so it does not fail on windows
as the symbols are not exported by default
@SRombauts SRombauts self-assigned this Jul 24, 2022
@SRombauts SRombauts merged commit aca5fa9 into SRombauts:master Jul 24, 2022
@SRombauts
Copy link
Owner

Thanks a lot for this contribution.

Cheers!

SRombauts added a commit that referenced this pull request Aug 30, 2023
this PR only affects meson, however a later change could be made for
CMake
updates the following depenencies:
 - GTests to 1.14.0
 - sqlite to 3.42.0
makes 
sets the recommended version to C++14 as Gtest now requires C++14,
additionally shows a warning and sets it to c++14 if
- C++11 is set and is on windows (this was #354 but now checks if is
C++11 and shows a warning instead of setting it to C++14 so it does not
revert when using a newer version)
- C++11 is set and uses [GTest
1.14.0](https://github.com/google/googletest/releases/tag/v1.14.0) or
greater, for more information check [Google's Foundational C++ Support
Policy](https://opensource.google/documentation/policies/cplusplus-support)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants