From 2db97c0f5eaf1a28eb53de7a3042b28d2f3ec36d Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Fri, 9 Jul 2021 14:37:27 +0200 Subject: [PATCH 01/15] Fix CMake "files" expression in pre-commit --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f929f80..a66cdac 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,7 @@ repos: rev: 'v0.6.0' hooks: - id: cmake-format # cmake formatter - files: (CMakeLists.*|.*\.cmake^|.*\.cmake.in) + files: ^(CMakeLists.*|.*\.cmake|.*\.cmake.in)$ - repo: https://github.com/pre-commit/mirrors-yapf rev: 'v0.27.0' hooks: From 86f5e19b544203cd5a3d8ff46d0f097890dcb808 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alan=20Dragomirecky=CC=81?= Date: Fri, 9 Jul 2021 23:35:56 +0200 Subject: [PATCH 02/15] Remove unused Python dependecies --- utils/bootstrap.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/bootstrap.py b/utils/bootstrap.py index 5ee1aaf..f09cdf1 100755 --- a/utils/bootstrap.py +++ b/utils/bootstrap.py @@ -61,7 +61,7 @@ dependencies = { } }, } -pip_dependencies = ['ecdsa', 'polib'] +pip_dependencies = [] # yapf: enable From 8361bd10276cc422636c4e3e6ad0b292654f497d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alan=20Dragomirecky=CC=81?= Date: Fri, 9 Jul 2021 23:49:16 +0200 Subject: [PATCH 03/15] Replace urls for gcc-avr with dummy (but working) ones --- utils/bootstrap.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/utils/bootstrap.py b/utils/bootstrap.py index f09cdf1..e01994a 100755 --- a/utils/bootstrap.py +++ b/utils/bootstrap.py @@ -45,11 +45,13 @@ dependencies = { }, }, 'gcc-avr': { - 'version': '5.4.0', + # dummy placeholder (currently downloading cmake just for the sake of a valid url/zip archive) + # ... we truly need the binaries! :) + 'version': '0.0.0', 'url': { - 'Linux': 'https://xxxarmkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/7-2018q2/gcc-arm-none-eabi-7-2018-q2-update-linux.tar.bz2', - 'Windows': 'https://xxxarmkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/7-2018q2/gcc-arm-none-eabi-7-2018-q2-update-win32.zip', - 'Darwin': 'https://xxxarmkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/7-2018q2/gcc-arm-none-eabi-7-2018-q2-update-mac.tar.bz2', + 'Linux': 'https://github.com/Kitware/CMake/releases/download/v3.15.5/cmake-3.15.5-Linux-x86_64.tar.gz', + 'Windows': 'https://github.com/Kitware/CMake/releases/download/v3.15.5/cmake-3.15.5-win64-x64.zip', + 'Darwin': 'https://github.com/Kitware/CMake/releases/download/v3.15.5/cmake-3.15.5-Darwin-x86_64.tar.gz', } }, 'clang-format': { From ba1920846904fe9ea927afb249aa2af349917db5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alan=20Dragomirecky=CC=81?= Date: Fri, 9 Jul 2021 23:50:00 +0200 Subject: [PATCH 04/15] Add Dockerfile/Jenkinsfile for Holly --- utils/holly/Dockerfile | 9 ++++ utils/holly/Jenkinsfile | 116 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+) create mode 100644 utils/holly/Dockerfile create mode 100644 utils/holly/Jenkinsfile diff --git a/utils/holly/Dockerfile b/utils/holly/Dockerfile new file mode 100644 index 0000000..c44582c --- /dev/null +++ b/utils/holly/Dockerfile @@ -0,0 +1,9 @@ +FROM gcc:11.1 +RUN apt-get clean && \ + apt-get update -qq -y && \ + apt-get install curl python3 python3-pip libncurses5 -y +RUN pip3 install pre-commit ecdsa +WORKDIR /work +ADD utils/bootstrap.py bootstrap.py +RUN gcc --version +RUN python3 bootstrap.py diff --git a/utils/holly/Jenkinsfile b/utils/holly/Jenkinsfile new file mode 100644 index 0000000..cc2d03d --- /dev/null +++ b/utils/holly/Jenkinsfile @@ -0,0 +1,116 @@ +pipeline { + agent { + dockerfile { + label 'docker' + filename 'utils/holly/Dockerfile' + additionalBuildArgs '-t prusa-firmware-mmu' + } + } + + parameters { + string(name: 'VERSION_SUFFIX', defaultValue: '', description: 'Specify custom version suffix for the build (e.g. "-RC1+1010"). Set to "" to use the default one. Leave empty to make a final-version build without any suffix.') + string(name: 'VERSION_SUFFIX_SHORT', defaultValue: '', description: 'Specify custom version suffix for the build (e.g. "-RC1"). Set to "" to use the default one. Leave empty to make a final-version build without any suffix.') + } + + stages { + stage('Prepare Build Stages') { + steps { + script { + // required configurations + def configurations = [ + [build_type: "release"], + ] + + // prepare version suffix + def commit_nr = sh(script: 'git rev-list HEAD --count', returnStdout: true).trim() + def short_suffix + def full_suffix + if (env.CHANGE_ID) { + // This is a PR build + short_suffix = "-BETA+${commit_nr}" + full_suffix = "${short_suffix}.PR${env.CHANGE_ID}.B${env.BUILD_NUMBER}" + } else if (env.BRANCH_NAME.startsWith("RELEASE-")) { + // This is an RC build + short_suffix = "-RC+${commit_nr}" + full_suffix = "${short_suffix}.B${env.BUILD_NUMBER}" + } else { + // This is build of an ordinary branch (not a release branch) + short_suffix = "-BETA+${commit_nr}" + def branch_spec = env.BRANCH_NAME.replaceAll("_", "-") + full_suffix = "${short_suffix}.BRANCH-${branch_spec}.B${env.BUILD_NUMBER}" + } + + if (params.VERSION_SUFFIX != '') { + full_suffix = params.VERSION_SUFFIX + } + if (params.VERSION_SUFFIX_SHORT != '') { + short_suffix = params.VERSION_SUFFIX_SHORT + } + + // create the build stages + configurations.each { config -> + stage("Build - ${config.build_type}") { + catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { + sh """ + ln -fs /.dependencies + python3 utils/build.py \ + --build-type ${config.build_type} \ + --generate-bbf \ + --generate-dfu \ + --no-store-output \ + --version-suffix=${full_suffix} \ + --version-suffix-short=${short_suffix} \ + -DCUSTOM_COMPILE_OPTIONS:STRING=-Werror + """ + } + } + } + } + } + } + + stage('Check Formatting') { + when { + expression { env.CHANGE_TARGET } + } + steps { + sh """ + export XDG_CACHE_HOME=\$PWD/.precommit + pre-commit install + pre-commit run \ + --source remotes/origin/${env.CHANGE_TARGET} \ + --origin HEAD \ + --show-diff-on-failure \ + --hook-stage manual + """ + } + } + + stage('Test') { + steps { + sh """ + python3 utils/bootstrap.py + export PATH=\$PWD/.dependencies/cmake-3.15.5/bin:\$PWD/.dependencies/ninja-1.9.0:\$PATH + mkdir -p build-test + LD_LIBRARY_PATH=/usr/local/lib32 \$PWD/.dependencies/cmake-3.15.5/bin/ctest --build-and-test . build-test \ + -DCMAKE_MAKE_PROGRAM=\$PWD/.dependencies/ninja-1.9.0/ninja \ + --build-generator Ninja \ + --build-target tests \ + --test-command ctest + """ + } + } + } + + post { + always { + // archive build products + archiveArtifacts artifacts: 'build/products/*', fingerprint: true + // archive test products + archiveArtifacts artifacts: 'build-test/Testing/Temporary/LastTest.log' + } + cleanup { + deleteDir() + } + } +} From 3dbba6ca8868a2e579532f40d5e26d7718cd8470 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alan=20Dragomirecky=CC=81?= Date: Sat, 10 Jul 2021 00:11:23 +0200 Subject: [PATCH 05/15] holly: Temporarily disable builds of the firmware (as there is no avr-gcc available) --- utils/holly/Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/holly/Jenkinsfile b/utils/holly/Jenkinsfile index cc2d03d..e22bf7b 100644 --- a/utils/holly/Jenkinsfile +++ b/utils/holly/Jenkinsfile @@ -52,6 +52,7 @@ pipeline { stage("Build - ${config.build_type}") { catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { sh """ + exit 0 # temporarily disable building (as we don't have avr-gcc in dependencies) ln -fs /.dependencies python3 utils/build.py \ --build-type ${config.build_type} \ @@ -105,7 +106,7 @@ pipeline { post { always { // archive build products - archiveArtifacts artifacts: 'build/products/*', fingerprint: true + //archiveArtifacts artifacts: 'build/products/*', fingerprint: true // archive test products archiveArtifacts artifacts: 'build-test/Testing/Temporary/LastTest.log' } From b3f3f0538e7eeb6baf0fadac0e5ef0447df1a547 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Tue, 6 Jul 2021 16:33:21 +0200 Subject: [PATCH 06/15] Shim on AVR Instead of adding #ifdefs for missing headers, create a shim that can be included everywhere. "limits.h" includes a bare-bone implementation of numeric_limits (to be extended as needed). --- src/hal/circular_buffer.h | 8 +------- src/limits.h | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 src/limits.h diff --git a/src/hal/circular_buffer.h b/src/hal/circular_buffer.h index 7e8249a..4330e15 100644 --- a/src/hal/circular_buffer.h +++ b/src/hal/circular_buffer.h @@ -1,10 +1,6 @@ #pragma once - -#include #include -#ifndef __AVR__ -#include -#endif +#include "../limits.h" /// A generic circular index class which can be used to build circular buffers /// Can hold up to size elements @@ -15,10 +11,8 @@ template class CircularIndex { public: -#ifndef __AVR__ static_assert(size <= std::numeric_limits::max() / 2, "index_t is too small for the requested size"); -#endif constexpr inline CircularIndex() : tail(0) diff --git a/src/limits.h b/src/limits.h new file mode 100644 index 0000000..232f03b --- /dev/null +++ b/src/limits.h @@ -0,0 +1,23 @@ +#pragma once +#ifndef __AVR__ +#include +#else + +// A minimal std::numeric_limits for platforms that lack one +#include +#include + +namespace std { + +template +class numeric_limits; + +template <> +class numeric_limits { +public: + static constexpr size_t max() { return UINT8_MAX; } +}; + +} // namespace std + +#endif From 99b847bf983e288630825c374df8c831e267f66c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alan=20Dragomirecky=CC=81?= Date: Fri, 2 Jul 2021 13:57:39 +0200 Subject: [PATCH 07/15] Remove the PRINTER cmake option and other irrelevant code --- CMakeLists.txt | 18 +-------------- utils/build.py | 59 ++------------------------------------------------ 2 files changed, 3 insertions(+), 74 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d98231d..67e2fde 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,17 +21,9 @@ endif() # # You should specify those options when invoking CMake. Example: # ~~~ -# cmake .. -DPRINTER=MMU +# cmake .. -DCUSTOM_COMPILE_OPTIONS=-DENABLE_FEATURE_X # ~~~ -set(PRINTER_VALID_OPTS "MMU") - -set(PRINTER - "MMU" - CACHE - STRING - "Select the MMU unit for which you want to compile the project (valid values are ${PRINTER_VALID_OPTS})." - ) set(PROJECT_VERSION_SUFFIX "" CACHE @@ -53,13 +45,6 @@ set(CUSTOM_COMPILE_OPTIONS CACHE STRING "Allows adding custom C/C++ flags" ) -# Validate options -foreach(OPTION "PRINTER") - if(NOT ${OPTION} IN_LIST ${OPTION}_VALID_OPTS) - message(FATAL_ERROR "Invalid ${OPTION} ${${OPTION}}: Valid values are ${${OPTION}_VALID_OPTS}") - endif() -endforeach() - # Resolve BUILD_NUMBER and PROJECT_VERSION_* variables resolve_version_variables() @@ -86,7 +71,6 @@ message( STATUS "Project version with short suffix: ${PROJECT_VERSION}${PROJECT_VERSION_SUFFIX_SHORT}" ) message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}.") -message(STATUS "Printer: ${PRINTER}") # eclipse sets those variables, so lets just use them so we don't get a warning about unused # variables diff --git a/utils/build.py b/utils/build.py index 8da233d..8b5db24 100755 --- a/utils/build.py +++ b/utils/build.py @@ -61,31 +61,6 @@ def get_dependency(name): return install_dir -class Printer(Enum): - """Represents the -DPRINTER CMake option.""" - - MMU = 'MMU' - - -#class Bootloader(Enum): -# """Represents the -DBOOTLOADER CMake option.""" -# -# NO = 'NO' -# EMPTY = 'EMPTY' -# YES = 'YES' -# -# @property -# def file_component(self): -# if self == Bootloader.NO: -# return 'NOBOOT' -# elif self == Bootloader.EMPTY: -# return 'EMPTYBOOT' -# elif self == Bootloader.YES: -# return 'BOOT' -# else: -# raise NotImplementedError - - class BuildType(Enum): """Represents the -DCONFIG CMake option.""" @@ -93,15 +68,6 @@ class BuildType(Enum): RELEASE = 'RELEASE' -#class HostTool(Enum): -# """Known host tools.""" -# -# png2font = "png2font" -# bin2cc = "bin2cc" -# hex2dfu = "hex2dfu" -# makefsdata = "makefsdata" - - class BuildConfiguration(ABC): @abstractmethod def get_cmake_cache_entries(self): @@ -121,14 +87,12 @@ class BuildConfiguration(ABC): class FirmwareBuildConfiguration(BuildConfiguration): def __init__(self, - printer: Printer, build_type: BuildType, toolchain: Path = None, generator: str = None, version_suffix: str = None, version_suffix_short: str = None, custom_entries: List[str] = None): - self.printer = printer self.build_type = build_type self.toolchain = toolchain or FirmwareBuildConfiguration.default_toolchain( ) @@ -139,8 +103,7 @@ class FirmwareBuildConfiguration(BuildConfiguration): @staticmethod def default_toolchain() -> Path: - return Path( - __file__).resolve().parent.parent / 'cmake/AnyAvrGcc.cmake' + return Path(__file__).resolve().parent.parent / 'cmake/AnyAvrGcc.cmake' def get_cmake_cache_entries(self): entries = [] @@ -149,7 +112,6 @@ class FirmwareBuildConfiguration(BuildConfiguration): str(get_dependency('ninja')))) entries.extend([ ('CMAKE_MAKE_PROGRAM', 'FILEPATH', str(get_dependency('ninja'))), - ('PRINTER', 'STRING', self.printer.value), ('CMAKE_TOOLCHAIN_FILE', 'FILEPATH', str(self.toolchain)), ('CMAKE_BUILD_TYPE', 'STRING', self.build_type.value.title()), ('PROJECT_VERSION_SUFFIX', 'STRING', self.version_suffix or ''), @@ -170,7 +132,6 @@ class FirmwareBuildConfiguration(BuildConfiguration): @property def name(self): components = [ - self.printer.name, self.build_type.value, ] return '_'.join(components) @@ -178,7 +139,6 @@ class FirmwareBuildConfiguration(BuildConfiguration): class BuildResult: """Represents a result of an attempt to build the project.""" - def __init__(self, config_returncode: int, build_returncode: Optional[int], stdout: Path, stderr: Path, products: List[Path]): self.config_returncode = config_returncode @@ -281,7 +241,6 @@ def store_products(products: List[Path], build_config: BuildConfiguration, def list_of(EnumType): """Create an argument-parser for comma-separated list of values of some Enum subclass.""" - def convert(val): if val == '': return [] @@ -305,12 +264,6 @@ def cmake_cache_entry(arg): def main(): parser = argparse.ArgumentParser() # yapf: disable - parser.add_argument( - '--printer', - type=list_of(Printer), - default=list(Printer), - help='Printer type (default: {default}).'.format( - default=','.join(str(p.value.lower()) for p in Printer))) parser.add_argument( '--build-type', type=list_of(BuildType), @@ -348,12 +301,6 @@ def main(): '--toolchain', type=Path, help='Path to a CMake toolchain file to be used.') - parser.add_argument( - '--host-tools', - action='store_true', - help=('Build host tools (png2font and others). ' - 'Turned on by default with --generate-cproject only.') - ) parser.add_argument( '--no-build', action='store_true', @@ -388,13 +335,11 @@ def main(): # prepare configurations configurations = [ FirmwareBuildConfiguration( - printer=printer, build_type=build_type, version_suffix=args.version_suffix, version_suffix_short=args.version_suffix_short, generator=args.generator, - custom_entries=args.cmake_def) for printer in args.printer - for build_type in args.build_type + custom_entries=args.cmake_def) for build_type in args.build_type ] # build everything From 6f68fc6e767f6fd65fc5724c191344b4500e6483 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alan=20Dragomirecky=CC=81?= Date: Wed, 7 Jul 2021 15:01:30 +0200 Subject: [PATCH 08/15] Remove empty CMakeLists from the utils directory --- utils/CMakeLists.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 utils/CMakeLists.txt diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt deleted file mode 100644 index e69de29..0000000 From ed72b07e045568933568d5ca9877b3139549b8ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alan=20Dragomirecky=CC=81?= Date: Wed, 7 Jul 2021 15:05:35 +0200 Subject: [PATCH 09/15] Remove `include` from header search paths --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 67e2fde..73822c8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -165,7 +165,7 @@ endif() # add_link_dependency(firmware "${LINKER_SCRIPT}") -target_include_directories(firmware PRIVATE include src) +target_include_directories(firmware PRIVATE src) target_compile_options(firmware PRIVATE -Wdouble-promotion) target_sources( From 09819cb1aa93f9ccb33d0a9e571186b626946faf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alan=20Dragomirecky=CC=81?= Date: Wed, 7 Jul 2021 15:13:48 +0200 Subject: [PATCH 10/15] Split the main CMakeLists.txt into more files within subdirectories --- CMakeLists.txt | 44 ++------------------------------------ src/CMakeLists.txt | 19 ++++++++++++++++ src/hal/CMakeLists.txt | 9 ++++++++ src/logic/CMakeLists.txt | 14 ++++++++++++ src/modules/CMakeLists.txt | 17 +++++++++++++++ 5 files changed, 61 insertions(+), 42 deletions(-) create mode 100644 src/CMakeLists.txt create mode 100644 src/hal/CMakeLists.txt create mode 100644 src/logic/CMakeLists.txt create mode 100644 src/modules/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 73822c8..3263b85 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -168,49 +168,9 @@ endif() target_include_directories(firmware PRIVATE src) target_compile_options(firmware PRIVATE -Wdouble-promotion) -target_sources( - firmware - PRIVATE src/main.cpp - src/hal/avr/cpu.cpp - src/hal/avr/usart.cpp - src/hal/avr/shr16.cpp - src/hal/avr/eeprom.cpp - src/hal/adc.cpp - src/modules/protocol.cpp - src/modules/buttons.cpp - src/modules/debouncer.cpp - src/modules/finda.cpp - src/modules/fsensor.cpp - src/modules/globals.cpp - src/modules/idler.cpp - src/modules/leds.cpp - src/modules/motion.cpp - src/modules/permanent_storage.cpp - src/modules/selector.cpp - src/modules/timebase.cpp - src/modules/user_input.cpp - src/logic/command_base.cpp - src/logic/cut_filament.cpp - src/logic/eject_filament.cpp - src/logic/feed_to_bondtech.cpp - src/logic/feed_to_finda.cpp - src/logic/load_filament.cpp - src/logic/no_command.cpp - src/logic/tool_change.cpp - src/logic/unload_filament.cpp - src/logic/unload_to_finda.cpp - ) -set_property( - SOURCE src/version.c - APPEND - PROPERTY COMPILE_DEFINITIONS - FW_BUILD_NUMBER=${BUILD_NUMBER} - FW_VERSION_FULL=${PROJECT_VERSION_FULL} - FW_VERSION=${PROJECT_VERSION} - FW_VERSION_SUFFIX=${PROJECT_VERSION_SUFFIX} - FW_VERSION_SUFFIX_SHORT=${PROJECT_VERSION_SUFFIX_SHORT} - ) +add_subdirectory(src) + if(NOT CMAKE_CROSSCOMPILING) enable_testing() add_subdirectory(tests) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..9fb39e8 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,19 @@ +target_sources( + firmware + PRIVATE main.cpp +) + +set_property( + SOURCE src/version.c + APPEND + PROPERTY COMPILE_DEFINITIONS + FW_BUILD_NUMBER=${BUILD_NUMBER} + FW_VERSION_FULL=${PROJECT_VERSION_FULL} + FW_VERSION=${PROJECT_VERSION} + FW_VERSION_SUFFIX=${PROJECT_VERSION_SUFFIX} + FW_VERSION_SUFFIX_SHORT=${PROJECT_VERSION_SUFFIX_SHORT} +) + +add_subdirectory(hal) +add_subdirectory(logic) +add_subdirectory(modules) diff --git a/src/hal/CMakeLists.txt b/src/hal/CMakeLists.txt new file mode 100644 index 0000000..c417e72 --- /dev/null +++ b/src/hal/CMakeLists.txt @@ -0,0 +1,9 @@ +target_sources( + firmware + PRIVATE + avr/cpu.cpp + avr/usart.cpp + avr/shr16.cpp + avr/eeprom.cpp + adc.cpp +) diff --git a/src/logic/CMakeLists.txt b/src/logic/CMakeLists.txt new file mode 100644 index 0000000..ec8f87b --- /dev/null +++ b/src/logic/CMakeLists.txt @@ -0,0 +1,14 @@ +target_sources( + firmware + PRIVATE + command_base.cpp + cut_filament.cpp + eject_filament.cpp + feed_to_bondtech.cpp + feed_to_finda.cpp + load_filament.cpp + no_command.cpp + tool_change.cpp + unload_filament.cpp + unload_to_finda.cpp +) diff --git a/src/modules/CMakeLists.txt b/src/modules/CMakeLists.txt new file mode 100644 index 0000000..8e3f3e1 --- /dev/null +++ b/src/modules/CMakeLists.txt @@ -0,0 +1,17 @@ +target_sources( + firmware + PRIVATE + protocol.cpp + buttons.cpp + debouncer.cpp + finda.cpp + fsensor.cpp + globals.cpp + idler.cpp + leds.cpp + motion.cpp + permanent_storage.cpp + selector.cpp + timebase.cpp + user_input.cpp +) From 5018c4448972d0973fd989b34318806ce2668591 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alan=20Dragomirecky=CC=81?= Date: Fri, 9 Jul 2021 23:01:45 +0200 Subject: [PATCH 11/15] Do not include the utils directory --- CMakeLists.txt | 7 ------- 1 file changed, 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3263b85..206abc6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,13 +9,6 @@ project( VERSION ${PROJECT_VERSION} ) -if(NOT CMAKE_CROSSCOMPILING) - # - # If we are not crosscompiling, include `utils` with host tools. - # - add_subdirectory(utils) -endif() - # # Command Line Options # From 332c740a8b06bbb69a1b75bd44c32cdac126579b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alan=20Dragomirecky=CC=81?= Date: Fri, 9 Jul 2021 23:06:20 +0200 Subject: [PATCH 12/15] Do not build the firmware target when crosscompiling --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 206abc6..1595cc5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -165,6 +165,9 @@ target_compile_options(firmware PRIVATE -Wdouble-promotion) add_subdirectory(src) if(NOT CMAKE_CROSSCOMPILING) + # do not build the firmware by default (tests are the focus if not crosscompiling) + set_target_properties(firmware PROPERTIES EXCLUDE_FROM_ALL YES) + enable_testing() add_subdirectory(tests) endif() From c3f0e59d12561af0376904d672ade9193b2d2c11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alan=20Dragomirecky=CC=81?= Date: Fri, 9 Jul 2021 23:07:04 +0200 Subject: [PATCH 13/15] Remove the empty integration tests directory --- tests/integration/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 tests/integration/CMakeLists.txt diff --git a/tests/integration/CMakeLists.txt b/tests/integration/CMakeLists.txt deleted file mode 100644 index 792d600..0000000 --- a/tests/integration/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -# From 3a131cfa0afc601d6d61c741dbbbfc87fb64eec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alan=20Dragomirecky=CC=81?= Date: Fri, 9 Jul 2021 23:07:45 +0200 Subject: [PATCH 14/15] Remove mentions of the -m32 flag (commented code) --- tests/unit/CMakeLists.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt index d755b48..cd5d5be 100644 --- a/tests/unit/CMakeLists.txt +++ b/tests/unit/CMakeLists.txt @@ -1,10 +1,6 @@ # first, let's create a symbolic target for all tests add_custom_target(tests) -# this had a reason on the Buddy FW, but on the AVR we cannot get close to having 16bit ints and -# pointers so the unit tests may be compiled 64bit afterall set(CMAKE_C_FLAGS -m32) -# set(CMAKE_CXX_FLAGS -m32) - # include catch_discover_tests function from Catch2 include(${Catch2_SOURCE_DIR}/contrib/Catch.cmake) From cf5b1c3955aa91ade7de281cdc5b27aadb99bfc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alan=20Dragomirecky=CC=81?= Date: Fri, 9 Jul 2021 23:30:39 +0200 Subject: [PATCH 15/15] Do not use hard-to-read relative paths in CMake --- tests/unit/CMakeLists.txt | 3 ++ tests/unit/logic/cut_filament/CMakeLists.txt | 42 ++++++++--------- .../unit/logic/eject_filament/CMakeLists.txt | 42 ++++++++--------- .../logic/feed_to_bondtech/CMakeLists.txt | 36 +++++++-------- tests/unit/logic/feed_to_finda/CMakeLists.txt | 36 +++++++-------- tests/unit/logic/load_filament/CMakeLists.txt | 40 ++++++++-------- tests/unit/logic/tool_change/CMakeLists.txt | 46 +++++++++---------- .../unit/logic/unload_filament/CMakeLists.txt | 40 ++++++++-------- .../unit/logic/unload_to_finda/CMakeLists.txt | 36 +++++++-------- tests/unit/modules/buttons/CMakeLists.txt | 5 +- tests/unit/modules/leds/CMakeLists.txt | 4 +- tests/unit/modules/protocol/CMakeLists.txt | 2 +- 12 files changed, 168 insertions(+), 164 deletions(-) diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt index cd5d5be..53fd3a5 100644 --- a/tests/unit/CMakeLists.txt +++ b/tests/unit/CMakeLists.txt @@ -17,6 +17,9 @@ endfunction() add_executable(system_tests ${CMAKE_CURRENT_SOURCE_DIR}/system_test.cpp) add_catch_test(system_tests) +set(MODULES_STUBS_DIR ${CMAKE_SOURCE_DIR}/tests/unit/modules/stubs) +set(LOGIC_STUBS_DIR ${CMAKE_SOURCE_DIR}/tests/unit/logic/stubs) + # now, include all the unit tests; they should add themselves using the add_catch_test function add_subdirectory(hal) add_subdirectory(logic) diff --git a/tests/unit/logic/cut_filament/CMakeLists.txt b/tests/unit/logic/cut_filament/CMakeLists.txt index 07d0990..6f8618f 100644 --- a/tests/unit/logic/cut_filament/CMakeLists.txt +++ b/tests/unit/logic/cut_filament/CMakeLists.txt @@ -1,27 +1,27 @@ # define the test executable add_executable( cut_filament_tests - ../../../../src/logic/cut_filament.cpp - ../../../../src/logic/feed_to_finda.cpp - ../../../../src/logic/unload_filament.cpp - ../../../../src/logic/unload_to_finda.cpp - ../../../../src/modules/buttons.cpp - ../../../../src/modules/debouncer.cpp - ../../../../src/modules/finda.cpp - ../../../../src/modules/fsensor.cpp - ../../../../src/modules/globals.cpp - ../../../../src/modules/idler.cpp - ../../../../src/modules/leds.cpp - ../../../../src/modules/permanent_storage.cpp - ../../../../src/modules/selector.cpp - ../../../../src/modules/user_input.cpp - ../../modules/stubs/stub_adc.cpp - ../../modules/stubs/stub_eeprom.cpp - ../../modules/stubs/stub_gpio.cpp - ../../modules/stubs/stub_shr16.cpp - ../../modules/stubs/stub_timebase.cpp - ../stubs/main_loop_stub.cpp - ../stubs/stub_motion.cpp + ${CMAKE_SOURCE_DIR}/src/logic/cut_filament.cpp + ${CMAKE_SOURCE_DIR}/src/logic/feed_to_finda.cpp + ${CMAKE_SOURCE_DIR}/src/logic/unload_filament.cpp + ${CMAKE_SOURCE_DIR}/src/logic/unload_to_finda.cpp + ${CMAKE_SOURCE_DIR}/src/modules/buttons.cpp + ${CMAKE_SOURCE_DIR}/src/modules/debouncer.cpp + ${CMAKE_SOURCE_DIR}/src/modules/finda.cpp + ${CMAKE_SOURCE_DIR}/src/modules/fsensor.cpp + ${CMAKE_SOURCE_DIR}/src/modules/globals.cpp + ${CMAKE_SOURCE_DIR}/src/modules/idler.cpp + ${CMAKE_SOURCE_DIR}/src/modules/leds.cpp + ${CMAKE_SOURCE_DIR}/src/modules/permanent_storage.cpp + ${CMAKE_SOURCE_DIR}/src/modules/selector.cpp + ${CMAKE_SOURCE_DIR}/src/modules/user_input.cpp + ${MODULES_STUBS_DIR}/stub_adc.cpp + ${MODULES_STUBS_DIR}/stub_eeprom.cpp + ${MODULES_STUBS_DIR}/stub_gpio.cpp + ${MODULES_STUBS_DIR}/stub_shr16.cpp + ${MODULES_STUBS_DIR}/stub_timebase.cpp + ${LOGIC_STUBS_DIR}/main_loop_stub.cpp + ${LOGIC_STUBS_DIR}/stub_motion.cpp test_cut_filament.cpp ) diff --git a/tests/unit/logic/eject_filament/CMakeLists.txt b/tests/unit/logic/eject_filament/CMakeLists.txt index 40f277d..0f424fe 100644 --- a/tests/unit/logic/eject_filament/CMakeLists.txt +++ b/tests/unit/logic/eject_filament/CMakeLists.txt @@ -1,27 +1,27 @@ # define the test executable add_executable( eject_filament_tests - ../../../../src/logic/eject_filament.cpp - ../../../../src/logic/feed_to_finda.cpp - ../../../../src/logic/unload_filament.cpp - ../../../../src/logic/unload_to_finda.cpp - ../../../../src/modules/buttons.cpp - ../../../../src/modules/debouncer.cpp - ../../../../src/modules/finda.cpp - ../../../../src/modules/fsensor.cpp - ../../../../src/modules/globals.cpp - ../../../../src/modules/idler.cpp - ../../../../src/modules/leds.cpp - ../../../../src/modules/permanent_storage.cpp - ../../../../src/modules/selector.cpp - ../../../../src/modules/user_input.cpp - ../../modules/stubs/stub_adc.cpp - ../../modules/stubs/stub_eeprom.cpp - ../../modules/stubs/stub_gpio.cpp - ../../modules/stubs/stub_shr16.cpp - ../../modules/stubs/stub_timebase.cpp - ../stubs/main_loop_stub.cpp - ../stubs/stub_motion.cpp + ${CMAKE_SOURCE_DIR}/src/logic/eject_filament.cpp + ${CMAKE_SOURCE_DIR}/src/logic/feed_to_finda.cpp + ${CMAKE_SOURCE_DIR}/src/logic/unload_filament.cpp + ${CMAKE_SOURCE_DIR}/src/logic/unload_to_finda.cpp + ${CMAKE_SOURCE_DIR}/src/modules/buttons.cpp + ${CMAKE_SOURCE_DIR}/src/modules/debouncer.cpp + ${CMAKE_SOURCE_DIR}/src/modules/finda.cpp + ${CMAKE_SOURCE_DIR}/src/modules/fsensor.cpp + ${CMAKE_SOURCE_DIR}/src/modules/globals.cpp + ${CMAKE_SOURCE_DIR}/src/modules/idler.cpp + ${CMAKE_SOURCE_DIR}/src/modules/leds.cpp + ${CMAKE_SOURCE_DIR}/src/modules/permanent_storage.cpp + ${CMAKE_SOURCE_DIR}/src/modules/selector.cpp + ${CMAKE_SOURCE_DIR}/src/modules/user_input.cpp + ${MODULES_STUBS_DIR}/stub_adc.cpp + ${MODULES_STUBS_DIR}/stub_eeprom.cpp + ${MODULES_STUBS_DIR}/stub_gpio.cpp + ${MODULES_STUBS_DIR}/stub_shr16.cpp + ${MODULES_STUBS_DIR}/stub_timebase.cpp + ${LOGIC_STUBS_DIR}/main_loop_stub.cpp + ${LOGIC_STUBS_DIR}/stub_motion.cpp test_eject_filament.cpp ) diff --git a/tests/unit/logic/feed_to_bondtech/CMakeLists.txt b/tests/unit/logic/feed_to_bondtech/CMakeLists.txt index d727aeb..550372b 100644 --- a/tests/unit/logic/feed_to_bondtech/CMakeLists.txt +++ b/tests/unit/logic/feed_to_bondtech/CMakeLists.txt @@ -1,24 +1,24 @@ # define the test executable add_executable( feed_to_bondtech_tests - ../../../../src/logic/feed_to_bondtech.cpp - ../../../../src/modules/buttons.cpp - ../../../../src/modules/debouncer.cpp - ../../../../src/modules/finda.cpp - ../../../../src/modules/fsensor.cpp - ../../../../src/modules/globals.cpp - ../../../../src/modules/idler.cpp - ../../../../src/modules/leds.cpp - ../../../../src/modules/permanent_storage.cpp - ../../../../src/modules/selector.cpp - ../../../../src/modules/user_input.cpp - ../../modules/stubs/stub_adc.cpp - ../../modules/stubs/stub_eeprom.cpp - ../../modules/stubs/stub_gpio.cpp - ../../modules/stubs/stub_shr16.cpp - ../../modules/stubs/stub_timebase.cpp - ../stubs/main_loop_stub.cpp - ../stubs/stub_motion.cpp + ${CMAKE_SOURCE_DIR}/src/logic/feed_to_bondtech.cpp + ${CMAKE_SOURCE_DIR}/src/modules/buttons.cpp + ${CMAKE_SOURCE_DIR}/src/modules/debouncer.cpp + ${CMAKE_SOURCE_DIR}/src/modules/finda.cpp + ${CMAKE_SOURCE_DIR}/src/modules/fsensor.cpp + ${CMAKE_SOURCE_DIR}/src/modules/globals.cpp + ${CMAKE_SOURCE_DIR}/src/modules/idler.cpp + ${CMAKE_SOURCE_DIR}/src/modules/leds.cpp + ${CMAKE_SOURCE_DIR}/src/modules/permanent_storage.cpp + ${CMAKE_SOURCE_DIR}/src/modules/selector.cpp + ${CMAKE_SOURCE_DIR}/src/modules/user_input.cpp + ${MODULES_STUBS_DIR}/stub_adc.cpp + ${MODULES_STUBS_DIR}/stub_eeprom.cpp + ${MODULES_STUBS_DIR}/stub_gpio.cpp + ${MODULES_STUBS_DIR}/stub_shr16.cpp + ${MODULES_STUBS_DIR}/stub_timebase.cpp + ${LOGIC_STUBS_DIR}/main_loop_stub.cpp + ${LOGIC_STUBS_DIR}/stub_motion.cpp test_feed_to_bondtech.cpp ) diff --git a/tests/unit/logic/feed_to_finda/CMakeLists.txt b/tests/unit/logic/feed_to_finda/CMakeLists.txt index 1965ccd..1709ac7 100644 --- a/tests/unit/logic/feed_to_finda/CMakeLists.txt +++ b/tests/unit/logic/feed_to_finda/CMakeLists.txt @@ -1,24 +1,24 @@ # define the test executable add_executable( feed_to_finda_tests - ../../../../src/logic/feed_to_finda.cpp - ../../../../src/modules/buttons.cpp - ../../../../src/modules/debouncer.cpp - ../../../../src/modules/finda.cpp - ../../../../src/modules/fsensor.cpp - ../../../../src/modules/globals.cpp - ../../../../src/modules/idler.cpp - ../../../../src/modules/leds.cpp - ../../../../src/modules/permanent_storage.cpp - ../../../../src/modules/selector.cpp - ../../../../src/modules/user_input.cpp - ../../modules/stubs/stub_adc.cpp - ../../modules/stubs/stub_eeprom.cpp - ../../modules/stubs/stub_gpio.cpp - ../../modules/stubs/stub_shr16.cpp - ../../modules/stubs/stub_timebase.cpp - ../stubs/main_loop_stub.cpp - ../stubs/stub_motion.cpp + ${CMAKE_SOURCE_DIR}/src/logic/feed_to_finda.cpp + ${CMAKE_SOURCE_DIR}/src/modules/buttons.cpp + ${CMAKE_SOURCE_DIR}/src/modules/debouncer.cpp + ${CMAKE_SOURCE_DIR}/src/modules/finda.cpp + ${CMAKE_SOURCE_DIR}/src/modules/fsensor.cpp + ${CMAKE_SOURCE_DIR}/src/modules/globals.cpp + ${CMAKE_SOURCE_DIR}/src/modules/idler.cpp + ${CMAKE_SOURCE_DIR}/src/modules/leds.cpp + ${CMAKE_SOURCE_DIR}/src/modules/permanent_storage.cpp + ${CMAKE_SOURCE_DIR}/src/modules/selector.cpp + ${CMAKE_SOURCE_DIR}/src/modules/user_input.cpp + ${MODULES_STUBS_DIR}/stub_adc.cpp + ${MODULES_STUBS_DIR}/stub_eeprom.cpp + ${MODULES_STUBS_DIR}/stub_gpio.cpp + ${MODULES_STUBS_DIR}/stub_shr16.cpp + ${MODULES_STUBS_DIR}/stub_timebase.cpp + ${LOGIC_STUBS_DIR}/main_loop_stub.cpp + ${LOGIC_STUBS_DIR}/stub_motion.cpp test_feed_to_finda.cpp ) diff --git a/tests/unit/logic/load_filament/CMakeLists.txt b/tests/unit/logic/load_filament/CMakeLists.txt index 22619d3..b95d53b 100644 --- a/tests/unit/logic/load_filament/CMakeLists.txt +++ b/tests/unit/logic/load_filament/CMakeLists.txt @@ -1,26 +1,26 @@ # define the test executable add_executable( load_filament_tests - ../../../../src/logic/feed_to_bondtech.cpp - ../../../../src/logic/feed_to_finda.cpp - ../../../../src/logic/load_filament.cpp - ../../../../src/modules/buttons.cpp - ../../../../src/modules/debouncer.cpp - ../../../../src/modules/finda.cpp - ../../../../src/modules/fsensor.cpp - ../../../../src/modules/globals.cpp - ../../../../src/modules/idler.cpp - ../../../../src/modules/leds.cpp - ../../../../src/modules/permanent_storage.cpp - ../../../../src/modules/selector.cpp - ../../../../src/modules/user_input.cpp - ../../modules/stubs/stub_adc.cpp - ../../modules/stubs/stub_eeprom.cpp - ../../modules/stubs/stub_gpio.cpp - ../../modules/stubs/stub_shr16.cpp - ../../modules/stubs/stub_timebase.cpp - ../stubs/main_loop_stub.cpp - ../stubs/stub_motion.cpp + ${CMAKE_SOURCE_DIR}/src/logic/feed_to_bondtech.cpp + ${CMAKE_SOURCE_DIR}/src/logic/feed_to_finda.cpp + ${CMAKE_SOURCE_DIR}/src/logic/load_filament.cpp + ${CMAKE_SOURCE_DIR}/src/modules/buttons.cpp + ${CMAKE_SOURCE_DIR}/src/modules/debouncer.cpp + ${CMAKE_SOURCE_DIR}/src/modules/finda.cpp + ${CMAKE_SOURCE_DIR}/src/modules/fsensor.cpp + ${CMAKE_SOURCE_DIR}/src/modules/globals.cpp + ${CMAKE_SOURCE_DIR}/src/modules/idler.cpp + ${CMAKE_SOURCE_DIR}/src/modules/leds.cpp + ${CMAKE_SOURCE_DIR}/src/modules/permanent_storage.cpp + ${CMAKE_SOURCE_DIR}/src/modules/selector.cpp + ${CMAKE_SOURCE_DIR}/src/modules/user_input.cpp + ${MODULES_STUBS_DIR}/stub_adc.cpp + ${MODULES_STUBS_DIR}/stub_eeprom.cpp + ${MODULES_STUBS_DIR}/stub_gpio.cpp + ${MODULES_STUBS_DIR}/stub_shr16.cpp + ${MODULES_STUBS_DIR}/stub_timebase.cpp + ${LOGIC_STUBS_DIR}/main_loop_stub.cpp + ${LOGIC_STUBS_DIR}/stub_motion.cpp test_load_filament.cpp ) diff --git a/tests/unit/logic/tool_change/CMakeLists.txt b/tests/unit/logic/tool_change/CMakeLists.txt index 00c6c5e..c33f919 100644 --- a/tests/unit/logic/tool_change/CMakeLists.txt +++ b/tests/unit/logic/tool_change/CMakeLists.txt @@ -1,29 +1,29 @@ # define the test executable add_executable( tool_change_tests - ../../../../src/logic/feed_to_bondtech.cpp - ../../../../src/logic/feed_to_finda.cpp - ../../../../src/logic/load_filament.cpp - ../../../../src/logic/tool_change.cpp - ../../../../src/logic/unload_filament.cpp - ../../../../src/logic/unload_to_finda.cpp - ../../../../src/modules/buttons.cpp - ../../../../src/modules/debouncer.cpp - ../../../../src/modules/finda.cpp - ../../../../src/modules/fsensor.cpp - ../../../../src/modules/globals.cpp - ../../../../src/modules/idler.cpp - ../../../../src/modules/leds.cpp - ../../../../src/modules/permanent_storage.cpp - ../../../../src/modules/selector.cpp - ../../../../src/modules/user_input.cpp - ../../modules/stubs/stub_adc.cpp - ../../modules/stubs/stub_eeprom.cpp - ../../modules/stubs/stub_gpio.cpp - ../../modules/stubs/stub_shr16.cpp - ../../modules/stubs/stub_timebase.cpp - ../stubs/main_loop_stub.cpp - ../stubs/stub_motion.cpp + ${CMAKE_SOURCE_DIR}/src/logic/feed_to_bondtech.cpp + ${CMAKE_SOURCE_DIR}/src/logic/feed_to_finda.cpp + ${CMAKE_SOURCE_DIR}/src/logic/load_filament.cpp + ${CMAKE_SOURCE_DIR}/src/logic/tool_change.cpp + ${CMAKE_SOURCE_DIR}/src/logic/unload_filament.cpp + ${CMAKE_SOURCE_DIR}/src/logic/unload_to_finda.cpp + ${CMAKE_SOURCE_DIR}/src/modules/buttons.cpp + ${CMAKE_SOURCE_DIR}/src/modules/debouncer.cpp + ${CMAKE_SOURCE_DIR}/src/modules/finda.cpp + ${CMAKE_SOURCE_DIR}/src/modules/fsensor.cpp + ${CMAKE_SOURCE_DIR}/src/modules/globals.cpp + ${CMAKE_SOURCE_DIR}/src/modules/idler.cpp + ${CMAKE_SOURCE_DIR}/src/modules/leds.cpp + ${CMAKE_SOURCE_DIR}/src/modules/permanent_storage.cpp + ${CMAKE_SOURCE_DIR}/src/modules/selector.cpp + ${CMAKE_SOURCE_DIR}/src/modules/user_input.cpp + ${MODULES_STUBS_DIR}/stub_adc.cpp + ${MODULES_STUBS_DIR}/stub_eeprom.cpp + ${MODULES_STUBS_DIR}/stub_gpio.cpp + ${MODULES_STUBS_DIR}/stub_shr16.cpp + ${MODULES_STUBS_DIR}/stub_timebase.cpp + ${LOGIC_STUBS_DIR}/main_loop_stub.cpp + ${LOGIC_STUBS_DIR}/stub_motion.cpp test_tool_change.cpp ) diff --git a/tests/unit/logic/unload_filament/CMakeLists.txt b/tests/unit/logic/unload_filament/CMakeLists.txt index 0b4cc25..b5a8d58 100644 --- a/tests/unit/logic/unload_filament/CMakeLists.txt +++ b/tests/unit/logic/unload_filament/CMakeLists.txt @@ -1,26 +1,26 @@ # define the test executable add_executable( unload_filament_tests - ../../../../src/logic/feed_to_finda.cpp - ../../../../src/logic/unload_filament.cpp - ../../../../src/logic/unload_to_finda.cpp - ../../../../src/modules/buttons.cpp - ../../../../src/modules/debouncer.cpp - ../../../../src/modules/finda.cpp - ../../../../src/modules/fsensor.cpp - ../../../../src/modules/globals.cpp - ../../../../src/modules/idler.cpp - ../../../../src/modules/leds.cpp - ../../../../src/modules/permanent_storage.cpp - ../../../../src/modules/selector.cpp - ../../../../src/modules/user_input.cpp - ../../modules/stubs/stub_adc.cpp - ../../modules/stubs/stub_eeprom.cpp - ../../modules/stubs/stub_gpio.cpp - ../../modules/stubs/stub_shr16.cpp - ../../modules/stubs/stub_timebase.cpp - ../stubs/main_loop_stub.cpp - ../stubs/stub_motion.cpp + ${CMAKE_SOURCE_DIR}/src/logic/feed_to_finda.cpp + ${CMAKE_SOURCE_DIR}/src/logic/unload_filament.cpp + ${CMAKE_SOURCE_DIR}/src/logic/unload_to_finda.cpp + ${CMAKE_SOURCE_DIR}/src/modules/buttons.cpp + ${CMAKE_SOURCE_DIR}/src/modules/debouncer.cpp + ${CMAKE_SOURCE_DIR}/src/modules/finda.cpp + ${CMAKE_SOURCE_DIR}/src/modules/fsensor.cpp + ${CMAKE_SOURCE_DIR}/src/modules/globals.cpp + ${CMAKE_SOURCE_DIR}/src/modules/idler.cpp + ${CMAKE_SOURCE_DIR}/src/modules/leds.cpp + ${CMAKE_SOURCE_DIR}/src/modules/permanent_storage.cpp + ${CMAKE_SOURCE_DIR}/src/modules/selector.cpp + ${CMAKE_SOURCE_DIR}/src/modules/user_input.cpp + ${MODULES_STUBS_DIR}/stub_adc.cpp + ${MODULES_STUBS_DIR}/stub_eeprom.cpp + ${MODULES_STUBS_DIR}/stub_gpio.cpp + ${MODULES_STUBS_DIR}/stub_shr16.cpp + ${MODULES_STUBS_DIR}/stub_timebase.cpp + ${LOGIC_STUBS_DIR}/main_loop_stub.cpp + ${LOGIC_STUBS_DIR}/stub_motion.cpp test_unload_filament.cpp ) diff --git a/tests/unit/logic/unload_to_finda/CMakeLists.txt b/tests/unit/logic/unload_to_finda/CMakeLists.txt index c0a215a..4721d4d 100644 --- a/tests/unit/logic/unload_to_finda/CMakeLists.txt +++ b/tests/unit/logic/unload_to_finda/CMakeLists.txt @@ -1,24 +1,24 @@ # define the test executable add_executable( unload_to_finda_tests - ../../../../src/logic/unload_to_finda.cpp - ../../../../src/modules/buttons.cpp - ../../../../src/modules/debouncer.cpp - ../../../../src/modules/finda.cpp - ../../../../src/modules/fsensor.cpp - ../../../../src/modules/globals.cpp - ../../../../src/modules/idler.cpp - ../../../../src/modules/leds.cpp - ../../../../src/modules/permanent_storage.cpp - ../../../../src/modules/selector.cpp - ../../../../src/modules/user_input.cpp - ../../modules/stubs/stub_adc.cpp - ../../modules/stubs/stub_eeprom.cpp - ../../modules/stubs/stub_gpio.cpp - ../../modules/stubs/stub_shr16.cpp - ../../modules/stubs/stub_timebase.cpp - ../stubs/main_loop_stub.cpp - ../stubs/stub_motion.cpp + ${CMAKE_SOURCE_DIR}/src/logic/unload_to_finda.cpp + ${CMAKE_SOURCE_DIR}/src/modules/buttons.cpp + ${CMAKE_SOURCE_DIR}/src/modules/debouncer.cpp + ${CMAKE_SOURCE_DIR}/src/modules/finda.cpp + ${CMAKE_SOURCE_DIR}/src/modules/fsensor.cpp + ${CMAKE_SOURCE_DIR}/src/modules/globals.cpp + ${CMAKE_SOURCE_DIR}/src/modules/idler.cpp + ${CMAKE_SOURCE_DIR}/src/modules/leds.cpp + ${CMAKE_SOURCE_DIR}/src/modules/permanent_storage.cpp + ${CMAKE_SOURCE_DIR}/src/modules/selector.cpp + ${CMAKE_SOURCE_DIR}/src/modules/user_input.cpp + ${MODULES_STUBS_DIR}/stub_adc.cpp + ${MODULES_STUBS_DIR}/stub_eeprom.cpp + ${MODULES_STUBS_DIR}/stub_gpio.cpp + ${MODULES_STUBS_DIR}/stub_shr16.cpp + ${MODULES_STUBS_DIR}/stub_timebase.cpp + ${LOGIC_STUBS_DIR}/main_loop_stub.cpp + ${LOGIC_STUBS_DIR}/stub_motion.cpp test_unload_to_finda.cpp ) diff --git a/tests/unit/modules/buttons/CMakeLists.txt b/tests/unit/modules/buttons/CMakeLists.txt index 7bc32c3..4116fde 100644 --- a/tests/unit/modules/buttons/CMakeLists.txt +++ b/tests/unit/modules/buttons/CMakeLists.txt @@ -1,7 +1,8 @@ # define the test executable add_executable( - buttons_tests ../../../../src/modules/buttons.cpp ../../../../src/modules/debouncer.cpp - ../stubs/stub_adc.cpp ../stubs/stub_timebase.cpp test_buttons.cpp + buttons_tests + ${CMAKE_SOURCE_DIR}/src/modules/buttons.cpp ${CMAKE_SOURCE_DIR}/src/modules/debouncer.cpp + ${MODULES_STUBS_DIR}/stub_adc.cpp ${MODULES_STUBS_DIR}/stub_timebase.cpp test_buttons.cpp ) # define required search paths diff --git a/tests/unit/modules/leds/CMakeLists.txt b/tests/unit/modules/leds/CMakeLists.txt index 045db8a..8643d17 100644 --- a/tests/unit/modules/leds/CMakeLists.txt +++ b/tests/unit/modules/leds/CMakeLists.txt @@ -1,7 +1,7 @@ # define the test executable add_executable( - leds_tests ../../../../src/modules/leds.cpp ../stubs/stub_shr16.cpp ../stubs/stub_timebase.cpp - test_leds.cpp + leds_tests ${CMAKE_SOURCE_DIR}/src/modules/leds.cpp ${MODULES_STUBS_DIR}/stub_shr16.cpp + ${MODULES_STUBS_DIR}/stub_timebase.cpp test_leds.cpp ) # define required search paths diff --git a/tests/unit/modules/protocol/CMakeLists.txt b/tests/unit/modules/protocol/CMakeLists.txt index 75344ba..58d1a78 100644 --- a/tests/unit/modules/protocol/CMakeLists.txt +++ b/tests/unit/modules/protocol/CMakeLists.txt @@ -1,5 +1,5 @@ # define the test executable -add_executable(protocol_tests ../../../../src/modules/protocol.cpp test_protocol.cpp) +add_executable(protocol_tests ${CMAKE_SOURCE_DIR}/src/modules/protocol.cpp test_protocol.cpp) # define required search paths target_include_directories(protocol_tests PUBLIC ${CMAKE_SOURCE_DIR}/src/modules)