mirror of
https://github.com/webui-dev/webui.git
synced 2024-09-11 14:06:09 +03:00
GNU Makefile Adding Musl-GCC
- Adding musl-gcc - Renaming text-editor to main. It should be the same as other examples
This commit is contained in:
parent
618c2a7939
commit
30a1e49130
@ -26,6 +26,10 @@ BUILD_DIR := $(MAKEFILE_DIR)/dist
|
||||
# ARGS
|
||||
# Set a compiler when running on Linux via `make CC=gcc` / `make CC=clang`
|
||||
CC = gcc
|
||||
ifneq ($(filter $(CC),gcc clang aarch64-linux-gnu-gcc arm-linux-gnueabihf-gcc musl-gcc),$(CC))
|
||||
$(error Invalid compiler specified: `$(CC)`)
|
||||
endif
|
||||
|
||||
# Allow to add arch-target for macOS CI cross compilation
|
||||
ARCH_TARGET ?=
|
||||
|
||||
@ -56,9 +60,7 @@ else
|
||||
# Linux
|
||||
PLATFORM := linux
|
||||
LIB_DYN_OUT := $(WEBUI_OUT_LIB_NAME).so
|
||||
ifneq ($(filter $(CC),gcc clang aarch64-linux-gnu-gcc arm-linux-gnueabihf-gcc),$(CC))
|
||||
$(error Invalid compiler specified: `$(CC)`)
|
||||
else ifeq ($(CC),clang)
|
||||
ifeq ($(CC),clang)
|
||||
LLVM_OPT := llvm-
|
||||
endif
|
||||
endif
|
||||
|
@ -118,8 +118,8 @@ clean: --clean-$(PLATFORM)
|
||||
# INTERNAL TARGETS
|
||||
|
||||
--validate-args:
|
||||
ifneq ($(filter $(CC),gcc clang),$(CC))
|
||||
$(error Invalid compiler specified: `$(CC)`)
|
||||
ifneq ($(filter $(CC),gcc clang aarch64-linux-gnu-gcc arm-linux-gnueabihf-gcc musl-gcc),$(CC))
|
||||
$(error Invalid compiler specified: `$(CC)`)
|
||||
endif
|
||||
|
||||
--clean-linux: --clean-unix
|
||||
|
@ -118,8 +118,8 @@ clean: --clean-$(PLATFORM)
|
||||
# INTERNAL TARGETS
|
||||
|
||||
--validate-args:
|
||||
ifneq ($(filter $(CC),gcc clang),$(CC))
|
||||
$(error Invalid compiler specified: `$(CC)`)
|
||||
ifneq ($(filter $(CC),gcc clang aarch64-linux-gnu-gcc arm-linux-gnueabihf-gcc musl-gcc),$(CC))
|
||||
$(error Invalid compiler specified: `$(CC)`)
|
||||
endif
|
||||
|
||||
--clean-linux: --clean-unix
|
||||
|
@ -118,8 +118,8 @@ clean: --clean-$(PLATFORM)
|
||||
# INTERNAL TARGETS
|
||||
|
||||
--validate-args:
|
||||
ifneq ($(filter $(CC),gcc clang),$(CC))
|
||||
$(error Invalid compiler specified: `$(CC)`)
|
||||
ifneq ($(filter $(CC),gcc clang aarch64-linux-gnu-gcc arm-linux-gnueabihf-gcc musl-gcc),$(CC))
|
||||
$(error Invalid compiler specified: `$(CC)`)
|
||||
endif
|
||||
|
||||
--clean-linux: --clean-unix
|
||||
|
@ -118,8 +118,8 @@ clean: --clean-$(PLATFORM)
|
||||
# INTERNAL TARGETS
|
||||
|
||||
--validate-args:
|
||||
ifneq ($(filter $(CC),gcc clang),$(CC))
|
||||
$(error Invalid compiler specified: `$(CC)`)
|
||||
ifneq ($(filter $(CC),gcc clang aarch64-linux-gnu-gcc arm-linux-gnueabihf-gcc musl-gcc),$(CC))
|
||||
$(error Invalid compiler specified: `$(CC)`)
|
||||
endif
|
||||
|
||||
--clean-linux: --clean-unix
|
||||
|
@ -118,8 +118,8 @@ clean: --clean-$(PLATFORM)
|
||||
# INTERNAL TARGETS
|
||||
|
||||
--validate-args:
|
||||
ifneq ($(filter $(CC),gcc clang),$(CC))
|
||||
$(error Invalid compiler specified: `$(CC)`)
|
||||
ifneq ($(filter $(CC),gcc clang aarch64-linux-gnu-gcc arm-linux-gnueabihf-gcc musl-gcc),$(CC))
|
||||
$(error Invalid compiler specified: `$(CC)`)
|
||||
endif
|
||||
|
||||
--clean-linux: --clean-unix
|
||||
|
38
examples/C/text-editor/main.c
Normal file
38
examples/C/text-editor/main.c
Normal file
@ -0,0 +1,38 @@
|
||||
// Text Editor in C using WebUI
|
||||
|
||||
#include "webui.h"
|
||||
|
||||
void Close(webui_event_t* e) {
|
||||
printf("Exit.\n");
|
||||
|
||||
// Close all opened windows
|
||||
webui_exit();
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
||||
// Create a new window
|
||||
int MainWindow = webui_new_window();
|
||||
|
||||
// Set the root folder for the UI
|
||||
webui_set_root_folder(MainWindow, "ui");
|
||||
|
||||
// Bind HTML elements with the specified ID to C functions
|
||||
webui_bind(MainWindow, "__close-btn", Close);
|
||||
|
||||
// Show the window, preferably in a chromium based browser
|
||||
if (!webui_show_browser(MainWindow, "index.html", ChromiumBased))
|
||||
webui_show(MainWindow, "index.html");
|
||||
|
||||
// Wait until all windows get closed
|
||||
webui_wait();
|
||||
|
||||
// Free all memory resources (Optional)
|
||||
webui_clean();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hInstPrev, PSTR cmdline, int cmdshow) { return main(); }
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user