Skip to content

Commit 2f7cc9b

Browse files
authored
Merge pull request #13 from diffCheckOrg/pybind
Pybinding for diffCheck
2 parents 45b2f43 + 69f3478 commit 2f7cc9b

File tree

86 files changed

+3664
-6428
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+3664
-6428
lines changed
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "win-build"
1+
name: "cpp-build"
22

33
on:
44
push:
@@ -7,7 +7,6 @@ on:
77
branches: ["main"]
88

99

10-
1110
env:
1211
BUILD_TYPE: Release
1312
VCPKG_FILE: c:/vcpkg/scripts/buildsystems/vcpkg.cmake
@@ -19,7 +18,9 @@ jobs:
1918
steps:
2019
- uses: actions/checkout@v4
2120

22-
- name: CMAKE Configure
23-
run: ${{github.workspace}}/cmake/config.bat
21+
- name: Cmake Configure
22+
run: |
23+
cmake -S . -B build -A x64 -DBUILD_PYTHON_MODULE=OFF
24+
2425
- name: CMake Build
2526
run: ${{github.workspace}}/cmake/build.bat

.github/workflows/pypi-build.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: "pypi-build"
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
8+
9+
10+
env:
11+
BUILD_TYPE: Release
12+
VCPKG_FILE: c:/vcpkg/scripts/buildsystems/vcpkg.cmake
13+
14+
jobs:
15+
pypi_build:
16+
runs-on: windows-latest
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Setup conda environment
22+
uses: conda-incubator/setup-miniconda@v2
23+
with:
24+
auto-update-conda: true
25+
python-version: 3.9.1
26+
27+
- name: Create diff_check conda environment
28+
run: conda env create -f environment.yml
29+
30+
- name: Activate diff_check conda environment
31+
run: conda activate diff_check
32+
33+
- name: Cmake Configure
34+
run: |
35+
cmake -S . -B build -A x64 -DBUILD_PYTHON_MODULE=ON
36+
- name: CMake Build
37+
run: ${{github.workspace}}/cmake/build.bat
38+
39+
- name: Build wheel
40+
run: |
41+
cd ${{github.workspace}}/src/gh/diffCheck/
42+
python setup.py bdist_wheel
43+
cd ${{github.workspace}}
44+
45+
- name: Upload wheel
46+
uses: actions/upload-artifact@v2
47+
with:
48+
name: wheel
49+
path: ${{github.workspace}}/src/gh/diffCheck/dist/

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@
1414
[submodule "deps/loguru"]
1515
path = deps/loguru
1616
url = https://github.com/emilk/loguru.git
17+
[submodule "deps/pybind11"]
18+
path = deps/pybind11
19+
url = https://github.com/pybind/pybind11.git

.vscode/settings.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,13 @@
9797
"*.inc": "cpp",
9898
"coroutine": "cpp",
9999
"resumable": "cpp",
100-
"*.ipp": "cpp"
100+
"*.ipp": "cpp",
101+
"cinttypes": "cpp",
102+
"codecvt": "cpp",
103+
"csetjmp": "cpp",
104+
"cwctype": "cpp",
105+
"memory_resource": "cpp",
106+
"scoped_allocator": "cpp",
107+
"strstream": "cpp"
101108
}
102109
}

CMakeLists.txt

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.16.)
2-
project(DiffCheck VERSION 1.0.0 LANGUAGES CXX C)
2+
project(diffCheck VERSION 0.0.24 LANGUAGES CXX C)
33
set(CMAKE_CXX_STANDARD 17)
44

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

125-
# add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tests/global_registrations)
125+
# add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tests/global_registrations)
126+
127+
#--------------------------------------------------------------------------
128+
# pybind11
129+
#--------------------------------------------------------------------------
130+
if (BUILD_PYTHON_MODULE)
131+
set(PYBINDMODULE_NAME diffcheck_bindings)
132+
set(PYPI_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/gh/diffCheck/diffCheck)
133+
set(TARGET_DLL_PYPI_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/gh/diffCheck/diffCheck/dlls)
134+
135+
download_submodule_project(pybind11)
136+
add_subdirectory(deps/pybind11)
137+
138+
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
139+
140+
message(STATUS "Python3_EXECUTABLE: ${Python3_EXECUTABLE}")
141+
message(STATUS "Python3_INCLUDE_DIRS: ${Python3_INCLUDE_DIRS}")
142+
message(STATUS "Python3_LIBRARIES: ${Python3_LIBRARIES}")
143+
message(STATUS "Python3_VERSION: ${Python3_VERSION}")
144+
145+
set(PYBIND11_PYTHON_VERSION 3.9.10)
146+
147+
pybind11_add_module(${PYBINDMODULE_NAME} src/diffCheckBindings.cc)
148+
149+
target_link_libraries(${PYBINDMODULE_NAME} PRIVATE ${SHARED_LIB_NAME})
150+
target_include_directories(${PYBINDMODULE_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
151+
152+
# copy the pyd file to the pypi directory
153+
add_custom_command(TARGET ${PYBINDMODULE_NAME} POST_BUILD
154+
COMMAND ${CMAKE_COMMAND} -E copy
155+
$<TARGET_FILE:${PYBINDMODULE_NAME}>
156+
${PYPI_DIR}
157+
)
158+
159+
# get all the files -dlls in the bin directory and copy them one by one to the pypi directory
160+
file(GLOB files ${CMAKE_BINARY_DIR}/bin/Release/*.dll)
161+
foreach(file ${files})
162+
message(STATUS "Copying ${file} to ${TARGET_DLL_PYPI_DIR}")
163+
add_custom_command(TARGET ${PYBINDMODULE_NAME} POST_BUILD
164+
COMMAND ${CMAKE_COMMAND} -E copy
165+
${file}
166+
${TARGET_DLL_PYPI_DIR}
167+
)
168+
endforeach()
169+
170+
endif()

README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
<img src="./assets/logo/logo_pixelized_bwvioelt.png" width="150">
33
</p>
44
<p align="center">
5-
<img src="https://github.com/diffCheckOrg/diffCheck/actions/workflows/win-build.yml/badge.svg">
5+
<img src="https://github.com/diffCheckOrg/diffCheck/actions/workflows/cpp-build.yml/badge.svg">
66
<img src="https://github.com/diffCheckOrg/diffCheck/actions/workflows/gh-build.yml/badge.svg">
7-
<img src="https://img.shields.io/pypi/v/diffCheck" href="https://pypi.org/project/diffCheck/">
7+
<img src="https://github.com/diffCheckOrg/diffCheck/actions/workflows/pypi-build.yml/badge.svg">
8+
<img href="https://pypi.org/project/diffCheck/" src="https://img.shields.io/pypi/v/diffCheck">
9+
<img href="https://github.com/ellerbrock/open-source-badges/" src="https://badges.frapsoft.com/os/v2/open-source.svg?v=103">
810
</p>
911

1012

@@ -71,9 +73,3 @@ To prototype:
7173

7274
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).
7375

74-
75-
## TODO:
76-
- [ ] @Andrea: add writing functions for mesh and point cloud
77-
- [ ] @Andrea: refactor `IOManager.hh` with a class `IOManager` and static methods
78-
- [ ] @Andrea: test Rhino exporeted `.ply` files
79-
- [ ] @Andrea: tests suite for IO /pcdmesh / visualizer

assets/icon_pool/cloud1.png

12 KB
Loading

assets/icon_pool/cloud1.xcf

2.93 KB
Binary file not shown.

assets/icon_pool/cloud2.png

10.5 KB
Loading

assets/icon_pool/cloud2.xcf

4.77 KB
Binary file not shown.

0 commit comments

Comments
 (0)