generated from cubao/cmake_example
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* remove pybind11 * update * fix * fix * fix * fix * move code * fix * update * fix * fix * fix * fix --------- Co-authored-by: tang zhixiong <[email protected]>
- Loading branch information
1 parent
55c5c8b
commit 2050715
Showing
21 changed files
with
789 additions
and
333 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,5 +18,5 @@ jobs: | |
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.x" | ||
python-version: "3.9" | ||
- uses: pre-commit/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ _generate/ | |
*env* | ||
wheelhouse | ||
site | ||
stubs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
[submodule "pybind11"] | ||
path = pybind11 | ||
url = https://github.com/pybind/pybind11.git | ||
branch = master | ||
[submodule "headers"] | ||
path = headers | ||
url = https://github.com/cubao/headers.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"configurations": [ | ||
{ | ||
"name": "Linux", | ||
"defines": [], | ||
"compilerPath": "/usr/bin/clang", | ||
"cStandard": "c11", | ||
"cppStandard": "c++17", | ||
"intelliSenseMode": "clang-x64", | ||
"compileCommands": "${workspaceFolder}/build/compile_commands.json" | ||
} | ||
], | ||
"version": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,46 @@ | ||
cmake_minimum_required(VERSION 3.4...3.18) | ||
project(naive_svg) | ||
cmake_minimum_required(VERSION 3.15...3.26) | ||
if(NOT DEFINED SKBUILD_PROJECT_NAME) | ||
set(SKBUILD_PROJECT_NAME "naive_svg") | ||
endif() | ||
if(NOT DEFINED PROJECT_VERSION) | ||
set(PROJECT_VERSION "dev") | ||
endif() | ||
# https://scikit-build-core.readthedocs.io/en/latest/cmakelists.html#accessing-information | ||
project( | ||
${SKBUILD_PROJECT_NAME} | ||
VERSION ${SKBUILD_PROJECT_VERSION} | ||
LANGUAGES CXX) | ||
|
||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | ||
set(CMAKE_POSITION_INDEPENDENT_CODE ON) | ||
set(CMAKE_INCLUDE_CURRENT_DIR ON) | ||
set(CMAKE_CXX_STANDARD 14) | ||
|
||
# set(CMAKE_BUILD_TYPE "Debug") | ||
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() | ||
|
||
# https://scikit-build-core.readthedocs.io/en/latest/getting_started.html | ||
find_package(Python REQUIRED COMPONENTS Interpreter Development.Module) | ||
find_package(pybind11 CONFIG REQUIRED) | ||
include_directories(headers/include) | ||
|
||
set(PYBIND11_CPP_STANDARD -std=c++14) | ||
add_subdirectory(pybind11) | ||
file(GLOB SRCS src/*.cpp) | ||
pybind11_add_module(_naive_svg ${SRCS}) | ||
|
||
# EXAMPLE_VERSION_INFO is defined by setup.py and passed into the C++ code as a | ||
# define (VERSION_INFO) here. | ||
target_compile_definitions(_naive_svg | ||
PRIVATE VERSION_INFO=${EXAMPLE_VERSION_INFO}) | ||
python_add_library(_core MODULE ${SRCS} WITH_SOABI) | ||
target_link_libraries(_core PRIVATE pybind11::headers) | ||
target_include_directories(_core PRIVATE src) | ||
target_compile_definitions(_core PRIVATE VERSION_INFO=${PROJECT_VERSION}) | ||
install(TARGETS _core DESTINATION ${PROJECT_NAME}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Submodule pybind11
deleted from
8a099e
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,92 @@ | ||
[build-system] | ||
requires = [ | ||
"setuptools>=42", | ||
"wheel", | ||
"ninja", | ||
"cmake>=3.12", | ||
requires = ["scikit-build-core>=0.3.3", "pybind11"] | ||
build-backend = "scikit_build_core.build" | ||
|
||
|
||
[project] | ||
name = "naive_svg" | ||
version = "0.0.3" | ||
url = "https://github.com/cubao/pybind11-naive-svg" | ||
description="naive svg writer" | ||
readme = "README.md" | ||
authors = [ | ||
{ name = "district10", email = "[email protected]" }, | ||
] | ||
requires-python = ">=3.7" | ||
classifiers = [ | ||
"Development Status :: 4 - Beta", | ||
"License :: OSI Approved :: MIT License", | ||
"Programming Language :: Python :: 3 :: Only", | ||
"Programming Language :: Python :: 3.7", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.mypy] | ||
files = "setup.py" | ||
python_version = "3.7" | ||
strict = true | ||
show_error_codes = true | ||
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"] | ||
warn_unreachable = true | ||
[project.optional-dependencies] | ||
test = ["pytest", "scipy"] | ||
|
||
|
||
[tool.scikit-build] | ||
wheel.expand-macos-universal-tags = true | ||
|
||
[[tool.mypy.overrides]] | ||
module = ["ninja"] | ||
ignore_missing_imports = true | ||
|
||
[tool.pytest.ini_options] | ||
minversion = "6.0" | ||
addopts = ["-ra", "--showlocals", "--strict-markers", "--strict-config"] | ||
xfail_strict = true | ||
filterwarnings = ["error"] | ||
log_cli_level = "INFO" | ||
filterwarnings = [ | ||
"error", | ||
] | ||
testpaths = ["tests"] | ||
|
||
|
||
[tool.cibuildwheel] | ||
test-command = "pytest {project}/tests" | ||
test-extras = ["test"] | ||
test-skip = ["*universal2:arm64"] | ||
# Setuptools bug causes collision between pypy and cpython artifacts | ||
before-build = "rm -rf {project}/build" | ||
build-verbosity = 1 | ||
|
||
|
||
[tool.ruff] | ||
src = ["src"] | ||
|
||
[tool.ruff.lint] | ||
exclude = ["*.pyi"] | ||
extend-select = [ | ||
"B", # flake8-bugbear | ||
"B904", | ||
"I", # isort | ||
"PGH", # pygrep-hooks | ||
"RUF", # Ruff-specific | ||
"UP", # pyupgrade | ||
"B", # flake8-bugbear | ||
"I", # isort | ||
"ARG", # flake8-unused-arguments | ||
"C4", # flake8-comprehensions | ||
"EM", # flake8-errmsg | ||
"ICN", # flake8-import-conventions | ||
"G", # flake8-logging-format | ||
"PGH", # pygrep-hooks | ||
"PIE", # flake8-pie | ||
"PL", # pylint | ||
"PT", # flake8-pytest-style | ||
"PTH", # flake8-use-pathlib | ||
"RET", # flake8-return | ||
"RUF", # Ruff-specific | ||
"SIM", # flake8-simplify | ||
"T20", # flake8-print | ||
"UP", # pyupgrade | ||
"YTT", # flake8-2020 | ||
"EXE", # flake8-executable | ||
"NPY", # NumPy specific rules | ||
"PD", # pandas-vet | ||
] | ||
extend-ignore = [ | ||
"E501", # Line too long | ||
ignore = [ | ||
"PLR09", # Too many X | ||
"PLR2004", # Magic comparison | ||
"PTH100", | ||
"PTH103", | ||
"PTH120", | ||
] | ||
target-version = "py37" | ||
isort.required-imports = ["from __future__ import annotations"] | ||
|
||
[tool.ruff.lint.per-file-ignores] | ||
"tests/**" = ["T20"] |
Oops, something went wrong.