Update .vscode, untrack and move to /contrib

This commit is contained in:
Pesc0
2023-07-11 15:50:47 +02:00
committed by Adrián Insaurralde Avalos
parent 3895b5d6c0
commit d98f0e1ae3
13 changed files with 286 additions and 156 deletions

View File

@@ -1,12 +0,0 @@
{
"configurations": [
{
"name": "FreeCAD",
"includePath": ["${workspaceFolder}/**"],
"cStandard": "c17",
"cppStandard": "c++17",
"configurationProvider": "ms-vscode.cmake-tools"
}
],
"version": 4
}

View File

@@ -1,18 +0,0 @@
[
{
"name": "FreeCAD Linux",
"compilers": {
"C": "${workspaceFolder}/.conda/freecad/bin/cc",
"CXX": "${workspaceFolder}/.conda/freecad/bin/c++"
},
"environmentSetupScript": "${workspaceFolder}/.vscode/env.sh"
},
{
"name": "FreeCAD macOS",
"compilers": {
"C": "${workspaceFolder}/.conda/freecad/bin/clang",
"CXX": "${workspaceFolder}/.conda/freecad/bin/clang++"
},
"environmentSetupScript": "${workspaceFolder}/.vscode/env.sh"
}
]

3
.vscode/env.sh vendored
View File

@@ -1,3 +0,0 @@
#!/bin/bash
source activate freecad

48
.vscode/launch.json vendored
View File

@@ -1,48 +0,0 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "C/C++: Linux: build and debug FreeCAD",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/bin/FreeCAD",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"preLaunchTask": "CMake: build"
},
{
"name": "C/C++: macOS: build and debug FreeCAD",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/bin/FreeCAD",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "lldb",
"preLaunchTask": "CMake: build"
},
{
"name": "Python: Remote Attach",
"type": "python",
"request": "attach",
"preLaunchTask": "conda: activate environment",
"redirectOutput": true,
"connect": {
"host": "localhost",
"port": 5678
},
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "${workspaceFolder}"
}
],
"justMyCode": false
}
]
}

17
.vscode/settings.json vendored
View File

@@ -1,17 +0,0 @@
{
"files.associations": {
"__config": "cpp",
"iosfwd": "cpp",
"vector": "cpp",
"tuple": "cpp"
},
"editor.formatOnType": true,
"cmake.preferredGenerators": ["Ninja", "NMake Makefiles"],
"cmake.cmakePath": "${workspaceFolder}/.conda/freecad/bin/cmake",
"cmake.configureSettings": {
"BUILD_WITH_CONDA:BOOL": "ON",
"BUILD_FEM_NETGEN:BOOL": "ON",
"FREECAD_USE_PYBIND11:BOOL": "ON",
"FREECAD_USE_EXTERNAL_SMESH:BOOL": "ON"
}
}

58
.vscode/tasks.json vendored
View File

@@ -1,58 +0,0 @@
{
"tasks": [
{
"type": "shell",
"label": "conda: activate environment",
"command": "activate freecad",
"problemMatcher": [],
"detail": "Activate conda environment",
"group": "build"
},
{
"type": "cmake",
"label": "CMake: configure",
"command": "configure",
"problemMatcher": [],
"detail": "CMake template configure task",
"group": "build"
},
{
"type": "cmake",
"label": "CMake: build",
"command": "build",
"targets": ["all"],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [],
"detail": "CMake template build task"
},
{
"type": "cmake",
"label": "CMake: test",
"command": "test",
"problemMatcher": [],
"detail": "CMake template test task",
"group": "build"
},
{
"type": "cmake",
"label": "CMake: clean",
"command": "clean",
"problemMatcher": [],
"detail": "CMake template clean task",
"group": "build"
},
{
"type": "cmake",
"label": "CMake: clean rebuild",
"command": "cleanRebuild",
"targets": ["all"],
"problemMatcher": [],
"detail": "CMake template clean rebuild task",
"group": "build"
}
],
"version": "2.0.0"
}

27
contrib/.vscode/c_cpp_properties.json vendored Normal file
View File

@@ -0,0 +1,27 @@
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"configurationProvider": "ms-vscode.cmake-tools"
},
{
"name": "Mac",
"includePath": [
"${workspaceFolder}/**"
],
"configurationProvider": "ms-vscode.cmake-tools"
},
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/usr/include/**"
],
"configurationProvider": "ms-vscode.cmake-tools"
}
],
"version": 4
}

102
contrib/.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,102 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug C++ Tests",
"type": "cppdbg",
"request": "launch",
"cwd": "${workspaceFolder}",
"program": "${command:cmake.buildDirectory}/tests/Tests_run",
"args": [],
"environment": [
{
"name": "PATH",
"value": "${command:cmake.buildDirectory}/tests:${env:PATH}"
}
],
"linux": {
"MIMode": "gdb",
"miDebuggerPath": "/usr/bin/gdb"
},
"osx": {
"MIMode": "lldb"
},
"windows": {
"MIMode": "gdb",
"miDebuggerPath": "gdb.exe"
},
"stopAtEntry": false,
"externalConsole": false,
"preLaunchTask": "CMake: build",
"sourceFileMap": {
"${workspaceFolder}": "${workspaceFolder}"
}
},
{
"name": "C/C++ debugger",
"type": "cppdbg",
"request": "launch",
"cwd": "${workspaceFolder}",
"program": "${command:cmake.buildDirectory}/bin/FreeCAD",
"args": ["${workspaceFolder}/.vscode/scripts/VSCodeAutostartDebug.FCMacro"],
"environment": [
{
"name": "PATH",
"value": "${command:cmake.buildDirectory}/bin:${env:PATH}"
},
{
"name": "PYDEVD_DISABLE_FILE_VALIDATION",
"value": "1"
}
],
"linux": {
"MIMode": "gdb",
"miDebuggerPath": "/usr/bin/gdb"
},
"osx": {
"MIMode": "lldb"
},
"windows": {
"MIMode": "gdb",
"miDebuggerPath": "C:\\MinGw\\bin\\gdb.exe"
},
"stopAtEntry": false,
"externalConsole": false,
"presentation": {
"hidden": true,
}
},
{
"name": "Python debugger",
"type": "python",
"request": "attach",
"preLaunchTask": "WaitForDebugpy",
"redirectOutput": true,
"connect": {
"host": "localhost",
"port": 5678
},
"pathMappings": [
{
"localRoot": "${workspaceFolder}/src",
"remoteRoot": "${command:cmake.buildDirectory}"
}
],
"justMyCode": false,
"presentation": {
"hidden": true,
}
}
],
"compounds": [
{
"name": "Debug FreeCAD",
"configurations": ["C/C++ debugger", "Python debugger"],
"preLaunchTask": "CMake: build",
"stopAll": true,
"presentation": {
"order": 1
}
}
]
}

View File

@@ -0,0 +1,18 @@
import debugpy
from multiprocessing.connection import Listener
from freecad.utils import get_python_exe
# get_python_exe is needed because debugpy needs a python interpreter to work.
# It does not have to be FC embedded interpreter.
# By default it attempts to use Freecad's PID mistaking it for python.
# https://github.com/microsoft/debugpy/issues/262
debugpy.configure(python=get_python_exe())
debugpy.listen(('localhost', 5678))
# Turns out you cannot probe debugpy to see if it is up:
# https://github.com/microsoft/debugpy/issues/974
# Open another port that the script WaitForDebugpy can probe to see if
# debugpy is running
listener = Listener(('localhost', 6000), backlog=10)
debugpy.wait_for_client()

View File

@@ -0,0 +1,29 @@
import socket
from contextlib import closing
import time
TIMEOUT_TIME_S = 30
RETRY_DELAY_S = 0.1
MAX_ATTEMPTS = TIMEOUT_TIME_S / RETRY_DELAY_S
def check_socket(host, port):
with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock:
sock.settimeout(RETRY_DELAY_S)
return sock.connect_ex((host, port)) == 0
def main():
# DO NOT CHECK 5678 or debugpy will break
# Check other port manually opened instead
attempt_counter = 0
while (not check_socket('localhost', 6000)) and attempt_counter < MAX_ATTEMPTS:
time.sleep(RETRY_DELAY_S)
attempt_counter += 1
if attempt_counter >= MAX_ATTEMPTS:
exit(1)
else:
exit(0)
if __name__ == "__main__":
main()

39
contrib/.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,39 @@
{
// This disables vscode from adding lines to files.associations,
// some files might not be recognized though.
// This is a vscode issue.
"C_Cpp.autoAddFileAssociations": false,
"files.associations": {
"*.c": "c",
"*.h": "cpp",
"*.cpp": "cpp",
"*.hpp": "cpp",
"*.cxx": "cpp",
"*.hxx": "cpp",
"*.py": "python",
"*.FCMacro": "python"
},
"editor.formatOnType": true,
"files.autoSave": "afterDelay",
"debug.onTaskErrors": "abort", //to not launch the python debugger when waitforport.py fails
// Does not quick launch the debugger, forces to select debugger config every time
// Use the debug panel on the left instead
"debug.showInStatusBar": "never",
"cmake.options.advanced": {
"configurePreset": {
"statusBarVisibility": "visible"
},
"build": {
"statusBarVisibility": "visible"
},
"launch": {
"statusBarVisibility": "hidden"
},
"debug": {
"statusBarVisibility": "hidden"
}
}
}

71
contrib/.vscode/tasks.json vendored Normal file
View File

@@ -0,0 +1,71 @@
{
"tasks": [
{
"type": "shell",
"label": "FreeCAD: setup conda environment",
"linux": {
"command": "conda/setup-environment.sh",
},
"osx": {
"command": "conda/setup-environment.sh",
},
"windows": {
"command": "conda/setup-environment.cmd",
},
"group": "none",
"problemMatcher": [],
},
{
"label": "WaitForDebugpy",
"type": "shell",
"command": "python ${workspaceFolder}/.vscode/scripts/WaitForDebugpy.py",
"group": "none",
"problemMatcher": [],
"presentation": {
"reveal": "never", //silently fail and don't launch the debugger
"panel": "dedicated",
"close": true,
"revealProblems": "never"
},
"hide": true
},
{
"type": "cmake",
"label": "CMake: build",
"command": "build",
"preset": "${command:cmake.activeBuildPresetName}",
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Build all targets",
"dependsOn": [],
"problemMatcher": ["$gcc"]
},
{
"label": "Tests: run c++ tests",
"detail": "Run googletest",
"type": "shell",
"command": "${command:cmake.buildDirectory}/tests/Tests_run",
"group": {
"kind": "test",
"isDefault": true
},
"dependsOn": ["CMake: build"],
"problemMatcher": []
},
{
"label": "Tests: run python tests",
"detail": "Run FreeCAD integrated tests",
"type": "shell",
"command": "${command:cmake.buildDirectory}/bin/FreeCAD",
"args": ["-t", "0"],
"group": {
"kind": "test"
},
"dependsOn": ["CMake: build"],
"problemMatcher": []
}
],
"version": "2.0.0"
}