diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..2e80e51e --- /dev/null +++ b/.vscode/launch.json @@ -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": [], + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..776fc349 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "cmake.sourceDirectory": "${workspaceFolder}/src", + "C_Cpp.intelliSenseEngine": "Tag Parser", + "files.associations": { + "*.h": "c", + }, +} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e54a342c..0cd69c4a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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") @@ -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)