Files
MuditaOS/cmake/modules/SerialPort.cmake
Lefucjusz 178fba165e [MOS-783] First part of new dir structure implementation
Works:
    - generating .img for Pure;
    - Pure boots after flashing new image and
    seems to be working fine;

    Not yet:
    - generating update package;
    - generating image for Harmony;
    - simulator;
    - path-related unit tests fail
    due to paths being hardcoded
    in test scenarios.
2023-01-19 16:41:56 +01:00

45 lines
1.4 KiB
CMake

# This modul checks if "SERIAL_PORT" for linux target variable is set
# if yes define_serial_port macro can be used to set proper definitions
#
#####
# define_serial(TARGET_NAME)
#
# this checks if SERIAL_PORT variable is defined and if so, add proper defines
# for the specified target
#
#####
# message_serial_status()
#
# This macro can be used to message if and which port is used
include(Colours)
macro(define_serial)
if(NOT ${ARGC} EQUAL 1 )
message(WARNING "No target specified!")
else()
if(${PROJECT_TARGET} STREQUAL "TARGET_Linux")
if (SERIAL_PORT)
set(SERIAL_PORT_DEF "SERIAL_PORT=\"${SERIAL_PORT}\"")
target_compile_definitions(
${ARGV0}
PUBLIC
${SERIAL_PORT_DEF}
)
endif()
endif()
endif()
endmacro()
macro(message_serial_status)
if(${PROJECT_TARGET} STREQUAL "TARGET_Linux")
if (SERIAL_PORT_DEF)
message("Using serial port: ${SERIAL_PORT_DEF}")
else()
message ("${Orange}Serial Port not defined, modem support disabled! ${ColourReset}")
message ("${Orange}add -DSERIAL_PORT=<path to serial> where modem is connected ${ColourReset}")
message ("${Orange}ex.: \n ./configure.sh linux Debug -DSERIAL_PORT=/dev/ttyUSB0 ${ColourReset}")
endif()
endif()
endmacro()