Fix some mac stuff, add more debug options
This commit is contained in:
parent
740a0c46f4
commit
947728809f
6 changed files with 72 additions and 5 deletions
49
.vscode/launch.json
vendored
49
.vscode/launch.json
vendored
|
|
@ -6,13 +6,58 @@
|
||||||
"configurations": [
|
"configurations": [
|
||||||
|
|
||||||
{
|
{
|
||||||
"name": "Nim Debug",
|
"name": "Nim Debug GLFW Windows",
|
||||||
"type": "gdb",
|
"type": "gdb",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"target": "${workspaceFolder}\\build\\demo\\demo_glfw_debug.exe",
|
"target": "${workspaceFolder}\\build\\demo\\demo_glfw_debug.exe",
|
||||||
"cwd": "${workspaceRoot}",
|
"cwd": "${workspaceRoot}",
|
||||||
"gdbpath": "${workspaceFolder}\\nim-gdb.bat",
|
"gdbpath": "${workspaceFolder}\\nim-gdb.bat",
|
||||||
"valuesFormatting": "parseText"
|
"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"
|
||||||
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -10,7 +10,7 @@ proc main =
|
||||||
c.version = glv32
|
c.version = glv32
|
||||||
c.title = "Minimal Nim-GLFW example"
|
c.title = "Minimal Nim-GLFW example"
|
||||||
c.forwardCompat = true
|
c.forwardCompat = true
|
||||||
c.profile = opCompatProfile
|
c.profile = opCoreProfile
|
||||||
c.debugContext = false
|
c.debugContext = false
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@ requires "nim >= 1.0.0",
|
||||||
import os
|
import os
|
||||||
|
|
||||||
proc setupBuildDir(buildDir: string, prefixes: openArray[string]) =
|
proc setupBuildDir(buildDir: string, prefixes: openArray[string]) =
|
||||||
|
if not defined(windows):
|
||||||
|
return
|
||||||
var arch = ""
|
var arch = ""
|
||||||
if system.existsDir(buildDir):
|
if system.existsDir(buildDir):
|
||||||
rmDir buildDir
|
rmDir buildDir
|
||||||
|
|
@ -54,7 +56,7 @@ task buildSDL2ExampleDebug, "Build SDL2 example debug":
|
||||||
|
|
||||||
task buildGLFWExample, "Build GLFW example":
|
task buildGLFWExample, "Build GLFW example":
|
||||||
let buildDir = setupGLFW()
|
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":
|
task buildGLFWExampleDebug, "Build GLFW example debug":
|
||||||
let buildDir = setupGLFW()
|
let buildDir = setupGLFW()
|
||||||
|
|
|
||||||
0
nim-gdb
Normal file → Executable file
0
nim-gdb
Normal file → Executable file
20
nim-gdb-mac
Executable file
20
nim-gdb-mac
Executable 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" "$@"
|
||||||
|
|
@ -71,7 +71,7 @@ cIncludeDir(srcDir/"src")
|
||||||
when defined(macosx):
|
when defined(macosx):
|
||||||
# cDefine("GLFW_INCLUDE_GLCOREARB", "1")
|
# 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".}
|
{.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):
|
elif defined(unix):
|
||||||
{.passC: "-DNANOVG_GL3_IMPLEMENTATION -DNANOVG_GLEW".}
|
{.passC: "-DNANOVG_GL3_IMPLEMENTATION -DNANOVG_GLEW".}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue