Skip to content

Instantly share code, notes, and snippets.

@pakLebah
Last active July 21, 2023 15:39
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save pakLebah/dab98067e9a388a3a8d2f5c0b44a7d3f to your computer and use it in GitHub Desktop.
Save pakLebah/dab98067e9a388a3a8d2f5c0b44a7d3f to your computer and use it in GitHub Desktop.
My VS Code tasks for Free Pascal programs on Mac.
{
// 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": [
{ // shortcut: F5 (start debugging)
"type": "lldb",
"request": "launch",
"name": "LLDB Debugger",
"cwd": "${workspaceFolder}",
"program": ".build/debug/${fileBasenameNoExtension}",
"args": [],
"terminal": "integrated",
"preLaunchTask": "fpc: Build Debug",
"postDebugTask": "fpc: Remove Build Files"
},
// { // native debugger
// "type": "lldb-mi",
// "request": "launch",
// "name": "Native Debugger",
// "cwd": "${workspaceFolder}",
// "target": ".build/debug/${fileBasenameNoExtension}",
// // "terminal": "",
// "preLaunchTask": "fpc: Build Debug",
// "postDebugTask": "fpc: Remove Build Files"
// },
]
}
{
"omnipascal.searchPath": "~/Programs/pascal",
"omnipascal.freePascalSourcePath": "~/Programs/freepascal/fpcsrc",
"omnipascal.delphiInstallationPath": "~/Programs/freepascal/fpc/bin/x86_64-darwin",
"omnipascal.defaultDevelopmentEnvironment": "FreePascal",
"sde.buildOnSave": false,
"sde.languageServerMode": "langserver",
"swift.languageServerPath": "~/GitHub/sourcekit-lsp/.build/release/sourcekit-lsp",
"sourcekit-lsp.serverPath": "~/GitHub/sourcekit-lsp/.build/release/sourcekit-lsp",
"[markdown]": {
"files.trimTrailingWhitespace": false,
},
"files.trimFinalNewlines": true,
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
"files.associations": {
"*.json": "jsonc"
},
"editor.fontFamily": "'FiraCode-Medium', 'DejaVu Sans Code', Menlo, Monaco, monospace",
"editor.rulers": [80, 120],
"editor.tabSize": 2,
"editor.fontSize": 13,
"editor.letterSpacing": 0.1,
"editor.wordWrapColumn": 120,
"editor.fontLigatures": true,
"editor.matchBrackets": false,
"editor.smoothScrolling": true,
"editor.minimap.enabled": false,
"editor.renderLineHighlight": "all",
"editor.tokenColorCustomizations": {
"comments": {
"fontStyle": "italic"
}
},
"workbench.iconTheme": "vscode-great-icons",
"workbench.enableExperiments": false,
"workbench.editor.tabCloseButton": "left",
"workbench.statusBar.feedback.visible": false,
"workbench.settings.enableNaturalLanguageSearch": false,
"workbench.colorCustomizations": {
"[Default Dark+]": {
"editorRuler.foreground": "#333333",
"editor.lineHighlightBackground": "#282828",
// "editorGutter.background": "#181818",
// "editorIndentGuide.activeBackground": "#a0a0a0",
"sideBar.border": "#333333",
// "tab.border": "#3f3f3f",
},
},
"window.zoomLevel": 0,
"window.titleBarStyle": "native",
"window.title": "${rootName}${separator}${dirty}${activeFolderShort}/${activeEditorShort} | Code",
"explorer.confirmDelete": false,
"explorer.confirmDragAndDrop": false,
"terminal.integrated.fontSize": 13,
"terminal.integrated.cursorStyle": "line",
"terminal.integrated.cursorBlinking": true,
"debug.toolBarLocation": "docked",
"lldb.launch.terminal": "integrated",
"git.enableSmartCommit": true,
"search.showLineNumbers": true,
"zenMode.hideLineNumbers": false,
"telemetry.enableTelemetry": false,
"telemetry.enableCrashReporter": false,
}
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
//
//! DON'T FORGET TO ADD THESE LINES INTO YOUR USER SHELL PROFILE
// export PATH=$PATH:<PATH_TO_FPC_BIN_FOLDER>
// export INSTANTFPCOPTIONS="-n @<PATH_TO_FPC_BIN_FOLDER>fpc.cfg"
//
"version": "2.0.0",
"options": {
"cwd": "${workspaceFolder}",
"env": {
// task settings for files and folders, use full path for commands
"FPC_COMMAND" : "/Users/MacBee/Programs/freepascal/fpc/bin/x86_64-darwin/fpc.sh",
"JCF_COMMAND" : "./jcf",
"PROJECTFILE" : "${relativeFile}",
"PROJECTBASE" : "${fileBasenameNoExtension}",
"UNITS" : "~/Programs/GitHub/*",
"INCLUDES" : "~/Programs/pascal/inc/*",
"LIBRARIES" : "~/Programs/pascal/lib/*",
"OUTPUT" : ".build",
"DEBUG" : ".build/debug",
"RELEASE" : ".build/release",
"DEPLOY" : ".build/deploy",
"EXTENSION" : ".cgi", // set this to .cgi for web app
"PROCESSOR" : "-Px86_64",
"OPSYSTEM" : "-Tdarwin",
"SYNTAX" : "-Mobjfpc",
},
},
"tasks": [
{ //! Build debug without any optimization
"label" : "fpc: Build Debug",
"type" : "shell",
"group" : "build",
"command": "${FPC_COMMAND}",
"args" : [
"${PROJECTFILE}", // main project file
"${PROCESSOR}", // target processor
"${OPSYSTEM}", // target operating system
"${SYNTAX}", // pascal syntax mode
"-Scahij-", // pascal syntax setting
"-CroOti", // generated code setting
"-O-", // disable optimization
"-Xg", // external debug info
"-B", // rebuild all units
"-v", // verbose message
"-glpsw2", // dwarf debug setting
"-godwarfcpp", // dwarf mode setting
"-Fu${UNITS}", // additional units
"-Fi${INCLUDES}", // additional include files
"-Fl${LIBRARIES}", // additional libraries
"-FE${DEBUG}", // output for binary
"-FU${OUTPUT}", // output for units
],
"presentation": {
"focus": true,
},
"problemMatcher": {
"owner" : "objectpascal",
"fileLocation": ["relative", "${workspaceFolder}"],
"pattern" : {
// capture FPC's error messages and display them in Problems panel
"kind" : "location",
"regexp" : "^(.*)\\((\\d.*),(\\d.*)\\) (Warning|Error|Fatal): (.*)$",
"file" : 1,
"line" : 2,
"column" : 3,
"severity" : 4,
"message" : 5,
"loop" : true
}
}
},
{ //! Build release with full optimization
"label" : "fpc: Build Release",
"type" : "shell",
"group" : {
"kind" : "build",
"isDefault": true
},
"command": "${FPC_COMMAND}",
"args": [
"${PROJECTFILE}", // main project file
"${PROCESSOR}", // target processor
"${OPSYSTEM}", // target operating system
"${SYNTAX}", // pascal syntax mode
"-Schij-", // pascal syntax setting
"-CX", // generated code setting
"-O3", // code optimization setting
"-XXs", // executable setting
"-B", // rebuild all units
"-v", // verbose message
"-Fu${UNITS}", // additional units
"-Fi${INCLUDES}", // additional include files
"-Fl${LIBRARIES}", // additional libraries
"-FE${RELEASE}", // output for binary
"-FU${OUTPUT}", // output for units
],
"presentation": {
"focus": true,
},
"problemMatcher": {
"owner" : "objectpascal",
"fileLocation": ["relative", "${workspaceFolder}"],
"pattern" : {
"kind" : "location",
"regexp" : "^(.*)\\((\\d.*),(\\d.*)\\) (Warning|Error|Fatal): (.*)$",
"file" : 1,
"line" : 2,
"column" : 3,
"severity" : 4,
"message" : 5,
"loop" : true
}
}
},
{ //! Syntax check without linking
"label" : "fpc: Syntax Check",
"type" : "shell",
"group" : "build",
"command": "${FPC_COMMAND}",
"args" : [
"${PROJECTFILE}", // main project file
"${PROCESSOR}", // target processor
"${OPSYSTEM}", // target operating system
"${SYNTAX}", // pascal syntax mode
"-Scahij-", // pascal syntax setting
"-Se99", // maximum error found
"-B", // rebuild all units
"-v", // verbose message
"-s", // syntax check mode
"-Fu${UNITS}", // additional units
"-Fi${INCLUDES}", // additional include files
"-Fl${LIBRARIES}", // additional libraries
"-FE${OUTPUT}", // output for binary
"-FU${OUTPUT}", // output for units
],
"presentation": {
"focus": true,
},
"problemMatcher": {
"owner" : "objectpascal",
"fileLocation": ["relative", "${workspaceFolder}"],
"pattern" : {
"kind" : "location",
"regexp" : "^(.*)\\((\\d.*),(\\d.*)\\) (Warning|Error|Fatal): (.*)$",
"file" : 1,
"line" : 2,
"column" : 3,
"severity" : 4,
"message" : 5,
"loop" : true
}
}
},
{ //! Run code using InstantFPC (quick compile)
"label" : "fpc: Run Code",
"type" : "shell",
"group" : "test",
"command": "instantfpc",
"args" : [
"${PROJECTFILE}", // main project file
"-B", // always build
],
"presentation": {
"focus": true,
},
"problemMatcher": {
"owner" : "objectpascal",
"fileLocation": ["relative", "${workspaceFolder}"],
"pattern" : {
"kind" : "location",
"regexp" : "^(.*)\\((\\d.*),(\\d.*)\\) (Warning|Error|Fatal): (.*)$",
"file" : 1,
"line" : 2,
"column" : 3,
"severity" : 4,
"message" : 5,
"loop" : true
}
}
},
{ //! Execute generated (debug) binary
"label": "fpc: Execute Binary",
"type" : "shell",
"group": {
"kind": "test",
"isDefault": true
},
"command": "./${DEBUG}/${PROJECTBASE}",
"args" : [],
"presentation": {
"focus": true,
},
"problemMatcher": []
},
{ //! Deploy binary from release
"label" : "fpc: Deploy Release",
"type" : "shell",
"command": "cp",
"args" : [
"${RELEASE}/${PROJECTBASE}", // from release
"${DEPLOY}/${PROJECTBASE}${EXTENSION}", // to deploy
],
"presentation": {
"reveal": "silent",
},
"problemMatcher": []
},
{ //! JCF beautify Code
"label" : "JCF: Beautify Code",
"type" : "shell",
"command": "${JCF_COMMAND}",
"args" : [
"${PROJECTFILE}",
"-clarify",
"-inplace",
"-config=jcf.xml"
],
"presentation": {
"reveal": "never"
},
"problemMatcher": []
},
{ //! JCF obfuscate Code
"label" : "JCF: Obfuscate Code",
"type" : "shell",
"command": "${JCF_COMMAND}",
"args" : [
"${PROJECTFILE}",
"-obfuscate",
"-inplace",
"-config=jcf.xml"
],
"presentation": {
"reveal": "never"
},
"problemMatcher": []
},
{ //! Create build folders for compilation
"label" : "fpc: Create Build Folders",
"type" : "shell",
"command": "mkdir",
"args" : [
"${OUTPUT}",
"${DEBUG}",
"${RELEASE}",
"${DEPLOY}",
],
"presentation": {
"reveal": "silent",
},
"problemMatcher": []
},
{ //! Remove compiler genereted files
"label" : "fpc: Remove Build Files",
"type" : "shell",
"command": "rm",
"args" : [
"-rf", // remove them all!
"${OUTPUT}/*.*", // unit files
"${DEBUG}/{,.[!.],..?}*", // debug files
"${RELEASE}/{,.[!.],..?}*", // release files
"~/.cache/instantfpc/${PROJECTBASE}", // ifpc binary
"~/.cache/instantfpc/${PROJECTBASE}.*", // ifpc source
],
"presentation": {
"reveal": "silent",
},
"problemMatcher": []
},
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment