Fix some mac stuff, add more debug options

This commit is contained in:
Joey Yakimowich-Payne 2020-01-11 20:26:57 -07:00
commit 947728809f
6 changed files with 72 additions and 5 deletions

49
.vscode/launch.json vendored
View file

@ -6,13 +6,58 @@
"configurations": [
{
"name": "Nim Debug",
"name": "Nim Debug GLFW Windows",
"type": "gdb",
"request": "launch",
"target": "${workspaceFolder}\\build\\demo\\demo_glfw_debug.exe",
"cwd": "${workspaceRoot}",
"gdbpath": "${workspaceFolder}\\nim-gdb.bat",
"valuesFormatting": "parseText"
}
},
{
"name": "Nim Debug SDL2 Windows",
"type": "gdb",
"request": "launch",
"target": "${workspaceFolder}\\build\\demosdl2\\demo_sdl2_debug.exe",
"cwd": "${workspaceRoot}",
"gdbpath": "${workspaceFolder}\\nim-gdb.bat",
"valuesFormatting": "parseText"
},
{
"name": "Nim Debug SDL2",
"type": "gdb",
"request": "launch",
"target": "${workspaceFolder}/build/demosdl2/demo_sdl2_debug",
"cwd": "${workspaceRoot}",
"gdbpath": "${workspaceFolder}/nim-gdb",
"valuesFormatting": "parseText"
},
{
"name": "Nim Debug GLFW",
"type": "gdb",
"request": "launch",
"target": "${workspaceFolder}/build/demo/demo_glfw_debug",
"cwd": "${workspaceRoot}",
"gdbpath": "${workspaceFolder}/nim-gdb",
"valuesFormatting": "parseText"
},
{
"name": "Nim Debug SDL2 Mac",
"type": "gdb",
"request": "launch",
"target": "${workspaceFolder}/build/demosdl2/demo_sdl2_debug",
"cwd": "${workspaceRoot}",
"gdbpath": "${workspaceFolder}/nim-gdb-mac",
"valuesFormatting": "parseText"
},
{
"name": "Nim Debug GLFW Mac",
"type": "gdb",
"request": "launch",
"target": "${workspaceFolder}/build/demo/demo_glfw_debug",
"cwd": "${workspaceRoot}",
"gdbpath": "${workspaceFolder}/nim-gdb-mac",
"valuesFormatting": "parseText"
},
]
}

View file

@ -10,7 +10,7 @@ proc main =
c.version = glv32
c.title = "Minimal Nim-GLFW example"
c.forwardCompat = true
c.profile = opCompatProfile
c.profile = opCoreProfile
c.debugContext = false
let

View file

@ -18,6 +18,8 @@ requires "nim >= 1.0.0",
import os
proc setupBuildDir(buildDir: string, prefixes: openArray[string]) =
if not defined(windows):
return
var arch = ""
if system.existsDir(buildDir):
rmDir buildDir
@ -54,7 +56,7 @@ task buildSDL2ExampleDebug, "Build SDL2 example debug":
task buildGLFWExample, "Build GLFW example":
let buildDir = setupGLFW()
exec "nim c --app:gui -d:release -d:danger -o:" & buildDir & "/" & "demo_glfw".toExe & " -r examples/demo.nim"
exec "nim c --app:gui -d:useGlfw -d:release -d:danger -o:" & buildDir & "/" & "demo_glfw".toExe & " -r examples/demo.nim"
task buildGLFWExampleDebug, "Build GLFW example debug":
let buildDir = setupGLFW()

0
nim-gdb Normal file → Executable file
View file

20
nim-gdb-mac Executable file
View file

@ -0,0 +1,20 @@
#!/usr/bin/env bash
# Exit if anything fails
set -e
which nim > /dev/null || (echo "nim not in PATH"; exit 1)
which gdb > /dev/null || (echo "gdb not in PATH"; exit 1)
# Find out where the pretty printer Python module is
NIM_SYSROOT=$(dirname $(dirname $(greadlink -e $(which nim))))
GDB_PYTHON_MODULE_PATH="$NIM_SYSROOT/tools/nim-gdb.py"
# Run GDB with the additional arguments that load the pretty printers
# Set the environment variable `NIM_GDB` to overwrite the call to a
# different/specific command (defaults to `gdb`).
NIM_GDB="${NIM_GDB:-gdb}"
echo "source $GDB_PYTHON_MODULE_PATH" > gdbcommands.txt
# exec replaces the new process of bash with gdb. It is always good to
# have fewer processes.
exec ${NIM_GDB} --command="gdbcommands.txt" "$@"

View file

@ -71,7 +71,7 @@ cIncludeDir(srcDir/"src")
when defined(macosx):
# cDefine("GLFW_INCLUDE_GLCOREARB", "1")
{.passC: "-DNANOVG_GL3_IMPLEMENTATION -DNANOVG_GLEW -D_GLFW_USE_RETINA -D_GLFW_COCOA -D_GLFW_USE_CHDir -D_GLFW_USE_MENUBAR".}
{.passL: "-m64 -framework GLUT -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo -framework Carbon -lm".}
{.passL: "-m64 -lglew -framework GLUT -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo -framework Carbon -lm".}
elif defined(unix):
{.passC: "-DNANOVG_GL3_IMPLEMENTATION -DNANOVG_GLEW".}