|
| 1 | +# Created on April 08 2023 |
| 2 | +# Copyright (c) 2020 - Daniel Hajnal |
| 3 | + |
| 4 | +# This file is part of the Shellminator project. |
| 5 | + |
| 6 | +cmake_minimum_required( VERSION 3.24 ) |
| 7 | +project( Shellminator VERSION 1.1.3 ) |
| 8 | + |
| 9 | +set(CMAKE_C_STANDARD 11) |
| 10 | +set(CMAKE_CXX_STANDARD 17) |
| 11 | + |
| 12 | +option(RUN_TESTS "Enable Tests" OFF) |
| 13 | +option(BUILD_SIMULATOR "Build Simulator" OFF) |
| 14 | +option(BUILD_EXAMPLES "Build Examples" OFF) |
| 15 | +option(BUILD_WEBASSEMBLY "Build WebAssembly" OFF) |
| 16 | + |
| 17 | +if (RUN_TESTS) |
| 18 | + |
| 19 | + add_compile_options( -fprofile-arcs ) |
| 20 | + add_compile_options( -ftest-coverage ) |
| 21 | + add_compile_options( -O0 ) |
| 22 | + add_compile_options( -Wall ) |
| 23 | + add_link_options("--coverage") |
| 24 | + set( CMAKE_EXE_LINKER_FLAGS "-lgcov -fprofile-arcs -ftest-coverage" ) |
| 25 | + |
| 26 | +endif() |
| 27 | + |
| 28 | +include_directories( |
| 29 | + src |
| 30 | + extras/simulator |
| 31 | + extras/Unity/src |
| 32 | +) |
| 33 | + |
| 34 | +set( SOURCES |
| 35 | + #src/Commander-API-Commands.cpp |
| 36 | + #src/Commander-API-Commands.hpp |
| 37 | + src/Commander-API.cpp |
| 38 | + src/Commander-API.hpp |
| 39 | + src/Commander-IO.cpp |
| 40 | + src/Commander-IO.hpp |
| 41 | + src/Commander-Utils.cpp |
| 42 | + src/Commander-Utils.hpp |
| 43 | + src/Commander-Arguments.cpp |
| 44 | + src/Commander-Arguments.hpp |
| 45 | + src/Commander-Settings.hpp |
| 46 | + |
| 47 | + extras/simulator/Arduino.h |
| 48 | + extras/simulator/Print.cpp |
| 49 | + extras/simulator/Print.h |
| 50 | + extras/simulator/Printable.h |
| 51 | + extras/simulator/Stream.cpp |
| 52 | + extras/simulator/Stream.h |
| 53 | + extras/simulator/System.h |
| 54 | + extras/simulator/System.cpp |
| 55 | + extras/simulator/stdioStream.hpp |
| 56 | + extras/simulator/stdioStream.cpp |
| 57 | +) |
| 58 | + |
| 59 | +if (RUN_TESTS) |
| 60 | + |
| 61 | + |
| 62 | + set( UNIT_TESTING |
| 63 | + extras/Unity/src/unity_internals.h |
| 64 | + extras/Unity/src/unity.c |
| 65 | + extras/Unity/src/unity.h |
| 66 | + extras/tests/testStream.cpp |
| 67 | + extras/tests/testStream.hpp |
| 68 | + ) |
| 69 | + |
| 70 | +endif() |
| 71 | + |
| 72 | +# Commander settings |
| 73 | +add_compile_definitions( |
| 74 | + # SHELLMINATOR_ENABLE_HIGH_MEMORY_USAGE |
| 75 | + SHELLMINATOR_ENABLE_PROGRESS_BAR_SUPPORT |
| 76 | + SHELLMINATOR_ENABLE_PLOT_MODULE |
| 77 | + |
| 78 | + #UNITY_OUTPUT_COLOR |
| 79 | + |
| 80 | +) |
| 81 | + |
| 82 | +if( BUILD_SIMULATOR ) |
| 83 | + |
| 84 | + # Build the simulator |
| 85 | + add_executable( Simulator ${SOURCES} extras/simulator/simulator.cpp ) |
| 86 | + |
| 87 | +endif() |
| 88 | + |
| 89 | +if(RUN_TESTS) |
| 90 | + |
| 91 | + # Unit testing |
| 92 | + add_executable( test_init ${SOURCES} ${UNIT_TESTING} extras/tests/testCases/test_init.cpp ) |
| 93 | + add_executable( test_piping ${SOURCES} ${UNIT_TESTING} extras/tests/testCases/test_piping.cpp ) |
| 94 | + |
| 95 | +endif() |
| 96 | + |
| 97 | +# Do not edit this comment and do not write anything after it! |
| 98 | +# It will be generated with the exampleGenerator.py script. |
| 99 | +#---- Examples Section ----# |
| 100 | + |
| 101 | +if( BUILD_EXAMPLES ) |
| 102 | + add_executable( Argumentbasic ${SOURCES} extras/examples_desktop/Desktop/Argumentbasic/Argumentbasic.cpp ) |
| 103 | + add_executable( Basic ${SOURCES} extras/examples_desktop/Desktop/Basic/Basic.cpp ) |
| 104 | +endif() |
| 105 | +if( BUILD_WEBASSEMBLY ) |
| 106 | + add_executable( Argumentbasic ${SOURCES} extras/examples_emscripten/Emscripten/Argumentbasic/Argumentbasic.cpp ) |
| 107 | + target_link_options( Argumentbasic PUBLIC -sNO_EXIT_RUNTIME=1 -sFORCE_FILESYSTEM=1 -sRETAIN_COMPILER_SETTINGS -sASYNCIFY ) |
| 108 | + |
| 109 | + add_executable( Basic ${SOURCES} extras/examples_emscripten/Emscripten/Basic/Basic.cpp ) |
| 110 | + target_link_options( Basic PUBLIC -sNO_EXIT_RUNTIME=1 -sFORCE_FILESYSTEM=1 -sRETAIN_COMPILER_SETTINGS -sASYNCIFY ) |
| 111 | + |
| 112 | +endif() |
0 commit comments