Skip to content

Commit

Permalink
WIP: testing new ci with wrap
Browse files Browse the repository at this point in the history
  • Loading branch information
9and3 committed Apr 30, 2024
1 parent 1402988 commit 0812d05
Show file tree
Hide file tree
Showing 31 changed files with 514 additions and 107 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/win-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
branches: ["main"]



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

- name: Setup conda environment
uses: conda-incubator/setup-miniconda@v2
with:
environment-file: environment.yml
activate-environment: diff_check

- name: CMAKE Configure
run: ${{github.workspace}}/cmake/config.bat
- name: CMake Build
Expand Down
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"
}
}
32 changes: 31 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,40 @@ target_include_directories(${APP_NAME_EXE}
# pybind11
#--------------------------------------------------------------------------
set(PYBINDMODULE_NAME diffCheckBindings)
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)
target_include_directories(${PYBINDMODULE_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)

add_custom_command(TARGET ${PYBINDMODULE_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:${PYBINDMODULE_NAME}>
${PYPI_DIR}
)

add_custom_command(TARGET ${PYBINDMODULE_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:${SHARED_LIB_NAME}>
${TARGET_DLL_PYPI_DIR}
)
# TODO: for open3d-dll is working but it should be done in a more elegant way
add_custom_command(TARGET ${PYBINDMODULE_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:Open3D::Open3D>
${TARGET_DLL_PYPI_DIR}
)
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.
58 changes: 58 additions & 0 deletions cmake/activate_conda.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
@echo off
setlocal

REM ########################################################################
REM check if conda is available >
REM check that diff_check environment is available >
REM activate it
REM ########################################################################

REM 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.

REM 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, creating it now...

call conda env create -f environment.yml
if %ERRORLEVEL% neq 0 (
echo Failed to create diff_check environment, please check the environment.yml file.
exit /b 1
)
) else (
echo diff_check environment is available, updating it now...

call conda env update --name diff_check --file environment.yml --prune
if %ERRORLEVEL% neq 0 (
echo Failed to update diff_check environment, please check the environment.yml file.
exit /b 1
)
)
echo diff_check environment is up to date.

REM activate the diff_check environment
call conda activate diff_check
echo diff_check environment activated.
7 changes: 7 additions & 0 deletions cmake/build.bat
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
@echo off
setlocal

REM activate the conda diff_check environment otherwise the python wrap won't work
call cmake/activate_conda.bat

REM build the project in Release mode
cmake --build build --config Release
9 changes: 9 additions & 0 deletions cmake/clean_config.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
@echo off
setlocal

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

REM configure the project
cmake -S . -B build -G "Visual Studio 16 2019" -A x64
9 changes: 8 additions & 1 deletion cmake/config.bat
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
cmake -S . -B build
@echo off
setlocal

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 -G "Visual Studio 16 2019" -A x64
2 changes: 1 addition & 1 deletion deps/eigen
Submodule eigen updated from dcceb9 to 0ee5c9
Binary file added environment.yml
Binary file not shown.
16 changes: 4 additions & 12 deletions src/diffCheckBindings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@

namespace py = pybind11;

bool test() { return true; }

PYBIND11_MODULE(diffCheckBindings, m) {
m.doc() = "diffCheck python bindings"; // optional module docstring

m.def("test", &test, "A function that returns true for testing import");

py::class_<diffCheck::geometry::DFPointCloud>(m, "DFPointCloud")
.def(py::init<>())
.def(py::init<std::vector<Eigen::Vector3d>, std::vector<Eigen::Vector3d>, std::vector<Eigen::Vector3d>>())
Expand All @@ -20,15 +23,4 @@ PYBIND11_MODULE(diffCheckBindings, m) {
.def("ComputeBoundingBox", &diffCheck::geometry::DFPointCloud::ComputeBoundingBox)

.def("get_num_points", &diffCheck::geometry::DFPointCloud::GetNumPoints);
}


// #include <pybind11/pybind11.h>

// int add(int i, int j) {
// return i + j;
// }

// PYBIND11_MODULE(diffCheckBindings, m) {
// m.def("add", &add, "A function which adds two numbers");
// }
}
19 changes: 10 additions & 9 deletions src/gh/diffCheck/diffCheck.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
Metadata-Version: 2.1
Name: diffCheck
Version: 0.0.3
Version: 0.0.17
Summary: DiffCheck is a package to check the differences between two timber structures
Home-page: https://github.com/diffCheckOrg/diffCheck
Author: Andrea Settimi, Damien Gilliard, Eleni Skevaki, Marirena Kladeftira, Julien Gamerro, Stefana Parascho, and Yves Weinand
Author-email: [email protected]
License: UNKNOWN
Description: # DiffCheck Grasshopper Plugin

DiffCheck is a plugin for Rhino/Grasshopper that allows the user to compare a 3D model with its scan.

More information to come
Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.9
Description-Content-Type: text/markdown
Requires-Dist: numpy
Requires-Dist: pybind11>=2.5.0

# DiffCheck Grasshopper Plugin

DiffCheck is a plugin for Rhino/Grasshopper that allows the user to compare a 3D model with its scan.

More information to come
5 changes: 3 additions & 2 deletions src/gh/diffCheck/diffCheck.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ diffCheck/df_geometries.py
diffCheck/df_joint_detector.py
diffCheck/df_transformations.py
diffCheck/df_util.py
diffCheck/diffCheck_app.py
diffCheck/test.py
diffCheck/diffCheckBindings.cp39-win_amd64.pyd
diffCheck/newmodule.py
diffCheck.egg-info/PKG-INFO
diffCheck.egg-info/SOURCES.txt
diffCheck.egg-info/dependency_links.txt
diffCheck.egg-info/requires.txt
diffCheck.egg-info/top_level.txt
1 change: 1 addition & 0 deletions src/gh/diffCheck/diffCheck.egg-info/requires.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
numpy
pybind11>=2.5.0
9 changes: 8 additions & 1 deletion src/gh/diffCheck/diffCheck/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
__version__ = "0.0.9"
import os
import sys

__version__ = "0.0.17"

PATH_TO_DLL = "dlls"
extra_dll_dir = os.path.join(os.path.dirname(__file__), PATH_TO_DLL)
os.add_dll_directory(extra_dll_dir)
Binary file not shown.
Binary file modified src/gh/diffCheck/diffCheck/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified src/gh/diffCheck/diffCheck/__pycache__/df_util.cpython-39.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
22 changes: 20 additions & 2 deletions src/gh/diffCheck/diffCheck_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,27 @@
import diffCheck
import diffCheck.df_geometries

# import diffCheck.diffCheckBindings

import sys
sys.path.append(R"F:\diffCheck\build\Release")
import diffCheckBindings
import platform
print(sys.version)
print(platform.architecture())

# import sys
# sys.path.append(R"F:\diffCheck\build\Release")
# os.add_dll_directory(R"F:\diffCheck\build\Release")
from diffCheck import diffCheckBindings

print(f"is pyd working: {diffCheckBindings.test()}")


df_cloud = diffCheckBindings.DFPointCloud(
[[0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]],
[[0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]],
[[0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]]
)
print(df_cloud.get_num_points())

print(diffCheck.__version__)

Expand Down
Binary file not shown.
Binary file removed src/gh/diffCheck/dist/diffCheck-0.0.3.tar.gz
Binary file not shown.
Binary file not shown.
Binary file removed src/gh/diffCheck/dist/diffCheck-0.0.9.tar.gz
Binary file not shown.
13 changes: 12 additions & 1 deletion src/gh/diffCheck/setup.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
from setuptools import setup, find_packages
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
import sys
import setuptools



setup(
name="diffCheck",
version="0.0.9",
version="0.0.17",
packages=find_packages(),
install_requires=[
"numpy",
"pybind11>=2.5.0"
# other dependencies...
],
description="DiffCheck is a package to check the differences between two timber structures",
Expand All @@ -19,4 +26,8 @@
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
],
# include_package_data=True,
package_data={
"diffCheck": ["diffCheck/dlls/*.dll", "*.pyd"]
},
)
Loading

0 comments on commit 0812d05

Please sign in to comment.