From 8e6e40848dbfabffe959375a9a4a57afc2f94151 Mon Sep 17 00:00:00 2001 From: mjbudd77 <44712797+mjbudd77@users.noreply.github.com> Date: Fri, 8 Jan 2021 15:14:23 -0500 Subject: [PATCH] VS Code integration (#298) * Integrated VS Code IDE into project. A very useful tool for debugging Qt/SDL port. * Fixed Qt/SDL debug launch target in vscode config for MacOS --- .vscode/launch.json | 39 ++++++++++++++++++++++++ .vscode/tasks.json | 28 +++++++++++++++++ scripts/unix_debug_build.sh | 60 +++++++++++++++++++++++++++++++++++++ 3 files changed, 127 insertions(+) create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json create mode 100755 scripts/unix_debug_build.sh diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..c090b463 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,39 @@ +{ + // 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": [ + { + "name": "(gdb) Launch (Linux)", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/build/src/fceux", + "args": [], + "stopAtEntry": false, + "cwd": "${workspaceFolder}" + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + }, + { + "name": "(lldb) Launch (MacOS)", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/build/src/fceux.app/Contents/MacOS/fceux", + "args": [], + "stopAtEntry": false, + "cwd": "${workspaceFolder}" + "environment": [], + "externalConsole": false, + "MIMode": "lldb" + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 00000000..da5007b9 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,28 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "Build - Incremental", + "type": "shell", + "command": "${workspaceFolder}/scripts/unix_debug_build.sh", + "problemMatcher": [ "$gcc" ], + "group": { + "kind": "build", + "isDefault": true + } + }, + { + "label": "Build - Full/Clean", + "type": "shell", + "command": "${workspaceFolder}/scripts/unix_debug_build.sh -B", + "problemMatcher": [ "$gcc" ], + "group": { + "kind": "build", + "isDefault": false + } + } + + ] +} \ No newline at end of file diff --git a/scripts/unix_debug_build.sh b/scripts/unix_debug_build.sh new file mode 100755 index 00000000..45f512e4 --- /dev/null +++ b/scripts/unix_debug_build.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +CLEAN_BUILD=0; +MAKE_ARGS=""; + +while test $# -gt 0 +do + echo "$1" + + case $1 in + -B) CLEAN_BUILD=1; MAKE_ARGS=" -B "; + ;; + + -J) MAKE_ARGS+=" -j`nproc` "; + ;; + + -j) shift; MAKE_ARGS+=" -j$1 "; + ;; + esac + shift; +done + +PROJECT_ROOT=$( cd "$(dirname ${BASH_SOURCE[0]})"/.. && pwd ) + +echo $PROJECT_ROOT; +echo "Building for OS: $OSTYPE"; +#echo "CLEAN_BUILD=$CLEAN_BUILD"; + +cd $PROJECT_ROOT; + +if [[ $CLEAN_BUILD == 1 ]]; then + echo "Performing Clean Build"; + rm -rf build; +fi + +if [ ! -e "build" ]; then + mkdir build; +fi + +cd build; + +CMAKE_ARGS="\ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON "; + +if [[ "$OSTYPE" == "darwin"* ]]; then + export Qt5_DIR=`brew --prefix qt5` + echo "Qt5_DIR=$Qt5_DIR"; + CMAKE_ARGS+=" -DCMAKE_PREFIX_PATH=`brew --prefix qt5` "; +fi + +#echo $CMAKE_ARGS; + +cmake $CMAKE_ARGS ..; + +#echo $MAKE_ARGS; + +make $MAKE_ARGS; +