Skip to content

Commit f89226c

Browse files
author
peng.li24
committed
Add project infrastructure: CMake, CI, docs, examples
Following numpycpp patterns: - CMakeLists.txt with DEB packaging - shapelycpp-config.cmake.in for find_package - .github/workflows/ci.yml for CI/CD - README.md with full documentation - Example usage code - Community files (CODE_OF_CONDUCT, CONTRIBUTING, SECURITY, LICENSE)
1 parent 6142945 commit f89226c

14 files changed

Lines changed: 488 additions & 0 deletions
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
name: Bug report
3+
about: Create a bug report to help us improve
4+
title: '[Bug]: '
5+
labels: ['bug']
6+
assignees: ''
7+
---
8+
9+
**Describe the bug**
10+
A clear and concise description of what the bug is.
11+
12+
**To Reproduce**
13+
Steps to reproduce the behavior:
14+
15+
```cpp
16+
// minimal reproducing code
17+
```
18+
19+
**Expected behavior**
20+
A clear and concise description of what you expected to happen.
21+
22+
**Environment:**
23+
- OS: [e.g. Ubuntu 22.04]
24+
- Compiler: [e.g. GCC 12]
25+
- GEOS version: [e.g. 3.12]
26+
- shapelycpp version: [e.g. 0.1.0]
27+
28+
**Additional context**
29+
Add any other context about the problem here.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: Feature request
3+
about: Suggest a new feature or API
4+
title: '[Feature]: '
5+
labels: ['enhancement']
6+
assignees: ''
7+
---
8+
9+
**Is your feature request related to a problem? Please describe.**
10+
A clear and concise description of what the problem is.
11+
12+
**Describe the solution you'd like**
13+
A clear and concise description of what you want to happen.
14+
15+
**Describe alternatives you've considered**
16+
A clear and concise description of any alternative solutions or features you've considered.
17+
18+
**Additional context**
19+
Add any other context or screenshots about the feature request here.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
## Description
2+
3+
Please include a summary of the change and which issue is fixed.
4+
5+
Fixes # (issue)
6+
7+
## Type of change
8+
9+
- [ ] Bug fix (non-breaking change which fixes an issue)
10+
- [ ] New feature (non-breaking change which adds functionality)
11+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
12+
- [ ] Documentation update
13+
14+
## Checklist
15+
16+
- [ ] My code follows the style guidelines of this project
17+
- [ ] I have performed a self-review of my own code
18+
- [ ] I have commented my code, particularly in hard-to-understand areas
19+
- [ ] I have made corresponding changes to the documentation
20+
- [ ] My changes generate no new warnings

.github/workflows/ci.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
tags: ['v*']
7+
pull_request:
8+
branches: [master]
9+
10+
jobs:
11+
# ---- Build test ----
12+
build:
13+
runs-on: ubuntu-22.04
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Install dependencies
18+
run: |
19+
sudo apt-get update
20+
sudo apt-get install -y libgeos-dev
21+
22+
- name: Configure
23+
run: |
24+
mkdir build && cd build
25+
cmake .. -DCMAKE_BUILD_TYPE=Release
26+
27+
- name: Build .deb
28+
run: make -C build deb
29+
30+
# ---- Release: build .deb and publish on tag -------------------------------
31+
release:
32+
if: startsWith(github.ref, 'refs/tags/v')
33+
needs: build
34+
runs-on: ubuntu-22.04
35+
steps:
36+
- uses: actions/checkout@v4
37+
38+
- name: Install dependencies
39+
run: |
40+
sudo apt-get update
41+
sudo apt-get install -y libgeos-dev
42+
43+
- name: Build .deb
44+
run: |
45+
mkdir build && cd build
46+
cmake .. -DCMAKE_BUILD_TYPE=Release
47+
make deb
48+
49+
- name: Publish release
50+
uses: softprops/action-gh-release@v2
51+
with:
52+
files: build/shapelycpp-dev-*.deb
53+
generate_release_notes: true
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Build directories
2+
build/
3+
cmake-build-*/
4+
5+
# Compiled output
6+
*.o
7+
*.so
8+
*.dylib
9+
*.dll
10+
*.a
11+
*.lib
12+
*.exe
13+
14+
# Python
15+
__pycache__/
16+
*.py[cod]
17+
*$py.class
18+
*.egg-info/
19+
dist/
20+
.eggs/
21+
22+
# IDE
23+
.vscode/
24+
.idea/
25+
*.swp
26+
*.swo
27+
*~
28+
.DS_Store
29+
30+
# CMake generated
31+
CMakeCache.txt
32+
CMakeFiles/
33+
cmake_install.cmake
34+
Makefile
35+
!tests/Makefile
36+
CTestTestfile.cmake
37+
compile_commands.json
38+
39+
# Packaging
40+
*.deb
41+
*.rpm

CMakeLists.txt

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
cmake_minimum_required(VERSION 3.16)
2+
project(shapelycpp VERSION 0.1.0 LANGUAGES CXX)
3+
4+
# C++17
5+
set(CMAKE_CXX_STANDARD 17)
6+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
7+
set(CMAKE_CXX_EXTENSIONS OFF)
8+
9+
# ---- INTERFACE target for find_package consumers ----------------------------
10+
add_library(shapelycpp INTERFACE)
11+
target_include_directories(shapelycpp INTERFACE
12+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
13+
$<INSTALL_INTERFACE:include/shapelycpp>
14+
)
15+
target_compile_features(shapelycpp INTERFACE cxx_std_17)
16+
17+
# ---- Install — header-only C++ library --------------------------------------
18+
install(DIRECTORY geometry ops
19+
DESTINATION include/shapelycpp
20+
FILES_MATCHING PATTERN "*.h"
21+
)
22+
23+
include(CMakePackageConfigHelpers)
24+
configure_package_config_file(
25+
shapelycpp-config.cmake.in
26+
${CMAKE_CURRENT_BINARY_DIR}/shapelycpp-config.cmake
27+
INSTALL_DESTINATION lib/cmake/shapelycpp
28+
)
29+
30+
write_basic_package_version_file(
31+
${CMAKE_CURRENT_BINARY_DIR}/shapelycpp-config-version.cmake
32+
VERSION ${PROJECT_VERSION}
33+
COMPATIBILITY SameMajorVersion
34+
)
35+
36+
install(FILES
37+
${CMAKE_CURRENT_BINARY_DIR}/shapelycpp-config.cmake
38+
${CMAKE_CURRENT_BINARY_DIR}/shapelycpp-config-version.cmake
39+
DESTINATION lib/cmake/shapelycpp
40+
)
41+
42+
# ---- Docs & examples -------------------------------------------------------
43+
install(FILES README.md
44+
DESTINATION share/shapelycpp
45+
)
46+
install(DIRECTORY example/
47+
DESTINATION share/shapelycpp/example
48+
)
49+
50+
# ---- CPack DEB packaging ----------------------------------------------------
51+
set(CPACK_PACKAGE_NAME "shapelycpp-dev")
52+
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
53+
set(CPACK_PACKAGE_VENDOR "array2d")
54+
set(CPACK_PACKAGE_CONTACT "array2d")
55+
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "C++ pixel-level alignment of Python shapely — header-only library")
56+
set(CPACK_GENERATOR "DEB")
57+
set(CPACK_DEB_COMPONENT_INSTALL OFF)
58+
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "array2d")
59+
set(CPACK_DEBIAN_PACKAGE_SECTION "libdevel")
60+
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
61+
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libgeos-dev")
62+
set(CPACK_DEBIAN_FILE_NAME "shapelycpp-dev-${CPACK_PACKAGE_VERSION}-Linux.deb")
63+
set(CPACK_PACKAGING_INSTALL_PREFIX "/usr")
64+
65+
include(CPack)
66+
67+
# Convenience target
68+
add_custom_target(deb
69+
COMMAND cpack -G DEB
70+
COMMENT "Packaging shapelycpp-dev-${CPACK_PACKAGE_VERSION}-Linux.deb"
71+
)
72+
73+
message(STATUS "shapelycpp v${PROJECT_VERSION} (header-only C++ library)")
74+
message(STATUS " C++ Standard: ${CMAKE_CXX_STANDARD}")
75+
message(STATUS " DEB: make deb → shapelycpp-dev-${CPACK_PACKAGE_VERSION}-Linux.deb")
76+
message(STATUS " Install: sudo apt-get install -y libgeos-dev")

CODE_OF_CONDUCT.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity
10+
and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment:
18+
19+
- Demonstrating empathy and kindness toward other people
20+
- Being respectful of differing opinions, viewpoints, and experiences
21+
- Giving and gracefully accepting constructive feedback
22+
- Accepting responsibility and apologizing to those affected by our mistakes
23+
- Focusing on what is best for the overall community
24+
25+
## Enforcement
26+
27+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
28+
reported to the community leaders responsible for enforcement.
29+
All complaints will be reviewed and investigated promptly and fairly.
30+
31+
## Attribution
32+
33+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org),
34+
version 2.0, available at
35+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

CONTRIBUTING.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Contributing to numpycpp
2+
3+
Thanks for your interest in contributing!
4+
5+
## Getting Started
6+
7+
1. Fork the repository and clone it locally.
8+
2. Install dependencies: C++20 compiler, CMake >= 3.16, Eigen3 >= 3.3, pybind11.
9+
3. Build the project:
10+
11+
```bash
12+
mkdir build && cd build
13+
cmake .. -DCMAKE_BUILD_TYPE=Release
14+
make -j$(nproc)
15+
```
16+
17+
## Development Workflow
18+
19+
- Create a branch for your change.
20+
- Make your changes, following the existing code style.
21+
- Add tests in `tests/` for new functionality.
22+
- Verify the build succeeds before submitting.
23+
24+
## Pull Requests
25+
26+
- Keep PRs focused on a single change.
27+
- Reference any related issues in the PR description.
28+
- Ensure all tests pass.
29+
30+
## Code Style
31+
32+
- C++20, no compiler extensions.
33+
- Follow existing naming conventions in the codebase.
34+
- Header-only where practical for pybind11 integration.
35+
36+
## Reporting Issues
37+
38+
Use the [issue tracker](https://github.com/array2d/numpycpp/issues) and include:
39+
40+
- Steps to reproduce
41+
- Expected vs actual behavior
42+
- Compiler version, OS, and dependency versions

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2026 numpycpp contributors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)