[env:darwin_sdl_64bits]
lib_archive = false
platform = native@^1.1.4
extra_scripts =
  pre:tools/osx_build_extra.py
  tools/linux_build_extra.py
build_flags =
  ${env.build_flags}
    -D HASP_MODEL="MacOS X App"

  ; ----- Monitor
  -D TFT_WIDTH=240
  -D TFT_HEIGHT=320
  ; SDL drivers options
  ;-D LV_LVGL_H_INCLUDE_SIMPLE
  ;-D LV_DRV_NO_CONF
  -D USE_MONITOR
  -D MONITOR_ZOOM=1  ; can be fractional like 1.5 or 2
  -D USE_MOUSE
  -D USE_MOUSEWHEEL
  -D USE_KEYBOARD
  ; ----- ArduinoJson
  -D ARDUINOJSON_DECODE_UNICODE=1
  -D HASP_NUM_PAGES=12
  -D HASP_USE_SPIFFS=0
  -D HASP_USE_LITTLEFS=0
  -D HASP_USE_EEPROM=0
  -D HASP_USE_GPIO=1
  -D HASP_USE_CONFIG=0            ; Standalone application, as library
  -D HASP_USE_DEBUG=1
  -D HASP_USE_PNGDECODE=1
  -D HASP_USE_BMPDECODE=1
  -D HASP_USE_GIFDECODE=0
  -D HASP_USE_JPGDECODE=0
  -D HASP_USE_MQTT=1
  -D MQTT_MAX_PACKET_SIZE=2048
  -D HASP_ATTRIBUTE_FAST_MEM=
  -D IRAM_ATTR=                      ; No IRAM_ATTR available
  -D PROGMEM=                      ; No PROGMEM available
  ;-D LV_LOG_LEVEL=LV_LOG_LEVEL_INFO
  ;-D LV_LOG_PRINTF=1
  ; Add recursive dirs for hal headers search
  -D POSIX
  -D PAHO_MQTT_STATIC
  -DPAHO_WITH_SSL=TRUE
  -DPAHO_BUILD_DOCUMENTATION=FALSE
  -DPAHO_BUILD_SAMPLES=FALSE
  -DCMAKE_BUILD_TYPE=Release
  -DCMAKE_VERBOSE_MAKEFILE=TRUE
  ;-D NO_PERSISTENCE
  -I.pio/libdeps/darwin_sdl_64bits/paho/src
  -I.pio/libdeps/darwin_sdl_64bits/ArduinoJson/src
  -I lib/ArduinoJson/src
  -I lib/lv_fs_if
  !python -c "import os; print(' '.join(['-I {}'.format(i[0].replace('\x5C','/')) for i in os.walk('hal/sdl2')]))"
  ; ----- Statically linked libraries --------------------
  -lSDL2
  -lm
  -lpthread
  ; MacOS with Homebrew
  -I/usr/local/include
  -L/usr/local/lib
  -DTARGET_OS_MAC=1

lib_deps =
  ${env.lib_deps}
  ; lv_drivers@~7.9.1
  ;lv_drivers=https://github.com/littlevgl/lv_drivers/archive/7d71907c1d6b02797d066f50984b866e080ebeed.zip
  https://github.com/eclipse/paho.mqtt.c.git
  bblanchon/ArduinoJson@^6.19.4    ; Json(l) parser
  https://github.com/fvanroie/lv_drivers
  git+https://github.com/lvgl/lv_lib_png.git#release/v7

lib_ignore =
  paho
  AXP192
  ArduinoLog
  lv_lib_qrcode

src_filter =
  +<*>
  -<*.h>
  +<../hal/sdl2>
  +<../.pio/libdeps/darwin_sdl_64bits/paho/src/*.c>
  +<../.pio/libdeps/darwin_sdl_64bits/paho/src/MQTTClient.c>
  +<../.pio/libdeps/darwin_sdl_64bits/paho/src/MQTTClient.h>
  -<../.pio/libdeps/darwin_sdl_64bits/paho/src/MQTTAsync.c>
  -<../.pio/libdeps/darwin_sdl_64bits/paho/src/MQTTAsyncUtils.c>
  -<../.pio/libdeps/darwin_sdl_64bits/paho/src/MQTTVersion.c>
  -<../.pio/libdeps/darwin_sdl_64bits/paho/src/SSLSocket.c>
  +<MQTTClient.c>
  -<MQTTAsync.c>
  -<MQTTAsyncUtils.c>
  -<MQTTVersion.c>
  -<SSLSocket.c>
  -<sys/>
  +<sys/gpio/>
  -<hal/>
  +<drv/>
  -<drv/touch>
  +<drv/tft>
  +<dev/>
  -<hal/>
  -<svc/>
  -<hasp_filesystem.cpp>
  +<font/>
  +<hasp/>
  +<lang/>
  -<log/>
  +<mqtt/>
  +<../.pio/libdeps/darwin_sdl_64bits/ArduinoJson/src/ArduinoJson.h>
