webui-dev / webui

Use any web browser or WebView as GUI, with your preferred language in the backend and modern web technologies in the frontend, all in a lightweight portable library.
https://webui.me
MIT License
2.9k stars 164 forks source link

Use a single Makefile to build examples #197

Closed ttytm closed 1 year ago

ttytm commented 1 year ago

Moves towards a single Makefile (+ a Makefile.nmake for Win MSVC) for examples.

Implemented / Tested:

Other TODOs:

Updating the C++ Makefiles will be a simple job based on the C Makefiles, just finishing C first.

hassandraga commented 1 year ago

That's good. To make things simpler and easier I suggest removing the .ico resources support.

ttytm commented 1 year ago

Okay good :+1:

What I want to add: This PR is based on the assumptions, that it's not part of the repo that the Makefiles in the examples serve as examples of how to write a Makefile for a platform. The content of the single Makefiles becomes more complicated here. But the changes should make the examples easier accessible and simpler to compile with different compilers. I hope this is more beneficial to the repo.

hassandraga commented 1 year ago

I suggest to completely remove the TCC support as it need headers to work properly.

ttytm commented 1 year ago

@hassandraga I'm torn between using a the same Makefile per example directory, to just run the make command e.g. make, OR a Makefile in the examples root directory (examples/C/ / examples/C++) and run the make command + as target, e.g., make call_c_from_js. Do you have a preference?

make from the directory of a single example make <example_name> from the examples root directory

hassandraga commented 1 year ago

I prefer make from the directory of a single example as it's simpler and easier. I already saw your PR and I was about to try it first, but now as you are asking, I really prefer a simple makefile for each example. Removing OS folders from examples is already a huge improvement.

ttytm commented 1 year ago

Okay thanks @hassandraga.

It's basically done, I'll just do some more test later or tomorrow and add a thing about the examples that I could observe during working on this that might need to be addressed before marking this as ready.

ttytm commented 1 year ago

Other changes added:

ttytm commented 1 year ago

Just added an update of the screenshort as part of the last commit.

hassandraga commented 1 year ago

LGTM. Ready to marge. And thank you for this PR @ttytm 👍

FYI:

The executable is not portable without the UI files

I guess portable means copying the example folder (exe + html) to another machine and running it is possible. You don't need to install any runtime or any dependency.

on windows it also needs the .dll file next to it

That's because the dynamic build version, the static one won't need any external lib.

hassandraga commented 1 year ago

The examples are cleaner now. I like it. Thank you again @ttytm

ttytm commented 1 year ago

Thanks :pray: please don't hesitate to update and change where I missed things. E.g. I've seen I left the line about size and portability in the examples/C/README.md.

I guess portable means copying the example folder (exe + html) to another machine and running it is possible. You don't need to install any runtime or any dependency.

I see, it indeed is portable, just took the "executable" too literally as the single executable file.