diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b7f0a56..5dda252 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,18 +11,21 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-18.04, ubuntu-latest] + os: [ubuntu-20.04, ubuntu-latest] steps: # https://github.com/actions/checkout - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + with: + ref: development + submodules: recursive - name: Checkout vscp repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: grodansparadis/vscp path: vscp - ref: master + ref: development - name: Checkout google test repo run: sudo apt-get install libgtest-dev && cd /usr/src/gtest && sudo mkdir build && cd build && sudo cmake .. && sudo make DESTDIR=/usr/lib @@ -64,7 +67,7 @@ jobs: sudo cpack -G DEB sudo make install DESTDIR=AppDir # Save artifact - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: ${{ matrix.os }}_libvscphelper_15.0.2.deb path: /home/runner/work/vscp-helper-lib/vscp-helper-lib/build/libvscphelper_15.0.2.deb diff --git a/.github/workflows/msbuild.yml b/.github/workflows/msbuild.yml index 46f408c..6aea567 100644 --- a/.github/workflows/msbuild.yml +++ b/.github/workflows/msbuild.yml @@ -5,47 +5,60 @@ on: [push] env: # Path to the solution file relative to the root of the project. SOLUTION_FILE_PATH: . + VSCP_PATH: '${{ github.workspace }}/vscp' + ENVIRONMENT_SCRIPT: "C:/Program Files (x86)/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat" + GENERATORS: "Visual Studio 17 2022" + BUILD_CONFIGURATION: Release # Configuration type to build. # You can convert this to a build matrix if you need coverage of multiple configuration types. # https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix # # https://github.com/marketplace/actions/run-vcpkg - # https://github.com/ilammy/msvc-dev-cmd - - BUILD_CONFIGURATION: Release + # https://github.com/ilammy/msvc-dev-cmd jobs: build: + name: Windows x64 runs-on: windows-latest steps: - - uses: actions/checkout@v2 - - uses: ilammy/msvc-dev-cmd@v1 + + - name: Install ms-dev environment + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: x64 - name: Clone - uses: actions/checkout@v2 + uses: actions/checkout@v3 + with: + ref: development + submodules: recursive - name: Checkout vscp repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: grodansparadis/vscp path: vscp ref: development + submodules: recursive - name: Get latest CMake and ninja # Using 'latest' branch, the most recent CMake and ninja are installed. uses: lukka/get-cmake@latest - - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@v1.0.3 - name: Checkout vcpkg repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: microsoft/vcpkg path: vcpkg + - name: Add MSBuild to PATH + uses: microsoft/setup-msbuild@v1.1 + with: + msbuild-architecture: x64 + - name: Setup vcpkg run: | cd vcpkg @@ -65,9 +78,10 @@ jobs: - name: Build run: | mkdir build - cd build - cmake .. -G "Visual Studio 16 2019" -DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=D:/a/vscp-helper-lib/vscp-helper-lib/vcpkg/scripts/buildsystems/vcpkg.cmake -DVSCP_PATH=vscp - msbuild libvscphelper.sln /p:Configuration=Release + cd build + cmake .. -G "${{ env.GENERATORS }}" -A x64 -DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_BUILD_TYPE=${{ env.BUILD_CONFIGURATION }} -DCMAKE_TOOLCHAIN_FILE=D:/a/vscp-helper-lib/vscp-helper-lib/vcpkg/scripts/buildsystems/vcpkg.cmake -DVSCP_PATH=vscp + cmake --build . --config ${{ env.BUILD_CONFIGURATION }} + #msbuild libvscphelper.sln /p:Configuration=Release cpack . # Save artifacts diff --git a/.gitmodules b/.gitmodules index e69de29..cb79d30 100644 --- a/.gitmodules +++ b/.gitmodules @@ -0,0 +1,12 @@ +[submodule "third_party/mustache"] + path = third_party/mustache + url = https://github.com/kainjow/Mustache.git +[submodule "third_party/spdlog"] + path = third_party/spdlog + url = https://github.com/gabime/spdlog.git +[submodule "third_party/nlohmann"] + path = third_party/nlohmann + url = https://github.com/nlohmann/json.git +[submodule "third_party/mongoose"] + path = third_party/mongoose + url = https://github.com/cesanta/mongoose.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e71b4f..f59600f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ # # Build instructions for VSCP Works. # -# Copyright (c) 2000-2023 Åke Hedman, the VSCP Project +# Copyright (C) 2000-2024 Åke Hedman, the VSCP Project # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -32,15 +32,17 @@ set(PACKAGE_AUTHOR "Ake Hedman, the VSCP Project") # Version settings if(NOT DEFINED MAJOR_VERSION) - SET(MAJOR_VERSION "15") + SET(MAJOR_VERSION "16") endif() if(NOT DEFINED MINOR_VERSION) SET(MINOR_VERSION "0") endif() if(NOT DEFINED PATCH_VERSION) - SET(PATCH_VERSION "2") + SET(PATCH_VERSION "0") endif() +#add_subdirectory(./third_party/spdlog/) + SET(CPACK_PACKAGE_DESCRIPTION "VSCP Helper library") SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Helper functionality for VSCP applications") SET(CPACK_PACKAGE_VENDOR "the VSCP Project") @@ -75,8 +77,8 @@ endif() option(USE_SSL "Use SSL" TRUE) -## --- C++11 build flags --- -set(CMAKE_CXX_STANDARD 11) +## --- C++14 build flags --- +set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS ON) @@ -208,11 +210,34 @@ endif(WIN32) # Set sockettcp build flags add_definitions(-DUSE_IPV6) -string(FIND "${OPENSSL_VERSION}" "1.1." SSL_VER_POS) + +set(OPENSSL_VER "OPENSSL_API_${OPENSSL_VERSION_MAJOR}_${OPENSSL_VERSION_MINOR}") +message(STATUS "OPENSSL Version: ${OPENSSL_VER}") +add_definitions(-D${OPENSSL_VER}) + +# 1.1.0 / 1.1.1 / 3.0.0 / 3.1.0 +string(FIND "${OPENSSL_VERSION}" "1.0" SSL_VER_POS) if(${SSL_VER_POS}) - add_definitions(-DOPENSSL_API_1_0) -else() - add_definitions(-DOPENSSL_API_1_1) + #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DOPENSSL_API_1_0") + #add_definitions(-DOPENSSL_API_1_0) +endif() + +string(FIND "${OPENSSL_VERSION}" "1.1" SSL_VER_POS) +if(${SSL_VER_POS}) + #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DOPENSSL_API_1_1") + #add_definitions(-DOPENSSL_API_1_1) +endif() + +string(FIND "${OPENSSL_VERSION}" "3.0" SSL_VER_POS) +if(NOT SSL_VER_POS EQUAL -1) + #add_definitions(-DOPENSSL_API_3_0) + message(STATUS "openssl test ${SSL_VER_POS}") +endif() + +string(FIND "${OPENSSL_VERSION}" "3.1" SSL_VER_POS) +if(NOT SSL_VER_POS EQUAL -1) + add_definitions(-DOPENSSL_API_3_0) + message(STATUS "Open ssl version is 3.1 but set to 3.0 ${SSL_VER_POS} fir Civetweb. That is OK") endif() set(RESOURCE_FILES @@ -226,34 +251,30 @@ add_library(libvscphelper SHARED ./src/vscphelperlib.cpp ./windows/libvscphelper.h ./windows/libvscphelper.cpp - ${VSCP_PATH}/src/common/third_party/mustache.hpp - ${VSCP_PATH}/src/common/third_party/spdlog-1.9.2/include - ${VSCP_PATH}/src/vscp/common/vscp.h - ${VSCP_PATH}/src/vscp/common/vscpremotetcpif.h - ${VSCP_PATH}/src/vscp/common/vscpremotetcpif.cpp - ${VSCP_PATH}/src/vscp/common/vscpdatetime.h - ${VSCP_PATH}/src/vscp/common/vscpdatetime.cpp - ${VSCP_PATH}/src/vscp/common/guid.h - ${VSCP_PATH}/src/vscp/common/guid.cpp -# ${VSCP_PATH}/src/vscp/common/mdf.h -# ${VSCP_PATH}/src/vscp/common/mdf.cpp - ${VSCP_PATH}/src/vscp/common/vscphelper.h - ${VSCP_PATH}/src/vscp/common/vscphelper.cpp - ${VSCP_PATH}/src/vscp/common/canal.h - ${VSCP_PATH}/src/common/sockettcp.h - ${VSCP_PATH}/src/common/sockettcp.c - ${VSCP_PATH}/src/common/vscpbase64.h - ${VSCP_PATH}/src/common/vscpbase64.c - ${VSCP_PATH}/src/common/vscp_aes.h - ${VSCP_PATH}/src/common/vscp_aes.c - ${VSCP_PATH}/src/common/crc.h - ${VSCP_PATH}/src/common/crc.c - ${VSCP_PATH}/src/common/crc8.h - ${VSCP_PATH}/src/common/crc8.c - ${VSCP_PATH}/src/common/vscpmd5.h - ${VSCP_PATH}/src/common/vscpmd5.c - ${VSCP_PATH}/src/common/fastpbkdf2.h - ${VSCP_PATH}/src/common/fastpbkdf2.c + ./third_party/mustache/mustache.hpp + ./third_party/spdlog/include + $ENV{VSCP_ROOT}/src/vscp/common/vscp.h + $ENV{VSCP_ROOT}/src/vscp/common/vscpremotetcpif.h + $ENV{VSCP_ROOT}/src/vscp/common/vscpremotetcpif.cpp + $ENV{VSCP_ROOT}/src/vscp/common/vscpdatetime.h + $ENV{VSCP_ROOT}/src/vscp/common/vscpdatetime.cpp + $ENV{VSCP_ROOT}/src/vscp/common/guid.h + $ENV{VSCP_ROOT}/src/vscp/common/guid.cpp + $ENV{VSCP_ROOT}/src/vscp/common/vscphelper.h + $ENV{VSCP_ROOT}/src/vscp/common/vscphelper.cpp + $ENV{VSCP_ROOT}/src/vscp/common/canal.h + $ENV{VSCP_ROOT}/src/common/sockettcp.h + $ENV{VSCP_ROOT}/src/common/sockettcp.c + $ENV{VSCP_ROOT}/src/common/vscpbase64.h + $ENV{VSCP_ROOT}/src/common/vscpbase64.c + $ENV{VSCP_ROOT}/src/common/vscp-aes.h + $ENV{VSCP_ROOT}/src/common/vscp-aes.c + $ENV{VSCP_ROOT}/src/common/crc.h + $ENV{VSCP_ROOT}/src/common/crc.c + $ENV{VSCP_ROOT}/src/common/crc8.h + $ENV{VSCP_ROOT}/src/common/crc8.c + $ENV{VSCP_ROOT}/src/common/vscpmd5.h + $ENV{VSCP_ROOT}/src/common/vscpmd5.c ) else() add_library(libvscphelper SHARED @@ -261,34 +282,30 @@ else() ./src/vscphelperlib.cpp ./linux/libvscphelper.h ./linux/libvscphelper.cpp - ${VSCP_PATH}/src/common/third_party/mustache.hpp - ${VSCP_PATH}/src/common/third_party/spdlog-1.9.2/include - ${VSCP_PATH}/src/vscp/common/vscp.h - ${VSCP_PATH}/src/vscp/common/vscpremotetcpif.h - ${VSCP_PATH}/src/vscp/common/vscpremotetcpif.cpp - ${VSCP_PATH}/src/vscp/common/vscpdatetime.h - ${VSCP_PATH}/src/vscp/common/vscpdatetime.cpp - ${VSCP_PATH}/src/vscp/common/guid.h - ${VSCP_PATH}/src/vscp/common/guid.cpp -# ${VSCP_PATH}/src/vscp/common/mdf.h -# ${VSCP_PATH}/src/vscp/common/mdf.cpp - ${VSCP_PATH}/src/vscp/common/vscphelper.h - ${VSCP_PATH}/src/vscp/common/vscphelper.cpp - ${VSCP_PATH}/src/vscp/common/canal.h - ${VSCP_PATH}/src/common/sockettcp.h - ${VSCP_PATH}/src/common/sockettcp.c - ${VSCP_PATH}/src/common/vscpbase64.h - ${VSCP_PATH}/src/common/vscpbase64.c - ${VSCP_PATH}/src/common/vscp_aes.h - ${VSCP_PATH}/src/common/vscp_aes.c - ${VSCP_PATH}/src/common/crc.h - ${VSCP_PATH}/src/common/crc.c - ${VSCP_PATH}/src/common/crc8.h - ${VSCP_PATH}/src/common/crc8.c - ${VSCP_PATH}/src/common/vscpmd5.h - ${VSCP_PATH}/src/common/vscpmd5.c - ${VSCP_PATH}/src/common/fastpbkdf2.h - ${VSCP_PATH}/src/common/fastpbkdf2.c + ./third_party/mustache/mustache.hpp + ./third_party/spdlog/include + $ENV{VSCP_ROOT}/src/vscp/common/vscp.h + $ENV{VSCP_ROOT}/src/vscp/common/vscpremotetcpif.h + $ENV{VSCP_ROOT}/src/vscp/common/vscpremotetcpif.cpp + $ENV{VSCP_ROOT}/src/vscp/common/vscpdatetime.h + $ENV{VSCP_ROOT}/src/vscp/common/vscpdatetime.cpp + $ENV{VSCP_ROOT}/src/vscp/common/guid.h + $ENV{VSCP_ROOT}/src/vscp/common/guid.cpp + $ENV{VSCP_ROOT}/src/vscp/common/vscphelper.h + $ENV{VSCP_ROOT}/src/vscp/common/vscphelper.cpp + $ENV{VSCP_ROOT}/src/vscp/common/canal.h + $ENV{VSCP_ROOT}/src/common/sockettcp.h + $ENV{VSCP_ROOT}/src/common/sockettcp.c + $ENV{VSCP_ROOT}/src/common/vscpbase64.h + $ENV{VSCP_ROOT}/src/common/vscpbase64.c + $ENV{VSCP_ROOT}/src/common/vscp-aes.h + $ENV{VSCP_ROOT}/src/common/vscp-aes.c + $ENV{VSCP_ROOT}/src/common/crc.h + $ENV{VSCP_ROOT}/src/common/crc.c + $ENV{VSCP_ROOT}/src/common/crc8.h + $ENV{VSCP_ROOT}/src/common/crc8.c + $ENV{VSCP_ROOT}/src/common/vscpmd5.h + $ENV{VSCP_ROOT}/src/common/vscpmd5.c ) endif() @@ -320,11 +337,11 @@ if (WIN32) include_directories( PUBLIC src/ ./windows/ - ${VSCP_PATH}/src/vscp/common/ - ${VSCP_PATH}/src/common - ${VSCP_PATH}/src/common/third_party - ${VSCP_PATH}/src/common/third_party/nlohmann - ${VSCP_PATH}/src/common/third_party/spdlog-1.9.2/include + $ENV{VSCP_ROOT}/src/vscp/common/ + $ENV{VSCP_ROOT}/src/common + $ENV{VSCP_ROOT}/src/common/third_party + ./third_party/nlohmann/include/ + ./third_party/spdlog/include ${PThreads4W_INCLUDE_DIR} ${CMAKE_BINARY_DIR} ${OPENSSL_INCLUDE_DIR} @@ -332,11 +349,11 @@ if (WIN32) ${LOCAL_SYSLOG_INCLUDE} ) else() include_directories( PUBLIC src/ - ${VSCP_PATH}/src/vscp/common/ - ${VSCP_PATH}/src/common - ${VSCP_PATH}/src/common/third_party - ${VSCP_PATH}/src/common/third_party/nlohmann - ${VSCP_PATH}/src/common/third_party/spdlog-1.9.2/include + $ENV{VSCP_ROOT}/src/vscp/common/ + $ENV{VSCP_ROOT}/src/common + $ENV{VSCP_ROOT}/src/common/third_party + ./third_party/nlohmann/include/ + ./third_party/spdlog/include/ ${CMAKE_BINARY_DIR} ${OPENSSL_INCLUDE_DIR} ${LOCAL_SYSLOG_INCLUDE} ) @@ -391,11 +408,11 @@ if(WIN32) DESTINATION ${CMAKE_INSTALL_BINDIR}/..) # Headers - INSTALL( FILES "${VSCP_PATH}/src/vscp/common/vscp.h" + INSTALL( FILES "$ENV{VSCP_ROOT}/src/vscp/common/vscp.h" "${CMAKE_SOURCE_DIR}/src/vscphelperlib.h" - "${VSCP_PATH}/src/vscp/common/canal.h" - "${VSCP_PATH}/src/vscp/common/vscp_class.h" - "${VSCP_PATH}/src/vscp/common/vscp_type.h" + "$ENV{VSCP_ROOT}/src/vscp/common/canal.h" + "$ENV{VSCP_ROOT}/src/vscp/common/vscp_class.h" + "$ENV{VSCP_ROOT}/src/vscp/common/vscp_type.h" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) else() @@ -410,12 +427,12 @@ else() DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig) # Headers - INSTALL(FILES "${VSCP_PATH}/src/vscp/common/vscp.h" + INSTALL(FILES "$ENV{VSCP_ROOT}/src/vscp/common/vscp.h" "${PROJECT_SOURCE_DIR}/src/vscphelperlib.h" - "${VSCP_PATH}/src/vscp/common/canal.h" - "${VSCP_PATH}/src/vscp/common/vscp_class.h" - "${VSCP_PATH}/src/vscp/common/vscp_type.h" + "$ENV{VSCP_ROOT}/src/vscp/common/canal.h" + "$ENV{VSCP_ROOT}/src/vscp/common/vscp_class.h" + "$ENV{VSCP_ROOT}/src/vscp/common/vscp_type.h" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) endif() - \ No newline at end of file + diff --git a/README.md b/README.md index 64dcf9a..737de51 100644 --- a/README.md +++ b/README.md @@ -126,7 +126,9 @@ The two projects should be cloned on the same directory level. vscp-helper-lib i cd vscp-helper-lib mkdir build cd build - cmake .. -G "Visual Studio 17 2022" -DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_TOOLCHAIN_FILE=E:\vcpkg\scripts\buildsystems\vcpkg.cmake + + cmake .. -G "Visual Studio 16 2019" -DVCPKG_TARGET_TRIPLET=x64-windows -D CMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=C:\Users\Administrator\Desktop\Development\vcpkg\scripts\buildsystems\vcpkg.cmake + ``` The path to the vspkg build script (_E:\vcpkg\scripts\buildsystems.._) is obviously different in your case. diff --git a/linux/libvscphelper.cpp b/linux/libvscphelper.cpp index 0be6cdd..206dcf3 100644 --- a/linux/libvscphelper.cpp +++ b/linux/libvscphelper.cpp @@ -46,7 +46,7 @@ #include #include -#include +#include #include #include "libvscphelper.h" diff --git a/src/vscphelperlib.cpp b/src/vscphelperlib.cpp index 9bcd7b6..8982a74 100644 --- a/src/vscphelperlib.cpp +++ b/src/vscphelperlib.cpp @@ -4,7 +4,7 @@ // // The MIT License (MIT) // -// Copyright (C) 2000-2022 Åke Hedman, The VSCP Project, +// Copyright (C) 2000-2024 Åke Hedman, The VSCP Project, // // // Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/src/vscphelperlib.h b/src/vscphelperlib.h index b65721d..ead3c07 100644 --- a/src/vscphelperlib.h +++ b/src/vscphelperlib.h @@ -5,7 +5,7 @@ // // The MIT License (MIT) // -// Copyright © 2000-2022 Ake Hedman, The VSCP Project, +// Copyright (C) 2000-2024 Åke Hedman, The VSCP Project, // // // Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/third_party/fastpbkdf2 b/third_party/fastpbkdf2 new file mode 160000 index 0000000..3c56895 --- /dev/null +++ b/third_party/fastpbkdf2 @@ -0,0 +1 @@ +Subproject commit 3c568957de1d26a3811deba4a0ce1895731ce9a4 diff --git a/third_party/mongoose b/third_party/mongoose new file mode 160000 index 0000000..7f3d450 --- /dev/null +++ b/third_party/mongoose @@ -0,0 +1 @@ +Subproject commit 7f3d450b3287297c61943f20f386c80877e244b8 diff --git a/third_party/mustache b/third_party/mustache new file mode 160000 index 0000000..04277d5 --- /dev/null +++ b/third_party/mustache @@ -0,0 +1 @@ +Subproject commit 04277d5552c6e46bee41a946b7d175a660ea1b3d diff --git a/third_party/nlohmann b/third_party/nlohmann new file mode 160000 index 0000000..a0c1318 --- /dev/null +++ b/third_party/nlohmann @@ -0,0 +1 @@ +Subproject commit a0c1318830519eac027a31edec1a99ce1ae5670e diff --git a/third_party/spdlog b/third_party/spdlog new file mode 160000 index 0000000..32bab0e --- /dev/null +++ b/third_party/spdlog @@ -0,0 +1 @@ +Subproject commit 32bab0e1030aa92c6e64fe9da7ea75531cfd9c6c