Skip to content

Commit

Permalink
vscode setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthieu Hodgkinson committed Oct 22, 2024
1 parent 90086df commit 3d83dac
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 5 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ win/xaudacity.ico
*.dll

.idea/
.vscode/

# AppImage
linuxdeploy/*
Expand All @@ -190,7 +189,6 @@ build.artifacts/
.qped
.directory
.idea
.vscode/
/builds
build
/build_overrides.cmake
Expand Down
30 changes: 30 additions & 0 deletions .vscode/audacity.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"folders": [
{
"path": ".."
}
],
"settings": {
"cmake.generator": "Ninja",
"cmake.configureArgs": [
"-DCMAKE_INSTALL_PREFIX=${workspaceFolder}/build/install",
// "-DAU_MODULE_EFFECTS_VST=ON"
],
"editor.guides.indentation": true,
"editor.detectIndentation": true,
"editor.guides.highlightActiveIndentation": true,
"editor.autoIndent": "full",
"editor.tabSize": 4,
"explorer.excludeGitIgnore": false,
"search.useIgnoreFiles": false,
"files.exclude": {
"build": true,
"builds": true
},
"C_Cpp.autoAddFileAssociations": false,
"uncrustify.configPath.windows": "${workspaceFolder}/_deps/muse_framework-src/buildscripts/ci/checkcodestyle/uncrustify_muse.cfg",
"uncrustify.configPath.linux": "${workspaceFolder}/_deps/muse_framework-src/buildscripts/ci/checkcodestyle/uncrustify_muse.cfg",
"uncrustify.configPath.osx": "${workspaceFolder}/_deps/muse_framework-src/buildscripts/ci/checkcodestyle/uncrustify_muse.cfg",
"cmake.useVsDeveloperEnvironment": "auto",
}
}
22 changes: 22 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"${QTDIR}/include/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "cl.exe",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "msvc-x64",
"configurationProvider": "ms-vscode.cmake-tools"
}
],
"version": 4
}
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"ms-vscode.cmake-tools",
"ms-vscode.cpptools",
"zachflower.uncrustify" // for code formatting
],
}
13 changes: 13 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"configurations": [
{
"name": "run audacity",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build/install/bin/audacity.exe",
"preLaunchTask": "CMake: install",
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
}
]
}
3 changes: 3 additions & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ TODO: generalize to other OSes

Note: the default generator is Ninja. Have it installed, or change the "cmake.generator" value in `.vscode/settings.json` to something else (eg `Visual Studio 16 2019`).

#### Open the workspace
One way of doing this is by executing Ctrl+Shift+P, and choosing "Open Workspace from File". Navigate to the root of the repository and select the `.vscode/audacity.code-workspace` file. Else, you can open the folder, then the workspace file, and click the "Open Workspace" button.

#### Install recommended extensions
When opening the repository in VSCode, you will be prompted to install recommended extensions. You can do it then. If you missed it, you can install them later by executing Ctrl+Shift+P, typing `Extensions: Show Recommended Extensions`, and installing the recommended extensions.

Expand Down
6 changes: 3 additions & 3 deletions src/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -273,14 +273,14 @@ if (OS_IS_WIN)
USE_SOURCE_PERMISSIONS
)

if (MSVC AND DEVELOPER)
if (MSVC)
set_target_properties(${EXECUTABLE_NAME} PROPERTIES
VS_DEBUGGER_COMMAND "${CMAKE_INSTALL_PREFIX}/bin/${EXECUTABLE_NAME}"
VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}/bin"
)
endif()

if (DEVELOPER)
# Unlike VSCode, Visual Studio doesn't have pre-launch tasks we could use to run the `INSTALL` target.
# Instead, we copy the executable to the install directory after the build.
add_custom_command(TARGET ${EXECUTABLE_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_INSTALL_PREFIX}/bin
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${EXECUTABLE_NAME}> ${CMAKE_INSTALL_PREFIX}/bin
Expand Down

0 comments on commit 3d83dac

Please sign in to comment.