-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
61 lines (50 loc) · 1.5 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
cmake_minimum_required(VERSION 3.14)
set(CMAKE_C_STANDARD 11)
set(ENVSDK $ENV{PLAYDATE_SDK_PATH})
if (NOT ${ENVSDK} STREQUAL "")
# Convert path from Windows
file(TO_CMAKE_PATH ${ENVSDK} SDK)
else()
execute_process(
COMMAND bash -c "egrep '^\\s*SDKRoot' $HOME/.Playdate/config"
COMMAND head -n 1
COMMAND cut -c9-
OUTPUT_VARIABLE SDK
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
if (NOT EXISTS ${SDK})
message(FATAL_ERROR "SDK Path not found; set ENV value PLAYDATE_SDK_PATH")
return()
endif()
set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
set(CMAKE_XCODE_GENERATE_SCHEME TRUE)
# Game Name Customization
set(PLAYDATE_GAME_NAME playing-with-blocks)
set(PLAYDATE_GAME_DEVICE playing-with-blocks_DEVICE)
# Source files
set(GAME_SRC_FILES
src/asset.c
src/form.c
src/game.c
src/main.c
src/rand.c
src/text.c
src/scenes/board/assets.c
src/scenes/board/boardScene.c
src/scenes/board/matrix.c
src/scenes/options/optionsScene.c
src/scenes/title/titleScene.c
)
project(${PLAYDATE_GAME_NAME} C ASM)
include_directories(${CMAKE_SOURCE_DIR}/src)
if (TOOLCHAIN STREQUAL "armgcc")
add_executable(${PLAYDATE_GAME_DEVICE} ${SDK}/C_API/buildsupport/setup.c ${GAME_SRC_FILES})
set(PLAYDATE_TARGET ${PLAYDATE_GAME_DEVICE})
else()
add_library(${PLAYDATE_GAME_NAME} SHARED ${GAME_SRC_FILES})
set(PLAYDATE_TARGET ${PLAYDATE_GAME_NAME})
endif()
# Suppress Playdate SDK warnings
target_include_directories(${PLAYDATE_TARGET} SYSTEM PUBLIC ${SDK}/C_API/)
include(${SDK}/C_API/buildsupport/playdate_game.cmake)