Skip to content

Commit

Permalink
Merge pull request #4 from esp-arduino-libs/feat/update_esp_ui
Browse files Browse the repository at this point in the history
feat(repo): rename from 'esp-ui' to 'esp-brookesia'
  • Loading branch information
Lzw655 authored Sep 25, 2024
2 parents e8015dd + a671180 commit 5b7c4e3
Show file tree
Hide file tree
Showing 21 changed files with 530 additions and 485 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build Test Application

on:
workflow_dispatch:
pull_request:
types: [opened, reopened, synchronize]
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-22.04
name: Build Test Application

container:
image: ubuntu:22.04
options: --user root

steps:
- name: Update apt and install Git 2.18+
run: |
apt-get update && apt-get upgrade -y
apt-get install -y git
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: 'recursive'
token: ${{ secrets.GITHUB_TOKEN }}

- name: Install dependencies
run: |
apt-get install -y gcc gdb cmake make build-essential libsdl2-dev
- name: Build Application
working-directory: ./
run: |
cmake -B ./build && make -C ./build
10 changes: 4 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
# Ignore build folder
build/

# Ignore all dot folders, with below exceptions
.*/
!.github

# VSCode
.vscode/

# MacOS
.DS_Store

# Ignore files generated by bear
compile_commands.events.json
compile_commands.json
# Ignore files generated by CMake
build/
bin/
22 changes: 3 additions & 19 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,7 @@
[submodule "components/lv_drivers"]
path = components/lv_drivers
url = https://github.com/lvgl/lv_drivers
[submodule "components/esp-ui"]
path = components/esp-ui
url = https://github.com/espressif/esp-ui.git
branch = master
[submodule "components/esp-ui-stylesheet/esp-ui-phone_480_480_stylesheet"]
path = components/esp-ui-stylesheet/esp-ui-phone_480_480_stylesheet
url = https://github.com/esp-arduino-libs/esp-ui-phone_480_480_stylesheet.git
branch = master
[submodule "components/esp-ui-stylesheet/esp-ui-phone_800_480_stylesheet"]
path = components/esp-ui-stylesheet/esp-ui-phone_800_480_stylesheet
url = https://github.com/esp-arduino-libs/esp-ui-phone_800_480_stylesheet.git
branch = master
[submodule "components/esp-ui-stylesheet/esp-ui-phone_1024_600_stylesheet"]
path = components/esp-ui-stylesheet/esp-ui-phone_1024_600_stylesheet
url = https://github.com/esp-arduino-libs/esp-ui-phone_1024_600_stylesheet.git
branch = master
[submodule "components/esp-ui-stylesheet/esp-ui-phone_320_240_stylesheet"]
path = components/esp-ui-stylesheet/esp-ui-phone_320_240_stylesheet
url = https://github.com/esp-arduino-libs/esp-ui-phone_320_240_stylesheet.git
[submodule "components/esp-brookesia"]
path = components/esp-brookesia
url = https://github.com/espressif/esp-brookesia
branch = master
111 changes: 111 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
cmake_minimum_required(VERSION 3.10)

project(esp_brookesia_simulator_vscode LANGUAGES C CXX)

# Set definitions
set(SIMULATOR_DEF "-DSIMULATOR=1") # Flag for simulator
set(DISP_DEF "-DDISP_HOR_RES=1024 -DDISP_VER_RES=600") # Resolution of the display
set(LVGL_DEF "-DLV_CONF_INCLUDE_SIMPLE") # Used for LVGL related codes
set(LV_DRIVERS_DEF "-DUSE_SDL") # Used for lv_drivers related codes
set(ESP_BROOKESIA_DEF "-DESP_BROOKESIA_KCONFIG_IGNORE") # Used for ESP-Brookesia related codes
# Set C/CXX toolchain
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(CMAKE_C_COMPILER /usr/bin/gcc)
set(CMAKE_CXX_COMPILER /usr/bin/g++)
message(STATUS "Detected system: Linux")
message(STATUS "Using toolchain C: ${CMAKE_C_COMPILER}")
message(STATUS "Using toolchain CXX: ${CMAKE_CXX_COMPILER}")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(CMAKE_C_COMPILER gcc.exe)
set(CMAKE_CXX_COMPILER g++.exe)
message(STATUS "Detected system: Windows")
message(STATUS "Using toolchain C: ${CMAKE_C_COMPILER}")
message(STATUS "Using toolchain CXX: ${CMAKE_CXX_COMPILER}")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(CMAKE_C_COMPILER /usr/bin/clang)
set(CMAKE_CXX_COMPILER /usr/bin/clang++)
message(STATUS "Detected system: MacOS")
message(STATUS "Using toolchain C: ${CMAKE_C_COMPILER}")
message(STATUS "Using toolchain CXX: ${CMAKE_CXX_COMPILER}")
endif()
# Set C/C++ standards
set(CMAKE_C_STANDARD 11) # C11
set(CMAKE_CXX_STANDARD 17) # C17
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Set compiler flags
set(CMAKE_C_FLAGS "-O0 -g -Wall -Wextra -Wshadow -Wundef -Wno-unused-function")
set(CMAKE_CXX_FLAGS "-O0 -g -Wall -Wextra -Wshadow -Wundef -Wno-unused-function -Wno-unused-parameter \
-Wno-missing-field-initializers")
# Set cmake options
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin)
# Set componets directory
set(MAIN_DIR ${CMAKE_SOURCE_DIR}/main)
set(COMPONENTS_DIR ${CMAKE_SOURCE_DIR}/components)
set(LVGL_DIR ${COMPONENTS_DIR}/lvgl)
set(LV_DRIVERS_DIR ${COMPONENTS_DIR}/lv_drivers)
set(ESP_BROOKESIA_DIR ${COMPONENTS_DIR}/esp-brookesia/src)
set(ESP_BROOKESIA_APP_DIR ${COMPONENTS_DIR}/esp-brookesia-app)
set(ESP_BROOKESIA_STYLESHEET_DIR ${COMPONENTS_DIR}/esp-brookesia-stylesheet)

# Include componets directories
include_directories(
${SDL2_INCLUDE_DIRS}
${COMPONENTS_DIR}
${LVGL_DIR}
${LV_DRIVERS_DIR}
${ESP_BROOKESIA_DIR}
${ESP_BROOKESIA_APP_DIR}
${ESP_BROOKESIA_STYLESHEET_DIR}
)

# Search C/CXX sources
file(GLOB_RECURSE MAIN_SRCS "${MAIN_DIR}/*.c" "${MAIN_DIR}/*.cpp") # Main sources
file(GLOB_RECURSE LVGL_SRCS "${LVGL_DIR}/src/*.c") # LVGL sources
file(GLOB_RECURSE LV_DRIVER_SRCS "${LV_DRIVERS_DIR}/*.c") # lv_drivers sources
file(GLOB_RECURSE ESP_BROOKESIA_SRCS "${ESP_BROOKESIA_DIR}/*.c" "${ESP_BROOKESIA_DIR}/*.cpp")
# ESP-Brookesia sources
file(GLOB_RECURSE ESP_BROOKESIA_APP_SRCS "${ESP_BROOKESIA_APP_DIR}/*.c" "${ESP_BROOKESIA_APP_DIR}/*.cpp")
# ESP-Brookesia apps sources
file(GLOB_RECURSE ESP_BROOKESIA_STYLESHEET_SRCS # ESP-Brookesia stylesheets sources
"${ESP_BROOKESIA_STYLESHEET_DIR}/*.c"
"${ESP_BROOKESIA_STYLESHEET_DIR}/*.cpp"
)
# Set definitions for sources
set_source_files_properties(${MAIN_SRCS} # Main definitions
PROPERTIES COMPILE_FLAGS "${SIMULATOR_DEF} ${DISP_DEF} ${LVGL_DEF} ${LV_DRIVERS_DEF} ${ESP_BROOKESIA_DEF}"
)
set_source_files_properties(${LVGL_SRCS} PROPERTIES COMPILE_FLAGS "${LVGL_DEF}")
# LVGL definitions
set_source_files_properties(${LV_DRIVER_SRCS} PROPERTIES COMPILE_FLAGS "${LV_DRIVERS_DEF} ${DISP_DEF}")
# lv_drivers definitions
set_source_files_properties(${ESP_BROOKESIA_SRCS} PROPERTIES COMPILE_FLAGS "${ESP_BROOKESIA_DEF}")
# ESP-Brookesia definitions
set_source_files_properties(${ESP_BROOKESIA_APP_SRCS} PROPERTIES COMPILE_FLAGS "${SIMULATOR_DEF} ${ESP_BROOKESIA_DEF}")
# ESP-Brookesia apps definitions
set_source_files_properties(${ESP_BROOKESIA_STYLESHEET_SRCS} # ESP-Brookesia stylesheets definitions
PROPERTIES COMPILE_FLAGS "${SIMULATOR_DEF} ${ESP_BROOKESIA_DEF}"
)
# Add C/CXX sources
add_executable(esp_brookesia_simulator_vscode
${MAIN_SRCS}
${LVGL_SRCS}
${LV_DRIVER_SRCS}
${ESP_BROOKESIA_SRCS}
${ESP_BROOKESIA_APP_SRCS}
${ESP_BROOKESIA_STYLESHEET_SRCS}
)

# Link SDL2 library
find_package(SDL2 REQUIRED)
target_link_libraries(esp_brookesia_simulator_vscode SDL2main)
target_link_libraries(esp_brookesia_simulator_vscode SDL2)

# Add target: clean_build (command: make clean_build)
add_custom_target(clean_build
COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}
)
# Add target: run (command: make run)
add_custom_target (run
COMMAND ${EXECUTABLE_OUTPUT_PATH}/esp_brookesia_simulator_vscode
)
144 changes: 0 additions & 144 deletions Makefile

This file was deleted.

Loading

0 comments on commit 5b7c4e3

Please sign in to comment.