Skip to content

Commit 15b6767

Browse files
committed
rework build system
1 parent 2a92ab0 commit 15b6767

File tree

9 files changed

+117
-440
lines changed

9 files changed

+117
-440
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
*.dylib
1313
build/
1414
dist/
15-
mapnik/paths.py
1615
*.egg-info/
1716
.eggs/
1817
.mason/
1918
mason_packages/
2019
mapnik/plugins
20+
_skbuild/

CMakeLists.txt

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
cmake_minimum_required(VERSION 3.15)
2+
include(cmake/vcpkg_setup.cmake)
3+
project(${SKBUILD_PROJECT_NAME} LANGUAGES CXX VERSION ${SKBUILD_PROJECT_VERSION})
4+
5+
find_package(Python COMPONENTS Interpreter Development.Module)
6+
find_package(mapnik CONFIG REQUIRED)
7+
find_package(Boost REQUIRED COMPONENTS thread python${Python_VERSION_MAJOR}${Python_VERSION_MINOR})
8+
9+
#set(Python_SOABI ${SKBUILD_SOABI})
10+
Python_add_library(_mapnik MODULE)
11+
target_link_libraries(_mapnik PRIVATE
12+
mapnik::mapnik
13+
mapnik::json
14+
mapnik::wkt
15+
# even though boost_thread is no longer used in mapnik core
16+
# we need to link in for boost_python to avoid missing symbol: _ZN5boost6detail12get_tss_dataEPKv / boost::detail::get_tss_data
17+
Boost::thread
18+
Boost::python${Python_VERSION_MAJOR}${Python_VERSION_MINOR}
19+
ICU::data ICU::i18n ICU::uc
20+
)
21+
target_sources(_mapnik PRIVATE
22+
src/boost_std_shared_shim.hpp
23+
src/mapnik_color.cpp
24+
src/mapnik_coord.cpp
25+
src/mapnik_datasource_cache.cpp
26+
src/mapnik_datasource.cpp
27+
src/mapnik_enumeration_wrapper_converter.hpp
28+
src/mapnik_enumeration.hpp
29+
src/mapnik_envelope.cpp
30+
src/mapnik_expression.cpp
31+
src/mapnik_feature.cpp
32+
src/mapnik_featureset.cpp
33+
src/mapnik_font_engine.cpp
34+
src/mapnik_fontset.cpp
35+
src/mapnik_gamma_method.cpp
36+
src/mapnik_geometry.cpp
37+
src/mapnik_grid_view.cpp
38+
src/mapnik_grid.cpp
39+
src/mapnik_image_view.cpp
40+
src/mapnik_image.cpp
41+
src/mapnik_label_collision_detector.cpp
42+
src/mapnik_layer.cpp
43+
src/mapnik_logger.cpp
44+
src/mapnik_map.cpp
45+
src/mapnik_palette.cpp
46+
src/mapnik_parameters.cpp
47+
src/mapnik_proj_transform.cpp
48+
src/mapnik_projection.cpp
49+
src/mapnik_python.cpp
50+
src/mapnik_query.cpp
51+
src/mapnik_raster_colorizer.cpp
52+
src/mapnik_rule.cpp
53+
src/mapnik_scaling_method.cpp
54+
src/mapnik_style.cpp
55+
src/mapnik_svg.hpp
56+
src/mapnik_symbolizer.cpp
57+
src/mapnik_threads.hpp
58+
src/mapnik_value_converter.hpp
59+
src/mapnik_view_transform.cpp
60+
src/python_grid_utils.cpp
61+
src/python_grid_utils.hpp
62+
src/python_optional.hpp
63+
src/python_to_value.hpp
64+
)
65+
66+
install(TARGETS _mapnik LIBRARY DESTINATION ${SKBUILD_PROJECT_NAME})

build.py

-120
This file was deleted.

cmake/vcpkg_setup.cmake

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
if(WIN32)
2+
set(VCPKG_TARGET_TRIPLET x64-windows-static)
3+
endif()
4+
set(CMAKE_TOOLCHAIN_FILE "~/vcpkg/scripts/buildsystems/vcpkg.cmake")

mapnik/paths.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import os
2+
3+
mapniklibpath = os.path.join(os.path.dirname(os.path.realpath(__file__)), "lib")
4+
inputpluginspath = os.path.join(mapniklibpath, 'mapnik', 'input')
5+
fontscollectionpath = os.path.join(mapniklibpath, 'mapnik', 'fonts')
6+
7+
__all__ = [mapniklibpath,inputpluginspath,fontscollectionpath]

pyproject.toml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[project]
2+
name = "mapnik"
3+
version = "4.0.0"
4+
authors = [
5+
{ name="Blake Thompson", email="[email protected]" },
6+
]
7+
description = "Python bindings for Mapnik"
8+
readme = "README.md"
9+
requires-python = ">=3.7"
10+
11+
[project.urls]
12+
"Homepage" = "https://github.com/mapnik/python-mapnik"
13+
"Bug Tracker" = "https://github.com/mapnik/python-mapnik/issues"
14+
15+
[project.optional-dependencies]
16+
test = ["pytest"]
17+
18+
[build-system]
19+
requires = ["scikit-build-core"]
20+
build-backend = "scikit_build_core.build"
21+
22+
[tool.scikit-build]
23+
cmake.minimum-version = "3.15"
24+
cmake.build-type = "Release"
25+
sdist.reproducible = true
26+
wheel.packages = ["mapnik"]
27+
#build-dir = "build"

setup.cfg

-2
This file was deleted.

0 commit comments

Comments
 (0)