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

[libpq] Add support for dynamic builds with Visual Studio #143

Closed
wants to merge 1 commit into from

Conversation

Talkless
Copy link
Contributor

@Talkless Talkless commented Sep 30, 2019

  • Fix source file lists to avoid link errors and to behave be as close as possible to the original MSVC projects.
  • Generate more complete pg_config.h.
  • Use .def file to make exported symbols work as expected.
  • Add missing wldap32 library link in package_info().
  • Enable dynamc build in conanfile.py

Specify library name and version: libpq/11.5

  • I've read the guidelines for contributing.
  • I've followed the PEP8 style guides for Python code in the recipes.
  • I've used the latest Conan client version.
  • I've tried at least one configuration locally with the
    conan-center hook activated.

Original related bug report: bincrafters/conan-libpq#25

@conan-center-bot
Copy link
Collaborator

Sorry, the build is only launched for Early Access Program users. You can request access writing in this issue.

@jgsogo jgsogo changed the title Add support for dynamic builds with Visual Studio [libpq] Add support for dynamic builds with Visual Studio Oct 1, 2019
@Talkless
Copy link
Contributor Author

Talkless commented Oct 2, 2019

I have issue - test_package.exe application fails because it for some reason expects libpqd.dll, while libpq is build without d suffix.

Interestingly, in the official Qt builds, qsqlpsqld.dll plugin still requires libpq.dll (without d). And if I specifcy build_type=Release in my profile.txt, test_package.exe still requires libpqd.dll?

@Talkless
Copy link
Contributor Author

Talkless commented Oct 2, 2019

OK the issue seems is here:

    if (CMAKE_BUILD_TYPE EQUAL Debug)
        set(DLL_DEF_FILE source_subfolder/src/interfaces/libpq/libpqddll.def)
    else()
        set(DLL_DEF_FILE source_subfolder/src/interfaces/libpq/libpqdll.def)
    endif()

Looks like conan does not set CMAKE_BUILD_TYPE, so either always release .def file is used, or if I change if() logic, always debug .def file is used, so one of the test_package.exe builds fails to find libpq[d].dll. It either always wants libpq.dll or libpqd.dll...

How do I detect build_type=Release|Debug in CMakeLists.txt? @uilianries, anywone?

@Talkless
Copy link
Contributor Author

Talkless commented Oct 2, 2019

Looks like I have to use generator expressions? Though using add_library(libpq ${pg_port_src} ${pg_backend_src} ${pg_libpq_src} ${DLL_DEF_FILE} "$<$<CONFIG:Debug>:${DLL_DEF_FILE_DEBUG}>" "$<$<CONFIG:Release>:${DLL_DEF_FILE_RELEASE}>") fails with:

-- Generating done
CMake Error in CMakeLists.txt:
  Target "libpq" has source files which vary by configuration.  This is not
  supported by the "Visual Studio 14 2015" generator.

@Talkless
Copy link
Contributor Author

Talkless commented Oct 2, 2019

Started discussion in CMake bug tracker:
https://gitlab.kitware.com/cmake/cmake/issues/19782

I guess I'll just use libpqdll.def (without "d" suffix) for both debug and release builds, as I don't know alternative yet. Though this looks like deviation from upstream, as libpqddll.def hints that originally it should be libpqd.dll when built in debug mode...

@conan-center-bot
Copy link
Collaborator

Sorry, the build is only launched for Early Access Program users. You can request access writing in this issue.

* Fix source file lists to avoid link errors and to behave be as close as possible to the original MSVC projects.
* Generate more complete pg_config.h.
* Use .def file to make exported symbols work as expected.
* Add missing wldap32 library link in package_info().
* Enable dynamc build in conanfile.py
@conan-center-bot
Copy link
Collaborator

Sorry, the build is only launched for Early Access Program users. You can request access writing in this issue.

@Talkless
Copy link
Contributor Author

Talkless commented Oct 9, 2019

There are more issues to be fixed after this is merged, but I can't do anything without early access.

@SSE4 @uilianries could someone author this PR instead of me, to make thins more forward?

@SSE4
Copy link
Contributor

SSE4 commented Oct 9, 2019

@Talkless I'll create PR from my account and give you write permissions to my fork

@SSE4
Copy link
Contributor

SSE4 commented Oct 9, 2019

moved to #188

@SSE4 SSE4 closed this Oct 9, 2019
artem-kamyshev pushed a commit to artem-kamyshev/conan-center-index that referenced this pull request Sep 28, 2020
@Talkless Talkless deleted the libpq-windows branch June 22, 2021 16:57
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.

None yet

3 participants