Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ac17f8c
Feature: Implement custom logging system and integrate into existing …
DayUx Nov 22, 2025
586b5a5
Feature: Add logging source file to Makefile for custom logging system
DayUx Nov 22, 2025
f0cac3c
Feature: Include logging header in cli_wrapper.cpp for custom logging…
DayUx Nov 22, 2025
f11c123
Feature: Add manual cropping functionality for sheet detection with c…
DayUx Jan 15, 2026
5eaba94
Feature: Rename cli_wrapper.cpp to cli_wrapper.cs for C++/CLI compati…
DayUx Jan 15, 2026
8d61d64
Feature: Update CMakeLists and Makefile for C++/CLI wrapper build and…
DayUx Jan 17, 2026
35cc5c9
Feature: Enhance ProcessTargetImage method with input validation and …
DayUx Jan 17, 2026
39170c2
Feature: Refactor ProcessTargetImage method to improve image data han…
DayUx Jan 18, 2026
3fb4bea
Feature: Improve ProcessTargetImage method with input validation and …
DayUx Jan 18, 2026
37521f9
Add a validation test and improve impacts detection
DayUx Jan 19, 2026
7edba30
test
DayUx Jan 19, 2026
b2a3204
Feature: Refactor workflow configuration and enhance image processing…
DayUx Feb 10, 2026
a6bfa0f
Fix getPoint on ellipse
DayUx Feb 10, 2026
fc080be
feat: Generate comprehensive C++ documentation, and establish CI build.
DayUx Mar 5, 2026
b4cb834
feat: add multi-architecture C++/CLI wrapper support and NuGet packag…
DayUx Apr 5, 2026
eeba424
refactor: update CMake configuration to improve C++/CLI build compati…
DayUx Apr 5, 2026
3d54f38
fix github action
DayUx Apr 5, 2026
8d704c8
fix github action build
DayUx Apr 5, 2026
4301774
fix github action and remove build directory from repo
DayUx Apr 5, 2026
fb93715
fix github action
DayUx Apr 5, 2026
3e35413
fix wasm build
DayUx Apr 5, 2026
b4aaab4
fix github action wasm
DayUx Apr 5, 2026
e810235
fix github action
DayUx Apr 5, 2026
1748ec8
fix nuget packaging
DayUx Apr 5, 2026
fe16e03
Merge branch 'features/Manual-crop' of https://github.com/DayUx/subvi…
DayUx Apr 5, 2026
b317cd7
fix tests
DayUx Apr 5, 2026
02625f6
chore: include README.md in NuGet package metadata
DayUx Apr 5, 2026
6f2f8b9
Merge remote-tracking branch 'origin/develop' into features/Manual-crop
DayUx Apr 5, 2026
92dd6e7
fix merge issue
DayUx Apr 5, 2026
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
178 changes: 150 additions & 28 deletions .github/workflows/build-subvision-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,33 @@ name: Build and Release Subvision Core

on:
push:
branches: []
branches: [ ]
pull_request:
branches: []
branches: [ ]
workflow_dispatch:
inputs:
release_notes:
description: 'Release notes'
required: false

jobs:
get-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
pre-release-label: ${{ steps.version.outputs.pre-release-label }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get version
uses: reecetech/version-increment@2023.10.2
id: version
with:
scheme: calver
increment: patch

test:
runs-on: ubuntu-latest
steps:
Expand All @@ -33,7 +50,7 @@ jobs:
./subvision_tests

build-wasm:
needs: test
# needs: test

Copilot AI Apr 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The needs: test dependency is commented out for the build-wasm job, so artifacts/releases can be produced even if unit tests fail. Re-enable the dependency (or add an explicit gate) to avoid publishing untested builds.

Suggested change
# needs: test
needs: test

Copilot uses AI. Check for mistakes.
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -53,10 +70,19 @@ jobs:
build_wasm/subvision.mjs

build-dotnet:
needs: test
# needs: test

Copilot AI Apr 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The needs: test dependency is commented out for the build-dotnet job, which means .NET artifacts and the NuGet package can be created without tests passing. Consider restoring the dependency so packaging/releasing only happens after successful tests.

Suggested change
# needs: test
needs: test

Copilot uses AI. Check for mistakes.
runs-on: windows-latest
permissions:
contents: write
strategy:
fail-fast: false
matrix:
arch: [x64]
include:
- arch: x64
cmake_arch: x64
rid: win-x64
suffix: x64
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -69,39 +95,75 @@ jobs:
choco install opencv -y
echo "OpenCV_DIR=C:\tools\opencv\build" >> $env:GITHUB_ENV

- name: Build C++/CLI .NET Library (x64)
- name: Build C++/CLI .NET Library (${{ matrix.arch }})
run: |
mkdir build-dotnet-x64
cd build-dotnet-x64
cmake -G "Visual Studio 17 2022" -A x64 -DBUILD_CLI_WRAPPER=ON ..
if (Test-Path build-dotnet-${{ matrix.suffix }}) { Remove-Item -Recurse -Force build-dotnet-${{ matrix.suffix }} }
New-Item -ItemType Directory -Force -Path build-dotnet-${{ matrix.suffix }}
cd build-dotnet-${{ matrix.suffix }}
cmake -G "Visual Studio 17 2022" -A ${{ matrix.cmake_arch }} -DBUILD_CLI_WRAPPER=ON ..
cmake --build . --config Release

- name: Upload .NET artifacts
- name: Upload .NET artifacts (${{ matrix.arch }})
uses: actions/upload-artifact@v4
with:
name: dotnet-artifacts-x64
name: dotnet-artifacts-${{ matrix.suffix }}
path: |
build-dotnet-x64/bin/**/*.dll
build-dotnet-x64/bin/**/*.pdb
build-dotnet-${{ matrix.suffix }}/bin/**/*.dll
build-dotnet-${{ matrix.suffix }}/bin/**/*.pdb

create-release:
needs: [build-wasm, build-dotnet]
runs-on: ubuntu-latest
package-nuget:
needs: [build-dotnet, get-version]
runs-on: windows-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Get next version
uses: reecetech/version-increment@2023.10.2
id: version
- name: Download x64 artifacts
uses: actions/download-artifact@v4
with:
scheme: calver
increment: patch
name: dotnet-artifacts-x64
path: ./nupkg/runtimes/win-x64/native

- name: Flatten artifact directories
shell: pwsh
run: |
# Flatten nested bin/<arch>/Release/*.dll to runtimes/<rid>/native/
foreach ($rid in @("win-x64")) {
$nativeDir = "./nupkg/runtimes/$rid/native"
Get-ChildItem -Path $nativeDir -Recurse -Filter "*.dll" | ForEach-Object {
if ($_.DirectoryName -ne (Resolve-Path $nativeDir).Path) {
Move-Item $_.FullName -Destination $nativeDir -Force
}
}
# Clean up empty subdirectories
Get-ChildItem -Path $nativeDir -Directory -Recurse | Sort-Object FullName -Descending | Remove-Item -Force -ErrorAction SilentlyContinue
}

- name: Build NuGet package
shell: pwsh
run: |
Copy-Item Subvision.targets ./nupkg/
nuget pack Subvision.nuspec -OutputDirectory ./nupkg -Version ${{ needs.get-version.outputs.version }} -BasePath ./nupkg

- name: Upload NuGet package
uses: actions/upload-artifact@v4
with:
name: nuget-package
path: ./nupkg/*.nupkg

create-release:
needs: [ build-wasm, build-dotnet, package-nuget, get-version ]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Print version
run: echo "Version is ${{ steps.version.outputs.version }}"
run: echo "Version is ${{ needs.get-version.outputs.version }}"

- name: Download WASM artifacts
uses: actions/download-artifact@v4
Expand All @@ -113,7 +175,13 @@ jobs:
uses: actions/download-artifact@v4
with:
name: dotnet-artifacts-x64
path: ./dotnet-artifacts
path: ./dotnet-artifacts-x64

- name: Download NuGet package
uses: actions/download-artifact@v4
with:
name: nuget-package
path: ./nuget-package

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
Expand All @@ -125,14 +193,68 @@ jobs:
startsWith(github.ref, 'refs/heads/develop')
)
with:
tag_name: ${{ steps.version.outputs.version }}
name: ${{ steps.version.outputs.version }}
tag_name: ${{ needs.get-version.outputs.version }}
name: ${{ needs.get-version.outputs.version }}
body: ${{ inputs.release_notes }}
prerelease : ${{ steps.version.outputs.pre-release-label != '' }}
make_latest: ${{ steps.version.outputs.pre-release-label == '' }}
prerelease: ${{ needs.get-version.outputs.pre-release-label != '' }}
make_latest: ${{ needs.get-version.outputs.pre-release-label == '' }}
files: |
wasm-artifacts/subvision.js
wasm-artifacts/subvision.mjs
dotnet-artifacts/**/*.dll
dotnet-artifacts-x64/**/*.dll
nuget-package/*.nupkg
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build-docs:
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install Doxygen
run: |
sudo apt-get update
sudo apt-get install -y doxygen

- name: Create output directories
run: mkdir -p docs/cpp/html

- name: Generate C++ API docs (Doxygen)
run: |
cd docs
doxygen Doxyfile

- name: Install DocFX
run: |
dotnet tool install -g docfx || true
echo "$HOME/.dotnet/tools" >> $GITHUB_PATH

- name: Build documentation site (DocFX)
run: |
cd docs
docfx build docfx.json || echo "DocFX build completed (metadata step skipped — no .NET project present)"

- name: Upload docs artifact
uses: actions/upload-artifact@v4
with:
name: documentation
path: docs/_site

- name: Setup GitHub Pages
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
uses: actions/configure-pages@v4

- name: Upload to GitHub Pages
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
uses: actions/upload-pages-artifact@v3
with:
path: docs/_site

- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
uses: actions/deploy-pages@v4
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,11 @@
/build_wasm/
/build/
.vscode/
.idea
.idea
/build-dotnet-x64
/build-dotnet-arm64

# Generated documentation output
docs/cpp/html/
docs/_site/
docs/api/
3 changes: 2 additions & 1 deletion .idea/editor.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/subvision-cv.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

76 changes: 66 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.30.5)
cmake_minimum_required(VERSION 3.27.7)

project(subvision_core)

Expand Down Expand Up @@ -60,6 +60,24 @@ endif ()
if (BUILD_CLI_WRAPPER AND NOT EMSCRIPTEN)
# C++/CLI requires MSVC
if (MSVC)
# --- Architecture detection (x64, ARM64, x86) ---
if (CMAKE_GENERATOR_PLATFORM)
string(TOUPPER "${CMAKE_GENERATOR_PLATFORM}" _PLAT)
elseif (CMAKE_VS_PLATFORM_NAME)
string(TOUPPER "${CMAKE_VS_PLATFORM_NAME}" _PLAT)
else ()
string(TOUPPER "${CMAKE_SYSTEM_PROCESSOR}" _PLAT)
endif ()

if (_PLAT MATCHES "ARM64")
set(ARCH_SUFFIX "arm64")
elseif (_PLAT MATCHES "X64" OR _PLAT MATCHES "AMD64" OR CMAKE_SIZEOF_VOID_P EQUAL 8)
set(ARCH_SUFFIX "x64")
else ()
set(ARCH_SUFFIX "x86")
Comment on lines +72 to +77

Copilot AI Apr 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The BUILD_TESTS conditional is duplicated (if (...) repeated twice). This is a syntax/logic error in CMake and should be reduced to a single if/endif pair.

Copilot uses AI. Check for mistakes.
endif ()
message(STATUS "Building C++/CLI wrapper for architecture: ${ARCH_SUFFIX}")

# Create the C++/CLI wrapper library (only compile the wrapper with /clr)
add_library(Subvision SHARED cli_wrapper.cpp)
Comment on lines +79 to 82

Copilot AI Apr 5, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The if (BUILD_CLI_WRAPPER AND NOT EMSCRIPTEN) line is duplicated, which will break the control structure (nested identical if without corresponding separate endif). Remove the duplicate if and keep a single wrapper configuration block.

Copilot uses AI. Check for mistakes.
target_include_directories(Subvision PUBLIC ${CMAKE_SOURCE_DIR}/include)
Expand All @@ -77,22 +95,60 @@ if (BUILD_CLI_WRAPPER AND NOT EMSCRIPTEN)

# Enable C++/CLI only for the wrapper file
target_compile_options(Subvision PRIVATE
/clr
/EHa # Exception handling for C++/CLI
/std:c++17 # C++/CLI works best with C++17
/EHa # Exception handling for C++/CLI (clr added via COMMON_LANGUAGE_RUNTIME)
)

# Set output name with architecture suffix
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(ARCH_SUFFIX "x64")
else ()
set(ARCH_SUFFIX "x86")
endif ()
# NOTE: C++/CLI (/clr) requires dynamic CRT (/MD). Static CRT (/MT) is NOT
# compatible. The VC++ Redistributable is required on target machines, but it
# is already installed on the vast majority of Windows machines.

# Set output name with architecture suffix
set_target_properties(Subvision PROPERTIES
OUTPUT_NAME "subvision-${ARCH_SUFFIX}"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/${ARCH_SUFFIX}"
)

# --- Post-build: copy OpenCV DLLs next to the wrapper for distribution ---
# OpenCV_DIR is set by find_package(OpenCV).
set(_OPENCV_BIN_DIR "")

# 1. Try OpenCV_DIR / ARCH / RUNTIME / bin (typical for OpenCV root)
if (DEFINED OpenCV_ARCH AND DEFINED OpenCV_RUNTIME)
set(_TEST_DIR "${OpenCV_DIR}/${OpenCV_ARCH}/${OpenCV_RUNTIME}/bin")
if (EXISTS "${_TEST_DIR}")
set(_OPENCV_BIN_DIR "${_TEST_DIR}")
endif ()
endif ()

# 2. Try OpenCV_DIR / ../bin (typical if OpenCV_DIR is in the lib folder)
if (NOT _OPENCV_BIN_DIR OR NOT EXISTS "${_OPENCV_BIN_DIR}")
get_filename_component(_TEST_DIR "${OpenCV_DIR}/../bin" ABSOLUTE)
if (EXISTS "${_TEST_DIR}")
set(_OPENCV_BIN_DIR "${_TEST_DIR}")
endif ()
endif ()

# 3. Fallback to standard choco path if everything else fails
if (NOT _OPENCV_BIN_DIR OR NOT EXISTS "${_OPENCV_BIN_DIR}")
set(_OPENCV_BIN_DIR "C:/tools/opencv/build/x64/vc16/bin")
endif ()

file(GLOB OPENCV_DLLS "${_OPENCV_BIN_DIR}/opencv_*.dll")
if (OPENCV_DLLS)
message(STATUS "Found OpenCV DLLs in: ${_OPENCV_BIN_DIR}")
add_custom_command(TARGET Subvision POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo "Copying OpenCV DLLs to output directory..."
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${OPENCV_DLLS}
"$<TARGET_FILE_DIR:Subvision>/"
COMMAND ${CMAKE_COMMAND} -E echo "OpenCV DLLs copied successfully."
COMMENT "Bundling OpenCV DLLs with Subvision wrapper"
VERBATIM
)
else ()
message(WARNING "Could not find OpenCV DLLs (opencv_*.dll) in ${_OPENCV_BIN_DIR}. "
"You will need to manually place the OpenCV binaries next to subvision-${ARCH_SUFFIX}.dll")
endif ()
else ()
message(WARNING "C++/CLI wrapper requires MSVC compiler")
endif ()
Expand Down
Loading
Loading