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

CMake: revise how we deal with symbol export and static builds #2912

Merged
merged 1 commit into from
Oct 25, 2021

Conversation

rouault
Copy link
Member

@rouault rouault commented Oct 23, 2021

  • Remove the explicit PROJ_MSVC_DLL_IMPORT symbol used for importing
    symbols from a MSVC .dll: by default on MSVC, we use
    now __declspec(dllimport), unless PROJ_MSVC_DLL_EXPORT is defined
    by PROJ at build time. This makes it easier for users: they
    don't have to define anything special. This simplifies in particular
    the build of our binaries
  • For static builds, export -DPROJ_DLL= as public, so that users
    that import PROJ through CMake mechanism don't have to do it
    manually.

- Remove the explicit PROJ_MSVC_DLL_IMPORT symbol used for importing
  symbols from a MSVC .dll: by default on MSVC, we use
  now __declspec(dllimport), unless PROJ_MSVC_DLL_EXPORT is defined
  by PROJ at build time. This makes it easier for users: they
  don't have to define anything special. This simplifies in particular
  the build of our binaries
- For static builds, export -DPROJ_DLL= as public, so that users
  that import PROJ through CMake mechanism don't have to do it
  manually.
@rouault rouault added this to the 8.2.0 milestone Oct 23, 2021
@rouault
Copy link
Member Author

rouault commented Oct 23, 2021

Solves #1821

@rouault rouault requested a review from kbevers October 25, 2021 13:58
Copy link
Member

@kbevers kbevers left a comment

Choose a reason for hiding this comment

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

Looks alright to me although I can't claim to understand all of it in details. Should the docs be updated to reflect this?

@rouault
Copy link
Member Author

rouault commented Oct 25, 2021

Should the docs be updated to reflect this?

I don't see any mention of that in the docs. It is more than with this change we'd need less documentations as things will be more automatic and in line with general practice

@kbevers
Copy link
Member

kbevers commented Oct 25, 2021

Was just wondering since I don't really grasp the details. Is the special Windows behaviour noted in https://proj.org/install.html#cmdoption-arg-BUILD_SHARED_LIBS still present?

@rouault
Copy link
Member Author

rouault commented Oct 25, 2021

Is the special Windows behaviour noted in https://proj.org/install.html#cmdoption-arg-BUILD_SHARED_LIBS still present?

yes, I didn't change that. This PR is only about how we import symbols

@kbevers kbevers merged commit 24ad521 into OSGeo:master Oct 25, 2021
a0x8o added a commit to a0x8o/PROJ that referenced this pull request Oct 25, 2021
CMake: revise how we deal with symbol export and static builds
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