From 7f4e7f3ccf67ad94426370bc74ef91a2ba39287f Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Wed, 10 Apr 2024 08:05:19 +1000 Subject: [PATCH 01/18] Updating next release version to be v6.3.3 --- lib/include/commsdsl/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/include/commsdsl/version.h b/lib/include/commsdsl/version.h index cba631ad..fcb30a7c 100644 --- a/lib/include/commsdsl/version.h +++ b/lib/include/commsdsl/version.h @@ -26,7 +26,7 @@ #define COMMSDSL_MINOR_VERSION 3U /// @brief Patch level of the library -#define COMMSDSL_PATCH_VERSION 2U +#define COMMSDSL_PATCH_VERSION 3U /// @brief Macro to create numeric version as single unsigned number #define COMMSDSL_MAKE_VERSION(major_, minor_, patch_) \ From 686ade1f2db8d328c04f34bfb93787273772cf8b Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Tue, 18 Jun 2024 08:50:36 +1000 Subject: [PATCH 02/18] Fixing location of the interface in the namespace. --- app/commsdsl2comms/src/CommsInterface.cpp | 18 ++++++------ app/commsdsl2comms/test/CMakeLists.txt | 3 +- app/commsdsl2comms/test/test51/Schema.xml | 29 ++++++++++++++++++++ app/commsdsl2comms/test/test51/test51Test.th | 22 +++++++++++++++ 4 files changed, 62 insertions(+), 10 deletions(-) create mode 100644 app/commsdsl2comms/test/test51/Schema.xml create mode 100644 app/commsdsl2comms/test/test51/test51Test.th diff --git a/app/commsdsl2comms/src/CommsInterface.cpp b/app/commsdsl2comms/src/CommsInterface.cpp index d43d0afc..47a58c4e 100644 --- a/app/commsdsl2comms/src/CommsInterface.cpp +++ b/app/commsdsl2comms/src/CommsInterface.cpp @@ -152,10 +152,11 @@ bool CommsInterface::prepareImpl() m_name = strings::messageClassStr(); } - m_constructCode = util::readFileContents(comms::inputCodePathFor(*this, generator()) + strings::constructFileSuffixStr()); - m_publicCode = util::readFileContents(comms::inputCodePathFor(*this, generator()) + strings::publicFileSuffixStr()); - m_protectedCode = util::readFileContents(comms::inputCodePathFor(*this, generator()) + strings::protectedFileSuffixStr()); - m_privateCode = util::readFileContents(comms::inputCodePathFor(*this, generator()) + strings::privateFileSuffixStr()); + auto inputCodePrefix = comms::inputCodePathFor(*this, generator()); + m_constructCode = util::readFileContents(inputCodePrefix + strings::constructFileSuffixStr()); + m_publicCode = util::readFileContents(inputCodePrefix + strings::publicFileSuffixStr()); + m_protectedCode = util::readFileContents(inputCodePrefix + strings::protectedFileSuffixStr()); + m_privateCode = util::readFileContents(inputCodePrefix + strings::privateFileSuffixStr()); m_commsFields = CommsField::commsTransformFieldsList(fields()); return true; @@ -251,8 +252,8 @@ bool CommsInterface::commsWriteDefInternal() const return stream.good(); }; - auto genFilePath = comms::headerPathRoot(m_name, gen); - auto codePathPrefix = comms::inputCodePathForRoot(m_name, gen); + auto genFilePath = comms::headerPathFor(*this, gen); + auto codePathPrefix = comms::inputCodePathFor(*this, gen); auto replaceContent = util::readFileContents(codePathPrefix + strings::replaceFileSuffixStr()); if (!replaceContent.empty()) { return writeFunc(genFilePath, replaceContent); @@ -268,8 +269,8 @@ bool CommsInterface::commsWriteDefInternal() const {"DOC_DETAILS", commsDefDocDetailsInternal()}, {"BASE", commsDefBaseClassInternal()}, {"HEADERFILE", comms::relHeaderPathFor(*this, gen)}, - {"EXTEND", util::readFileContents(comms::inputCodePathForRoot(m_name, gen) + strings::extendFileSuffixStr())}, - {"APPEND", util::readFileContents(comms::inputCodePathForRoot(m_name, gen) + strings::appendFileSuffixStr())} + {"EXTEND", util::readFileContents(codePathPrefix + strings::extendFileSuffixStr())}, + {"APPEND", util::readFileContents(codePathPrefix + strings::appendFileSuffixStr())} }; if (!repl["EXTEND"].empty()) { @@ -477,7 +478,6 @@ std::string CommsInterface::commsDefPublicInternal() const " #^#EXTRA#$#\n" ; - auto inputCodePrefix = comms::inputCodePathFor(*this, generator()); util::ReplacementMap repl = { {"CONSTRUCT", m_constructCode}, {"ACCESS", commsDefFieldsAccessInternal()}, diff --git a/app/commsdsl2comms/test/CMakeLists.txt b/app/commsdsl2comms/test/CMakeLists.txt index 49045a18..85392a3e 100644 --- a/app/commsdsl2comms/test/CMakeLists.txt +++ b/app/commsdsl2comms/test/CMakeLists.txt @@ -208,4 +208,5 @@ test_func (test46) test_func (test47) test_func (test48) test_func (test49) -test_func (test50) \ No newline at end of file +test_func (test50) +test_func (test51) \ No newline at end of file diff --git a/app/commsdsl2comms/test/test51/Schema.xml b/app/commsdsl2comms/test/test51/Schema.xml new file mode 100644 index 00000000..7e2f684a --- /dev/null +++ b/app/commsdsl2comms/test/test51/Schema.xml @@ -0,0 +1,29 @@ + + + + Testing interface in the namespace + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/commsdsl2comms/test/test51/test51Test.th b/app/commsdsl2comms/test/test51/test51Test.th new file mode 100644 index 00000000..1747049f --- /dev/null +++ b/app/commsdsl2comms/test/test51/test51Test.th @@ -0,0 +1,22 @@ +#include "cxxtest/TestSuite.h" + +#include "comms/iterator.h" +#include "test51/ns1/Message.h" +#include "test51/ns1/frame/Frame.h" + +class TestSuite : public CxxTest::TestSuite +{ +public: + void test1(); + + using Interface = test51::ns1::Message<>; + using Frame = test51::ns1::frame::Frame; + + TEST51_ALIASES_FOR_ALL_MESSAGES_DEFAULT_OPTIONS(,,Interface); +}; + +void TestSuite::test1() +{ + Msg1 msg; + static_cast(msg); +} From 701d761025753986edf9ff6a00182f71b65ca08f Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Sat, 22 Jun 2024 11:32:04 +1000 Subject: [PATCH 03/18] Attempting to allow internal build of libxml for all platforms. --- CMakeLists.txt | 7 ++++++- lib/src/CMakeLists.txt | 46 ++++++++++++++++++++++-------------------- 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 44e53394..66c3dd72 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ option (COMMSDSL_BUILD_COMMSDSL2TEST_TESTS "Build commsdsl2test unittests." ${CO option (COMMSDSL_VALGRIND_TESTS "Enable testing with valgrind (applicable when COMMSDSL_BUILD_UNIT_TESTS is on)" OFF) option (COMMSDSL_TEST_USE_SANITIZERS "Build unittiests with sanitizers (applicable when COMMSDSL_BUILD_UNIT_TESTS is on)" ON) option (COMMSDSL_TEST_BUILD_DOC "Build documentation target in generated projects (applicable when COMMSDSL_BUILD_UNIT_TESTS is on)" OFF) -option (COMMSDSL_WIN_ALLOW_LIBXML_BUILD "Allow internal build of libxml2 on Windows platforms" ON) +option (COMMSDSL_FORCE_INTERNAL_LIBXML_BUILD "Force internal build of libxml2 when external one is not found" OFF) # Additional variables to be used if needed # --------------------------- @@ -40,6 +40,7 @@ option (COMMSDSL_WIN_ALLOW_LIBXML_BUILD "Allow internal build of libxml2 on Wind # option (COMMSDSL_NO_WARN_AS_ERR "Do NOT treat warning as error" OFF) # option (COMMSDSL_NO_CCACHE "Disable use of ccache on UNIX system" OFF) # option (COMMSDSL_NO_TESTS "Disable unittesting" OFF) +# option (COMMSDSL_WIN_ALLOW_LIBXML_BUILD "Allow internal build of libxml2 on Windows platforms" ON) ################################################ @@ -54,6 +55,10 @@ commsdsl_negate_option(COMMSDSL_NO_WARN_AS_ERR COMMSDSL_WARN_AS_ERR) commsdsl_negate_option(COMMSDSL_NO_CCACHE COMMSDSL_USE_CCACHE) commsdsl_negate_option(COMMSDSL_NO_TESTS COMMSDSL_BUILD_UNIT_TESTS) +if (WIN32 AND COMMSDSL_WIN_ALLOW_LIBXML_BUILD) + set (COMMSDSL_FORCE_INTERNAL_LIBXML_BUILD ON) +endif () + ################################################ if ("${COMMSDSL_TESTS_QT_VERSION}" STREQUAL "") diff --git a/lib/src/CMakeLists.txt b/lib/src/CMakeLists.txt index 32a051b0..727bc2f7 100644 --- a/lib/src/CMakeLists.txt +++ b/lib/src/CMakeLists.txt @@ -1,23 +1,29 @@ set (INTERNAL_LIBXML_TGT) while (TRUE) - if ((NOT WIN32) OR (NOT COMMSDSL_WIN_ALLOW_LIBXML_BUILD)) - # Use libxml2 from system / external repositories - break() - endif () - - find_package(LibXml2 QUIET) - if (LIBXML2_FOUND) - # Find again just to display info - find_package(LibXml2 REQUIRED) - break() + if (NOT COMMSDSL_FORCE_INTERNAL_LIBXML_BUILD) + find_package(LibXml2 QUIET) + if (LIBXML2_FOUND) + # Find again just to display info + find_package(LibXml2 REQUIRED) + break() + endif () endif () set (INTERNAL_LIBXML_TGT "libxml2_tgt") set (LIBXML2_DIR "${CMAKE_CURRENT_BINARY_DIR}/libxml2") set (LIBXML2_SRC_DIR "${LIBXML2_DIR}/src") - set (LIBXML2_BIN_DIR "${LIBXML2_SRC_DIR}/win32") + set (LIBXML2_BIN_DIR "${LIBXML2_DIR}/build") set (LIBXML2_INSTALL_DIR "${LIBXML2_BIN_DIR}/install") + set (LIBXML2_LIB_NAME libxml2.a) + if (WIN32) + set (LIBXML2_LIB_NAME libxml2sd.lib) + if (("${CMAKE_BUILD_TYPE}" STREQUAL "Release") OR + ("${CMAKE_BUILD_TYPE}" STREQUAL "MinSizeRel") OR + ("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")) + set (LIBXML2_LIB_NAME libxml2s.lib) + endif () + endif () include(ExternalProject) ExternalProject_Add( @@ -41,17 +47,13 @@ while (TRUE) BINARY_DIR "${LIBXML2_BIN_DIR}" INSTALL_DIR "${LIBXML2_INSTALL_DIR}" # BUILD_BYPRODUCTS needed by Ninja - BUILD_BYPRODUCTS /lib/libxml2_a.lib + BUILD_BYPRODUCTS /lib/${LIBXML2_LIB_NAME} ) set (LIBXML2_FOUND TRUE) set (LIBXML2_INCLUDE_DIR "${LIBXML2_INSTALL_DIR}/include/libxml2") - set (LIBXML2_LIBRARIES "${LIBXML2_INSTALL_DIR}/lib/libxml2sd.lib") - if (("${CMAKE_BUILD_TYPE}" STREQUAL "Release") OR - ("${CMAKE_BUILD_TYPE}" STREQUAL "MinSizeRel") OR - ("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")) - set (LIBXML2_LIBRARIES "${LIBXML2_INSTALL_DIR}/lib/libxml2s.lib") - endif () + set (LIBXML2_LIBRARIES "${LIBXML2_INSTALL_DIR}/lib/${LIBXML2_LIB_NAME}") + set (LIBXML2_DEFINITIONS "LIBXML_STATIC") file(MAKE_DIRECTORY ${LIBXML2_INCLUDE_DIR}) @@ -68,10 +70,6 @@ while (TRUE) break() endwhile () -if (NOT LIBXML2_FOUND) - find_package(LibXml2 REQUIRED) -endif () - if (LIBXML2_FOUND AND (NOT TARGET LibXml2::LibXml2)) # Older versions of cmake may not define LibXml2::LibXml2 target add_library(LibXml2::LibXml2 UNKNOWN IMPORTED) @@ -82,6 +80,10 @@ if (LIBXML2_FOUND AND (NOT TARGET LibXml2::LibXml2)) ) endif () +if (NOT TARGET LibXml2::LibXml2) + message (FATAL_ERROR "LibXml2 dependency is not found and not built internally" ) +endif () + set ( parse_src "parse/Alias.cpp" From 6e288d976d89705b9ce173eab2f5ed9f9a641086 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Sat, 22 Jun 2024 11:34:58 +1000 Subject: [PATCH 04/18] Temporarily disable non-Windows builds on github actions. --- .github/workflows/actions_build.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/actions_build.yml b/.github/workflows/actions_build.yml index 42dffe2e..b7c2e34f 100644 --- a/.github/workflows/actions_build.yml +++ b/.github/workflows/actions_build.yml @@ -8,6 +8,7 @@ env: jobs: build_gcc_old_ubuntu_20_04: + if: false runs-on: ubuntu-20.04 strategy: fail-fast: false @@ -77,6 +78,7 @@ jobs: run: ctest build_gcc_ubuntu_20_04: + if: false runs-on: ubuntu-20.04 strategy: fail-fast: false @@ -138,6 +140,7 @@ jobs: run: ctest build_gcc_ubuntu_22_04: + if: false runs-on: ubuntu-22.04 strategy: fail-fast: false @@ -207,6 +210,7 @@ jobs: build_clang_old_ubuntu_20_04: + if: false runs-on: ubuntu-20.04 strategy: fail-fast: false @@ -279,6 +283,7 @@ jobs: run: ctest build_clang_ubuntu_20_04: + if: false runs-on: ubuntu-20.04 strategy: fail-fast: false @@ -346,6 +351,7 @@ jobs: run: ctest build_clang_ubuntu_22_04: + if: false runs-on: ubuntu-22.04 strategy: fail-fast: false From de0a35c138772b9bc6642fb72fbf77328d9b28b7 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Sat, 22 Jun 2024 12:40:33 +1000 Subject: [PATCH 05/18] Revert "Temporarily disable non-Windows builds on github actions." This reverts commit 6e288d976d89705b9ce173eab2f5ed9f9a641086. --- .github/workflows/actions_build.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/actions_build.yml b/.github/workflows/actions_build.yml index b7c2e34f..42dffe2e 100644 --- a/.github/workflows/actions_build.yml +++ b/.github/workflows/actions_build.yml @@ -8,7 +8,6 @@ env: jobs: build_gcc_old_ubuntu_20_04: - if: false runs-on: ubuntu-20.04 strategy: fail-fast: false @@ -78,7 +77,6 @@ jobs: run: ctest build_gcc_ubuntu_20_04: - if: false runs-on: ubuntu-20.04 strategy: fail-fast: false @@ -140,7 +138,6 @@ jobs: run: ctest build_gcc_ubuntu_22_04: - if: false runs-on: ubuntu-22.04 strategy: fail-fast: false @@ -210,7 +207,6 @@ jobs: build_clang_old_ubuntu_20_04: - if: false runs-on: ubuntu-20.04 strategy: fail-fast: false @@ -283,7 +279,6 @@ jobs: run: ctest build_clang_ubuntu_20_04: - if: false runs-on: ubuntu-20.04 strategy: fail-fast: false @@ -351,7 +346,6 @@ jobs: run: ctest build_clang_ubuntu_22_04: - if: false runs-on: ubuntu-22.04 strategy: fail-fast: false From 67409f8bd77d2221cc49191e1c9e6287816382ec Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Sat, 22 Jun 2024 12:41:47 +1000 Subject: [PATCH 06/18] Removed appveyor configuration. --- .appveyor.yml | 97 ------------------------------------- script/appveyor_install.bat | 69 -------------------------- 2 files changed, 166 deletions(-) delete mode 100644 .appveyor.yml delete mode 100644 script/appveyor_install.bat diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index 0f0f047e..00000000 --- a/.appveyor.yml +++ /dev/null @@ -1,97 +0,0 @@ -image: - - Visual Studio 2022 - - Visual Studio 2019 - -init: - - git config --global core.autocrlf input - -clone_folder: c:\projects\commsdsl -shallow_clone: true - -platform: - - x86 - - x64 - -configuration: - - Debug - - Release - -environment: - COMMS_TAG: v5.2.3 - CC_TOOLS_QT_TAG: v5.2.1 - matrix: - - CPP_STD: 11 - EXTRA_CONFIG: -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT_TESTS=OFF - TOOLS_CPP_STD: 17 - QT_MAJOR: 5 - - CPP_STD: 14 - EXTRA_CONFIG: -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT_TESTS=OFF - TOOLS_CPP_STD: 17 - QT_MAJOR: 6 - - CPP_STD: 17 - EXTRA_CONFIG: -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT_TESTS=OFF - TOOLS_CPP_STD: 17 - QT_MAJOR: 5 - - CPP_STD: 17 - EXTRA_CONFIG: "-DCOMMSDSL_BUILD_COMMSDSL2COMMS_TESTS=OFF -DCOMMSDSL_BUILD_COMMSDSL2TEST_TESTS=OFF -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT_TESTS_CHUNK2=OFF -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT_TESTS_CHUNK3=OFF" - TOOLS_CPP_STD: 17 - QT_MAJOR: 5 - - CPP_STD: 17 - EXTRA_CONFIG: "-DCOMMSDSL_BUILD_COMMSDSL2COMMS_TESTS=OFF -DCOMMSDSL_BUILD_COMMSDSL2TEST_TESTS=OFF -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT_TESTS_CHUNK1=OFF -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT_TESTS_CHUNK3=OFF" - TOOLS_CPP_STD: 17 - QT_MAJOR: 6 - - CPP_STD: 17 - EXTRA_CONFIG: "-DCOMMSDSL_BUILD_COMMSDSL2COMMS_TESTS=OFF -DCOMMSDSL_BUILD_COMMSDSL2TEST_TESTS=OFF -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT_TESTS_CHUNK1=OFF -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT_TESTS_CHUNK2=OFF" - TOOLS_CPP_STD: 17 - QT_MAJOR: 6 - - CPP_STD: 17 - EXTRA_CONFIG: -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT_TESTS=OFF - TOOLS_CPP_STD: 17 - QT_MAJOR: 5 - - CPP_STD: 20 - EXTRA_CONFIG: "-DCOMMSDSL_BUILD_COMMSDSL2COMMS_TESTS=OFF -DCOMMSDSL_BUILD_COMMSDSL2TEST_TESTS=OFF -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT_TESTS_CHUNK2=OFF -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT_TESTS_CHUNK3=OFF" - TOOLS_CPP_STD: 20 - QT_MAJOR: 5 - - CPP_STD: 20 - EXTRA_CONFIG: "-DCOMMSDSL_BUILD_COMMSDSL2COMMS_TESTS=OFF -DCOMMSDSL_BUILD_COMMSDSL2TEST_TESTS=OFF -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT_TESTS_CHUNK1=OFF -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT_TESTS_CHUNK3=OFF" - TOOLS_CPP_STD: 20 - QT_MAJOR: 6 - - CPP_STD: 20 - EXTRA_CONFIG: "-DCOMMSDSL_BUILD_COMMSDSL2COMMS_TESTS=OFF -DCOMMSDSL_BUILD_COMMSDSL2TEST_TESTS=OFF -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT_TESTS_CHUNK1=OFF -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT_TESTS_CHUNK2=OFF" - TOOLS_CPP_STD: 20 - QT_MAJOR: 6 - -matrix: - fast_finish: false - exclude: - - platform: x86 - QT_MAJOR: 6 - -install: - - call script\appveyor_install.bat - - set PATH=%PATH%;%QTDIR%\bin - - set BUILD_DIR=%APPVEYOR_BUILD_FOLDER%\build.%PLATFORM%.%CONFIGURATION%.%TOOLCHAIN% - - if exist %BUILD_DIR% rmdir /S /Q %BUILD_DIR% - - set COMMS_TAG=%COMMS_TAG% - - set CC_TOOLS_QT_TAG=%CC_TOOLS_QT_TAG% - - set COMMON_INSTALL_DIR=%BUILD_DIR%\install - - set COMMON_BUILD_TYPE=%CONFIGURATION% - - set COMMON_CXX_STANDARD=%CPP_STD% - - set GENERATOR="%CMAKE_GENERATOR%" - - set PLATFORM="%CMAKE_PLATFORM%" - - set CC_TOOLS_QT_MAJOR_QT_VERSION=%QT_MAJOR% - - call script\prepare_externals.bat - -build_script: - - echo ------------------------- Building Project ------------------------- - - cd %BUILD_DIR% - - cmake .. -DCMAKE_BUILD_TYPE=%CONFIGURATION% -G "%CMAKE_GENERATOR%" %PLATFORM_PARAM% -DCMAKE_INSTALL_PREFIX="%COMMON_INSTALL_DIR%" ^ - -DCMAKE_PREFIX_PATH="%COMMON_INSTALL_DIR%" -DCOMMSDSL_TESTS_CXX_STANDARD=%CPP_STD% ^ - -DCOMMSDSL_BUILD_UNIT_TESTS=ON -DCOMMSDSL_BUILD_COMMSDSL2TEST=ON -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT=ON ^ - -DCMAKE_CXX_STANDARD=%TOOLS_CPP_STD% -DCOMMSDSL_TESTS_QT_VERSION=%QT_MAJOR% %EXTRA_CONFIG% - - cmake --build . --config %CONFIGURATION% --target install - - echo ------------------------- Testing ------------------------- - - ctest - - - diff --git a/script/appveyor_install.bat b/script/appveyor_install.bat deleted file mode 100644 index e34e8559..00000000 --- a/script/appveyor_install.bat +++ /dev/null @@ -1,69 +0,0 @@ -IF "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" ( - set TOOLCHAIN=msvc15 - set QT_SUBDIR=msvc2017 - set QT_VER=5.13 - set CMAKE_GENERATOR=NMake Makefiles - IF "%PLATFORM%"=="x86" ( - echo Performing x86 build in VS2017 - call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat" - ) ELSE ( - echo Performing amd64 build in VS2017 - call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" - ) -) ELSE IF "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2019" ( - set TOOLCHAIN=msvc16 - set QT_SUBDIR=msvc2019 - set CMAKE_GENERATOR=Visual Studio 16 2019 - IF "%QT_MAJOR%"=="6" ( - set QT_VER=6.4 - ) ELSE ( - set QT_VER=5.15 - ) - IF "%PLATFORM%"=="x86" ( - echo Performing x86 build in VS2019 - call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars32.bat" - set CMAKE_PLATFORM=Win32 - ) ELSE ( - echo Performing amd64 build in VS2019 - call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" - set CMAKE_PLATFORM=x64 - ) -) ELSE IF "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2022" ( - set TOOLCHAIN=msvc17 - set QT_SUBDIR=msvc2019 - IF "%QT_MAJOR%"=="6" ( - set QT_VER=6.4 - ) ELSE ( - set QT_VER=5.15 - ) - set CMAKE_GENERATOR=Visual Studio 17 2022 - IF "%PLATFORM%"=="x86" ( - echo Performing x86 build in VS2022 - call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars32.bat" - set CMAKE_PLATFORM=Win32 - ) ELSE ( - echo Performing amd64 build in VS2022 - call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" - set CMAKE_PLATFORM=x64 - ) -) ELSE ( - echo Toolchain %TOOLCHAIN% is not supported - exit -1 -) - -set QTDIR_PREFIX=C:/Qt/%QT_VER% -IF "%PLATFORM%"=="x86" ( - set QTDIR_SUFFIX= -) ELSE ( - set QTDIR_SUFFIX=_64 -) - -set QTDIR=%QTDIR_PREFIX%/%QT_SUBDIR%%QTDIR_SUFFIX% -IF NOT EXIST %QTDIR% ( - echo WARNING: %QTDIR% does not exist!!! - set QTDIR=%QTDIR_PREFIX%/msvc2015%QTDIR_SUFFIX% -) - -echo Using Qt from %QTDIR% - - From a2a9c865b9d1a453d5a4168fa6e01c9e90733983 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Sat, 22 Jun 2024 12:55:13 +1000 Subject: [PATCH 07/18] Requiring v5.2.4 of comms library and v5.3 of cc_tools_qt --- .github/workflows/actions_build.yml | 4 ++-- app/commsdsl2comms/src/CommsGenerator.cpp | 2 +- app/commsdsl2tools_qt/src/ToolsQtGenerator.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/actions_build.yml b/.github/workflows/actions_build.yml index 42dffe2e..8f2e4997 100644 --- a/.github/workflows/actions_build.yml +++ b/.github/workflows/actions_build.yml @@ -3,8 +3,8 @@ name: Github Actions Build on: [push] env: - COMMS_TAG: v5.2.3 - CC_TOOLS_QT_TAG: v5.2.1 + COMMS_TAG: v5.2.4 + CC_TOOLS_QT_TAG: v5.3.0 jobs: build_gcc_old_ubuntu_20_04: diff --git a/app/commsdsl2comms/src/CommsGenerator.cpp b/app/commsdsl2comms/src/CommsGenerator.cpp index 19802126..4c22762e 100644 --- a/app/commsdsl2comms/src/CommsGenerator.cpp +++ b/app/commsdsl2comms/src/CommsGenerator.cpp @@ -68,7 +68,7 @@ namespace util = commsdsl::gen::util; namespace commsdsl2comms { -const std::string MinCommsVersion("5.2.3"); +const std::string MinCommsVersion("5.2.4"); const std::string& CommsGenerator::commsFileGeneratedComment() { diff --git a/app/commsdsl2tools_qt/src/ToolsQtGenerator.cpp b/app/commsdsl2tools_qt/src/ToolsQtGenerator.cpp index ff2419f0..cc9eb645 100644 --- a/app/commsdsl2tools_qt/src/ToolsQtGenerator.cpp +++ b/app/commsdsl2tools_qt/src/ToolsQtGenerator.cpp @@ -66,7 +66,7 @@ namespace commsdsl2tools_qt namespace { -const std::string MinToolsQtVersion("5.2.1"); +const std::string MinToolsQtVersion("5.3.0"); } // namespace From 86586a1fcc862395dbab4848c42fdeddaab8479e Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Sat, 22 Jun 2024 14:03:57 +1000 Subject: [PATCH 08/18] Requiring v5.3.1 of the cc_tools_qt. --- .github/workflows/actions_build.yml | 2 +- app/commsdsl2tools_qt/src/ToolsQtGenerator.cpp | 2 +- app/commsdsl2tools_qt/src/ToolsQtMessage.cpp | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/actions_build.yml b/.github/workflows/actions_build.yml index 8f2e4997..8eaf77a3 100644 --- a/.github/workflows/actions_build.yml +++ b/.github/workflows/actions_build.yml @@ -4,7 +4,7 @@ on: [push] env: COMMS_TAG: v5.2.4 - CC_TOOLS_QT_TAG: v5.3.0 + CC_TOOLS_QT_TAG: v5.3.1 jobs: build_gcc_old_ubuntu_20_04: diff --git a/app/commsdsl2tools_qt/src/ToolsQtGenerator.cpp b/app/commsdsl2tools_qt/src/ToolsQtGenerator.cpp index cc9eb645..2bee2406 100644 --- a/app/commsdsl2tools_qt/src/ToolsQtGenerator.cpp +++ b/app/commsdsl2tools_qt/src/ToolsQtGenerator.cpp @@ -66,7 +66,7 @@ namespace commsdsl2tools_qt namespace { -const std::string MinToolsQtVersion("5.3.0"); +const std::string MinToolsQtVersion("5.3.1"); } // namespace diff --git a/app/commsdsl2tools_qt/src/ToolsQtMessage.cpp b/app/commsdsl2tools_qt/src/ToolsQtMessage.cpp index bde04414..6954575c 100644 --- a/app/commsdsl2tools_qt/src/ToolsQtMessage.cpp +++ b/app/commsdsl2tools_qt/src/ToolsQtMessage.cpp @@ -74,7 +74,9 @@ const std::string& toolsHeaderCodeSinglePimplInterfaceTemplInternal() " virtual ~#^#CLASS_NAME#$#();\n" " #^#CLASS_NAME#$#& operator=(const #^#CLASS_NAME#$#& other);\n" " #^#CLASS_NAME#$#& operator=(#^#CLASS_NAME#$#&&);\n" - " static MsgIdParamType doGetId();\n\n" + " static MsgIdParamType doGetId();\n" + " static constexpr bool hasStaticMsgId() { return true; }\n" + " static constexpr MsgIdType staticMsgId() { return static_cast(#^#MSG_ID#$#); }\n\n" "protected:\n" " virtual const char* nameImpl() const override;\n" " virtual const QVariantList& fieldsPropertiesImpl() const override;\n" @@ -479,6 +481,7 @@ std::string ToolsQtMessage::toolsHeaderCodeInternal() const {"INTERFACE", comms::scopeFor(*interfaces.front(), gen)}, {"PROT_MESSAGE", comms::scopeFor(*this, gen)}, {"DEF_OPTIONS", ToolsQtDefaultOptions::toolsScope(gen)}, + {"MSG_ID", util::numToString(dslObj().id())}, }; return util::processTemplate(func(), repl); From ac11a59219ec760726aba9e7e3818c81afaf6995 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Sat, 22 Jun 2024 14:15:01 +1000 Subject: [PATCH 09/18] Disable ccache by default. --- CMakeLists.txt | 12 ++++++------ script/env_dev.sh | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 66c3dd72..60dccbed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 3.10) project ("commsdsl") option (COMMSDSL_WARN_AS_ERR "Treat warning as error" ON) -option (COMMSDSL_USE_CCACHE "Use ccache on UNIX systems if it's available" ON) +option (COMMSDSL_USE_CCACHE "Use ccache on UNIX systems if it's available" OFF) option (COMMSDSL_INSTALL_LIBRARY "Install commdsl library" OFF ) option (COMMSDSL_INSTALL_LIBRARY_HEADERS "Install commdsl library headers" ${COMMSDSL_INSTALL_LIBRARY}) option (COMMSDSL_BUILD_COMMSDSL2COMMS "Build commsdsl2comms" ON) @@ -90,17 +90,17 @@ if (NOT COMMSDSL_EXTERNALS_DIR) endif () # Compiler options -set (warn_opt) +set (extra_opts) if (COMMSDSL_WARN_AS_ERR) - set (warn_opt WARN_AS_ERR) + list (APPEND extra_opts WARN_AS_ERR) endif () set (ccache_opt) -if ((UNIX) AND (COMMSDSL_USE_CCACHE)) - set (ccache_opt USE_CCACHE) +if (COMMSDSL_USE_CCACHE) + list (APPEND extra_opts USE_CCACHE) endif () -commsdsl_compile(${warn_opt} ${ccache_opt}) +commsdsl_compile(${extra_opts}) commsdsl_msvc_force_warn_opt("/W4") set (COMMSDSL_FOUND_COMMS_INTERNAL OFF CACHE INTERNAL "Mark COMMS library found" FORCE) function (commsdsl_mark_comms_found) diff --git a/script/env_dev.sh b/script/env_dev.sh index bd7fc602..3d563f35 100755 --- a/script/env_dev.sh +++ b/script/env_dev.sh @@ -25,7 +25,7 @@ mkdir -p ${BUILD_DIR} cd ${BUILD_DIR} cmake .. -DCMAKE_INSTALL_PREFIX=install -DCMAKE_BUILD_TYPE=${COMMON_BUILD_TYPE} \ - -DCOMMSDSL_BUILD_UNIT_TESTS=ON -DCOMMSDSL_TEST_BUILD_DOC=ON \ + -DCOMMSDSL_USE_CCACHE=ON -DCOMMSDSL_BUILD_UNIT_TESTS=ON -DCOMMSDSL_TEST_BUILD_DOC=ON \ -DCOMMSDSL_BUILD_COMMSDSL2TEST=ON -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT=ON -DCOMMSDSL_BUILD_COMMSDSL2SWIG=ON \ -DCOMMSDSL_BUILD_COMMSDSL2EMSCRIPTEN=ON ${CXX_STANDARD_PARAM} "$@" From e0b6afb7f93889d05d755b1de4cc2711f8ab429b Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Sat, 22 Jun 2024 14:20:39 +1000 Subject: [PATCH 10/18] Allow custom ccache executable. --- CMakeLists.txt | 8 +++++--- cmake/CommsdslCompile.cmake | 12 ++++++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 60dccbed..9024bb3a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,12 +25,12 @@ option (COMMSDSL_FORCE_INTERNAL_LIBXML_BUILD "Force internal build of libxml2 wh # Additional variables to be used if needed # --------------------------- -# COMMSDSL_TESTS_CXX_STANDARD - C++ standard to use in unittests +# COMMSDSL_TESTS_CXX_STANDARD - The C++ standard to use in tests, defaults to 11 # COMMSDSL_TESTS_C_COMPILER - C compiler to build unittests # COMMSDSL_TESTS_CXX_COMPILER - C++ compiler to build unittests # COMMSDSL_EXTERNALS_DIR - Directory to contain sources for external projects, defaults to ${PROJECT_SOURCE_DIR}/externals. # COMMSDSL_TESTS_QT_VERSION - The major Qt version for tests, defaults to 5 -# COMMSDSL_TESTS_CXX_STANDARD - The C++ standard to use in tests, defaults to 11 +# COMMSDSL_CCACHE_EXECUTABLE - Path to ccache executable # Other used CMake variables # CMAKE_CXX_STANDARD - The C++ standard to use during the compilation, defaults to 17 (min) @@ -95,9 +95,11 @@ if (COMMSDSL_WARN_AS_ERR) list (APPEND extra_opts WARN_AS_ERR) endif () -set (ccache_opt) if (COMMSDSL_USE_CCACHE) list (APPEND extra_opts USE_CCACHE) + if (NOT "${COMMSDSL_CCACHE_EXECUTABLE}" STREQUAL "") + list (APPEND extra_opts CCACHE_EXECUTABLE "${COMMSDSL_CCACHE_EXECUTABLE}") + endif () endif () commsdsl_compile(${extra_opts}) diff --git a/cmake/CommsdslCompile.cmake b/cmake/CommsdslCompile.cmake index 1dc357e0..5a1e3e45 100644 --- a/cmake/CommsdslCompile.cmake +++ b/cmake/CommsdslCompile.cmake @@ -5,6 +5,7 @@ # commsdsl_compile( # [WARN_AS_ERR] # [USE_CCACHE] +# [CCACHE_EXECUTABLE /path/to/ccache] # ) # # - WARN_AS_ERR - Treat warnings as errors. @@ -100,10 +101,13 @@ macro (commsdsl_compile) endif () if (COMMSDSL_COMPILE_USE_CCACHE) - find_program(CCACHE_EXECUTABLE ccache) - if (CCACHE_EXECUTABLE) - set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_EXECUTABLE}) - set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE_EXECUTABLE}) + if (NOT COMMSDSL_COMPILE_CCACHE_EXECUTABLE) + find_program(COMMSDSL_COMPILE_CCACHE_EXECUTABLE ccache) + endif () + + if (COMMSDSL_COMPILE_CCACHE_EXECUTABLE) + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${COMMSDSL_COMPILE_CCACHE_EXECUTABLE}) + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${COMMSDSL_COMPILE_CCACHE_EXECUTABLE}) endif () endif () endmacro() From 5cff9036afde3b9e58cf54835b8f07c354422871 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Sat, 22 Jun 2024 14:28:41 +1000 Subject: [PATCH 11/18] Added windows-2022 runner to the github actions. --- .github/workflows/actions_build.yml | 62 ++++++++++++++++++++++++++++- script/prepare_externals.bat | 6 +++ 2 files changed, 67 insertions(+), 1 deletion(-) diff --git a/.github/workflows/actions_build.yml b/.github/workflows/actions_build.yml index 8eaf77a3..2c3644a6 100644 --- a/.github/workflows/actions_build.yml +++ b/.github/workflows/actions_build.yml @@ -483,4 +483,64 @@ jobs: shell: cmd run: cmake --build . --config ${{matrix.type}} --target install env: - VERBOSE: 1 \ No newline at end of file + VERBOSE: 1 + + - name: Testing + working-directory: ${{runner.workspace}}/build + shell: bash + run: ctest -V + + build_msvc_2022: + runs-on: windows-2022 + strategy: + fail-fast: false + matrix: + type: [Debug, Release, MinSizeRel] + arch: [x64] + cpp: [11, 14, 17, 20] + + steps: + - uses: actions/checkout@v4 + + - name: Create Build Environment + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Prepare externals + shell: cmd + run: | + %GITHUB_WORKSPACE%\script\prepare_externals.bat + env: + BUILD_DIR: ${{runner.workspace}}/build + PLATFORM: ${{matrix.arch}} + EXTERNALS_DIR: ${{runner.workspace}}/externals + COMMON_INSTALL_DIR: ${{runner.workspace}}/build/install + COMMON_BUILD_TYPE: ${{matrix.type}} + COMMON_CXX_STANDARD: ${{matrix.cpp}} + COMMS_TAG: ${{env.COMMS_TAG}} + CC_TOOLS_QT_SKIP: 1 + + - name: Configure CMake + shell: cmd + working-directory: ${{runner.workspace}}/build + run: | + cmake %GITHUB_WORKSPACE% -A ${{matrix.arch}} -DCMAKE_BUILD_TYPE=${{matrix.type}} -DCMAKE_INSTALL_PREFIX=install ^ + -DCMAKE_PREFIX_PATH="${{runner.workspace}}/build/install;${{env.QTDIR}}" ^ + -DCOMMSDSL_TESTS_CXX_STANDARD=${{matrix.cpp}} -DCOMMSDSL_TESTS_QT_VERSION=${{matrix.qt_ver}} ^ + -DCMAKE_CXX_STANDARD=${{env.TOOLS_CXX_STANDARD}} ^ + -DCOMMSDSL_BUILD_COMMSDSL2TEST=ON -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT=ON -DCOMMSDSL_BUILD_UNIT_TESTS=ON ^ + -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT_TESTS=OFF + env: + TOOLS_CXX_STANDARD: "${{ matrix.cpp >= 17 && matrix.cpp || '17' }}" + + - name: Build Target + working-directory: ${{runner.workspace}}/build + shell: cmd + run: cmake --build . --config ${{matrix.type}} --target install + env: + VERBOSE: 1 + + - name: Testing + working-directory: ${{runner.workspace}}/build + shell: bash + run: ctest -V + \ No newline at end of file diff --git a/script/prepare_externals.bat b/script/prepare_externals.bat index 4c03de7e..bb0cf0e0 100755 --- a/script/prepare_externals.bat +++ b/script/prepare_externals.bat @@ -9,6 +9,7 @@ rem COMMS_TAG - (Optional) Tag of the COMMS library rem CC_TOOLS_QT_REPO - (Optional) Repository of the cc_tools_qt rem CC_TOOLS_QT_TAG - (Optional) Tag of the cc_tools_qt rem CC_TOOLS_QT_MAJOR_QT_VERSION - (Optional) Major version of the Qt library +rem CC_TOOLS_QT_SKIP - (Optional) Skip build of cc_tools_qt rem COMMON_INSTALL_DIR - (Optional) Common directory to perform installations rem COMMON_BUILD_TYPE - (Optional) CMake build type rem COMMON_CXX_STANDARD - (Optional) CMake C++ standard @@ -79,6 +80,11 @@ if %COMMON_CXX_STANDARD% LSS 17 ( goto cc_tools_qt_end ) +if %CC_TOOLS_QT_SKIP% GTR 0 ( + echo "Skipping build of cc_tools_qt" + goto cc_tools_qt_end +) + if exist %CC_TOOLS_QT_SRC_DIR%/.git ( echo "Updating cc_tools_qt..." cd %CC_TOOLS_QT_SRC_DIR% From b37f895e40f112edb09e445502b13307215ef429 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Sat, 22 Jun 2024 15:59:49 +1000 Subject: [PATCH 12/18] Allow using ccache in the generated projects. --- app/commsdsl2emscripten/src/EmscriptenCmake.cpp | 13 +++++++++++++ app/commsdsl2emscripten/test/CMakeLists.txt | 2 ++ app/commsdsl2swig/src/SwigCmake.cpp | 17 ++++++++++++++++- app/commsdsl2swig/test/CMakeLists.txt | 2 ++ app/commsdsl2test/src/TestCmake.cpp | 17 +++++++++++++++-- app/commsdsl2test/test/CMakeLists.txt | 3 +++ app/commsdsl2tools_qt/src/ToolsQtCmake.cpp | 17 +++++++++++++++-- app/commsdsl2tools_qt/test/CMakeLists.txt | 3 +++ script/full_build.sh | 1 + script/prepare_externals.sh | 8 ++++++++ 10 files changed, 78 insertions(+), 5 deletions(-) diff --git a/app/commsdsl2emscripten/src/EmscriptenCmake.cpp b/app/commsdsl2emscripten/src/EmscriptenCmake.cpp index df638c6e..c1e24b89 100644 --- a/app/commsdsl2emscripten/src/EmscriptenCmake.cpp +++ b/app/commsdsl2emscripten/src/EmscriptenCmake.cpp @@ -65,12 +65,15 @@ bool EmscriptenCmake::emscriptenWriteInternal() const "option (OPT_MODULARIZE \"Force usage of -sMODULARIZE as linker parameter.\" OFF)\n" "option (OPT_FIND_COMMS \"Use find_package to find COMMS headers-only library.\" OFF)\n" "option (OPT_FIND_PROTOCOL \"Use find_package to find protocol definition headers-only library.\" OFF)\n" + "option (OPT_USE_CCACHE \"Use ccache\" OFF)\n" "\n" "# Extra input parameters:\n" "# OPT_PROTOCOL_NAME - Optional parameter to override expected protocol definition project name. Defaults to #^#PROJ_NAME#$#.\n" "# OPT_INSTALL_DIR - Optional parameter to override installation sub-directory. Defaults to \"js\".\n" "# OPT_EXTRA_INCLUDE_DIRS - Optional parameter to provide extra include directories for the dependencies.\n" + "# OPT_CCACHE_EXECUTABLE - Custom ccache executable\n" "\n" + "######################################################################\n\n" "if (NOT EMSCRIPTEN)\n" " message (FATAL_ERROR \"Expected to be wrapped in emcmake\")\n" "endif ()\n\n" @@ -86,6 +89,16 @@ bool EmscriptenCmake::emscriptenWriteInternal() const "if (OPT_FIND_PROTOCOL)\n" " find_package(${OPT_PROTOCOL_NAME} REQUIRED)\n" "endif ()\n\n" + "if (OPT_USE_CCACHE)\n" + " if (\"${OPT_CCACHE_EXECUTABLE}\" STREQUAL \"\")\n" + " find_program(ccache_exe ccache REQUIRED)\n" + " set (OPT_CCACHE_EXECUTABLE ${ccache_exe})\n" + " endif ()\n\n" + " if (OPT_CCACHE_EXECUTABLE)\n" + " set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${OPT_CCACHE_EXECUTABLE})\n" + " set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${OPT_CCACHE_EXECUTABLE})\n" + " endif ()\n" + "endif()\n\n" "set (src\n" " #^#SOURCES#$#\n" " #^#EXTRA_SOURCES#$#\n" diff --git a/app/commsdsl2emscripten/test/CMakeLists.txt b/app/commsdsl2emscripten/test/CMakeLists.txt index bf337353..70b783dc 100644 --- a/app/commsdsl2emscripten/test/CMakeLists.txt +++ b/app/commsdsl2emscripten/test/CMakeLists.txt @@ -93,6 +93,8 @@ foreach (name ${tests}) -DCMAKE_INSTALL_PREFIX=${install_dir} -DOPT_MODULARIZE=ON -DOPT_EXTRA_INCLUDE_DIRS=${extra_includes_path_str} + -DOPT_USE_CCACHE=${COMMSDSL_USE_CCACHE} + -DOPT_CCACHE_EXECUTABLE=${COMMSDSL_CCACHE_EXECUTABLE} ) add_dependencies(${APP_NAME}.all_tests ${build_tgt}) diff --git a/app/commsdsl2swig/src/SwigCmake.cpp b/app/commsdsl2swig/src/SwigCmake.cpp index 04a999b9..6884ccd8 100644 --- a/app/commsdsl2swig/src/SwigCmake.cpp +++ b/app/commsdsl2swig/src/SwigCmake.cpp @@ -54,10 +54,15 @@ bool SwigCmake::swigWriteInternal() const const std::string Templ = "cmake_minimum_required (VERSION 3.12)\n" "project (#^#PROJ_NAME#$#_swig)\n\n" + "option (OPT_USE_CCACHE \"Use ccache\" OFF)\n" + "\n" "# Input parameters:\n" "# OPT_SWIG_LANGUAGES - Mandatory list of target languages for which bindings need to be generated\n" "# OPT_PROTOCOL_NAME - Optional parameter to override expected default protocol name. Defaults to #^#PROJ_NAME#$#.\n" - "# OPT_PROTOCOL_TARGET - Optional parameter to override expected protocol definition target. Defaults to cc::${OPT_PROTOCOL_NAME}.\n\n" + "# OPT_PROTOCOL_TARGET - Optional parameter to override expected protocol definition target. Defaults to cc::${OPT_PROTOCOL_NAME}.\n" + "# OPT_CCACHE_EXECUTABLE - Custom ccache executable\n" + "\n" + "######################################################################\n\n" "if (\"${OPT_SWIG_LANGUAGES}\" STREQUAL \"\")\n" " message (FATAL_ERROR \"List of target languages are not provided, use OPT_SWIG_LANGUAGES variable to do so.\")\n" "endif ()\n\n" @@ -73,6 +78,16 @@ bool SwigCmake::swigWriteInternal() const "find_package(LibComms REQUIRED)\n" "find_package(SWIG REQUIRED COMPONENTS ${OPT_SWIG_LANGUAGES})\n" "find_package(${OPT_PROTOCOL_NAME} REQUIRED) # Protocol definition needs to be built\n\n" + "if (OPT_USE_CCACHE)\n" + " if (\"${OPT_CCACHE_EXECUTABLE}\" STREQUAL \"\")\n" + " find_program(ccache_exe ccache REQUIRED)\n" + " set (OPT_CCACHE_EXECUTABLE ${ccache_exe})\n" + " endif ()\n\n" + " if (OPT_CCACHE_EXECUTABLE)\n" + " set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${OPT_CCACHE_EXECUTABLE})\n" + " set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${OPT_CCACHE_EXECUTABLE})\n" + " endif ()\n" + "endif()\n\n" "if (\"${UseSWIG_TARGET_NAME_PREFERENCE}\" STREQUAL \"\")\n" " set (UseSWIG_TARGET_NAME_PREFERENCE STANDARD)\n" "endif ()\n\n" diff --git a/app/commsdsl2swig/test/CMakeLists.txt b/app/commsdsl2swig/test/CMakeLists.txt index 040579f6..63cb07bc 100644 --- a/app/commsdsl2swig/test/CMakeLists.txt +++ b/app/commsdsl2swig/test/CMakeLists.txt @@ -97,6 +97,8 @@ foreach (name ${tests}) -DCMAKE_INSTALL_PREFIX=${install_dir} -DCMAKE_PREFIX_PATH=${build_prefix_path_str} -DOPT_SWIG_LANGUAGES=${languages_str} + -DOPT_USE_CCACHE=${COMMSDSL_USE_CCACHE} + -DOPT_CCACHE_EXECUTABLE=${COMMSDSL_CCACHE_EXECUTABLE} INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "Skipping install" ) diff --git a/app/commsdsl2test/src/TestCmake.cpp b/app/commsdsl2test/src/TestCmake.cpp index b0591b96..ce870ac5 100644 --- a/app/commsdsl2test/src/TestCmake.cpp +++ b/app/commsdsl2test/src/TestCmake.cpp @@ -89,7 +89,7 @@ bool TestCmake::testWriteInternal() const "cmake_minimum_required (VERSION 3.10)\n" "project (\"#^#PROJ_NAME#$#_test\")\n\n" "option (OPT_WARN_AS_ERR \"Treat warning as error\" ON)\n" - "option (OPT_USE_CCACHE \"Use of ccache on UNIX system\" ON)\n" + "option (OPT_USE_CCACHE \"Use of ccache\" OFF)\n\n" "# Other parameters:\n" "# OPT_TEST_RENAME - Rename the final test application.\n" "# OPT_TEST_OPTIONS - Class name of the options for test applications,\n" @@ -101,6 +101,9 @@ bool TestCmake::testWriteInternal() const "# OPT_TEST_INPUT_MESSAGES - All input messages bundle for test applications,\n" "# defaults to #^#INPUT_SCOPE#$#.\n" "# OPT_MSVC_FORCE_WARN_LEVEL - Force msvc warning level\n\n" + "# Extra configuration variables:\n" + "# OPT_CCACHE_EXECUTABLE - Custom ccache executable\n\n" + "######################################################################\n\n" "if (\"${CMAKE_CXX_STANDARD}\" STREQUAL \"\")\n" " set(CMAKE_CXX_STANDARD 11)\n" "endif()\n\n" @@ -162,8 +165,18 @@ bool TestCmake::testWriteInternal() const "######################################################################\n\n" "find_package (LibComms REQUIRED)\n" "find_package (#^#PROJ_NS#$# REQUIRED)\n\n" + "set (extra_opts)\n" + "if (OPT_WARN_AS_ERR)\n" + " list(APPEND extra_opts WARN_AS_ERR)\n" + "endif()\n\n" + "if (OPT_USE_CCACHE)\n" + " list(APPEND extra_opts USE_CCACHE)\n" + " if (NOT \"${OPT_CCACHE_EXECUTABLE}\" STREQUAL \"\")\n" + " list(APPEND extra_opts CCACHE_EXECUTABLE \"${OPT_CCACHE_EXECUTABLE}\")\n" + " endif()\n" + "endif()\n\n" "include(${LibComms_DIR}/CC_Compile.cmake)\n" - "cc_compile(WARN_AS_ERR)\n" + "cc_compile(${extra_opts})\n" "cc_msvc_force_warn_opt(/W4)\n\n" "if (\"${OPT_TEST_INTERFACE}\" STREQUAL \"\")\n" " set (OPT_TEST_INTERFACE \"#^#INTERFACE_SCOPE#$#\")\n" diff --git a/app/commsdsl2test/test/CMakeLists.txt b/app/commsdsl2test/test/CMakeLists.txt index 43445748..eca4be96 100644 --- a/app/commsdsl2test/test/CMakeLists.txt +++ b/app/commsdsl2test/test/CMakeLists.txt @@ -88,6 +88,9 @@ foreach (name ${tests}) -DCMAKE_INSTALL_PREFIX=${install_dir} -DCMAKE_PREFIX_PATH=${build_prefix_path_str} ${options_param} + -DOPT_WARN_AS_ERR=ON + -DOPT_USE_CCACHE=${COMMSDSL_USE_CCACHE} + -DOPT_CCACHE_EXECUTABLE=${COMMSDSL_CCACHE_EXECUTABLE} ) add_dependencies(${APP_NAME}.all_tests ${build_tgt}) diff --git a/app/commsdsl2tools_qt/src/ToolsQtCmake.cpp b/app/commsdsl2tools_qt/src/ToolsQtCmake.cpp index 334177d6..4918e1e1 100644 --- a/app/commsdsl2tools_qt/src/ToolsQtCmake.cpp +++ b/app/commsdsl2tools_qt/src/ToolsQtCmake.cpp @@ -60,9 +60,12 @@ bool ToolsQtCmake::testWriteInternal() const "cmake_minimum_required (VERSION 3.10)\n" "project (\"#^#MAIN_NS#$#_cc_tools_qt_plugin\")\n\n" "# Build options:\n" + "option (OPT_WARN_AS_ERR \"Treat warnings as errors\" ON)\n" + "option (OPT_USE_CCACHE \"Use ccache\" OFF)\n" "option (OPT_INSTALL_DEFAULT_CONFIG \"Install default plugin configuration\" ON)\n\n" "# Configuration variables:\n" - "# OPT_QT_MAJOR_VERSION - The major Qt version, defaults to 5\n\n" + "# OPT_QT_MAJOR_VERSION - The major Qt version, defaults to 5\n" + "# OPT_CCACHE_EXECUTABLE - Custom ccache executable\n\n" "######################################################################\n\n" "if (\"${OPT_QT_MAJOR_VERSION}\" STREQUAL \"\")\n" " set(OPT_QT_MAJOR_VERSION 5)\n" @@ -80,8 +83,18 @@ bool ToolsQtCmake::testWriteInternal() const "set (CMAKE_AUTOMOC ON)\n" "set (CMAKE_AUTOUIC ON)\n" "set (CMAKE_AUTORCC ON)\n\n" + "set (extra_opts)\n" + "if (OPT_WARN_AS_ERR)\n" + " list(APPEND extra_opts WARN_AS_ERR)\n" + "endif()\n\n" + "if (OPT_USE_CCACHE)\n" + " list(APPEND extra_opts USE_CCACHE)\n" + " if (NOT \"${OPT_CCACHE_EXECUTABLE}\" STREQUAL \"\")\n" + " list(APPEND extra_opts CCACHE_EXECUTABLE \"${OPT_CCACHE_EXECUTABLE}\")\n" + " endif()\n" + "endif()\n\n" "include(${LibComms_DIR}/CC_Compile.cmake)\n" - "cc_compile(WARN_AS_ERR)\n" + "cc_compile(${extra_opts})\n" "cc_msvc_force_warn_opt(/W4)\n\n" "include(GNUInstallDirs)\n\n" "set (CORE_LIB_NAME \"cc_tools_qt_plugin_#^#MAIN_NS#$#_protocol_core\")\n\n" diff --git a/app/commsdsl2tools_qt/test/CMakeLists.txt b/app/commsdsl2tools_qt/test/CMakeLists.txt index 22ca1cfa..06f2dc87 100644 --- a/app/commsdsl2tools_qt/test/CMakeLists.txt +++ b/app/commsdsl2tools_qt/test/CMakeLists.txt @@ -106,6 +106,9 @@ foreach (name ${tests}) -DCMAKE_CXX_STANDARD=${COMMSDSL_TESTS_CXX_STANDARD} -DCMAKE_INSTALL_PREFIX=${install_dir} -DCMAKE_PREFIX_PATH=${build_prefix_path_str} + -DOPT_WARN_AS_ERR=ON + -DOPT_USE_CCACHE=${COMMSDSL_USE_CCACHE} + -DOPT_CCACHE_EXECUTABLE=${COMMSDSL_CCACHE_EXECUTABLE} -DOPT_QT_MAJOR_VERSION=${COMMSDSL_TESTS_QT_VERSION} ) diff --git a/script/full_build.sh b/script/full_build.sh index 9ac89251..d53b2319 100755 --- a/script/full_build.sh +++ b/script/full_build.sh @@ -15,6 +15,7 @@ ROOT_DIR=$( dirname ${SCRIPT_DIR} ) export BUILD_DIR="${ROOT_DIR}/build.full.${CC}.${COMMON_BUILD_TYPE}" export COMMON_INSTALL_DIR=${BUILD_DIR}/install export EXTERNALS_DIR=${ROOT_DIR}/externals +export COMMON_USE_CCACHE=ON mkdir -p ${BUILD_DIR} CXX_STANDARD_PARAM= diff --git a/script/prepare_externals.sh b/script/prepare_externals.sh index 54fc617c..c215df37 100755 --- a/script/prepare_externals.sh +++ b/script/prepare_externals.sh @@ -16,6 +16,8 @@ # COMMON_CXX_STANDARD - (Optional) CMake C++ standard # COMMON_CMAKE_GENERATOR - (Optional) CMake generator # COMMON_CMAKE_PLATFORM - (Optional) CMake platform +# COMMON_USE_CCACHE - (Optional) Common "use ccache" parameter +# COMMON_CCACHE_EXECUTABLE - (Optional) Common ccache executable ##################################### @@ -66,6 +68,10 @@ if [ -n "${CC_TOOLS_QT_MAJOR_QT_VERSION}" ]; then CC_TOOLS_QT_VERSION_OPT="-DCC_TOOLS_QT_MAJOR_QT_VERSION=${CC_TOOLS_QT_MAJOR_QT_VERSION}" fi +if [ -z "${COMMON_USE_CCACHE}" ]; then + COMMON_USE_CCACHE="OFF" +fi + procs=$(nproc) if [ -n "${procs}" ]; then procs_param="-- -j${procs}" @@ -117,6 +123,8 @@ function build_cc_tools_qt() { mkdir -p ${CC_TOOLS_QT_BUILD_DIR} cmake -S ${CC_TOOLS_QT_SRC_DIR} -B ${CC_TOOLS_QT_BUILD_DIR} \ ${COMMON_CMAKE_GENERATOR:+"-G ${COMMON_CMAKE_GENERATOR}"} ${COMMON_CMAKE_PLATFORM:+"-A ${COMMON_CMAKE_PLATFORM}"} \ + ${COMMON_USE_CCACHE:+"-DCC_TOOLS_QT_USE_CCACHE=${COMMON_USE_CCACHE}"} \ + ${COMMON_CCACHE_EXECUTABLE:+"-DCC_TOOLS_QT_CCACHE_EXECUTABLE=${COMMON_CCACHE_EXECUTABLE}"} \ -DCMAKE_INSTALL_PREFIX=${CC_TOOLS_QT_INSTALL_DIR} \ -DCMAKE_BUILD_TYPE=${COMMON_BUILD_TYPE} -DCC_TOOLS_QT_BUILD_APPS=OFF -DCMAKE_PREFIX_PATH=${COMMS_INSTALL_DIR} \ -DCMAKE_CXX_STANDARD=${COMMON_CXX_STANDARD} ${CC_TOOLS_QT_VERSION_OPT} From bf517a40dd9a2dd4f16d41575b5f3cf6cbeb7e48 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Sat, 22 Jun 2024 16:01:32 +1000 Subject: [PATCH 13/18] Using develop branch of the comms library in github actions. --- .github/workflows/actions_build.yml | 2 +- app/commsdsl2comms/src/CommsGenerator.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/actions_build.yml b/.github/workflows/actions_build.yml index 2c3644a6..254c1f3a 100644 --- a/.github/workflows/actions_build.yml +++ b/.github/workflows/actions_build.yml @@ -3,7 +3,7 @@ name: Github Actions Build on: [push] env: - COMMS_TAG: v5.2.4 + COMMS_TAG: develop CC_TOOLS_QT_TAG: v5.3.1 jobs: diff --git a/app/commsdsl2comms/src/CommsGenerator.cpp b/app/commsdsl2comms/src/CommsGenerator.cpp index 4c22762e..31cba33f 100644 --- a/app/commsdsl2comms/src/CommsGenerator.cpp +++ b/app/commsdsl2comms/src/CommsGenerator.cpp @@ -68,7 +68,7 @@ namespace util = commsdsl::gen::util; namespace commsdsl2comms { -const std::string MinCommsVersion("5.2.4"); +const std::string MinCommsVersion("5.2.5"); const std::string& CommsGenerator::commsFileGeneratedComment() { From 0b717ef319b5b92bec4b862b23e6de3913ac3ed2 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Sun, 23 Jun 2024 10:02:47 +1000 Subject: [PATCH 14/18] Fixing externals preparation scripts. --- script/prepare_externals.bat | 5 ++++- script/prepare_externals.sh | 27 +++++++++++---------------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/script/prepare_externals.bat b/script/prepare_externals.bat index bb0cf0e0..4a1a02a3 100755 --- a/script/prepare_externals.bat +++ b/script/prepare_externals.bat @@ -32,8 +32,12 @@ if [%CC_TOOLS_QT_REPO%] == [] set CC_TOOLS_QT_REPO="https://github.com/commscham if [%CC_TOOLS_QT_TAG%] == [] set CC_TOOLS_QT_TAG="master" +if [%CC_TOOLS_QT_SKIP%] == [] set CC_TOOLS_QT_SKIP=0 + if [%COMMON_BUILD_TYPE%] == [] set COMMON_BUILD_TYPE=Debug +if [%COMMON_CXX_STANDARD%] == [] set COMMON_CXX_STANDARD=11 + set COMMS_SRC_DIR=%EXTERNALS_DIR%/comms set COMMS_BUILD_DIR=%BUILD_DIR%/externals/comms/build set COMMS_INSTALL_DIR=%COMMS_BUILD_DIR%/install @@ -46,7 +50,6 @@ if NOT [%COMMON_INSTALL_DIR%] == [] set CC_TOOLS_QT_INSTALL_DIR=%COMMON_INSTALL_ set CC_TOOLS_QT_VERSION_OPT= if NOT [%CC_TOOLS_QT_MAJOR_QT_VERSION%] == [] set CC_TOOLS_QT_VERSION_OPT="-DCC_TOOLS_QT_MAJOR_QT_VERSION=%CC_TOOLS_QT_MAJOR_QT_VERSION%" - rem ---------------------------------------------------- mkdir "%EXTERNALS_DIR%" diff --git a/script/prepare_externals.sh b/script/prepare_externals.sh index c215df37..e4ad24a1 100755 --- a/script/prepare_externals.sh +++ b/script/prepare_externals.sh @@ -50,6 +50,10 @@ if [ -z "${COMMON_BUILD_TYPE}" ]; then COMMON_BUILD_TYPE=Debug fi +if [ -z "${COMMON_CXX_STANDARD}" ]; then + COMMON_CXX_STANDARD="11" +fi + COMMS_SRC_DIR=${EXTERNALS_DIR}/comms COMMS_BUILD_DIR=${BUILD_DIR}/externals/comms/build COMMS_INSTALL_DIR=${COMMS_BUILD_DIR}/install @@ -63,14 +67,6 @@ CC_TOOLS_QT_INSTALL_DIR=${CC_TOOLS_QT_BUILD_DIR}/install if [ -n "${COMMON_INSTALL_DIR}" ]; then CC_TOOLS_QT_INSTALL_DIR=${COMMON_INSTALL_DIR} fi -CC_TOOLS_QT_VERSION_OPT= -if [ -n "${CC_TOOLS_QT_MAJOR_QT_VERSION}" ]; then - CC_TOOLS_QT_VERSION_OPT="-DCC_TOOLS_QT_MAJOR_QT_VERSION=${CC_TOOLS_QT_MAJOR_QT_VERSION}" -fi - -if [ -z "${COMMON_USE_CCACHE}" ]; then - COMMON_USE_CCACHE="OFF" -fi procs=$(nproc) if [ -n "${procs}" ]; then @@ -101,11 +97,9 @@ function build_comms() { } function build_cc_tools_qt() { - if [ -n "${COMMON_CXX_STANDARD}" ]; then - if [ ${COMMON_CXX_STANDARD} -lt 17 ]; then - echo "Skipping build of cc_tools_qt due to old C++ standard" - return; - fi + if [ ${COMMON_CXX_STANDARD} -lt 17 ]; then + echo "Skipping build of cc_tools_qt due to old C++ standard" + return; fi if [ -e ${CC_TOOLS_QT_SRC_DIR}/.git ]; then @@ -123,11 +117,12 @@ function build_cc_tools_qt() { mkdir -p ${CC_TOOLS_QT_BUILD_DIR} cmake -S ${CC_TOOLS_QT_SRC_DIR} -B ${CC_TOOLS_QT_BUILD_DIR} \ ${COMMON_CMAKE_GENERATOR:+"-G ${COMMON_CMAKE_GENERATOR}"} ${COMMON_CMAKE_PLATFORM:+"-A ${COMMON_CMAKE_PLATFORM}"} \ + -DCMAKE_INSTALL_PREFIX=${CC_TOOLS_QT_INSTALL_DIR} -DCMAKE_BUILD_TYPE=${COMMON_BUILD_TYPE} \ + -DCMAKE_PREFIX_PATH=${COMMS_INSTALL_DIR} -DCMAKE_CXX_STANDARD=${COMMON_CXX_STANDARD} \ ${COMMON_USE_CCACHE:+"-DCC_TOOLS_QT_USE_CCACHE=${COMMON_USE_CCACHE}"} \ ${COMMON_CCACHE_EXECUTABLE:+"-DCC_TOOLS_QT_CCACHE_EXECUTABLE=${COMMON_CCACHE_EXECUTABLE}"} \ - -DCMAKE_INSTALL_PREFIX=${CC_TOOLS_QT_INSTALL_DIR} \ - -DCMAKE_BUILD_TYPE=${COMMON_BUILD_TYPE} -DCC_TOOLS_QT_BUILD_APPS=OFF -DCMAKE_PREFIX_PATH=${COMMS_INSTALL_DIR} \ - -DCMAKE_CXX_STANDARD=${COMMON_CXX_STANDARD} ${CC_TOOLS_QT_VERSION_OPT} + ${CC_TOOLS_QT_MAJOR_QT_VERSION:+"-DCC_TOOLS_QT_MAJOR_QT_VERSION=${CC_TOOLS_QT_MAJOR_QT_VERSION}"} \ + -DCC_TOOLS_QT_BUILD_APPS=OFF cmake --build ${CC_TOOLS_QT_BUILD_DIR} --config ${COMMON_BUILD_TYPE} --target install ${procs_param} } From f4f44d3c585fe0d43068f6951934acc38da5306b Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Sun, 23 Jun 2024 10:05:16 +1000 Subject: [PATCH 15/18] Temporarily disable some of the github actions builds. --- .github/workflows/actions_build.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/actions_build.yml b/.github/workflows/actions_build.yml index 254c1f3a..b6093515 100644 --- a/.github/workflows/actions_build.yml +++ b/.github/workflows/actions_build.yml @@ -8,6 +8,7 @@ env: jobs: build_gcc_old_ubuntu_20_04: + if: false runs-on: ubuntu-20.04 strategy: fail-fast: false @@ -77,6 +78,7 @@ jobs: run: ctest build_gcc_ubuntu_20_04: + if: false runs-on: ubuntu-20.04 strategy: fail-fast: false @@ -138,6 +140,7 @@ jobs: run: ctest build_gcc_ubuntu_22_04: + if: false runs-on: ubuntu-22.04 strategy: fail-fast: false @@ -207,6 +210,7 @@ jobs: build_clang_old_ubuntu_20_04: + if: false runs-on: ubuntu-20.04 strategy: fail-fast: false @@ -279,6 +283,7 @@ jobs: run: ctest build_clang_ubuntu_20_04: + if: false runs-on: ubuntu-20.04 strategy: fail-fast: false @@ -346,6 +351,7 @@ jobs: run: ctest build_clang_ubuntu_22_04: + if: false runs-on: ubuntu-22.04 strategy: fail-fast: false @@ -491,6 +497,7 @@ jobs: run: ctest -V build_msvc_2022: + if: false runs-on: windows-2022 strategy: fail-fast: false From a0af0859782d27dcf1930e17d9e6c21c72c9981e Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Sun, 23 Jun 2024 10:52:35 +1000 Subject: [PATCH 16/18] Revert "Temporarily disable some of the github actions builds." This reverts commit f4f44d3c585fe0d43068f6951934acc38da5306b. --- .github/workflows/actions_build.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/actions_build.yml b/.github/workflows/actions_build.yml index b6093515..254c1f3a 100644 --- a/.github/workflows/actions_build.yml +++ b/.github/workflows/actions_build.yml @@ -8,7 +8,6 @@ env: jobs: build_gcc_old_ubuntu_20_04: - if: false runs-on: ubuntu-20.04 strategy: fail-fast: false @@ -78,7 +77,6 @@ jobs: run: ctest build_gcc_ubuntu_20_04: - if: false runs-on: ubuntu-20.04 strategy: fail-fast: false @@ -140,7 +138,6 @@ jobs: run: ctest build_gcc_ubuntu_22_04: - if: false runs-on: ubuntu-22.04 strategy: fail-fast: false @@ -210,7 +207,6 @@ jobs: build_clang_old_ubuntu_20_04: - if: false runs-on: ubuntu-20.04 strategy: fail-fast: false @@ -283,7 +279,6 @@ jobs: run: ctest build_clang_ubuntu_20_04: - if: false runs-on: ubuntu-20.04 strategy: fail-fast: false @@ -351,7 +346,6 @@ jobs: run: ctest build_clang_ubuntu_22_04: - if: false runs-on: ubuntu-22.04 strategy: fail-fast: false @@ -497,7 +491,6 @@ jobs: run: ctest -V build_msvc_2022: - if: false runs-on: windows-2022 strategy: fail-fast: false From 777f9528f8b543ca22c458f82db9184f73660796 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Sun, 23 Jun 2024 11:05:25 +1000 Subject: [PATCH 17/18] Building the code generators with sanitizers. --- .github/workflows/actions_build.yml | 12 ++++++--- CMakeLists.txt | 5 ++++ app/commsdsl2comms/src/CommsEnumField.cpp | 30 +++++++++++++++++++---- app/commsdsl2comms/test/CMakeLists.txt | 1 + cmake/CommsdslCompile.cmake | 11 ++++++++- script/env_dev.sh | 8 ++---- script/full_build.sh | 9 +++---- 7 files changed, 55 insertions(+), 21 deletions(-) diff --git a/.github/workflows/actions_build.yml b/.github/workflows/actions_build.yml index 254c1f3a..943748d0 100644 --- a/.github/workflows/actions_build.yml +++ b/.github/workflows/actions_build.yml @@ -119,7 +119,8 @@ jobs: -DCMAKE_PREFIX_PATH=${{runner.workspace}}/build/install -DCOMMSDSL_TESTS_CXX_STANDARD=${{matrix.cpp}} \ -DCOMMSDSL_BUILD_UNIT_TESTS=ON -DCOMMSDSL_TEST_BUILD_DOC=ON \ -DCOMMSDSL_BUILD_COMMSDSL2TEST=ON -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT=ON \ - -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT_TESTS=${{env.BUILD_TOOLS_QT_UNIT_TESTS}} + -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT_TESTS=${{env.BUILD_TOOLS_QT_UNIT_TESTS}} \ + -DCOMMSDSL_BUILD_WITH_SANITIZERS=ON env: CC: gcc-${{matrix.cc_ver}} CXX: g++-${{matrix.cc_ver}} @@ -186,7 +187,8 @@ jobs: -DCOMMSDSL_BUILD_UNIT_TESTS=ON -DCOMMSDSL_TEST_BUILD_DOC=ON -DCMAKE_IGNORE_PATH=/usr/local/bin \ -DCOMMSDSL_BUILD_COMMSDSL2TEST=ON -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT=ON \ -DCOMMSDSL_BUILD_COMMSDSL2SWIG=ON -DCOMMSDSL_BUILD_COMMSDSL2EMSCRIPTEN=ON \ - -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT_TESTS=${{env.BUILD_TOOLS_QT_UNIT_TESTS}} + -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT_TESTS=${{env.BUILD_TOOLS_QT_UNIT_TESTS}} \ + -DCOMMSDSL_BUILD_WITH_SANITIZERS=ON env: CC: gcc-${{matrix.cc_ver}} CXX: g++-${{matrix.cc_ver}} @@ -326,7 +328,8 @@ jobs: -DCMAKE_PREFIX_PATH=${{runner.workspace}}/build/install -DCOMMSDSL_TESTS_CXX_STANDARD=${{matrix.cpp}} \ -DCMAKE_CXX_STANDARD=${{env.TOOLS_CXX_STANDARD}} -DCOMMSDSL_BUILD_UNIT_TESTS=ON \ -DCOMMSDSL_BUILD_COMMSDSL2TEST=ON -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT=ON \ - -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT_TESTS=${{env.BUILD_TOOLS_QT_UNIT_TESTS}} + -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT_TESTS=${{env.BUILD_TOOLS_QT_UNIT_TESTS}} \ + -DCOMMSDSL_BUILD_WITH_SANITIZERS=ON env: CC: clang-${{matrix.cc_ver}} CXX: clang++-${{matrix.cc_ver}} @@ -401,7 +404,8 @@ jobs: -DCOMMSDSL_BUILD_UNIT_TESTS=ON -DCMAKE_IGNORE_PATH=/usr/local/bin \ -DCOMMSDSL_BUILD_COMMSDSL2TEST=ON -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT=ON \ -DCOMMSDSL_BUILD_COMMSDSL2SWIG=ON -DCOMMSDSL_BUILD_COMMSDSL2EMSCRIPTEN=ON \ - -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT_TESTS=${{env.BUILD_TOOLS_QT_UNIT_TESTS}} + -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT_TESTS=${{env.BUILD_TOOLS_QT_UNIT_TESTS}} \ + -DCOMMSDSL_BUILD_WITH_SANITIZERS=ON env: CC: clang-${{matrix.cc_ver}} diff --git a/CMakeLists.txt b/CMakeLists.txt index 9024bb3a..d6fa50be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,7 @@ option (COMMSDSL_BUILD_COMMSDSL2TEST "Build commsdsl2test" OFF) option (COMMSDSL_BUILD_COMMSDSL2TOOLS_QT "Build commsdsl2tools_qt" OFF) option (COMMSDSL_BUILD_COMMSDSL2SWIG "Build commsdsl2swig" OFF) option (COMMSDSL_BUILD_COMMSDSL2EMSCRIPTEN "Build commsdsl2emscripten" OFF) +option (COMMSDSL_BUILD_WITH_SANITIZERS "Build with sanitizers enables" OFF) option (COMMSDSL_INSTALL_APPS "Install applications" ON) option (COMMSDSL_BUILD_UNIT_TESTS "Build unittests." OFF) option (COMMSDSL_BUILD_COMMSDSL2COMMS_TESTS "Build commsdsl2comms unittests." ${COMMSDSL_BUILD_UNIT_TESTS}) @@ -102,6 +103,10 @@ if (COMMSDSL_USE_CCACHE) endif () endif () +if (COMMSDSL_BUILD_WITH_SANITIZERS) + list (APPEND extra_opts DEFAULT_SANITIZERS) +endif () + commsdsl_compile(${extra_opts}) commsdsl_msvc_force_warn_opt("/W4") set (COMMSDSL_FOUND_COMMS_INTERNAL OFF CACHE INTERNAL "Mark COMMS library found" FORCE) diff --git a/app/commsdsl2comms/src/CommsEnumField.cpp b/app/commsdsl2comms/src/CommsEnumField.cpp index 6a49a40a..06805ced 100644 --- a/app/commsdsl2comms/src/CommsEnumField.cpp +++ b/app/commsdsl2comms/src/CommsEnumField.cpp @@ -38,6 +38,11 @@ namespace const std::size_t MaxRangesInOpts = 5U; +std::uintmax_t asBigUnsigned(std::intmax_t val) +{ + return static_cast(val); +} + } // namespace @@ -626,13 +631,28 @@ bool CommsEnumField::commsPrepareValidRangesInternal() } } - if ((iter->m_max + 1) < nextIter->m_min) { - break; + if (bigUnsigned) { + if ((asBigUnsigned(iter->m_max) < std::numeric_limits::max()) && + ((asBigUnsigned(iter->m_max) + 1U) < asBigUnsigned(nextIter->m_min))) { + break; + } + + assert(asBigUnsigned(iter->m_min) <= asBigUnsigned(nextIter->m_min)); + nextIter->m_deprecatedSince = 0U; // invalidate next range + iter->m_max = + static_castm_max)>( + std::max(asBigUnsigned(iter->m_max), asBigUnsigned(nextIter->m_max))); } + else { + if ((iter->m_max < std::numeric_limitsm_max)>::max()) && + ((iter->m_max + 1) < nextIter->m_min)) { + break; + } - assert(iter->m_min <= nextIter->m_min); - nextIter->m_deprecatedSince = 0U; // invalidate next range - iter->m_max = std::max(iter->m_max, nextIter->m_max); + assert(iter->m_min <= nextIter->m_min); + nextIter->m_deprecatedSince = 0U; // invalidate next range + iter->m_max = std::max(iter->m_max, nextIter->m_max); + } } } diff --git a/app/commsdsl2comms/test/CMakeLists.txt b/app/commsdsl2comms/test/CMakeLists.txt index 85392a3e..e3acb90a 100644 --- a/app/commsdsl2comms/test/CMakeLists.txt +++ b/app/commsdsl2comms/test/CMakeLists.txt @@ -129,6 +129,7 @@ set (CMAKE_CXX_STANDARD ${COMMSDSL_TESTS_CXX_STANDARD}) set (COMMSDSL_SANITIZER_OPTS) if (COMMSDSL_TEST_USE_SANITIZERS AND + (NOT COMMSDSL_BUILD_WITH_SANITIZERS) AND ((CMAKE_COMPILER_IS_GNUCC) OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"))) set (COMMSDSL_SANITIZER_OPTS -fno-omit-frame-pointer diff --git a/cmake/CommsdslCompile.cmake b/cmake/CommsdslCompile.cmake index 5a1e3e45..e5b39060 100644 --- a/cmake/CommsdslCompile.cmake +++ b/cmake/CommsdslCompile.cmake @@ -4,6 +4,7 @@ # Set predefined compilation flags # commsdsl_compile( # [WARN_AS_ERR] +# [DEFAULT_SANITIZERS] # [USE_CCACHE] # [CCACHE_EXECUTABLE /path/to/ccache] # ) @@ -22,7 +23,7 @@ macro (commsdsl_compile) set (_prefix COMMSDSL_COMPILE) - set (_options WARN_AS_ERR STATIC_RUNTIME USE_CCACHE) + set (_options WARN_AS_ERR STATIC_RUNTIME USE_CCACHE DEFAULT_SANITIZERS) set (_oneValueArgs) set (_mutiValueArgs) cmake_parse_arguments(${_prefix} "${_options}" "${_oneValueArgs}" "${_mutiValueArgs}" ${ARGN}) @@ -71,6 +72,14 @@ macro (commsdsl_compile) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") list (APPEND extra_flags_list "-Wno-dangling-field -Wno-unused-command-line-argument") endif () + + if (COMMSDSL_COMPILE_DEFAULT_SANITIZERS) + list (APPEND extra_flags_list + -fno-omit-frame-pointer + -fsanitize=address + -fsanitize=undefined + -fno-sanitize-recover=all) + endif () if (COMMSDSL_COMPILE_WARN_AS_ERR) list (APPEND extra_flags_list "-Werror") diff --git a/script/env_dev.sh b/script/env_dev.sh index 3d563f35..e50689a4 100755 --- a/script/env_dev.sh +++ b/script/env_dev.sh @@ -16,17 +16,13 @@ if [ -z "${BUILD_DIR}" ]; then BUILD_DIR="${ROOT_DIR}/build.${CC}.${COMMON_BUILD_TYPE}" fi -CXX_STANDARD_PARAM= -if [ -n "${COMMON_CXX_STANDARD}" ]; then - CXX_STANDARD_PARAM="-DCMAKE_CXX_STANDARD=${COMMON_CXX_STANDARD}" -fi - mkdir -p ${BUILD_DIR} cd ${BUILD_DIR} cmake .. -DCMAKE_INSTALL_PREFIX=install -DCMAKE_BUILD_TYPE=${COMMON_BUILD_TYPE} \ + ${COMMON_CXX_STANDARD:+"-DCMAKE_CXX_STANDARD=${COMMON_CXX_STANDARD}"} \ -DCOMMSDSL_USE_CCACHE=ON -DCOMMSDSL_BUILD_UNIT_TESTS=ON -DCOMMSDSL_TEST_BUILD_DOC=ON \ -DCOMMSDSL_BUILD_COMMSDSL2TEST=ON -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT=ON -DCOMMSDSL_BUILD_COMMSDSL2SWIG=ON \ - -DCOMMSDSL_BUILD_COMMSDSL2EMSCRIPTEN=ON ${CXX_STANDARD_PARAM} "$@" + -DCOMMSDSL_BUILD_COMMSDSL2EMSCRIPTEN=ON -DCOMMSDSL_BUILD_WITH_SANITIZERS=ON"$@" diff --git a/script/full_build.sh b/script/full_build.sh index d53b2319..d8451d4c 100755 --- a/script/full_build.sh +++ b/script/full_build.sh @@ -18,13 +18,12 @@ export EXTERNALS_DIR=${ROOT_DIR}/externals export COMMON_USE_CCACHE=ON mkdir -p ${BUILD_DIR} -CXX_STANDARD_PARAM= -if [ -n "${COMMON_CXX_STANDARD}" ]; then - CXX_STANDARD_PARAM="-DCMAKE_CXX_STANDARD=${COMMON_CXX_STANDARD}" +if [ -z "${COMMON_CXX_STANDARD}" ]; then + export COMMON_CXX_STANDARD="17" fi -${SCRIPT_DIR}/prepare_externals.sh ${CXX_STANDARD_PARAM} -${SCRIPT_DIR}/env_dev.sh -DCMAKE_PREFIX_PATH=${COMMON_INSTALL_DIR} ${CXX_STANDARD_PARAM} "$@" +${SCRIPT_DIR}/prepare_externals.sh +${SCRIPT_DIR}/env_dev.sh -DCMAKE_PREFIX_PATH=${COMMON_INSTALL_DIR} "$@" procs=$(nproc) if [ -n "${procs}" ]; then From e83aaff72cbda2a6a1e5a26d1d5335c8a6f735e7 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Sun, 23 Jun 2024 11:20:14 +1000 Subject: [PATCH 18/18] Using v5.2.5 of the comms library in github actions build. --- .github/workflows/actions_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/actions_build.yml b/.github/workflows/actions_build.yml index 943748d0..08588ca3 100644 --- a/.github/workflows/actions_build.yml +++ b/.github/workflows/actions_build.yml @@ -3,7 +3,7 @@ name: Github Actions Build on: [push] env: - COMMS_TAG: develop + COMMS_TAG: v5.2.5 CC_TOOLS_QT_TAG: v5.3.1 jobs: