Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pybinding for diffCheck #13

Merged
merged 28 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
96ee93f
ADD-WIP: pybinding submodule
9and3 Apr 29, 2024
1402988
WIP: working version with cmake pybind
9and3 Apr 29, 2024
0812d05
WIP: testing new ci with wrap
9and3 Apr 30, 2024
7a01df3
WIP: testing wrong byte in env
9and3 Apr 30, 2024
fa7640f
WIP testing minconda isntall different
9and3 Apr 30, 2024
825ab09
ADD: fundamental badge
9and3 Apr 30, 2024
85df7b7
WIP: testing another codna env builder
9and3 Apr 30, 2024
634690c
WIP: config without generator and architecture - test
9and3 Apr 30, 2024
9d52542
CAP: working cmake for pybind11
9and3 Apr 30, 2024
99937fe
WIP: testing pypi building wheel ci
9and3 Apr 30, 2024
c9c56a1
WIP: testing different vanilla cpp ci and pypi with module building
9and3 Apr 30, 2024
896f144
WIP: trying to fix pypi ci pipeline, got rid double cpython install
9and3 Apr 30, 2024
8cfb4cc
WIP: fixing win vanilla
9and3 Apr 30, 2024
1752b17
MILESTONE: functioning pipeline for pipenv + refined cmake for copyin…
9and3 Apr 30, 2024
0803ded
FIX: ci better without bat files (they cannot execute conda comamnds)
9and3 May 1, 2024
b18a07f
FIX-ADD: pythonnet pip dependecy spec in conda env.yml
9and3 May 1, 2024
d717b04
CAP-ADD: local componentize done
9and3 May 1, 2024
f1e5160
CAP-ADD: pypi invoke done
9and3 May 1, 2024
eead235
FIX: minor href badge
9and3 May 1, 2024
254a111
FIX: another ref badge
9and3 May 1, 2024
d6adb56
FIX: for ci for pypi building wheel
9and3 May 1, 2024
9323c68
Merge branch 'pybind' of https://github.com/diffCheckOrg/diffCheck in…
9and3 May 1, 2024
b68cba2
CAP-ADD: flagerzer invoke done
9and3 May 1, 2024
067f3b7
CAP-ADD: yakerizer invoke done
9and3 May 1, 2024
3342533
FIX: correct copying for bindings always flatten
9and3 May 1, 2024
ed523d2
WIP-ADD: working binding with renamed
9and3 May 1, 2024
92b5994
WIP-CAP: working version for load from ply, need to solve subsample +…
9and3 May 1, 2024
69f3478
ADD-CAP: working convertions
9and3 May 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "win-build"
name: "cpp-build"

on:
push:
Expand All @@ -7,7 +7,6 @@ on:
branches: ["main"]



env:
BUILD_TYPE: Release
VCPKG_FILE: c:/vcpkg/scripts/buildsystems/vcpkg.cmake
Expand All @@ -19,7 +18,9 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: CMAKE Configure
run: ${{github.workspace}}/cmake/config.bat
- name: Cmake Configure
run: |
cmake -S . -B build -A x64 -DBUILD_PYTHON_MODULE=OFF

- name: CMake Build
run: ${{github.workspace}}/cmake/build.bat
49 changes: 49 additions & 0 deletions .github/workflows/pypi-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: "pypi-build"

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]


env:
BUILD_TYPE: Release
VCPKG_FILE: c:/vcpkg/scripts/buildsystems/vcpkg.cmake

jobs:
pypi_build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v4

- name: Setup conda environment
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: 3.9.1

- name: Create diff_check conda environment
run: conda env create -f environment.yml

- name: Activate diff_check conda environment
run: conda activate diff_check

- name: Cmake Configure
run: |
cmake -S . -B build -A x64 -DBUILD_PYTHON_MODULE=ON
- name: CMake Build
run: ${{github.workspace}}/cmake/build.bat

- name: Build wheel
run: |
cd ${{github.workspace}}/src/gh/diffCheck/
python setup.py bdist_wheel
cd ${{github.workspace}}

- name: Upload wheel
uses: actions/upload-artifact@v2
with:
name: wheel
path: ${{github.workspace}}/src/gh/diffCheck/dist/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@
[submodule "deps/loguru"]
path = deps/loguru
url = https://github.com/emilk/loguru.git
[submodule "deps/pybind11"]
path = deps/pybind11
url = https://github.com/pybind/pybind11.git
9 changes: 8 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@
"*.inc": "cpp",
"coroutine": "cpp",
"resumable": "cpp",
"*.ipp": "cpp"
"*.ipp": "cpp",
"cinttypes": "cpp",
"codecvt": "cpp",
"csetjmp": "cpp",
"cwctype": "cpp",
"memory_resource": "cpp",
"scoped_allocator": "cpp",
"strstream": "cpp"
}
}
51 changes: 48 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.16.)
project(DiffCheck VERSION 1.0.0 LANGUAGES CXX C)
project(diffCheck VERSION 0.0.24 LANGUAGES CXX C)
set(CMAKE_CXX_STANDARD 17)

list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
Expand Down Expand Up @@ -80,7 +80,7 @@ if(WIN32)
if(open3d_type STREQUAL "SHARED_LIBRARY")
message(STATUS "Copying Open3D.dll to ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>")
add_custom_command(TARGET ${SHARED_LIB_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
COMMAND ${CMAKE_COMMAND} -E copy
$<TARGET_FILE:Open3D::Open3D>
$<TARGET_FILE_DIR:${SHARED_LIB_NAME}>)
endif()
Expand Down Expand Up @@ -122,4 +122,49 @@ target_include_directories(${APP_NAME_EXE}
# include(CTest)
# enable_testing()

# add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tests/global_registrations)
# add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tests/global_registrations)

#--------------------------------------------------------------------------
# pybind11
#--------------------------------------------------------------------------
if (BUILD_PYTHON_MODULE)
set(PYBINDMODULE_NAME diffcheck_bindings)
set(PYPI_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/gh/diffCheck/diffCheck)
set(TARGET_DLL_PYPI_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/gh/diffCheck/diffCheck/dlls)

download_submodule_project(pybind11)
add_subdirectory(deps/pybind11)

find_package(Python3 COMPONENTS Interpreter Development REQUIRED)

message(STATUS "Python3_EXECUTABLE: ${Python3_EXECUTABLE}")
message(STATUS "Python3_INCLUDE_DIRS: ${Python3_INCLUDE_DIRS}")
message(STATUS "Python3_LIBRARIES: ${Python3_LIBRARIES}")
message(STATUS "Python3_VERSION: ${Python3_VERSION}")

set(PYBIND11_PYTHON_VERSION 3.9.10)

pybind11_add_module(${PYBINDMODULE_NAME} src/diffCheckBindings.cc)

target_link_libraries(${PYBINDMODULE_NAME} PRIVATE ${SHARED_LIB_NAME})
target_include_directories(${PYBINDMODULE_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)

# copy the pyd file to the pypi directory
add_custom_command(TARGET ${PYBINDMODULE_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
$<TARGET_FILE:${PYBINDMODULE_NAME}>
${PYPI_DIR}
)

# get all the files -dlls in the bin directory and copy them one by one to the pypi directory
file(GLOB files ${CMAKE_BINARY_DIR}/bin/Release/*.dll)
foreach(file ${files})
message(STATUS "Copying ${file} to ${TARGET_DLL_PYPI_DIR}")
add_custom_command(TARGET ${PYBINDMODULE_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${file}
${TARGET_DLL_PYPI_DIR}
)
endforeach()

endif()
12 changes: 4 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
<img src="./assets/logo/logo_pixelized_bwvioelt.png" width="150">
</p>
<p align="center">
<img src="https://github.com/diffCheckOrg/diffCheck/actions/workflows/win-build.yml/badge.svg">
<img src="https://github.com/diffCheckOrg/diffCheck/actions/workflows/cpp-build.yml/badge.svg">
<img src="https://github.com/diffCheckOrg/diffCheck/actions/workflows/gh-build.yml/badge.svg">
<img src="https://img.shields.io/pypi/v/diffCheck" href="https://pypi.org/project/diffCheck/">
<img src="https://github.com/diffCheckOrg/diffCheck/actions/workflows/pypi-build.yml/badge.svg">
<img href="https://pypi.org/project/diffCheck/" src="https://img.shields.io/pypi/v/diffCheck">
<img href="https://github.com/ellerbrock/open-source-badges/" src="https://badges.frapsoft.com/os/v2/open-source.svg?v=103">
</p>


Expand Down Expand Up @@ -71,9 +73,3 @@ To prototype:

See the [CONTRIBUTING.md](https://github.com/diffCheckOrg/diffCheck/blob/main/CONTRIBUTING.md) for more information on how to prototype with diffCheck (code guidelines, visualizer, utilities, etc).


## TODO:
- [ ] @Andrea: add writing functions for mesh and point cloud
- [ ] @Andrea: refactor `IOManager.hh` with a class `IOManager` and static methods
- [ ] @Andrea: test Rhino exporeted `.ply` files
- [ ] @Andrea: tests suite for IO /pcdmesh / visualizer
Binary file added assets/icon_pool/cloud1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon_pool/cloud1.xcf
Binary file not shown.
Binary file added assets/icon_pool/cloud2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon_pool/cloud2.xcf
Binary file not shown.
Binary file added assets/icon_pool/code_xml_export.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon_pool/code_xml_export.xcf
Binary file not shown.
Binary file added assets/icon_pool/code_xml_export2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon_pool/code_xml_export2.xcf
Binary file not shown.
Binary file added assets/icon_pool/df_test_import.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon_pool/df_test_import.xcf
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/logo/logo_raw.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions cmake/__noenv__config.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
REM configure the project
cmake -S . -B build
57 changes: 57 additions & 0 deletions cmake/activate_conda.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
:: ########################################################################
:: check if conda is available >
:: check that diff_check environment is available >
:: activate it
:: ########################################################################

:: Check if conda command is available
echo Checking if conda command is available...
where conda >nul 2>nul
if %ERRORLEVEL% equ 0 (
echo Conda command is available.
goto :end
)
if exist "%USERPROFILE%\Anaconda3" (
echo Anaconda3 found in %USERPROFILE%\Anaconda3.
goto :end
)
if exist "%ProgramData%\Anaconda3" (
echo Anaconda3 found in %ProgramData%\Anaconda3.
goto :end
)
if exist "%ProgramFiles%\Anaconda3" (
echo Anaconda3 found in %ProgramFiles%\Anaconda3.
goto :end
)
echo Anaconda3 not found, you won't be able to build the python wrap for diffcheck. Please install it first.
exit /b 1

:end
echo Anaconda3 found.

:: Check if the diff_check environment is available
call conda env list | findstr /C:"diff_check" >nul 2>nul
if %ERRORLEVEL% neq 0 (
echo diff_check environment not found, you should create one by running:
echo $ conda env create -f environment.yml
exit /b 1
) else (
echo diff_check environment is available, updating it now...
conda env update --name diff_check --file environment.yml --prune && (
echo Environment created successfully.
) || (
echo Failed to update diff_check environment, please check the environment.yml file.
exit /b 1
)
)
echo diff_check environment is up to date.

:: check if a different environment then diff_check is activated, if so deactivate it
for /f "delims=" %%i in ('conda env list ^| findstr /C:"*"') do set "active_env=%%i"
for /f "delims= " %%j in ("%active_env%") do set "active_env_name=%%j"
if not "%active_env_name%"=="diff_check" (
echo You should deactivating %active_env_name% first with "conda deactivate" and "conda activate diff_check" before running this script.
exit /b 1
)

echo you can start the cmake config now ...
1 change: 1 addition & 0 deletions cmake/build.bat
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
REM build the project in Release mode
cmake --build build --config Release
8 changes: 7 additions & 1 deletion cmake/clean_config.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
REM activate the conda diff_check environment otherwise the python wrap won't work
call cmake/activate_conda.bat

REM clean the build directory and reconfigure it
rmdir /s /q build
cmake -S . -B build -G "Visual Studio 16 2019" -A x64

REM configure the project
cmake -S . -B build
4 changes: 4 additions & 0 deletions cmake/config.bat
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
REM activate the conda diff_check environment otherwise the python wrap won't work
call cmake/activate_conda.bat

REM configure the project
cmake -S . -B build
5 changes: 4 additions & 1 deletion cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@
# specify the same custom options.
option(STATIC_WINDOWS_RUNTIME "Use static (MT/MTd) Windows runtime" ON)

option(SILENT_LOGGING "Do not log messages in the terminal if on." OFF)
option(SILENT_LOGGING "Do not log messages in the terminal if on." OFF)

# To build the python bindings
option(BUILD_PYTHON_MODULE "Build the python bindings" ON)
2 changes: 1 addition & 1 deletion deps/eigen
Submodule eigen updated from 34967b to 9700fc
1 change: 1 addition & 0 deletions deps/pybind11
Submodule pybind11 added at 19a6b9
Binary file added environment.yml
Binary file not shown.
Loading
Loading