Verified Commit 11bde024 authored by Tadej Novak's avatar Tadej Novak
Browse files

Add VS Code helpers prototype

parent a6409df6
# This is a dummy CMake file meant only to help the CI system to categorise the files
# that are in this directory. This file is not meant to have *any* meaningful CMake
# configuration in it!
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
# TODO: should this be enabled or disabled by default
# Setup VS Code helpers
set( ATLAS_VSCODE_HELPERS TRUE CACHE BOOL
"Setup VS Code helpers" )
if( ATLAS_VSCODE_HELPERS )
# singularity settings
set( ATLAS_VSCODE_SINGULARITY_IMAGE "" CACHE STRING
"Use singularity wrapper for VS Code" )
set( ATLAS_VSCODE_SINGULARITY_ARGS "" CACHE STRING
"Singularity args for VS Code" )
# commom prefix
set( VSCODE_PREFIX "${CMAKE_BINARY_DIR}/vsc_")
# compiler
execute_process(
COMMAND ${CMAKE_COMMAND} -E create_symlink "${CMAKE_CXX_COMPILER}" "${VSCODE_PREFIX}compiler"
OUTPUT_FILE "${ATLAS_VSODE_PREFIX}compiler" )
# python
find_program( VSCODE_PYTHON python )
execute_process(
COMMAND ${CMAKE_COMMAND} -E create_symlink "${VSCODE_PYTHON}" "${VSCODE_PREFIX}python"
OUTPUT_FILE "${ATLAS_VSODE_PREFIX}python" )
# flake8 wrapper
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/flake8_wrapper.sh.in ${VSCODE_PREFIX}flake8 @ONLY )
# gdb wrappers
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/gdb_wrapper.sh.in ${VSCODE_PREFIX}gdb_wrapper @ONLY )
if( ATLAS_VSCODE_SINGULARITY_IMAGE )
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/gdb_runner_singularity.sh.in ${VSCODE_PREFIX}gdb_runner @ONLY )
else()
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/gdb_runner_plain.sh.in ${VSCODE_PREFIX}gdb_runner @ONLY )
endif()
endif()
......@@ -6,7 +6,7 @@
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "${env:CXX}",
"compilerPath": "${workspaceFolder}/../build/vsc_compiler",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "gcc-x64",
......
#!/bin/bash
set -o allexport
source "@CMAKE_BINARY_DIR@/env.txt"
set +o allexport
"@VSCODE_PYTHON@" -m flake8 "$@"
#!/bin/bash
BINARY_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
GDB_WRAPPER_SCRIPT="${BINARY_DIR}/vsc_gdb_wrapper"
echo "Running GDB wrapper from ${GDB_WRAPPER_SCRIPT}"
echo
"${GDB_WRAPPER_SCRIPT}" "$@"
#!/bin/bash
BINARY_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
GDB_WRAPPER_SCRIPT="${BINARY_DIR}/vsc_gdb_wrapper"
echo "Using singularity 'singularity exec @ATLAS_VSCODE_SINGULARITY_ARGS@ \"@ATLAS_VSCODE_SINGULARITY_IMAGE@\"'"
echo "Running GDB wrapper from ${GDB_WRAPPER_SCRIPT}"
echo
singularity exec @ATLAS_VSCODE_SINGULARITY_ARGS@ "@ATLAS_VSCODE_SINGULARITY_IMAGE@" "/bin/bash" "${GDB_WRAPPER_SCRIPT}" "$@"
#!/bin/bash
args=("$@")
set --
export ATLAS_LOCAL_ROOT_BASE="/cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase"
source "${ATLAS_LOCAL_ROOT_BASE}/user/atlasLocalSetup.sh"
echo
binary_dir="@CMAKE_BINARY_DIR@"
pushd "${binary_dir}" || exit
asetup --restore
source "@ATLAS_PLATFORM@/setup.sh"
popd || exit
echo
echo "Running gdb with args '${args[*]}'"
gdb "${args[@]}"
......@@ -4,5 +4,15 @@
"twxs.cmake"
],
"remote.SSH.lockfilesInTmp": true,
"gitlab.instanceUrl": "https://gitlab.cern.ch"
"gitlab.instanceUrl": "https://gitlab.cern.ch",
"python.pythonPath": "${workspaceFolder}/../build/vsc_python",
"python.envFile": "${workspaceFolder}/../build/env.txt",
"python.linting.enabled": true,
"python.linting.flake8Enabled": true,
"python.linting.flake8Path": "${workspaceFolder}/../build/vsc_flake8",
"python.linting.flake8Args": [
"--select=ATL,F,E101,E7,E9,W6",
"--ignore=ATL238,ATL9,E701,E702,E704,E741",
"--enable-extensions=ATL902"
]
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment