Skip to content

[CMake] add mapnik-config#4256

Closed
mathisloge wants to merge 4 commits intomapnik:masterfrom
mathisloge:cmake_mapnik_config2
Closed

[CMake] add mapnik-config#4256
mathisloge wants to merge 4 commits intomapnik:masterfrom
mathisloge:cmake_mapnik_config2

Conversation

@mathisloge
Copy link
Copy Markdown
Collaborator

@mathisloge mathisloge commented Oct 20, 2021

  • Squash commits together

add needed libs

pkg-conf: move libmapnikjson and libmapnikjson to m_requires

make pkg multi config aware
@codecov
Copy link
Copy Markdown

codecov bot commented Oct 20, 2021

Codecov Report

Merging #4256 (2ba4274) into master (f2ab25c) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #4256   +/-   ##
=======================================
  Coverage   71.83%   71.83%           
=======================================
  Files         446      446           
  Lines       23270    23270           
=======================================
  Hits        16715    16715           
  Misses       6555     6555           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f2ab25c...2ba4274. Read the comment docs.

@mathisloge mathisloge mentioned this pull request Oct 20, 2021
@mathisloge
Copy link
Copy Markdown
Collaborator Author

@artemp I don't really know how I can produce mapnik-config since I don't have the real link libraries and includes at configure time. At least I don't know any way to get those. But as CMake now exports pkg-config, I think you will get the same output:

pkg-config --cflags libmapnik
-DMAPNIK_THREADSAFE -DBOOST_REGEX_HAS_ICU -DBIGINT -DMAPNIK_MEMORY_MAPPED_FILE -DHAVE_LIBXML2 -DHAVE_PNG -DHAVE_JPEG -DHAVE_TIFF -DHAVE_WEBP -DHAVE_CAIRO -DGRID_RENDERER -DSVG_RENDERER -DMAPNIK_HAS_DLCFN -DLIBXML_STATIC -pthread -I/home/mathis/dev/mapnik-install/include -I/home/mathis/dev/vcpkg/installed/x64-linux/lib/pkgconfig/../../include -I/home/mathis/dev/vcpkg/installed/x64-linux/lib/pkgconfig/../../include/libxml2 -I/home/mathis/dev/vcpkg/installed/x64-linux/lib/pkgconfig/../../include -I/home/mathis/dev/vcpkg/installed/x64-linux/lib/pkgconfig/../../include/cairo -I/home/mathis/dev/vcpkg/installed/x64-linux/lib/pkgconfig/../../include/lzo -I/home/mathis/dev/vcpkg/installed/x64-linux/lib/pkgconfig/../../include -I/home/mathis/dev/vcpkg/installed/x64-linux/lib/pkgconfig/../../include/libpng16 -I/home/mathis/dev/vcpkg/installed/x64-linux/lib/pkgconfig/../../include -I/home/mathis/dev/vcpkg/installed/x64-linux/lib/pkgconfig/../../include/pixman-1 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
pkg-config --libs libmapnik
-L/home/mathis/dev/mapnik-install/lib -L/home/mathis/dev/vcpkg/installed/x64-linux/lib/pkgconfig/../../lib -llibmapnik -llibmapnikwkt -llibmapnikjson -licui18n -licuuc -licudata -lpthread -ldl -lm -lharfbuzz -lxml2 -pthread -lm -ltiff -lm -ljpeg -llzma -pthread -lwebp -lm -pthread -lcairo -lm -ldl -llzo2 -lfontconfig -pthread -lexpat -lfreetype -lbz2 -lpng16 -lz -lm -lz -lbrotlidec-static -lbrotlicommon-static -lpixman-1 -lm -pthread

I could create a minimal mapnik-config which will look like:
But CONFIG_DEP_INCLUDES, CONFIG_DEP_LIBS won't be populated. But as this isn't really workable I don't think mapnik-config from cmake will get someone any benefits.

#! /usr/bin/env bash

set -eu

RUNTIME_PREFIX=$(cd -- "${BASH_SOURCE%"${BASH_SOURCE##*/}"}.." && pwd)

## CONFIG variables substituted from build script

CONFIG_MAPNIK_NAME="mapnik"
CONFIG_MAPNIK_VERSION="400000"
CONFIG_MAPNIK_VERSION_STRING="4.0.0"
CONFIG_GIT_REVISION="464265488e4b5be270d556245e47944705228092"
CONFIG_GIT_DESCRIBE="v3.0.12-1509-g464265488"

CONFIG_PREFIX="/home/mathis/dev/mapnik-install"
CONFIG_LIBDIR_SCHEMA="lib"
CONFIG_LIB_DIR_NAME="mapnik"
CONFIG_MAPNIK_LIB_BASE="${CONFIG_PREFIX}/${CONFIG_LIBDIR_SCHEMA}"
CONFIG_MAPNIK_LIB_DIR="${CONFIG_MAPNIK_LIB_BASE}"
CONFIG_MAPNIK_INPUT_PLUGINS="${CONFIG_PREFIX}/lib/mapnik/input"
CONFIG_MAPNIK_FONTS="${CONFIG_PREFIX}/bin/fonts"

CONFIG_CXX="g++"
CONFIG_CXXFLAGS=
CONFIG_DEFINES="-DMAPNIK_THREADSAFE -DBOOST_REGEX_HAS_ICU -DBIGINT -DMAPNIK_MEMORY_MAPPED_FILE -DHAVE_LIBXML2 -DHAVE_PNG -DHAVE_JPEG -DHAVE_TIFF -DHAVE_WEBP -DHAVE_CAIRO -DGRID_RENDERER -DSVG_RENDERER -DMAPNIK_HAS_DLCFN"
CONFIG_LDFLAGS=
CONFIG_DEP_INCLUDES=
CONFIG_DEP_LIBS=
CONFIG_QUERIED_GDAL_DATA=
CONFIG_QUERIED_PROJ_LIB=
CONFIG_QUERIED_ICU_DATA=

## D.R.Y. variables

DRY_INCLUDES="-I${RUNTIME_PREFIX}/include -I${RUNTIME_PREFIX}/include/mapnik/agg -I${RUNTIME_PREFIX}/include/mapnik/deps"
DRY_CFLAGS="${DRY_INCLUDES} ${CONFIG_DEP_INCLUDES} ${CONFIG_DEFINES} ${CONFIG_CXXFLAGS}"
DRY_LIBS="-L${RUNTIME_PREFIX}/${CONFIG_LIBDIR_SCHEMA} -l${CONFIG_MAPNIK_NAME}"

@mathisloge mathisloge force-pushed the cmake_mapnik_config2 branch from 30323fd to 8d5efdf Compare October 20, 2021 09:18
@mathisloge mathisloge changed the title [CMake] add mapnik-config and improve pkg-config [CMake] add mapnik-config Oct 20, 2021
@mathisloge
Copy link
Copy Markdown
Collaborator Author

@artemp I'll close this for now because this would be very hacky to get right with cmake.
For most usage scenarios the now exported pkg-config files would be sufficient.

I think it could be worth it to add a way for python-mapnik and node-mapnik to accept the pkg-config files instead of mapnik-config.

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.

1 participant