Skip to content

Commit

Permalink
rework build system
Browse files Browse the repository at this point in the history
  • Loading branch information
mathisloge committed Feb 2, 2023
1 parent 2a92ab0 commit 15b6767
Show file tree
Hide file tree
Showing 9 changed files with 117 additions and 440 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
*.dylib
build/
dist/
mapnik/paths.py
*.egg-info/
.eggs/
.mason/
mason_packages/
mapnik/plugins
_skbuild/
66 changes: 66 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
cmake_minimum_required(VERSION 3.15)
include(cmake/vcpkg_setup.cmake)
project(${SKBUILD_PROJECT_NAME} LANGUAGES CXX VERSION ${SKBUILD_PROJECT_VERSION})

find_package(Python COMPONENTS Interpreter Development.Module)
find_package(mapnik CONFIG REQUIRED)
find_package(Boost REQUIRED COMPONENTS thread python${Python_VERSION_MAJOR}${Python_VERSION_MINOR})

#set(Python_SOABI ${SKBUILD_SOABI})
Python_add_library(_mapnik MODULE)
target_link_libraries(_mapnik PRIVATE
mapnik::mapnik
mapnik::json
mapnik::wkt
# even though boost_thread is no longer used in mapnik core
# we need to link in for boost_python to avoid missing symbol: _ZN5boost6detail12get_tss_dataEPKv / boost::detail::get_tss_data
Boost::thread
Boost::python${Python_VERSION_MAJOR}${Python_VERSION_MINOR}
ICU::data ICU::i18n ICU::uc
)
target_sources(_mapnik PRIVATE
src/boost_std_shared_shim.hpp
src/mapnik_color.cpp
src/mapnik_coord.cpp
src/mapnik_datasource_cache.cpp
src/mapnik_datasource.cpp
src/mapnik_enumeration_wrapper_converter.hpp
src/mapnik_enumeration.hpp
src/mapnik_envelope.cpp
src/mapnik_expression.cpp
src/mapnik_feature.cpp
src/mapnik_featureset.cpp
src/mapnik_font_engine.cpp
src/mapnik_fontset.cpp
src/mapnik_gamma_method.cpp
src/mapnik_geometry.cpp
src/mapnik_grid_view.cpp
src/mapnik_grid.cpp
src/mapnik_image_view.cpp
src/mapnik_image.cpp
src/mapnik_label_collision_detector.cpp
src/mapnik_layer.cpp
src/mapnik_logger.cpp
src/mapnik_map.cpp
src/mapnik_palette.cpp
src/mapnik_parameters.cpp
src/mapnik_proj_transform.cpp
src/mapnik_projection.cpp
src/mapnik_python.cpp
src/mapnik_query.cpp
src/mapnik_raster_colorizer.cpp
src/mapnik_rule.cpp
src/mapnik_scaling_method.cpp
src/mapnik_style.cpp
src/mapnik_svg.hpp
src/mapnik_symbolizer.cpp
src/mapnik_threads.hpp
src/mapnik_value_converter.hpp
src/mapnik_view_transform.cpp
src/python_grid_utils.cpp
src/python_grid_utils.hpp
src/python_optional.hpp
src/python_to_value.hpp
)

install(TARGETS _mapnik LIBRARY DESTINATION ${SKBUILD_PROJECT_NAME})
120 changes: 0 additions & 120 deletions build.py

This file was deleted.

4 changes: 4 additions & 0 deletions cmake/vcpkg_setup.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
if(WIN32)
set(VCPKG_TARGET_TRIPLET x64-windows-static)
endif()
set(CMAKE_TOOLCHAIN_FILE "~/vcpkg/scripts/buildsystems/vcpkg.cmake")
7 changes: 7 additions & 0 deletions mapnik/paths.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import os

mapniklibpath = os.path.join(os.path.dirname(os.path.realpath(__file__)), "lib")
inputpluginspath = os.path.join(mapniklibpath, 'mapnik', 'input')
fontscollectionpath = os.path.join(mapniklibpath, 'mapnik', 'fonts')

__all__ = [mapniklibpath,inputpluginspath,fontscollectionpath]
27 changes: 27 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[project]
name = "mapnik"
version = "4.0.0"
authors = [
{ name="Blake Thompson", email="[email protected]" },
]
description = "Python bindings for Mapnik"
readme = "README.md"
requires-python = ">=3.7"

[project.urls]
"Homepage" = "https://github.com/mapnik/python-mapnik"
"Bug Tracker" = "https://github.com/mapnik/python-mapnik/issues"

[project.optional-dependencies]
test = ["pytest"]

[build-system]
requires = ["scikit-build-core"]
build-backend = "scikit_build_core.build"

[tool.scikit-build]
cmake.minimum-version = "3.15"
cmake.build-type = "Release"
sdist.reproducible = true
wheel.packages = ["mapnik"]
#build-dir = "build"
2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

Loading

0 comments on commit 15b6767

Please sign in to comment.