-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generation of VS Code debug configuration #302
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,5 +15,8 @@ www/ | |
.project | ||
.settings | ||
|
||
# VSCode auto-generated files | ||
.vscode | ||
|
||
# CMake default directories | ||
build/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
function(generate_vscode) | ||
set(one_value_args "TARGET;FILE") | ||
cmake_parse_arguments(args "${option_args}" "${one_value_args}" "" ${ARGN}) | ||
|
||
if(args_UNPARSED_ARGUMENTS) | ||
message(SEND_ERROR "generate_vscode called with invalid arguments: ${args_UNPARSED_ARGUMENTS}") | ||
endif() | ||
|
||
if(NOT args_TARGET) | ||
message(SEND_ERROR "generate_vscode: TARGET argument is missing") | ||
endif() | ||
|
||
if(NOT args_FILE) | ||
message(SEND_ERROR "generate_vscode: FILE argument is missing") | ||
endif() | ||
|
||
# backup existing launch.json | ||
if(EXISTS ${args_FILE}) | ||
string(TIMESTAMP t) | ||
file(COPY_FILE ${args_FILE} ${args_FILE}.${t}) | ||
endif() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this does overwrite the file, then custom values get lost, am I right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is the biggest drawback especially for people with additional custom Configuration in their |
||
|
||
# collect all NED folders for given target | ||
get_ned_folders(${args_TARGET} opp_run_ned_folders) | ||
set(opp_run_ned_folders "\"-n$<JOIN:${opp_run_ned_folders},:>\"") | ||
|
||
# collect libraries for opp_run | ||
set(opp_run_libraries "") | ||
_get_opp_run_dependencies(${args_TARGET} opp_run_dependencies) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are the OmnetC++ dependencies am I right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are the libraries of Artery (e.g. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens if one includes all the libs all the time in the |
||
foreach(opp_run_dependency IN LISTS opp_run_dependencies) | ||
list(APPEND opp_run_libraries "\"-l$<TARGET_FILE:${opp_run_dependency}>\"") | ||
endforeach() | ||
set(opp_run_libraries "$<JOIN:${opp_run_libraries},,>") | ||
|
||
set(opp_run_executable ${OMNETPP_RUN_DEBUG}) | ||
|
||
# substitute variables first, then generator expressions | ||
configure_file(${PROJECT_SOURCE_DIR}/cmake/launch.json.in ${args_FILE} @ONLY) | ||
file(GENERATE OUTPUT ${args_FILE} INPUT ${args_FILE}) | ||
endfunction() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Launch Artery in Debugger", | ||
"type": "cppdbg", | ||
"request": "launch", | ||
|
||
// Set path to OMNet++ debug runner | ||
"program": "@opp_run_executable@", | ||
|
||
// Set working directory to scenario | ||
"cwd": "${workspaceFolder}/scenarios/${input:scenario}", | ||
|
||
"args": [ | ||
// Paths to NED files | ||
@opp_run_ned_folders@, | ||
|
||
// Libraries used for Artery | ||
@opp_run_libraries@ | ||
|
||
// .ini file to of the scenario | ||
"omnetpp.ini", | ||
|
||
// OMNet++ config to run | ||
"-c${input:config}", | ||
// Run number | ||
"-r${input:runId}", | ||
|
||
// OMNet++ interface can either be Qtenv or Cmdenv | ||
// "-uQtenv", | ||
"-uCmdenv" | ||
Comment on lines
+34
to
+36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think that Cmdenv is deprecated but Tkenv. Of course, Cmdenv is not a graphical environment at all but it is very useful for automated/headless simulation runs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Then I mixed that up. Thank you for the clarification. |
||
], | ||
"stopAtEntry": false, | ||
"externalConsole": false, | ||
"MIMode": "gdb", | ||
"setupCommands": [ | ||
{ | ||
"description": "Enable pretty-printing for gdb", | ||
"text": "-enable-pretty-printing", | ||
"ignoreFailures": true | ||
}, | ||
{ | ||
"description": "Enable all-exceptions", | ||
"text": "catch throw", | ||
"ignoreFailures": true | ||
} | ||
], | ||
// "preLaunchTask": "C/C++: clang++ build active file", | ||
"miDebuggerPath": "/usr/bin/gdb" | ||
} | ||
], | ||
"inputs": [ | ||
{ | ||
"id": "scenario", | ||
"type": "promptString", | ||
"default": "artery", | ||
"description": "Scenario folder to launch (provide the folder in ./scenarios/)" | ||
}, | ||
{ | ||
"id": "config", | ||
"type": "promptString", | ||
"default": "inet", | ||
"description": "OMNeT++ config to launch" | ||
}, | ||
{ | ||
"id": "runId", | ||
"type": "promptString", | ||
"default": "0", | ||
"description": "Run ID of the config to launch" | ||
} | ||
] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A doc-comment explaining the purpose of this function would be beneficial and appreciated 😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes!