From 88a3921c5b0a322245e5037b248ae83d05553717 Mon Sep 17 00:00:00 2001 From: Steve Karg Date: Wed, 13 Oct 2021 10:37:01 -0500 Subject: [PATCH] Issue 188 compile failed when bbmd enabled 0 (#200) * Fix compile for BBMD=none * Add compile for BBMD=none to pipeline * remove appveyor. add codeql badge Co-authored-by: Steve Karg --- .appveyor.yml | 8 ----- .github/workflows/gcc.yml | 61 ++++++++++++++++++++++++++++++++----- README.md | 8 ++--- apps/Makefile | 11 +++++-- src/bacnet/datalink/dlenv.c | 4 ++- 5 files changed, 69 insertions(+), 23 deletions(-) delete mode 100644 .appveyor.yml diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index aa847b77..00000000 --- a/.appveyor.yml +++ /dev/null @@ -1,8 +0,0 @@ -image: - - Visual Studio 2019 - - Ubuntu - - macOS - -build_script: - - cmake . -DBUILD_SHARED_LIBS=ON - - cmake --build . --config Release diff --git a/.github/workflows/gcc.yml b/.github/workflows/gcc.yml index 1805f69c..c56e2276 100644 --- a/.github/workflows/gcc.yml +++ b/.github/workflows/gcc.yml @@ -5,10 +5,38 @@ on: branches: - master pull_request: - branches: + branches: - '*' jobs: + bip-apps: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Create Build Environment + run: | + sudo apt-get update -qq + sudo apt-get install -qq libconfig-dev + - name: Build Demo Apps + run: | + gcc --version + make clean + make all + + bip-no-bbmd-apps: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Create Build Environment + run: | + sudo apt-get update -qq + sudo apt-get install -qq libconfig-dev + - name: Build Demo Apps BBMD=none + run: | + gcc --version + make clean + make BBMD=none all + gateway: runs-on: ubuntu-latest steps: @@ -18,7 +46,10 @@ jobs: sudo apt-get update -qq sudo apt-get install -qq libconfig-dev - name: Build Gateway Demo - run: make clean gateway + run: | + gcc --version + make clean + make gateway router: runs-on: ubuntu-latest @@ -29,7 +60,10 @@ jobs: sudo apt-get update -qq sudo apt-get install -qq libconfig-dev - name: Build Router Demo - run: make clean router + run: | + gcc --version + make clean + make router router-ipv6: runs-on: ubuntu-latest @@ -40,7 +74,10 @@ jobs: sudo apt-get update -qq sudo apt-get install -qq libconfig-dev - name: Build Router IPv6 Demo - run: make clean router-ipv6 + run: | + gcc --version + make clean + make router-ipv6 router-mstp: runs-on: ubuntu-latest @@ -51,7 +88,10 @@ jobs: sudo apt-get update -qq sudo apt-get install -qq libconfig-dev - name: Build Router MSTP Demo - run: make clean router-mstp + run: | + gcc --version + make clean + make router-mstp mstp: runs-on: ubuntu-latest @@ -62,7 +102,10 @@ jobs: sudo apt-get update -qq sudo apt-get install -qq libconfig-dev - name: Build MSTP Demos - run: make clean mstp + run: | + gcc --version + make clean + make mstp ethernet: runs-on: ubuntu-latest @@ -73,7 +116,10 @@ jobs: sudo apt-get update -qq sudo apt-get install -qq libconfig-dev - name: Build Ethernet Demos - run: make clean ethernet + run: | + gcc --version + make clean + make ethernet ports-arm: runs-on: ubuntu-latest @@ -123,4 +169,3 @@ jobs: export LD=i686-w64-mingw32-ld i686-w64-mingw32-gcc --version make win32 - diff --git a/README.md b/README.md index 1ef59d80..c58caa6f 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,9 @@ Welcome to the wonderful world of BACnet and true device interoperability! Continuous Integration ---------------------- -This library uses various automated continuous integration services -to assist in automated compilation, validation, linting, and unit testing -of robust C code and BACnet functionality. +This library uses automated continuous integration services +to assist in automated compilation, validation, linting, security scanning, +and unit testing to produce robust C code and BACnet functionality. [![Actions Status](https://github.com/bacnet-stack/bacnet-stack/workflows/CMake/badge.svg)](https://github.com/bacnet-stack/bacnet-stack/actions) GitHub Workflow @@ -18,7 +18,7 @@ of robust C code and BACnet functionality. [![Actions Status](https://github.com/bacnet-stack/bacnet-stack/workflows/Lint/badge.svg)](https://github.com/bacnet-stack/bacnet-stack/actions) GitHub Workflow -[![Build status](https://ci.appveyor.com/api/projects/status/5lq0d9a69g7ixskm/branch/master?svg=true)](https://ci.appveyor.com/project/skarg/bacnet-stack/branch/master) AppVeyor CI +[![Actions Status](https://github.com/bacnet-stack/bacnet-stack/workflows/CodeQL/badge.svg)](https://github.com/bacnet-stack/bacnet-stack/actions) GitHub Workflow About this Project ------------------ diff --git a/apps/Makefile b/apps/Makefile index 8b94cb93..c6849764 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -35,12 +35,16 @@ BACDL_DEFINE ?= -DBACDL_BIP=1 BBMD_DEFINE ?= -DBBMD_ENABLED=1 -DBBMD_CLIENT_ENABLED endif +ifeq (${BBMD},none) +BBMD_DEFINE = -DBBMD_ENABLED=0 +endif ifeq (${BBMD},server) -BBMD_DEFINE=-DBBMD_ENABLED=1 +BBMD_DEFINE = -DBBMD_ENABLED=1 endif ifeq (${BBMD},client) BBMD_DEFINE = -DBBMD_ENABLED=1 -DBBMD_CLIENT_ENABLED endif + endif # Define WEAK_FUNC for unsupported or specific compilers @@ -188,7 +192,10 @@ SUBDIRS = readprop writeprop readfile writefile reinit server dcc \ writepropm uptransfer getevent uevent abort error event ack-alarm ifeq (${BACDL_DEFINE},-DBACDL_BIP=1) - SUBDIRS += whoisrouter iamrouter initrouter readbdt readfdt writebdt + SUBDIRS += whoisrouter iamrouter initrouter + ifneq (${BBMD},none) + SUBDIRS += readbdt readfdt writebdt + endif endif ifeq (${BACNET_PORT},linux) diff --git a/src/bacnet/datalink/dlenv.c b/src/bacnet/datalink/dlenv.c index 5a4e0a36..3f17edb3 100644 --- a/src/bacnet/datalink/dlenv.c +++ b/src/bacnet/datalink/dlenv.c @@ -51,7 +51,9 @@ static uint16_t BBMD_TTL_Seconds = 60000; static BACNET_IP_ADDRESS BBMD_Address; static bool BBMD_Address_Valid; static uint16_t BBMD_Result = 0; +#if BBMD_ENABLED static BACNET_IP_BROADCAST_DISTRIBUTION_TABLE_ENTRY BBMD_Table_Entry; +#endif /* enable debugging */ static bool BIP_DL_Debug = false; @@ -117,7 +119,7 @@ int dlenv_bbmd_result(void) int dlenv_register_as_foreign_device(void) { int retval = 0; -#if defined(BACDL_BIP) +#if defined(BACDL_BIP) && BBMD_ENABLED bool bdt_entry_valid = false; uint16_t bdt_entry_port = 0; char *pEnv = NULL;