Skip to content

Commit 0b95dc7

Browse files
committed
stub for scikit-build-core based built
1 parent 11ab606 commit 0b95dc7

File tree

2 files changed

+10
-153
lines changed

2 files changed

+10
-153
lines changed

CMakeLists.txt

Lines changed: 4 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,114 +1,6 @@
1-
cmake_minimum_required(VERSION 3.15.0)
2-
project(pyosmium VERSION 4.0.2)
1+
cmake_minimum_required(VERSION 3.15...4.0)
2+
project(osmium LANGUAGES CXX)
33

4-
option(WITH_LZ4 "Build with lz4 support for PBF files" ON)
5-
6-
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
7-
8-
find_package(Osmium 2.16 REQUIRED COMPONENTS io pbf xml)
9-
10-
if(WITH_LZ4)
11-
find_package(LZ4)
12-
13-
if(LZ4_FOUND)
14-
message(STATUS "lz4 library found, compiling with it")
15-
add_definitions(-DOSMIUM_WITH_LZ4)
16-
include_directories(SYSTEM ${LZ4_INCLUDE_DIRS})
17-
list(APPEND OSMIUM_LIBRARIES ${LZ4_LIBRARIES})
18-
else()
19-
message(WARNING "lz4 library not found, compiling without it")
20-
endif()
21-
else()
22-
message(STATUS "Building without lz4 support: Set WITH_LZ4=ON to change this")
23-
endif()
24-
25-
include_directories(SYSTEM ${OSMIUM_INCLUDE_DIRS} ${PROTOZERO_INCLUDE_DIR})
26-
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib)
27-
28-
if(NOT "${CMAKE_CXX_STANDARD}")
29-
set(CMAKE_CXX_STANDARD 17)
30-
endif()
31-
32-
set(PYBIND11_CPP_STANDARD -std=c++${CMAKE_CXX_STANDARD})
33-
34-
message(STATUS "Building in C++${CMAKE_CXX_STANDARD} mode")
35-
36-
find_package(Python COMPONENTS Interpreter Development)
37-
38-
# Check for abiflags, so we can check for free-threaded later.
39-
execute_process(COMMAND ${Python_EXECUTABLE} -c "import sys; print(sys.abiflags, end='')"
40-
OUTPUT_VARIABLE PYTHON_ABIFLAGS)
41-
42-
if(PYBIND11_PREFIX)
43-
add_subdirectory(${PYBIND11_PREFIX} contrib/pybind11)
44-
elseif(PYTHON_ABIFLAGS STREQUAL "t")
45-
message(STATUS "Free-threading Python found. Enabling support (needs pybind11 2.13+).")
46-
find_package(pybind11 2.13 REQUIRED)
47-
else()
48-
find_package(pybind11 2.9 REQUIRED)
49-
endif()
50-
51-
find_package(Boost 1.70 REQUIRED COMPONENTS)
52-
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
53-
54-
function(set_module_output module outdir)
55-
set_target_properties(${module} PROPERTIES
56-
LIBRARY_OUTPUT_DIRECTORY
57-
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${outdir})
58-
# windows needs a build type variant
59-
foreach(config ${CMAKE_CONFIGURATION_TYPES})
60-
string(TOUPPER ${config} config)
61-
set_target_properties(${module} PROPERTIES
62-
LIBRARY_OUTPUT_DIRECTORY_${config}
63-
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${outdir})
64-
endforeach()
65-
endfunction()
66-
67-
# Modules without any Python code and just one source file.
68-
foreach(PYMOD geom index io area)
69-
pybind11_add_module(${PYMOD} lib/${PYMOD}.cc)
70-
set_module_output(${PYMOD} osmium)
71-
target_link_libraries(${PYMOD} PRIVATE ${OSMIUM_LIBRARIES})
72-
if(APPLE)
73-
set_target_properties(${PYMOD} PROPERTIES CXX_VISIBILITY_PRESET "default")
74-
endif()
75-
endforeach()
76-
77-
# Modules where additional Python code is in src (C++-part will be private).
78-
foreach(PYMOD osm replication)
79-
pybind11_add_module(_${PYMOD} lib/${PYMOD}.cc)
80-
set_module_output(_${PYMOD} osmium/${PYMOD})
81-
target_link_libraries(_${PYMOD} PRIVATE ${OSMIUM_LIBRARIES})
82-
if(APPLE)
83-
set_target_properties(_${PYMOD} PROPERTIES CXX_VISIBILITY_PRESET "default")
84-
endif()
85-
endforeach()
86-
87-
# Modules with multiple source files.
88-
pybind11_add_module(_osmium
89-
lib/osmium.cc
90-
lib/merge_input_reader.cc
91-
lib/node_location_handler.cc
92-
lib/simple_writer.cc
93-
lib/file_iterator.cc
94-
lib/id_tracker.cc)
95-
set_module_output(_osmium osmium)
96-
target_link_libraries(_osmium PRIVATE ${OSMIUM_LIBRARIES})
97-
98-
pybind11_add_module(filter
99-
lib/filter.cc
100-
lib/empty_tag_filter.cc
101-
lib/key_filter.cc
102-
lib/tag_filter.cc
103-
lib/id_filter.cc
104-
lib/entity_filter.cc
105-
lib/geo_interface_filter.cc)
106-
set_module_output(filter osmium)
107-
target_link_libraries(filter PRIVATE ${OSMIUM_LIBRARIES})
108-
109-
# workaround for https://github.com/pybind/pybind11/issues/1272
110-
if(APPLE)
111-
set_target_properties(_osmium PROPERTIES CXX_VISIBILITY_PRESET "default")
112-
set_target_properties(filter PROPERTIES CXX_VISIBILITY_PRESET "default")
113-
endif()
4+
set(PYBIND11_FINDPYTHON ON)
5+
find_package(pybind11 CONFIG REQUIRED)
1146

pyproject.toml

Lines changed: 6 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[build-system]
2-
requires = ["setuptools"]
3-
build-backend = "setuptools.build_meta"
2+
requires = ["scikit-build-core", "pybind11"]
3+
build-backend = "scikit_build_core.build"
44

55
[project]
66
name = "osmium"
77
description = "Python bindings for libosmium, the data processing library for OSM data"
8-
readme = "README.rst"
98
requires-python = ">=3.8"
9+
1010
license = {text = 'BSD-2-Clause'}
1111
authors = [
1212
{name = "Sarah Hoffmann", email = "[email protected]"}
@@ -18,6 +18,7 @@ keywords = ["OSM", "OpenStreetMap", "Osmium"]
1818
classifiers = [
1919
"Development Status :: 5 - Production/Stable",
2020
"Intended Audience :: Developers",
21+
"Topic :: Scientific/Engineering :: GIS",
2122
"License :: OSI Approved :: BSD License",
2223
"Programming Language :: Python :: 3.8",
2324
"Programming Language :: Python :: 3.9",
@@ -29,46 +30,10 @@ classifiers = [
2930
"Programming Language :: Python :: Free Threading :: 2 - Beta",
3031
"Programming Language :: Python :: Implementation :: CPython",
3132
"Programming Language :: C++",
33+
"Typing :: Typed"
3234
]
3335
dependencies = [
3436
"requests"
3537
]
3638

37-
dynamic = ["version"]
38-
39-
[tool.setuptools]
40-
packages = [
41-
"osmium",
42-
"osmium.osm",
43-
"osmium.replication"
44-
]
45-
package-dir = {"" = "src"}
46-
47-
48-
[project.urls]
49-
Homepage = "https://osmcode.org/pyosmium"
50-
Documentation = "https://docs.osmcode.org/pyosmium/latest/"
51-
Repository = "https://github.com/osmcode/pyosmium"
52-
Issues = "https://github.com/osmcode/pyosmium/issues"
53-
54-
[project.optional-dependencies]
55-
tests = [
56-
'pytest',
57-
'pytest-httpserver',
58-
'pytest-run-parallel',
59-
'werkzeug',
60-
'shapely'
61-
]
62-
docs = [
63-
'mkdocs',
64-
'mkdocs-material',
65-
'mkdocstrings',
66-
'mkdocstrings-python',
67-
'mkdocs-autorefs',
68-
'mkdocs-gen-files',
69-
'mkdocs-jupyter',
70-
'argparse-manpage '
71-
]
72-
73-
[tool.setuptools.dynamic]
74-
version = {attr = "osmium.version.pyosmium_release"}
39+
version = "0.1.0"

0 commit comments

Comments
 (0)