Giter Site home page Giter Site logo

Comments (1)

patrislav1 avatar patrislav1 commented on August 15, 2024

I solved it in a different project like this:

  • Create launch.json.part per target
  • Read the launch.json.part contents into a CMake variable
  • Append the contents to a environment variable LAUNCH_JSON
  • Write the LAUNCH_JSON to the file

It's a bit ugly b/c the launch.json gets generated and overwritten once for each target, but it works

# Create launch.json for a target and append it to the global launch.json
function(launch_json PROJ_NAME)
    set(LAUNCH_JSON $ENV{LAUNCH_JSON})
    configure_file(${TEMPLATE_DIR}/vscode-pyocd.in ${CMAKE_BINARY_DIR}/launch.json.part @ONLY)
    file(READ ${CMAKE_BINARY_DIR}/launch.json.part LAUNCH_JSON_PART)
    string(APPEND LAUNCH_JSON "${LAUNCH_JSON_PART}")
    set(ENV{LAUNCH_JSON} "${LAUNCH_JSON}")
    configure_file("${TEMPLATE_DIR}/launch.json.in" "${VSCODE_DIR}/launch.json" @ONLY)
endfunction()

vscode-pyocd.in

        {
            "name": "@PROJ_NAME@",
            "cwd": "${workspaceRoot}/pyocd",
            "executable": "${workspaceRoot}/build/@PROJ_NAME@/@[email protected]",
            "request": "attach",
            "type": "cortex-debug",
            "servertype": "pyocd",
            "serverArgs": [@PYOCD_ARGLIST_OPT@],
            "svdFile": "${workspaceRoot}/pyocd/..."
        },

launch.json.in

{
    "configurations": [
@LAUNCH_JSON@
    ]
}

I won't be able to implement and test it myself right now in cubemx.cmake, b/c I'm not working with this stuff at the moment.

from cubemx.cmake.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.