Skip to content

Commit

Permalink
Merge pull request #12 from 3DFin/pgeof_new_version
Browse files Browse the repository at this point in the history
pgeof2
drprojects authored Apr 11, 2024
2 parents 660905b + eda0377 commit fc20358
Showing 25 changed files with 1,447 additions and 636 deletions.
83 changes: 83 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
Language: Cpp
BasedOnStyle: Google
# ---
#AccessModifierOffset: -4
AlignAfterOpenBracket: AlwaysBreak # Values: Align, DontAlign, AlwaysBreak
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
#AlignEscapedNewlinesLeft: true
#AlignOperands: false
AlignTrailingComments: false # Should be off, causes many dummy problems!!
#AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: true
#AllowShortCaseLabelsOnASingleLine: false
#AllowShortFunctionsOnASingleLine: Empty
#AllowShortIfStatementsOnASingleLine: false
#AllowShortLoopsOnASingleLine: false
#AlwaysBreakAfterDefinitionReturnType: None
#AlwaysBreakAfterReturnType: None
#AlwaysBreakBeforeMultilineStrings: true
#AlwaysBreakTemplateDeclarations: true
#BinPackArguments: false
#BinPackParameters: false
#BraceWrapping:
#AfterClass: false
#AfterControlStatement: false
#AfterEnum: false
#AfterFunction: false
#AfterNamespace: false
#AfterObjCDeclaration: false
#AfterStruct: false
#AfterUnion: false
#BeforeCatch: false
#BeforeElse: true
#IndentBraces: false
#BreakBeforeBinaryOperators: None
BreakBeforeBraces: Allman
#BreakBeforeTernaryOperators: true
#BreakConstructorInitializersBeforeComma: false
ColumnLimit: 120
#CommentPragmas: ''
#ConstructorInitializerAllOnOneLineOrOnePerLine: true
#ConstructorInitializerIndentWidth: 4
#ContinuationIndentWidth: 4
#Cpp11BracedListStyle: true
#DerivePointerAlignment: false
#DisableFormat: false
#ExperimentalAutoDetectBinPacking: false
##FixNamespaceComments: true # Not applicable in 3.8
#ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
#IncludeCategories:
#- Regex: '.*'
#Priority: 1
IndentCaseLabels: true
IndentWidth: 4
IndentWrappedFunctionNames: true
#KeepEmptyLinesAtTheStartOfBlocks: true
#MacroBlockBegin: ''
#MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
#PenaltyBreakBeforeFirstCallParameter: 19
#PenaltyBreakComment: 300
#PenaltyBreakFirstLessLess: 120
#PenaltyBreakString: 1000
#PenaltyExcessCharacter: 1000000
#PenaltyReturnTypeOnItsOwnLine: 200
DerivePointerAlignment: false
#PointerAlignment: Left
ReflowComments: true # Should be true, otherwise clang-format doesn't touch comments
SortIncludes: true
#SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
#SpaceBeforeParens: ControlStatements
#SpaceInEmptyParentheses: false
#SpacesBeforeTrailingComments: 2
#SpacesInAngles: false
#SpacesInContainerLiterals: true
#SpacesInCStyleCastParentheses: false
#SpacesInParentheses: false
#SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 4
UseTab: Never # Available options are Never, Always, ForIndentation
29 changes: 29 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Tests

on:
- push
- pull_request

jobs:
build:
name: Tests on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, windows-2022]
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
with:
submodules: True
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions
- name: Test with tox
run: tox
21 changes: 9 additions & 12 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -15,21 +15,16 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, windows-2019]
os: [ubuntu-22.04, windows-2022, macos-12]
fail-fast: false

env:
CIBW_ENVIRONMENT: ${{ matrix.os == 'windows-2019' && 'EIGEN_LIB_PATH=.' || 'EIGEN_LIB_PATH=/project' }}
steps:
- uses: actions/checkout@v4

- uses: actions/checkout@v4
with:
repository: eigen-mirror/eigen
ref: "3.4.0"
path: eigen3

submodules: True

# Used to host cibuildwheel
- uses: actions/setup-python@v3
- uses: actions/setup-python@v4

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.15
@@ -49,9 +44,11 @@ jobs:
# Only publish to PyPI when a commit is tagged
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: True

- uses: actions/setup-python@v3
- uses: actions/setup-python@v4

- uses: actions/download-artifact@v3
with:
10 changes: 10 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[submodule "eigen"]
path = third_party/eigen
url = https://gitlab.com/libeigen/eigen
branch = 3.4
[submodule "nanoflann"]
path = third_party/nanoflann
url = https://github.com/jlblancoc/nanoflann
[submodule "taskflow"]
path = third_party/taskflow
url = https://github.com/taskflow/taskflow
33 changes: 33 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
cmake_minimum_required(VERSION 3.15...3.27)
project(pgeof)
find_package(Python 3.8 COMPONENTS Interpreter Development.Module REQUIRED)

if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()

# Detect the installed nanobind package and import it into CMake
execute_process(
COMMAND "${Python_EXECUTABLE}" -m nanobind --cmake_dir
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE NB_DIR)
list(APPEND CMAKE_PREFIX_PATH "${NB_DIR}")
find_package(nanobind CONFIG REQUIRED)

nanobind_add_module(pgeof_ext NOMINSIZE STABLE_ABI LTO src/pgeof_ext.cpp)

# for nanobind 2
# nanobind_add_stub(
# pgeof_ext_stub
# MODULE pgeof_ext
# OUTPUT pgeof_ext.pyi
# PYTHON_PATH $<TARGET_FILE_DIR:pgeof_ext>
# DEPENDS pgeof_ext
# )

# All lib are headeer only.
# it's faster to include like this than using exported targets
# (i.e add_subdirectories(...))
target_include_directories(pgeof_ext PRIVATE "include" "third_party/eigen" "third_party/nanoflann/include" "third_party/taskflow")

install(TARGETS pgeof_ext LIBRARY DESTINATION pgeof)
1 change: 0 additions & 1 deletion MANIFEST.in

This file was deleted.

Loading

0 comments on commit fc20358

Please sign in to comment.