Skip to content

Commit

Permalink
first pypi release (#1)
Browse files Browse the repository at this point in the history
* update build system

* tippecanoe

* not ready

* not ready

* not ready

* add sqlite from https://www.sqlite.org/download.html

* add zlib

* not good

* init

* not ready

* not good

* update

* not ready
?# - type: feat, fix, docs, style, refactor, test, chore

* not good

* not ready

* fix

* tippecanoe

* not ready

* add manifest

* not ready

* not ready

* ready?

* reday

* good

* ready

* clean

* fix

* fix

* skip windows binary, need to fix unistd

---------

Co-authored-by: TANG ZHIXIONG <[email protected]>
  • Loading branch information
district10 and zhixiong-tang authored Sep 17, 2023
1 parent 390771f commit 6f9e8f5
Show file tree
Hide file tree
Showing 19 changed files with 265,251 additions and 524 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This is a format job. Pre-commit has a first-party GitHub action, so we use
# that: https://github.com/pre-commit/action

name: Format

on:
workflow_dispatch:
pull_request:
push:
branches:
- master

jobs:
pre-commit:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- uses: pre-commit/[email protected]
33 changes: 33 additions & 0 deletions .github/workflows/pip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Pip

on:
workflow_dispatch:
pull_request:
push:
branches:
- master

jobs:
build:
strategy:
fail-fast: false
matrix:
platform: [ubuntu-20.04, windows-2019, macos-11]
python-version: ["3.8", "3.9", "3.10"]

runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v3
with:
submodules: true

- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Add requirements
run: python -m pip install --upgrade wheel setuptools

- name: Build and install
run: pip install --verbose .[test]
11 changes: 0 additions & 11 deletions .github/workflows/test.yml

This file was deleted.

84 changes: 84 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Wheels

on:
workflow_dispatch:
pull_request:
push:
branches:
- master
release:
types:
- published

jobs:
build_sdist:
name: Build SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true

- name: Build SDist
run: pipx run build --sdist

- name: Check metadata
run: pipx run twine check dist/*

- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz


build_wheels:
name: Wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]

steps:
- uses: actions/checkout@v3
with:
submodules: true

- uses: pypa/[email protected]
env:
# CIBW_ARCHS: auto64
CIBW_ARCHS_LINUX: x86_64 # aarch64
CIBW_ARCHS_WINDOWS: AMD64 # ARM64
CIBW_ARCHS_MACOS: x86_64 arm64
# https://cibuildwheel.readthedocs.io/en/stable/options/#build-skip
CIBW_SKIP: pp* *i686 *musllinux*
CIBW_TEST_SKIP: "*macosx* *win* *aarch64"

- name: Verify clean directory
run: git diff --exit-code
shell: bash

- name: Upload wheels
uses: actions/upload-artifact@v3
with:
path: wheelhouse/*.whl


upload_all:
name: Upload if release
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'

steps:
- uses: actions/setup-python@v4
with:
python-version: "3.x"

- uses: actions/download-artifact@v3
with:
name: artifact
path: dist

- uses: pypa/[email protected]
with:
password: ${{ secrets.PYPI_API_TOKEN }}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,9 @@ tests/**/*.geobuf

# Nodejs
node_modules
build
dist
*.egg-info
bin/*.exe
wheelhouse
__pycache__
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "pybind11"]
path = pybind11
url = https://github.com/pybind/pybind11.git
[submodule "zlib-ng"]
path = zlib-ng
url = https://github.com/zlib-ng/zlib-ng.git
43 changes: 43 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# To use:
#
# pre-commit run -a
#
# Or:
#
# pre-commit install # (runs every time you commit in git)
#
# To update this file:
#
# pre-commit autoupdate
#
# See https://github.com/pre-commit/pre-commit

ci:
autoupdate_commit_msg: "chore: update pre-commit hooks"
autofix_commit_msg: "style: pre-commit fixes"

repos:
# Standard hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
exclude: ^conda\.recipe/meta\.yaml$
- id: debug-statements
# - id: end-of-file-fixer
- id: mixed-line-ending
- id: requirements-txt-fixer
# - id: trailing-whitespace

# CMake formatting
- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13
hooks:
- id: cmake-format
additional_dependencies: [pyyaml]
types: [file]
files: (\.cmake|CMakeLists.txt)(.in)?$
103 changes: 103 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
cmake_minimum_required(VERSION 3.4...3.18)
project(cubao_tippecanoe)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

if(NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE
"Release"
CACHE STRING "" FORCE)
message(STATUS "Set build type to default: ${CMAKE_BUILD_TYPE}")
else()
message(STATUS "Your build type: ${CMAKE_BUILD_TYPE}")
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -ggdb")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb")
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
endif()

set(CMAKE_CXX_STANDARD 17)
set(PYBIND11_CPP_STANDARD -std=c++17)
include_directories(BEFORE ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR})
include_directories(${PYBIND11_INCLUDE_DIR})

set(BUILD_SHARED_LIBS OFF)

include(FetchContent)
set(ZLIB_COMPAT ON)
set(ZLIB_ENABLE_TESTS OFF)
set(ZLIBNG_ENABLE_TESTS OFF)
set(WITH_GZFILEOP ON)
# set(WITH_NEW_STRATEGIES OFF)
set(WITH_GTEST OFF)
add_subdirectory(zlib-ng)

set(MAIN_SRCS decode.cpp enumerate.cpp jsontool.cpp main.cpp overzoom.cpp
tile-join.cpp)

file(GLOB HEADERS *.hpp *.h jsonpull/*.h)
set(SOURCES
clip.cpp
compression.cpp
csv.cpp
dirtiles.cpp
evaluator.cpp
flatgeobuf.cpp
geobuf.cpp
geocsv.cpp
geojson-loop.cpp
geojson.cpp
geometry.cpp
json_logger.cpp
jsonpull/jsonpull.c
mbtiles.cpp
memfile.cpp
mvt.cpp
plugin.cpp
pmtiles_file.cpp
pool.cpp
projection.cpp
read_json.cpp
serial.cpp
sqlite3.c
text.cpp
tile.cpp
unit.cpp
visvalingam.cpp
write_json.cpp)

add_library(${PROJECT_NAME} ${SOURCES} ${HEADERS})
target_link_libraries(${PROJECT_NAME} zlib m dl pthread)
install(
TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})

set(SRCS decode.cpp enumerate.cpp jsontool.cpp main.cpp overzoom.cpp
tile-join.cpp)
foreach(src ${SRCS})
string(REGEX REPLACE "(^.*/|.cpp$)" "" exe ${src})
if(${src} STREQUAL "main.cpp")
set(exe tippecanoe)
add_executable(${exe} ${src})
set_target_properties(${exe} PROPERTIES OUTPUT_NAME tippecanoe)
else()
add_executable(${exe} ${src})
endif()
target_link_libraries(${exe} ${PROJECT_NAME})
set_target_properties(${exe} PROPERTIES PREFIX "__cubao_tippecanoe_")
set_target_properties(${exe} PROPERTIES SUFFIX ".exe")
endforeach(src)

add_subdirectory(pybind11)
pybind11_add_module(_pybind11_tippecanoe pybind11.cpp)

target_compile_definitions(_pybind11_tippecanoe
PRIVATE VERSION_INFO=${TIPPECANOE_VERSION_INFO})
target_link_libraries(_pybind11_tippecanoe PRIVATE ${PROJECT_NAME})
6 changes: 6 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
include README.md LICENSE pybind11/LICENSE
graft pybind11/include
graft pybind11/tools
graft zlib-ng
global-include *.hpp *.cpp *.c *.h
global-include CMakeLists.txt *.cmake
Loading

0 comments on commit 6f9e8f5

Please sign in to comment.