Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Easy build/debug configuration for vscode #267

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"version": "0.2.0",
"configurations": [
{ // This configuration fails to attach the process for debugging as described here: https://github.com/microsoft/vscode-cpptools/issues/3161.
"name": "(lldb) Launch",
"type": "cppdbg",
"request": "launch",
"cwd": "${workspaceFolder}",
"program": "${command:cmake.launchTargetPath}",
"args": [],
"stopAtEntry": false,
"externalConsole": false,
"MIMode": "lldb",
},
{ // Requires the CodeLLDB plugin, works for debugging
"name": "Launch",
"type": "lldb",
"request": "launch",
"cwd": "${workspaceFolder}",
"program": "${command:cmake.launchTargetPath}",
"args": [],
}
]
}
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"cmake.sourceDirectory": "${workspaceFolder}/src",
"C_Cpp.intelliSenseEngine": "Tag Parser",
"files.associations": {
"*.h": "c",
},
}
12 changes: 10 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 2.8...3.22)
project(SDLPoP)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -std=gnu99")
Expand All @@ -12,13 +12,21 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${SDLPoP_SOURCE_DIR}/..")

#set(SDL2 "C:/work/libraries/SDL2-2.0.8")

# On macOS, if you used Homebrew to install SDL2, the location may be something like this:
# On macOS, use homebrew to install SDL2: `brew install sdl2 sdl2_image`.
# Or, alternatively, set the library path via -DSDL2=... or uncomment the line below.

#set(SDL2 "/usr/local/Cellar/sdl2/2.0.5")

if (NOT(WIN32) AND (DEFINED SDL2))
include_directories(${SDL2}/include/SDL2)
link_directories(${SDL2}/lib)
elseif (DEFINED ENV{HOMEBREW_PREFIX})
if (EXISTS $ENV{HOMEBREW_PREFIX}/include/SDL2)
include_directories($ENV{HOMEBREW_PREFIX}/include/SDL2)
link_directories($ENV{HOMEBREW_PREFIX}/lib)
else()
message(FATAL_ERROR, "sdl2 not found; Run `brew install sdl2 sdl2_image`")
endif()
endif()

if (WIN32)
Expand Down