-
Notifications
You must be signed in to change notification settings - Fork 0
Features/Manual Crop & Docs & x64 build improvements #8
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
Changes from all commits
ac17f8c
586b5a5
f0cac3c
f11c123
5eaba94
8d61d64
35cc5c9
39170c2
3fb4bea
37521f9
7edba30
b2a3204
a6bfa0f
fc080be
b4cb834
eeba424
3d54f38
8d704c8
4301774
fb93715
3e35413
b4aaab4
e810235
1748ec8
fe16e03
b317cd7
02625f6
6f2f8b9
92dd6e7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -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: | ||||||
|
|
@@ -33,7 +50,7 @@ jobs: | |||||
| ./subvision_tests | ||||||
|
|
||||||
| build-wasm: | ||||||
| needs: test | ||||||
| # needs: test | ||||||
| runs-on: ubuntu-latest | ||||||
| permissions: | ||||||
| contents: write | ||||||
|
|
@@ -53,10 +70,19 @@ jobs: | |||||
| build_wasm/subvision.mjs | ||||||
|
|
||||||
| build-dotnet: | ||||||
| needs: test | ||||||
| # needs: test | ||||||
|
||||||
| # needs: test | |
| needs: test |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| 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) | ||
|
|
||
|
|
@@ -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
|
||
| 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
|
||
| target_include_directories(Subvision PUBLIC ${CMAKE_SOURCE_DIR}/include) | ||
|
|
@@ -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 () | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
needs: testdependency is commented out for thebuild-wasmjob, 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.