From 5b11a777f59f6b08a2e1f568289016c527caa1c5 Mon Sep 17 00:00:00 2001 From: SWS-Chipkin Date: Thu, 3 Dec 2026 13:11:59 -0700 Subject: [PATCH 1/2] Update CAS BACnet Stack submodule to 6.x 83e04a2d (6.1.2) --- CHANGELOG.md | 4 ++++ submodules/cas-bacnet-stack | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cff75b7..51619c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ and this project adheres to ## [Unreleased] +### Changed + +- Updated to CAS BACnet Stack 6.x `83e04a2d` (6.1.2, 2026-12-02). + ## [1.2.1] - 2026-11-02 Built on CAS BACnet Stack 6.x (`1e7dffe2b`). diff --git a/submodules/cas-bacnet-stack b/submodules/cas-bacnet-stack index 1e7dffe..83e04a2 160000 --- a/submodules/cas-bacnet-stack +++ b/submodules/cas-bacnet-stack @@ -1 +1 @@ -Subproject commit 1e7dffe2b8f4c2e74463e78749653abe2d4c85da +Subproject commit 83e04a2d9bbc8ec944c2474eac906f65e8a08a66 From dec4e5dc76d56a619cb0bbb509174406f77778a1 Mon Sep 17 00:00:00 2001 From: SWS-Chipkin Date: Thu, 3 Dec 2026 19:52:48 -0700 Subject: [PATCH 2/2] Find the stack library in the submodule's dist/ (stack 6.1.2 moved it from bin/) Stack 6.1.2 (#5077) installs the library into dist/ instead of bin/, so the CI workflow failed after the stack build and the example could not find the library at run time. The workflow, the run-time search and the docs now use dist/. CHANGELOG updated. --- .github/workflows/release.yml | 10 +++++----- .gitignore | 2 +- AGENTS.md | 8 ++++---- CHANGELOG.md | 1 + README.md | 18 +++++++++--------- TUTORIAL.md | 2 +- common/README.md | 2 +- main.py | 6 +++--- 8 files changed, 25 insertions(+), 24 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8c167d3..e21d30d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,8 +7,8 @@ # interpreted, so `main.py` runs directly - `pip install` of anything beyond the standard # library is NOT required (see README.md "Prerequisites"). The only compiled artifact is the # CAS BACnet Stack shared library, built from the stack submodule's C++ source into the -# submodule's own bin/ folder with the stack's CMake, its only build (the windows-x64-dll -# preset on Windows, linux-x64-release-shared on Linux, then `cmake --install` into bin/ - see +# submodule's own dist/ folder with the stack's CMake, its only build (the windows-x64-dll +# preset on Windows, linux-x64-release-shared on Linux, then `cmake --install` into dist/ - see # README.md "Build the CAS BACnet Stack library"), where main.py loads it with ctypes. main.py uses the stack's generated Python adapter in place from # submodules/cas-bacnet-stack/adapters/python/. # @@ -86,7 +86,7 @@ jobs: if ($LASTEXITCODE -ne 0) { throw "windows-x64-dll build failed" } cmake --install build-windows-x64-dll --config Release if ($LASTEXITCODE -ne 0) { throw "windows-x64-dll install failed" } - Get-ChildItem bin\CASBACnetStack_x64_Release.dll + Get-ChildItem dist\CASBACnetStack_x64_Release.dll - name: Build the CAS BACnet Stack library (Linux - CMake preset linux-x64-release-shared) if: runner.os == 'Linux' @@ -98,7 +98,7 @@ jobs: cmake --preset linux-x64-release-shared cmake --build --preset linux-x64-release-shared cmake --install build-linux-x64-release-shared - ls -la bin/libCASBACnetStack_x64_Release.so + ls -la dist/libCASBACnetStack_x64_Release.so - name: Smoke test + metrics (starts, binds, stays up; measures time to 'ready') shell: bash @@ -115,7 +115,7 @@ jobs: if kill -0 "$PID" 2>/dev/null; then kill "$PID" 2>/dev/null || true; else echo "FAIL: device exited early"; cat smoke.log; exit 1; fi [ -n "$ready_ms" ] || { echo "FAIL: no 'ready' line"; cat smoke.log; exit 1; } cat smoke.log - lib="submodules/cas-bacnet-stack/bin/${{ matrix.nativelib }}" + lib="submodules/cas-bacnet-stack/dist/${{ matrix.nativelib }}" bytes=$(stat -c %s "$lib" 2>/dev/null || wc -c < "$lib") sha=$(sha256sum "$lib" | cut -c1-16) stackver=$(grep -oE 'CAS BACnet Stack version: [0-9.]+' smoke.log | head -1 | grep -oE '[0-9.]+$' || true) diff --git a/.gitignore b/.gitignore index 44aa11f..9636eca 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,7 @@ venv/ *.log # The CAS BACnet Stack library is a BUILD ARTIFACT of the separately licensed stack, built -# from the submodule into submodules/cas-bacnet-stack/bin/ (README.md "Build the CAS BACnet +# from the submodule into submodules/cas-bacnet-stack/dist/ (README.md "Build the CAS BACnet # Stack library"), and is never committed or released from this repository - whatever its # name or platform. *.dll diff --git a/AGENTS.md b/AGENTS.md index aa82a08..c7a8280 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -52,7 +52,7 @@ can learn from and copy-paste. Favour clarity over cleverness. part of the licensed stack. If it is missing something, put the smallest marked workaround in this repository's own code and report it as an adapter defect. - - `bin/` - where the stack library is built (`CASBACnetStack_x64_Release.dll` + - `dist/` - where the stack library is installed (`CASBACnetStack_x64_Release.dll` / `libCASBACnetStack_x64_Release.so`) and where `main.py` loads it from. The `PROFILE-TABLE` block in README.md is generated from the example-series @@ -61,7 +61,7 @@ repository's `docs/profile-table.md`. Edit it there, not here. ## Build No build step for Python. The stack library is built once from the submodule -into its `bin/` (README.md "Build the CAS BACnet Stack library"): +into its `dist/` (README.md "Build the CAS BACnet Stack library"): ```bash git submodule update --init --recursive @@ -74,7 +74,7 @@ python -m py_compile main.py common/*.py tests/*.py CMake is the stack's only build: it no longer has `projects/msvs/` or `projects/linux/` (removed before `6.x` @ `29b83de6`). `cmake --install` puts -the library in the submodule's `bin/`, where `main.py` loads it from. Always a +the library in the submodule's `dist/`, where `main.py` loads it from. Always a customer-interface build, never the test-tool library. **The stack binary is never committed and never released.** `.gitignore` @@ -112,7 +112,7 @@ it). `BACnetStack_RegisterCallbackSetProperty*` call. - **Explicit library load**, like the C++ `LoadBACnetFunctions()`: `main()`'s `load_cas_bacnet_stack()` looks in the run directory (the folder of - `main.py`), then `submodules/cas-bacnet-stack/bin/`, does `ctypes.CDLL` + + `main.py`), then `submodules/cas-bacnet-stack/dist/`, does `ctypes.CDLL` + `bind()` before any `BACnetStack_*` call. Nothing imports or loads the stack at module import time. Without it (or if `ctypes` cannot load it) the example prints the series' missing-library message diff --git a/CHANGELOG.md b/CHANGELOG.md index 51619c4..a4bf217 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to ### Changed - Updated to CAS BACnet Stack 6.x `83e04a2d` (6.1.2, 2026-12-02). +- The stack library is now found in the submodule's `dist/` folder, where 6.1.2's `cmake --install` puts it (it was `bin/`). The CI workflow, the run-time search and the build instructions all use `dist/`. ## [1.2.1] - 2026-11-02 diff --git a/README.md b/README.md index e1bf3c6..006a50e 100644 --- a/README.md +++ b/README.md @@ -184,7 +184,7 @@ This is a **self-contained** project. It ships: call, generated by the stack's `_ci_scripts/generate-python-adapter.js`). `main.py` puts that folder on `sys.path`; nothing of it is copied into this repository. - - the **stack library** you build into its `bin/` folder (below). + - the **stack library** you build into its `dist/` folder (below). ## Prerequisites @@ -217,15 +217,15 @@ What you do have to build, once, is the **CAS BACnet Stack library** that `libCASBACnetStack_x64_Release.so` on Linux - in two places, in this order: 1. the **run directory**, the folder that holds `main.py`; -2. a development checkout's `submodules/cas-bacnet-stack/bin/`, where building +2. a development checkout's `submodules/cas-bacnet-stack/dist/`, where building the stack puts it. -In a checkout, build it into the submodule's `bin/`. The stack has **one +In a checkout, build it into the submodule's `dist/`. The stack has **one build, CMake** (`CMakeLists.txt` and `CMakePresets.json` in the submodule; its README's "Building and testing" and AGENTS.md "Building" list the presets). Each preset builds into `submodules/cas-bacnet-stack/build-/`, and `cmake --install build-` copies the library into the submodule's -`bin/`, under exactly the name `main.py` loads. It is a customer-interface +`dist/`, under exactly the name `main.py` loads. It is a customer-interface build (no test-tool exports). Run the commands from the submodule's folder, because `cmake --preset` reads `CMakePresets.json` from the current directory. @@ -237,7 +237,7 @@ Visual Studio 2022). PowerShell or a Developer Prompt: cd submodules\cas-bacnet-stack cmake --preset windows-x64-dll cmake --build --preset windows-x64-dll-release -cmake --install build-windows-x64-dll --config Release # -> bin\CASBACnetStack_x64_Release.dll +cmake --install build-windows-x64-dll --config Release # -> dist\CASBACnetStack_x64_Release.dll cd ..\.. ``` @@ -250,11 +250,11 @@ static-library name and stays in the build tree; `main.py` does not need it. cd submodules/cas-bacnet-stack cmake --preset linux-x64-release-shared cmake --build --preset linux-x64-release-shared -cmake --install build-linux-x64-release-shared # -> bin/libCASBACnetStack_x64_Release.so +cmake --install build-linux-x64-release-shared # -> dist/libCASBACnetStack_x64_Release.so cd ../.. ``` -The stack's own `.gitignore` already ignores `build-*/` and `bin/`, so the +The stack's own `.gitignore` already ignores `build-*/` and `dist/`, so the submodule stays clean. (Before stack `6.x` @ `29b83de6` this README built the DLL with MSBuild from @@ -278,7 +278,7 @@ ERROR: This example cannot run without the CAS BACnet Stack library. Missing file: CASBACnetStack_x64_Release.dll Looked in: C:\...\BACnetProfileExample-B-SS-Python - C:\...\BACnetProfileExample-B-SS-Python\submodules\cas-bacnet-stack\bin + C:\...\BACnetProfileExample-B-SS-Python\submodules\cas-bacnet-stack\dist The CAS BACnet Stack is a commercially licensed (paid) library from Chipkin. It is not included in this release, so the example cannot start without it. @@ -417,7 +417,7 @@ Python talks to the stack through `ctypes`: stack's own adapter from there. It is generated from the stack's C headers; a fix to it belongs in the stack, never in a copy here. - **An explicit load step, like C++.** `main.py` calls - `ctypes.CDLL(/)` then `bind()` + `ctypes.CDLL(/)` then `bind()` itself, before any `BACnetStack_*` call - the C++ edition's `LoadBACnetFunctions()`. A missing or unloadable library stops it there with the missing-library message above, never a traceback. diff --git a/TUTORIAL.md b/TUTORIAL.md index 08639f5..3e32ae6 100644 --- a/TUTORIAL.md +++ b/TUTORIAL.md @@ -316,7 +316,7 @@ defect, not a feature. | Symptom | Cause / fix | |---------|-------------| -| `ERROR: This example cannot run without the CAS BACnet Stack library.` and exit code 1, with `Missing file: CASBACnetStack_x64_Release.dll` (or `libCASBACnetStack_x64_Release.so`) | The stack library is in neither folder listed under `Looked in:` - the folder that holds `main.py`, then the checkout's `submodules/cas-bacnet-stack/bin/`. Build it (README.md [Build the CAS BACnet Stack library](README.md#build-the-cas-bacnet-stack-library)); a release never includes it. The same message appears if the file is there but cannot be loaded (wrong architecture, built for another OS, or from another stack commit than the adapter): rebuild it from the submodule as it is checked out now. | +| `ERROR: This example cannot run without the CAS BACnet Stack library.` and exit code 1, with `Missing file: CASBACnetStack_x64_Release.dll` (or `libCASBACnetStack_x64_Release.so`) | The stack library is in neither folder listed under `Looked in:` - the folder that holds `main.py`, then the checkout's `submodules/cas-bacnet-stack/dist/`. Build it (README.md [Build the CAS BACnet Stack library](README.md#build-the-cas-bacnet-stack-library)); a release never includes it. The same message appears if the file is there but cannot be loaded (wrong architecture, built for another OS, or from another stack commit than the adapter): rebuild it from the submodule as it is checked out now. | | The same message with `Missing file: CASBACnetStackAdapterBindings.py` | The library was found but the stack's Python adapter was not: check out the submodule (`git submodule update --init --recursive`), or, running a release, put `CASBACnetStackAdapter.py` and `CASBACnetStackAdapterBindings.py` from the submodule's `adapters/python/` next to `main.py`. | | `OSError` mentioning a mismatched architecture (`%1 is not a valid Win32 application`, or similar on Linux) | The native library's architecture does not match this Python interpreter's. This example expects an x64 build - make sure both your Python interpreter and the DLL/.so you built are x64. | | App prints *"Failed to bind UDP port 47808"* | Another BACnet program is already using 47808. Stop it, or run with `--port `. | diff --git a/common/README.md b/common/README.md index 69b3663..2ffe655 100644 --- a/common/README.md +++ b/common/README.md @@ -40,7 +40,7 @@ import CASBACnetStackAdapterBindings as bacnet from common.simple_udp import SimpleUDP from common import cas_example_helper as helper -bacnet.bind(ctypes.CDLL(library_path)) # main.py: the run directory, then /bin +bacnet.bind(ctypes.CDLL(library_path)) # main.py: the run directory, then /dist # (not found: helper.print_missing_stack_library(libname, folders); exit 1) if helper.handle_help_and_version_args(sys.argv, APP_NAME, APP_VERSION): sys.exit(0) diff --git a/main.py b/main.py index a257dd5..d11479b 100644 --- a/main.py +++ b/main.py @@ -43,7 +43,7 @@ # (nothing of it is copied into this repository), which means: # # - an EXPLICIT load step, like the C++ edition's LoadBACnetFunctions(): -# `ctypes.CDLL(/)` then +# `ctypes.CDLL(/)` then # `bind(library)`, both before any BACnetStack_* call (see "Load the CAS # BACnet Stack" below). Without the library the example prints why and # exits 1. @@ -99,7 +99,7 @@ REPOSITORY = os.path.dirname(os.path.abspath(__file__)) CAS_BACNET_STACK = os.path.join(REPOSITORY, "submodules", "cas-bacnet-stack") ADAPTER_DIRECTORIES = [REPOSITORY, os.path.join(CAS_BACNET_STACK, "adapters", "python")] -LIBRARY_DIRECTORIES = [REPOSITORY, os.path.join(CAS_BACNET_STACK, "bin")] +LIBRARY_DIRECTORIES = [REPOSITORY, os.path.join(CAS_BACNET_STACK, "dist")] sys.path[:0] = [d for d in ADAPTER_DIRECTORIES if d not in sys.path] # Show print() output immediately, even when stdout is redirected to a file or @@ -629,7 +629,7 @@ def main(argv): # Required before any other BACnetStack_* call, like the C++ edition's # LoadBACnetFunctions(). The library is looked for in the run directory # (the folder that holds main.py), then in a development checkout's - # submodules/cas-bacnet-stack/bin/, where building the stack puts it + # submodules/cas-bacnet-stack/dist/, where building the stack puts it # (README.md "Build the CAS BACnet Stack library"). A release of this # example does not include it: it is a separately licensed product. missing = load_cas_bacnet_stack()