Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tweak for native #532

Merged
merged 5 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions examples_for_PC/PlatformIO_SDL/README-en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@

## Steps to use LovyanGFX in Visual Studio Code + PlatformIO + SDL2 environment

First, install Visual Studio Code and install its PlatformIO extension.

---

### Install tools for PlatformIO `platform = native` builds

`Installation` Follow the installation steps from this URL
https://docs.platformio.org/en/latest/platforms/native.html#installation

The instructions below repeat the instructions given by the URL above with additional clarifications.

#### For Linux

Use `apt` to install the basic compilation tools from a shell prompt
```
sudo apt update
sudo apt install build-essential
```

#### For macOS
Use `xcode-select` to install xcode compilation tools from a Terminal
```
xcode-select --install
```

#### For Windows
Get `MSYS2` from https://www.msys2.org/ and install it. From the MSYS command window that appears after installation, run this command to install the compiler:
```
pacman -S mingw-w64-ucrt-x86_64-gcc
```

Edit the Windows System Environment Variables (search the web for instructions) and add these to the System variables `Path` variable
```
C:\msys64\mingw32\bin
C:\msys64\ucrt64\bin
C:\msys64\usr\bin
```


---

### Install SDL2

Install `SDL2` per these instructions
https://docs.lvgl.io/latest/en/html/get-started/pc-simulator.html#install-sdl-2


#### For Linux

Install libsdl2 using apt-get

```
sudo apt-get install libsdl2 libsdl2-dev
```

#### For MacOS OSX

Install sdl2 using Homebrew
```
brew install sdl2
```

#### For Windows

`platform = native` In the steps above, msys2 was installed, so get the SDL2-devel-x.xx.x-mingw release package from the SDL2 Github repository at
https://github.com/libsdl-org/SDL/releases

The filename at the time these instructions were written was `SDL2-devel-2.30.0-mingw.zip`.
Unzip it, open the folder inside `x86_64-w64-mingw32`, and confirm that the following four folders appear inside.
- share
- bin
- include
- lib

Open `C:\msys64\mingw32\` and confirm that it also contains those four folders, then add the contents of the fourfSDL2 folders to those inside `C:\msys64\mingw32\`. Typically, those four mingw32 folders are initially empty, so you can simply overwrite the mingw32 folders with the SDL2 ones.

---

### Compiling and Running the example program

#### Build the program

In VsCode, open this folder, i.e. <LovyanGFX>/examples_for_PC/PlatformIO_SDL/. The first time that you do so, PlatformIO will install a lot of packages.

Build the program by clicking on the checkmark icon at the bottom of the VsCode window; its tooltip is PlatformIO:Build.

#### Run the program

Run the program by starting a terminal - click on the icon at the bottom of the VsCode window whose tooltip is "PlatformIO:New Terminal" . Inside the terminal window that appears, type this command

```
.pio/build/native/program
```
8 changes: 8 additions & 0 deletions examples_for_PC/PlatformIO_SDL/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[platformio]
default_envs = native

[env]
lib_extra_dirs=../../

[env:native]
platform = native
build_type = debug
Expand All @@ -16,6 +22,8 @@ build_flags = -O0 -xc++ -std=c++14 -lSDL2
-L"/usr/local/lib" ; for intel mac homebrew SDL2
-I"${sysenv.HOMEBREW_PREFIX}/include/SDL2" ; for arm mac homebrew SDL2
-L"${sysenv.HOMEBREW_PREFIX}/lib" ; for arm mac homebrew SDL2
-I"C:/msys64/mingw32/include/SDL2" ; for Windows SDL2
-L"C:/msys64/mingw32/lib" ; for Windows SDL2

[esp32_base]
build_type = debug
Expand Down
Loading