aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt32
1 files changed, 27 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0efeb1f..e5d96e9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,10 +2,20 @@ cmake_minimum_required(VERSION 3.12)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
+set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # For Kate's LSP
+
+# Compile option for SDL2 build
+option(SDL2_BUILD "Build an SDL2 version that can be run on a computer." OFF)
+
+if (SDL2_BUILD)
+ set(PICO_PLATFORM host)
+ set(PICO_DEOPTIMIZED_DEBUG 1)
+ add_compile_definitions(SDL2_BUILD PICO_PLATFORM=host PICO_DEOPTIMIZED_DEBUG=1)
+endif(SDL2_BUILD)
# initalize pico_sdk from installed location
# (note this can come from environment, CMake cache etc)
-set(PICO_SDK_PATH "/home/pi/pico/pico-sdk")
+#set(PICO_SDK_PATH "/home/pi/pico/pico-sdk")
# Pull in Pico SDK (must be before project)
include(pico_sdk_import.cmake)
@@ -23,7 +33,8 @@ add_compile_definitions(PICO_DEBUG_MALLOC PICO_DEBUG_MALLOC_LOW_WATER=0 PICO_USE
# We still have to factor in global variables, so this is not precise. The best place for information seems to be the pico-wath.elf.map file.
# Small size used for testing, seems to work fine.
-add_compile_definitions(PICO_HEAP_SIZE=0x200)
+# TODO SDL: reduce back to 0x200 and see what happens (should work fine and change nothing as 60000 B malloc worked)
+add_compile_definitions(PICO_HEAP_SIZE=0x20000)
# Initialise the Pico SDK
pico_sdk_init()
@@ -35,7 +46,7 @@ add_library(Oled
oled/ss_oled.c
oled/ss_oled.h
)
-target_link_libraries(Oled pico_stdlib hardware_i2c)
+target_link_libraries(Oled pico_stdlib)
# Main code
add_executable(pico-watch
@@ -46,6 +57,8 @@ add_executable(pico-watch
buttons.cpp
buttons.hpp
hal/api.cpp
+ hal/sdl2/display.hpp
+ hal/sdl2/display.cpp
apps/home_menu/main.cpp
apps/home_menu/main.hpp
apps/main_clock/main.cpp
@@ -64,9 +77,18 @@ target_link_libraries(pico-watch pico_stdlib)
# Add any user requested libraries
target_link_libraries(pico-watch
- Oled
+ Oled)
+
+if(SDL2_BUILD)
+ find_package(SDL2 REQUIRED)
+ include_directories(${SDL2_INCLUDE_DIRS})
+ target_link_libraries(pico-watch ${SDL2_LIBRARIES})
+else()
+ target_link_libraries(pico-watch
+ hardware_i2c
hardware_rtc
hardware_sync # For use of __wfi()
- )
+)
+endif()
pico_add_extra_outputs(pico-watch)