-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make into pypi package with macos and windows support (#51)
* test for macos and windows support * Apple Clang has issues with std::log as constexpr * static cast implicit type conversions, include numeric * disable msvc warnings as error, add python cibuildwheel for macos * drop support for ubuntu 20.04, support python version >=3.8 * cache cmake build type for opencv windows * statically linked CRT OFF * add pypi workflow * all set for pip install * fix artifact same-name error due to shift to upload-artifact@v4 * try this * remove matrix.version, matrix.os for artifact name is enough * modify readme for pip install * bump version * cache v2 will literally break CI from 1st Feb 2025
- Loading branch information
1 parent
95bc9fe
commit e4a1543
Showing
17 changed files
with
162 additions
and
41 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
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,67 @@ | ||
name: Publish to PyPI.org | ||
on: | ||
release: | ||
types: [published] | ||
push: | ||
branches: ["main"] | ||
pull_request: | ||
branches: ["main"] | ||
|
||
jobs: | ||
build_sdist: | ||
name: Build source distribution | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Build sdist | ||
run: pipx run build --sdist ${{github.workspace}}/python/ | ||
- name: Move sdist to dist | ||
run: mkdir -p dist && mv ${{github.workspace}}/python/dist/*.tar.gz dist/ | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
path: dist/*.tar.gz | ||
|
||
cibuildwheel: | ||
name: Build wheels on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-24.04, windows-2022, macos-15] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Build test wheels (only PRs) | ||
if: github.event_name != 'release' | ||
uses: pypa/cibuildwheel@v2.22.0 | ||
env: # build 1 build per platform just to make sure we can do it later when releasing | ||
CIBW_BUILD: "cp310-*" | ||
with: | ||
package-dir: ${{github.workspace}}/python/ | ||
|
||
- name: Build all wheels | ||
if: github.event_name == 'release' | ||
uses: pypa/cibuildwheel@v2.22.0 | ||
with: | ||
package-dir: ${{github.workspace}}/python/ | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: artifact-${{ matrix.os }} | ||
path: ./wheelhouse/*.whl | ||
|
||
pypi: | ||
if: github.event_name == 'release' | ||
needs: [cibuildwheel, build_sdist] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: artifact | ||
path: dist | ||
|
||
- uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} |
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
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,51 @@ | ||
# MIT License | ||
# | ||
# Copyright (c) 2022 Ignacio Vizzo, Tiziano Guadagnino, Benedikt Mersch, Cyrill | ||
# Stachniss. | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in all | ||
# copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
function(set_global_target_properties target) | ||
target_compile_features(${target} PUBLIC cxx_std_17) | ||
target_compile_definitions(${target} PUBLIC $<$<COMPILE_LANG_AND_ID:CXX,MSVC>:_USE_MATH_DEFINES>) | ||
target_compile_options( | ||
${target} | ||
PRIVATE # MSVC | ||
$<$<COMPILE_LANG_AND_ID:CXX,MSVC>:/W4> | ||
# Clang/AppleClang | ||
$<$<COMPILE_LANG_AND_ID:CXX,Clang,AppleClang>:-fcolor-diagnostics> | ||
$<$<COMPILE_LANG_AND_ID:CXX,Clang,AppleClang>:-Wall> | ||
$<$<COMPILE_LANG_AND_ID:CXX,Clang,AppleClang>:-Wextra> | ||
$<$<COMPILE_LANG_AND_ID:CXX,Clang,AppleClang>:-Wconversion> | ||
$<$<COMPILE_LANG_AND_ID:CXX,Clang,AppleClang>:-Wno-sign-conversion> | ||
# GNU | ||
$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-fdiagnostics-color=always> | ||
$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-Wall> | ||
$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-Wextra> | ||
$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-pedantic> | ||
$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-Wcast-align> | ||
$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-Wcast-qual> | ||
$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-Wconversion> | ||
$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-Wdisabled-optimization> | ||
$<$<COMPILE_LANG_AND_ID:CXX,GNU>:-Woverloaded-virtual>) | ||
set(INCLUDE_DIRS ${PROJECT_SOURCE_DIR}) | ||
get_filename_component(INCLUDE_DIRS ${INCLUDE_DIRS} PATH) | ||
target_include_directories( | ||
${target} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} | ||
PUBLIC $<BUILD_INTERFACE:${INCLUDE_DIRS}> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) | ||
endfunction() |
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
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
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
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