Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 8 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
# without publishing.
#
# Two stages: (1) build the CAS BACnet Stack shared library from the stack submodule into
# submodules/cas-bacnet-stack/bin/ 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/ -
# submodules/cas-bacnet-stack/dist/ 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/ -
# README "Build"), then (2) `cargo build --release` this project. The stack's Rust adapter is
# compiled in place from submodules/cas-bacnet-stack/adapters/rust/ and opens the library from
# that bin/ folder at run time (libloading).
# that dist/ folder at run time (libloading).
#
# A RELEASE SHIPS THE APP, NEVER THE STACK LIBRARY. The stack is built here only to compile and
# test the example: no CASBACnetStack* library (and no .node addon) goes into any uploaded
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable

- name: Build the CAS BACnet Stack library (Windows - CMake preset windows-x64-dll, into the submodule's bin/)
- name: Build the CAS BACnet Stack library (Windows - CMake preset windows-x64-dll, into the submodule's dist/)
if: runner.os == 'Windows'
shell: pwsh
working-directory: submodules/cas-bacnet-stack
Expand All @@ -78,9 +78,9 @@ 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, into the submodule's bin/)
- name: Build the CAS BACnet Stack library (Linux - CMake preset linux-x64-release-shared, into the submodule's dist/)
if: runner.os == 'Linux'
shell: bash
working-directory: submodules/cas-bacnet-stack
Expand All @@ -90,7 +90,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

# Also the only compile gate the stack's Rust adapter has: it is compiled in place here.
- name: cargo build --release
Expand Down Expand Up @@ -163,7 +163,7 @@ jobs:

# The packaged executable, run the way a user runs a release - without the stack library -
# must stop with the missing-library message and exit 1, never panic. It runs from a folder
# outside the checkout, so the development fallback (submodules/cas-bacnet-stack/bin/, where
# outside the checkout, so the development fallback (submodules/cas-bacnet-stack/dist/, where
# this job built the library) cannot find it.
- name: Packaged app without the stack library -> clear message, exit 1
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Cargo.lock.bak

# The CAS BACnet Stack library is never committed (and never released): build it
# from the submodule into submodules/cas-bacnet-stack/bin/ (README "Build").
# from the submodule into submodules/cas-bacnet-stack/dist/ (README "Build").
*.dll
*.so
*.so.*
Expand Down
6 changes: 3 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ cargo build --release # -> target/release/BACnetExampleBSS[.exe], 0 war
`cargo build` does not build the stack's shared library - that is the
separate CMake step in README "Build". 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/`,
`29b83de6`). `cmake --install` puts the library in the submodule's `dist/`,
where the example loads it from. Always a customer-interface build, never the
test-tool library. **Never commit or release the
stack's DLL / `.so`** - it lives in the submodule's `bin/` (gitignored there),
stack's DLL / `.so`** - it lives in the submodule's `dist/` (gitignored there),
the example loads it from there, and
`git ls-files | grep -iE '\.(dll|so|node|lib|a)$'` must print nothing.

Expand All @@ -83,7 +83,7 @@ comment beside it saying why.
```

The library is looked for in `CAS_BACNET_STACK_LIBRARY_PATH` (if set), then the
executable's folder, then (a development checkout) `submodules/cas-bacnet-stack/bin/`
executable's folder, then (a development checkout) `submodules/cas-bacnet-stack/dist/`
found by walking up from the executable. Missing: the series' message on
stderr, exit 1, never a panic - and no binding may be called before
`load_bacnet_functions()` succeeds. `--help` / `--version` work without it. Interactive keys: `h`, `q`,
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ and this project adheres to

## [Unreleased]

### 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

Built on CAS BACnet Stack 6.x (`1e7dffe2b`).
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ This is a **self-contained** project. It ships:
(private; requires a license - see above). Its Rust adapter,
`adapters/rust/cas_bacnet_stack_adapters.rs`, is compiled into this example
in place; its CMake build produces the shared library, which `cmake --install`
puts in its own `bin/` folder.
puts in its own `dist/` folder.

## Prerequisites

Expand All @@ -198,15 +198,15 @@ Already cloned without `--recursive`? Run `git submodule update --init --recursi

### 1. Build the CAS BACnet Stack library from the submodule

The library goes into the submodule's own `bin/` folder, and the example loads
The library goes into the submodule's own `dist/` folder, and the example loads
it from there at run time. Do not copy it into this repository (it is
gitignored, and never part of a release).

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-<preset>/`, and `cmake --install
build-<preset>` copies the library into the submodule's `bin/`, under exactly
build-<preset>` copies the library into the submodule's `dist/`, under exactly
the name the example 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.
Expand All @@ -219,7 +219,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 ..\..
```

Expand All @@ -233,11 +233,11 @@ static-library name and stays in the build tree; the example 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. Only the **Release** library is used.

(Before stack `6.x` @ `29b83de6` this README built the DLL with MSBuild from
Expand Down Expand Up @@ -267,7 +267,7 @@ call. It looks, in this order:
1. `CAS_BACNET_STACK_LIBRARY_PATH`, if it is set (the full path of the library
file - the stack's Rust adapter's own override);
2. the **run directory** - the folder that holds the executable;
3. in a development checkout only, `submodules/cas-bacnet-stack/bin/`, found
3. in a development checkout only, `submodules/cas-bacnet-stack/dist/`, found
by walking up from the executable's folder (so `target/release/` finds the
library the submodule build put there - nothing to copy).

Expand Down Expand Up @@ -402,7 +402,7 @@ python tests/run_wire_tests.py

(`--exe <path>` tests another build, `--port <n>` another UDP port. The
library is found through the development-checkout fallback,
`submodules/cas-bacnet-stack/bin/` - no copy next to the executable.) It ends with `ALL WIRE TESTS PASSED`
`submodules/cas-bacnet-stack/dist/` - no copy next to the executable.) It ends with `ALL WIRE TESTS PASSED`
(exit 0); about 30 seconds. [tests/README.md](tests/README.md) says what each
check proves. **Verified on Windows only** (54/54 checks at 1.2.0,
no `[RETRY]` lines); this port has not been run on Linux. CI
Expand Down
4 changes: 2 additions & 2 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ the bindings this example does not call).

**Workaround (port code, marked):** `load_bacnet_functions()` in
`src/main.rs` finds the library itself (override variable, the executable's
folder, the checkout's `submodules/cas-bacnet-stack/bin/`) and opens it with
folder, the checkout's `submodules/cas-bacnet-stack/dist/`) and opens it with
`libloading::Library::new` before any binding is touched; only then does it
set `CAS_BACNET_STACK_LIBRARY_PATH` to that exact file for the adapter. A
missing library prints the series' missing-library message and exits 1. **When
Expand All @@ -97,7 +97,7 @@ the adapter returns the load error, drop the pre-open and use the binding's
## Smaller notes

- The adapter's default library path is `./bin/` under the **working
directory**, which is neither the run directory nor the checkout's `bin/`.
directory**, which is neither the run directory nor the checkout's `submodules/cas-bacnet-stack/dist/`.
The example therefore always sets the adapter's own override,
`CAS_BACNET_STACK_LIBRARY_PATH`, to the file it found.
- The interactive keys are read from stdin byte by byte; on a terminal they
Expand Down
2 changes: 1 addition & 1 deletion TUTORIAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ a feature.

| Symptom | Cause / fix |
|---------|-------------|
| `ERROR: This example cannot run without the CAS BACnet Stack library.` (exit code 1) | The stack's shared library is in none of the folders listed under `Looked in:`. It is a licensed Chipkin product and is never part of a release. Build it from the submodule (README "Build", a separate step from `cargo build`) and put it next to the executable, or set `CAS_BACNET_STACK_LIBRARY_PATH` to its full path. In a development checkout, building it into `submodules/cas-bacnet-stack/bin/` is enough. |
| `ERROR: This example cannot run without the CAS BACnet Stack library.` (exit code 1) | The stack's shared library is in none of the folders listed under `Looked in:`. It is a licensed Chipkin product and is never part of a release. Build it from the submodule (README "Build", a separate step from `cargo build`) and put it next to the executable, or set `CAS_BACNET_STACK_LIBRARY_PATH` to its full path. In a development checkout, building it into `submodules/cas-bacnet-stack/dist/` is enough. |
| `ERROR: The CAS BACnet Stack library could not be loaded.` | The file is there but the operating system refused it: built for another OS or architecture (the example wants x64), a truncated copy, or a missing dependency (the Visual C++ runtime on Windows). Rebuild it from the submodule for this machine. |
| `CAS BACnet Stack version: not loaded ...` in `--version` | The same missing library; `--help` and `--version` still work without it. |
| `Warning: ignoring invalid --port ...` / `--deviceID ...` | The value is not a whole number in range; the default is used. `--help` lists the options. |
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ fn stack_library_file_name() -> &'static str {
/// 2. The run directory: the folder that holds this executable. A release
/// ships the executable WITHOUT the library (it is a licensed product), so
/// this is where a licensed customer puts it.
/// 3. A development checkout only: submodules/cas-bacnet-stack/bin/, where the
/// 3. A development checkout only: submodules/cas-bacnet-stack/dist/, where the
/// submodule's build puts the library, found by walking up from the
/// executable's folder (target/release/ -> the repository root). Searched
/// only if that folder exists.
Expand All @@ -714,7 +714,7 @@ fn stack_library_candidates() -> Vec<PathBuf> {
candidates.push(run_directory.join(file_name));
let checkout_bin = run_directory
.ancestors()
.map(|folder| folder.join("submodules").join("cas-bacnet-stack").join("bin"))
.map(|folder| folder.join("submodules").join("cas-bacnet-stack").join("dist"))
.find(|folder| folder.is_dir());
if let Some(folder) = checkout_bin {
candidates.push(folder.join(file_name));
Expand Down
2 changes: 1 addition & 1 deletion submodules/cas-bacnet-stack
Loading