Skip to content

Commit 0d817bf

Browse files
authored
Merge pull request #8 from Stary2001/linux
Fix building on Linux, add PLAYDATE_SDK_PATH support
2 parents 9ca209d + 0d5f18b commit 0d817bf

File tree

4 files changed

+43
-16
lines changed

4 files changed

+43
-16
lines changed

CMakeLists.txt

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
11
cmake_minimum_required(VERSION 3.14)
22
set(CMAKE_C_STANDARD 11)
33

4-
execute_process(
5-
COMMAND bash -c "egrep '^\\s*SDKRoot' $HOME/.Playdate/config"
6-
COMMAND head -n 1
7-
COMMAND cut -c9-
8-
OUTPUT_VARIABLE SDK
9-
OUTPUT_STRIP_TRAILING_WHITESPACE
10-
)
4+
set(ENVSDK $ENV{PLAYDATE_SDK_PATH})
5+
6+
if (NOT ${ENVSDK} STREQUAL "")
7+
# Convert path from Windows
8+
file(TO_CMAKE_PATH ${ENVSDK} SDK)
9+
else()
10+
execute_process(
11+
COMMAND bash -c "egrep '^\\s*SDKRoot' $HOME/.Playdate/config"
12+
COMMAND head -n 1
13+
COMMAND cut -c9-
14+
OUTPUT_VARIABLE SDK
15+
OUTPUT_STRIP_TRAILING_WHITESPACE
16+
)
17+
endif()
18+
19+
if (NOT EXISTS ${SDK})
20+
message(FATAL_ERROR "SDK Path not found; set ENV value PLAYDATE_SDK_PATH")
21+
return()
22+
endif()
1123

1224
# Game Name Customization
1325
set(PLAYDATE_GAME_NAME Playnote)

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@ STACK_SIZE = 61800
44
PRODUCT = Playnote.pdx
55

66
# Locate the SDK
7-
SDK = $(shell egrep '^\s*SDKRoot' ~/.Playdate/config | head -n 1 | cut -c9-)
7+
SDK = ${PLAYDATE_SDK_PATH}
8+
ifeq ($(SDK),)
9+
SDK = $(shell egrep '^\s*SDKRoot' ~/.Playdate/config | head -n 1 | cut -c9-)
10+
endif
11+
12+
ifeq ($(SDK),)
13+
$(error SDK path not found; set ENV value PLAYDATE_SDK_PATH)
14+
endif
815

916
######
1017
# IMPORTANT: You must add your source folders to VPATH for make to find them

Source/main.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ import './components/NoNoteDialog'
4242
import './components/Thumbnail'
4343
import './components/Timeline'
4444
import './components/DitherSwatch'
45-
import './components/ScrollBar'
45+
import './components/Scrollbar'
4646
import './components/KeyValList'
4747
import './components/TextView'
4848

49-
import './scenes/Screenbase'
49+
import './scenes/ScreenBase'
5050

5151
playdate.graphics.setFont(MAIN_FONT)
5252
playdate.display.setRefreshRate(REFRESH_RATE_GLOBAL)
@@ -97,4 +97,4 @@ end
9797
-- playdate.graphics.generateQRCode('https://playnote.studio/filehelp', 120, function (qr)
9898
-- playdate.simulator.writeToFile(qr, '~/qr.png')
9999
-- print('qr generated')
100-
-- end)
100+
-- end)

build.sh

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,19 @@
44

55
# REPLACE WITH THE NAME OF YOUR PLAYDATE GAME PDX
66
GAME="Playnote.pdx"
7+
78
# SDK installer writes the install location to ~/.Playdate/config
8-
SDK = ${PLAYDATE_SDK_PATH}
9-
ifeq ($(SDK),)
10-
SDK = $(shell egrep '^\s*SDKRoot' ~/.Playdate/config | head -n 1 | cut -c9-)
11-
endif
9+
if [ -z $PLAYDATE_SDK_PATH ]; then
10+
SDK=$(egrep '^\s*SDKRoot' ~/.Playdate/config | head -n 1 | cut -c9-)
11+
else
12+
SDK=$PLAYDATE_SDK_PATH
13+
fi
14+
15+
if [ -z $SDK ]; then
16+
echo "Playdate SDK path not found; set environment value PLAYDATE_SDK_PATH."
17+
exit 1
18+
fi
19+
1220
CMD=$1
1321

1422
if [ -z $CMD ]; then
@@ -84,4 +92,4 @@ if [ $CMD == "release" ]; then
8492
rm ./${GAME}.zip
8593
fi
8694

87-
exit 0
95+
exit 0

0 commit comments

Comments
 (0)