Skip to content

[FEATURE] Command line selection of app to compile #74

@vcrocher

Description

@vcrocher

Allow to pass the statemachine folder to compile as a command line option instead of selecting (commenting in/out) the relevant line in the CMakeFileLists.txt.

Pros

  • No change required to any file to switch statemachine (also easier for PR)
  • Allow possible bulk compilation/testing of several SM
  • IDE/programmatic choice of SM to compile

Cons

  • Longer cmake command line

Possible Implementation

A typical build command would be rm -r build && mkdir build && cd build && cmake -DAPP:string=src/apps/M2DemoMachine ..

And the new CMakeFileLists.txt would look like this:

cmake_minimum_required(VERSION 3.3)
project(CORC C CXX)

#Invoke by specifying application path to build. e.g.
# cmake -DAPP:string=src/apps/ExoTestMachine ..
#or
# cmake -DAPP:string=src/apps/M2DemoMachine ..
#or
# cmake -DAPP:string=../myStateMachineApp .. for an external statemachine folder

#To cross-compile for Arm (BeagleBone) use the armhf toolchain:
# cmake -DAPP:string=src/apps/M3DemoMachine -DCMAKE_TOOLCHAIN_FILE=../armhf.cmake ..
# For aarch64 (e.g. Jetson):
# cmake -DAPP:string=src/apps/M3DemoMachine -DCMAKE_TOOLCHAIN_FILE=../aarch64.cmake ..

################################## USER FLAGS ##################################

## Comment to use actual hardware, uncomment for a nor robot (virtual) app
set(NO_ROBOT ON)

## Select desired logging level (Options: TRACE, DEBUG, INFO, WARN, ERROR, CRITICAL, OFF)
## INFO is the recommended level in normal operation
set(CORC_LOGGING_LEVEL DEBUG)

################################################################################

## Select the application by setting the state machine app.cmake to use
SET(${APP} "src/apps/ExoTestMachine" CACHE STRING "Realtive app state machine app to build") #Default to ExoTestMachine if not provided

include(${APP}/app.cmake)

message("-----------------------------------------------\nCompiling state machine ${APP} with platform ${PLATFORM}\n-----------------------------------------------")

## CORC internal cmake logic
include(corc.cmake)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions