Skip to content

Feature/cmake static plugins#4291

Merged
artemp merged 49 commits intomapnik:masterfrom
mathisloge:feature/cmake-static
Jan 17, 2023
Merged

Feature/cmake static plugins#4291
artemp merged 49 commits intomapnik:masterfrom
mathisloge:feature/cmake-static

Conversation

@mathisloge
Copy link
Copy Markdown
Collaborator

@mathisloge mathisloge commented Feb 2, 2022

fixes #4287

@artemp I needed to refactor the plugin logic a bit. I've introduced a new class datasource_plugin which has a common interface. So multiple static plugins with the same on_plugin_load logic can exist.

BUT as it now builds correctly and most tests are both in dynamic and static configuration good, the static configuration still has some flaws: the problem with singeltons then arises. e.g. the image_reader registration won't work correctly, since the compiler optimizes those calls away.

@mathisloge mathisloge force-pushed the feature/cmake-static branch from 77d34f3 to c6059c7 Compare February 3, 2022 16:58
@mathisloge
Copy link
Copy Markdown
Collaborator Author

So I've now added a mapnik::setup() function which should be called before any other method of mapnik. Currently this only registers the image_readers.

This would mean a very big breaking change, since users have to add this function to their source code. IMHO the global initialisation with functions a little opaque, as it is not clear what happens when or why something might not happen.

The plugins are working now in static and dynamic configurations.

But I don't know how i can express the additional things in SCons.

fix merge

remove old DATASOURCE_PLUGIN call

fix memory_datasource

wip

wip

fix temp return

fix install

wip before_unload

linux

remove docker

remove docker

comments

add windows error message if libmapnik=static and plugins=dynamic

fix false plugin macro

plugin default de/constructor to remove UB

simplyfy plugin targets - add fpic

fix makro

simplyfy

use unique_ptr for plugin handle

rename option static plugins

replace local init with fnc call

call setup everywhere

init datasource_static
@mathisloge mathisloge force-pushed the feature/cmake-static branch from 28abee1 to 49ef468 Compare February 7, 2022 14:35
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 7, 2022

Codecov Report

Base: 74.90% // Head: 75.00% // Increases project coverage by +0.10% 🎉

Coverage data is based on head (7cce5ce) compared to base (e811958).
Patch coverage: 78.59% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4291      +/-   ##
==========================================
+ Coverage   74.90%   75.00%   +0.10%     
==========================================
  Files         511      524      +13     
  Lines       36689    36774      +85     
==========================================
+ Hits        27482    27584     +102     
+ Misses       9207     9190      -17     
Impacted Files Coverage Δ
include/mapnik/datasource.hpp 100.00% <ø> (ø)
include/mapnik/webp_io.hpp 61.76% <ø> (+17.55%) ⬆️
src/webp_io.cpp 0.00% <0.00%> (ø)
src/memory_datasource.cpp 64.10% <25.00%> (-1.69%) ⬇️
include/mapnik/json/geojson_grammar_x3_def.hpp 64.70% <33.33%> (ø)
include/mapnik/wkt/wkt_grammar_x3_def.hpp 62.50% <50.00%> (ø)
...ns/input/base/include/mapnik/datasource_plugin.hpp 50.00% <50.00%> (ø)
plugins/input/csv/csv_datasource.cpp 90.87% <66.66%> (-0.33%) ⬇️
plugins/input/gdal/gdal_datasource.cpp 72.50% <66.66%> (-2.50%) ⬇️
plugins/input/geobuf/geobuf_datasource.cpp 69.72% <66.66%> (+0.85%) ⬆️
... and 89 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@mathisloge
Copy link
Copy Markdown
Collaborator Author

@artemp thoughts on this?

@artemp
Copy link
Copy Markdown
Member

artemp commented Feb 9, 2022

@artemp thoughts on this?

@mathisloge 👍 for reminding me! I'd like to understand more about potential implications but I didn't have a chance to look into this, yet. Will try to find time, thanks!

@mathisloge mathisloge mentioned this pull request Feb 11, 2022
15 tasks
@artemp artemp marked this pull request as ready for review February 15, 2022 11:09
@mathisloge mathisloge marked this pull request as draft February 15, 2022 11:15
@mathisloge mathisloge marked this pull request as ready for review February 15, 2022 11:16
@mathisloge mathisloge force-pushed the feature/cmake-static branch from fb91a0e to bc38652 Compare December 9, 2022 13:48
@mathisloge
Copy link
Copy Markdown
Collaborator Author

@artemp yey!
I've got the necessary bits finally together.
Could you review this PR?
From the functionality it is mergable.

@mathisloge
Copy link
Copy Markdown
Collaborator Author

@artemp do you had any chance to review this? :)

@artemp
Copy link
Copy Markdown
Member

artemp commented Jan 9, 2023

@artemp do you had any chance to review this? :)

Happy New Year @mathisloge :) !

Q. How to ensure static build favours linking to static (*.a) dependecies?
E.g RUNTIME_LINK: Set preference for linking dependencies (shared|static) ?

@mathisloge
Copy link
Copy Markdown
Collaborator Author

Happy New Year @artemp 🥳

How to ensure static build favours linking to static (*.a) dependecies?

I don't know of any reliable way of doing it. I would leave that to the user and the user has to make sure to pass the correct config file locations or paths to cmake config / pkg-config files when configuring the project. E.g. you can set https://cmake.org/cmake/help/latest/variable/CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH.html#variable:CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH to disable the system path and make sure that only the passed paths are used.

artemp
artemp previously approved these changes Jan 14, 2023
@mathisloge
Copy link
Copy Markdown
Collaborator Author

@artemp needed to rebase.
You can merge this now :)

@artemp artemp merged commit 4e064b8 into mapnik:master Jan 17, 2023
leedejun pushed a commit to leedejun/mapnik that referenced this pull request Dec 26, 2023
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.

question about static plugins

3 participants