-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add CMake modules to generate VSCode Launch and Settings files #11
Open
stephendpmurphy
wants to merge
4
commits into
glassboard-dev:develop
Choose a base branch
from
stephendpmurphy:main
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
78878c6
Add CMake modules to generate VSCode Launch and Settings files
stephendpmurphy 86d5f43
Add compileCommands param to cpp_settings and newlines in each .json …
stephendpmurphy f6228b9
Adding newlines to cmake module
stephendpmurphy fb08abd
Rework intellisense module to find all include dirs for the executabl…
stephendpmurphy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,2 @@ | ||
set(DEBUG_ERASE_CMD "pyocd" "erase" "-t${MCU_TARGET}" "--chip") | ||
set(DEBUG_FLASH_CMD "pyocd" "flash" "-t${MCU_TARGET}" "-f20000khz" "${EXECUTABLE_OUTPUT_PATH}/${EXECUTABLE_NAME}.elf") | ||
|
||
write_file(${CMAKE_CURRENT_SOURCE_DIR}/.vscode/launch.json | ||
{\n | ||
\t\"version\": \"0.2.0\",\n | ||
\t\"configurations\": [\n | ||
\t{\n | ||
\t\t\"name\": \"${MCU_TARGET}\",\n | ||
\t\t\"type\": \"cortex-debug\",\n | ||
\t\t\"request\": \"launch\",\n | ||
\t\t\"servertype\":\"pyocd\",\n | ||
\t\t\"cwd\": \"${workspaceRoot}\",\n | ||
\t\t\"executable\": \"${EXECUTABLE_OUTPUT_PATH}/${EXECUTABLE_NAME}.elf\",\n | ||
\t\t\"device\": \"${MCU_TARGET}\",\n | ||
\t\t\"runToMain\": true,\n | ||
\t\t\"v1\": false,\n | ||
\t\t\"serverArgs\": [\n | ||
\t\t\t\"--target\",\n | ||
\t\t\t\"${MCU_TARGET}\"\n | ||
\t\t]\n | ||
\t}]\n | ||
}) | ||
set(DEBUG_FLASH_CMD "pyocd" "flash" "-t${MCU_TARGET}" "-f20000khz" "${EXECUTABLE_OUTPUT_PATH}/${EXECUTABLE_NAME}.elf") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Make sure to create the .vscode directory if it doesn't exist | ||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/.vscode) | ||
|
||
string(TOLOWER ${DEBUG_TOOLSET} DEBUG_SERVER_TYPE) | ||
|
||
# Specify the template for the c_cpp_properties.json file | ||
write_file(${CMAKE_CURRENT_SOURCE_DIR}/.vscode/launch.json | ||
"{ | ||
\"version\":\"0.2.0\", | ||
\"configurations\":[ | ||
{ | ||
\"name\":\"${DEBUG_TOOLSET}\", | ||
\"type\":\"cortex-debug\", | ||
\"request\":\"launch\", | ||
\"servertype\":\"${DEBUG_SERVER_TYPE}\", | ||
\"cwd\":\"\", | ||
\"executable\":\"${EXECUTABLE_OUTPUT_PATH}/${EXECUTABLE_NAME}.elf\", | ||
\"device\":\"${MCU_TARGET}\", | ||
\"interface\": \"${DEBUG_INTERFACE}\", | ||
\"v1\":false, | ||
\"serverArgs\":[ | ||
\"--nogui\" | ||
]," | ||
) | ||
|
||
if(${ENABLE_SEGGER_RTT} AND (${DEBUG_SERVER_TYPE} STREQUAL "jlink")) | ||
|
||
write_file(${CMAKE_CURRENT_SOURCE_DIR}/.vscode/launch.json | ||
" \"rttConfig\":{ | ||
\"enabled\":true, | ||
\"address\":\"auto\", | ||
\"decoders\":[{ | ||
\"port\":0, | ||
\"type\":\"console\" | ||
}] | ||
} | ||
}] | ||
}" APPEND) | ||
|
||
else() | ||
|
||
write_file(${CMAKE_CURRENT_SOURCE_DIR}/.vscode/launch.json | ||
" }] | ||
}" APPEND) | ||
|
||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Make sure to create the .vscode directory if it doesn't exist | ||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/.vscode) | ||
|
||
get_target_property(LINKED_LIBRARIES ${EXECUTABLE_NAME} LINK_LIBRARIES) | ||
|
||
if(LINKED_LIBRARIES) | ||
foreach(lib ${LINKED_LIBRARIES}) | ||
get_target_property(LIBRARIES_INCLUDE_DIRS ${lib} INCLUDE_DIRECTORIES) | ||
if(LIBRARIES_INCLUDE_DIRS) | ||
set(INTELLISENSE_INCLUDES ${INTELLISENSE_INCLUDES} ${LIBRARIES_INCLUDE_DIRS}) | ||
endif() | ||
endforeach() | ||
|
||
foreach(lib ${LINKED_LIBRARIES}) | ||
get_target_property(INTF_LIBRARIES_INCLUDE_DIRS ${lib} INTERFACE_INCLUDE_DIRECTORIES) | ||
if(INTF_LIBRARIES_INCLUDE_DIRS) | ||
set(INTELLISENSE_INCLUDES ${INTELLISENSE_INCLUDES} ${INTF_LIBRARIES_INCLUDE_DIRS}) | ||
endif() | ||
endforeach() | ||
endif() | ||
|
||
get_target_property(APP_INCLUDE_DIRS ${EXECUTABLE_NAME} INCLUDE_DIRECTORIES) | ||
|
||
if(APP_INCLUDE_DIRS) | ||
set(INTELLISENSE_INCLUDES ${INTELLISENSE_INCLUDES} ${APP_INCLUDE_DIRS}) | ||
endif() | ||
|
||
# Generate the list of include directories as a JSON array | ||
set(INCLUDE_DIRS_JSON "") | ||
foreach(INCLUDE_DIR ${INTELLISENSE_INCLUDES}) | ||
list(APPEND INCLUDE_DIRS_JSON "\"${INCLUDE_DIR}\"") | ||
endforeach() | ||
string(JOIN ",\n" INCLUDE_DIRS_JSON ${INCLUDE_DIRS_JSON}) | ||
|
||
# Specify the template for the c_cpp_properties.json file | ||
write_file(${CMAKE_CURRENT_SOURCE_DIR}/.vscode/c_cpp_properties.json | ||
"{ | ||
\"configurations\": [ | ||
{ | ||
\"name\": \"${CMAKE_BUILD_TYPE}\", | ||
\"includePath\": [ | ||
${INCLUDE_DIRS_JSON} | ||
], | ||
\"compileCommands\": \"\$\{workspaceFolder\}/build/compile_command.json\", | ||
\"defines\": [\"\"], | ||
\"compilerPath\": \"${CMAKE_C_COMPILER}\", | ||
\"cStandard\": \"c99\", | ||
\"cppStandard\": \"c++17\", | ||
\"intelliSenseMode\": \"gcc-arm\" | ||
stephendpmurphy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
], | ||
\"version\": 1 | ||
}") |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why C 99 instead of C 2011 or C 2018?
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.
@lukewelchGB Current flags (
flags.cmake
) are using-std=gnu99
so setting CMake to be in parity.