lvgl / lv_web_emscripten

LVGL ported to Emscripten to be converted to JavaScript
MIT License
80 stars 28 forks source link

Add CMake support #5

Closed w8jcik closed 4 years ago

w8jcik commented 4 years ago

To test it

git clone https://github.com/emscripten-core/emsdk.git
(cd emsdk && ./emsdk install latest && ./emsdk activate latest)
source emsdk/emsdk_env.sh

git clone --recursive --branch add/cmake https://github.com/w8jcik/lv_sim_emscripten.git
cd lv_sim_emscripten
emconfigure cmake -DCMAKE_TOOLCHAIN_FILE="${EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake" -S . -B build && cmake --build build -j $(nproc)
firefox build/lvgl.html
embeddedt commented 4 years ago

I'm not sure about having multiple build systems available within one project. It seems like it would make maintenance harder. On the other hand, we do have both a Makefile and a CMake file for the regular PC simulator.

@kisvegabor What are your thoughts?

kisvegabor commented 4 years ago

IMO as CMakeLists.txt has very few hardcoded paths and file names the maintenance is not an issue. I suppose it will need very minimal maintenance as we have these 3 folders for a very long time.

In addition, while it's easy to use Makefile on Linux, CMake is much easier on Window (correct me if I wrong here, I don't really have development experiment on Windows)

w8jcik commented 4 years ago

We can also replace

file(GLOB INCLUDES1 "./*.h")
file(GLOB_RECURSE INCLUDES2 "lv_drivers/*.h" "lv_examples/*.h" "lvgl/*.h")

file(GLOB SOURCES1  "./*.c")
file(GLOB_RECURSE SOURCES2  "lv_drivers/*.c" "lv_examples/*.c" "lvgl/*.c")

set(INCLUDES ${INCLUDES1} ${INCLUDES2})
set(SOURCES ${SOURCES1} ${SOURCES2})

with

file(GLOB_RECURSE INCLUDES "./*.h")
file(GLOB_RECURSE SOURCES "./*.c")

Then there are no hardcoded pahts. I did it this way to make it easier for user to disable one of the folders or files.

kisvegabor commented 4 years ago

It'd be even better regarding maintenance. Please update it as you suggested.

w8jcik commented 4 years ago

Done

embeddedt commented 4 years ago

Looks good! Thanks for the contribution!