Skip to content

Commit

Permalink
Move VSCode launch configuration into example project folder, add Lin…
Browse files Browse the repository at this point in the history
…ux support
  • Loading branch information
samdze committed Jul 19, 2023
1 parent ff3c7b1 commit e4f0bdc
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 48 deletions.
41 changes: 0 additions & 41 deletions .vscode/launch.json

This file was deleted.

20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,30 @@ This package is an independent bindings library, not affiliated with Panic.
### Prerequisites

- Playdate SDK
- Nim 1.6.10+
- Nimble 0.13.1
- Nim 1.6.10+ (check with `nim -v`)
- Nimble 0.13.1 (check with `nimble -v`)
- `PLAYDATE_SDK_PATH` environment variable
- Linux or macOS (Windows support is still WIP)
- [SDK Prerequisites](https://sdk.play.date/Inside%20Playdate%20with%20C.html#_prerequisites) based on OS

### Installation

You can quickly start using the bindings opening the `playdate_example` project included in this repository.<br>
If you want to start from scratch, here are the steps to follow:

1. If you haven't run it already, start by initializing your nimble package:
1. If you haven't run it already, start by initializing your nimble package and follow the instructions:

```
nimble init
```

2. Move into your package directory.<br>
2. Install the `playdate` package:

```
nimble install playdate
```

3. Move into your package directory.<br>
Add the `playdate` package as a dependency and configure the build tasks by running the following:

```
Expand All @@ -55,7 +63,7 @@ echo 'include playdate/build/nimble' >> *.nimble;
echo 'include playdate/build/config' > config.nims;
```

3. Finally, run this command to setup the structure of the project, which prepares your application to be compiled and bundled correctly:
4. Finally, run this command to setup the structure of the project, which prepares your application to be compiled and bundled correctly:

```
nimble setup
Expand Down Expand Up @@ -100,7 +108,7 @@ For simulator + device (pdx):
nimble all
```

The repository also contains VSCode launch configurations to build, start and debug your Nim application from the editor.
The example project `playdate_example` also contains VSCode launch configurations to build, start and debug your Nim application from the editor.

---
This project is perfectly usable but do note that it's still a work in progress, here's what is missing right now:
Expand Down
89 changes: 89 additions & 0 deletions playdate_example/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
// 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": [
{
"type": "cppdbg",
"request": "launch",
"name": "Debug PDX",
"program": "${env:PLAYDATE_SDK_PATH}/bin/Playdate Simulator",
"args": ["${workspaceFolder}/playdate_example.pdx"],
"cwd": "${workspaceFolder}",
"osx": {
"MIMode": "lldb",
"program": "${env:PLAYDATE_SDK_PATH}/bin/Playdate Simulator.app"
},
"linux": {
"MIMode": "gdb",
"program": "${env:PLAYDATE_SDK_PATH}/bin/PlaydateSimulator"
},
"windows": {
"MIMode": "gdb",
"program": "${env:PLAYDATE_SDK_PATH}/bin/PlaydateSimulator.exe"
}
},
{
"type": "cppdbg",
"request": "launch",
"name": "Build & Debug PDX",
"program": "${env:PLAYDATE_SDK_PATH}/bin/Playdate Simulator",
"preLaunchTask": "Build Universal PDX",
"args": ["${workspaceFolder}/playdate_example.pdx"],
"cwd": "${workspaceFolder}",
"osx": {
"MIMode": "lldb",
"program": "${env:PLAYDATE_SDK_PATH}/bin/Playdate Simulator.app"
},
"linux": {
"MIMode": "gdb",
"program": "${env:PLAYDATE_SDK_PATH}/bin/PlaydateSimulator"
},
"windows": {
"MIMode": "gdb",
"program": "${env:PLAYDATE_SDK_PATH}/bin/PlaydateSimulator.exe"
}
},
{
"type": "cppdbg",
"request": "launch",
"name": "Build Sim. & Debug PDX",
"program": "${env:PLAYDATE_SDK_PATH}/bin/Playdate Simulator",
"preLaunchTask": "Build Simulator PDX",
"args": ["${workspaceFolder}/playdate_example.pdx"],
"cwd": "${workspaceFolder}",
"osx": {
"MIMode": "lldb",
"program": "${env:PLAYDATE_SDK_PATH}/bin/Playdate Simulator.app"
},
"linux": {
"MIMode": "gdb",
"program": "${env:PLAYDATE_SDK_PATH}/bin/PlaydateSimulator"
},
"windows": {
"MIMode": "gdb",
"program": "${env:PLAYDATE_SDK_PATH}/bin/PlaydateSimulator.exe"
}
},
{
"type": "cppdbg",
"request": "attach",
"name": "Build Sim. + Attach & Debug PDX",
"program": "${env:PLAYDATE_SDK_PATH}/bin/Playdate Simulator",
"preLaunchTask": "Build Simulator PDX",
"osx": {
"MIMode": "lldb",
"program": "${env:PLAYDATE_SDK_PATH}/bin/Playdate Simulator.app"
},
"linux": {
"MIMode": "gdb",
"program": "${env:PLAYDATE_SDK_PATH}/bin/PlaydateSimulator"
},
"windows": {
"MIMode": "gdb",
"program": "${env:PLAYDATE_SDK_PATH}/bin/PlaydateSimulator.exe"
}
}
]
}
File renamed without changes.
3 changes: 2 additions & 1 deletion src/playdate/build/nimble.nim
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ proc make(target: string) =
exec(arch & "make " & target & " -f " & makefile)

task clean, "Clean the project folders":
exec "rm -fR " & nimcacheDir()
if dirExists(nimcacheDir()):
exec "rm -fR " & nimcacheDir()
make "clean"

task cdevice, "Generate C files for the device":
Expand Down

0 comments on commit e4f0bdc

Please sign in to comment.