diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 417fb295c..2d35af970 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,43 +3,18 @@ on: push: pull_request: branches: [ main ] + workflow_dispatch: jobs: - - Windows-WebUI: - runs-on: windows-latest - steps: - - uses: actions/checkout@v2 - - uses: microsoft/setup-msbuild@v1.1 - - name: Windows-WebUI - shell: cmd - run: | - cd build\Windows\GCC - mingw32-make - cd ..\..\.. - cd build\Windows\MSVC - call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" - nmake - - Linux-WebUI: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Linux-WebUI - run: | - cd build/Linux/GCC - make - cd ../../.. - cd build/Linux/Clang - sudo ln -s llvm-ar-13 /usr/bin/llvm-ar - sudo ln -s llvm-ranlib-13 /usr/bin/llvm-ranlib - make - - macOS-WebUI: - runs-on: macOS-latest + build: + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{matrix.os}} steps: - uses: actions/checkout@v2 - - name: macOS-WebUI - run: | - cd build/macOS/Clang - make + - uses: goto-bus-stop/setup-zig@v2 + with: + version: 0.10.1 + - name: Build WebUI + run: zig build --verbose diff --git a/.gitignore b/.gitignore index 9b1fd7e78..1122e113e 100644 --- a/.gitignore +++ b/.gitignore @@ -78,6 +78,7 @@ nul # Zig zig-cache/ zig-out/ +build/ # macOS .DS_Store diff --git a/README.md b/README.md index ed01e0308..daad2c4cf 100644 --- a/README.md +++ b/README.md @@ -68,9 +68,24 @@ Think of WebUI like a WebView controller, but instead of embedding the WebView c ## Build - - [Windows](https://github.com/alifcommunity/webui/tree/main/build/Windows) - - [Linux](https://github.com/alifcommunity/webui/tree/main/build/Linux) - - [macOS](https://github.com/alifcommunity/webui/tree/main/build/macOS) +To build WebUI you need to have [Zig](https://ziglang.org/) on your system. This allows for the simplification of compilation on different platforms and architectures without the need for complex toolchains or configurations. Below is a brief example on how to build WebUI. Execute the command from this project's root directory, and the output will be in the `build/` directory: + +*Debug mode* +``` +zig build -Ddebug +``` + +*Optimize for smaller artifact size* +``` +zig build -Drelease-small +``` + +You can also cross-compile, or select different CPU architectures: + +*Cross-Compile to a 64-bit arm linux platform* +``` +zig build -Dtarget=aarch64-linux +``` ## Examples diff --git a/build.zig b/build.zig new file mode 100644 index 000000000..481cf8fa0 --- /dev/null +++ b/build.zig @@ -0,0 +1,52 @@ +const Builder = @import("std").build.Builder; +const Kind = @import("std").build.LibExeObjStep.SharedLibKind; + +pub fn build(b: *Builder) void { + const target = b.standardTargetOptions(.{}); + const mode = b.standardReleaseOptions(); + const buildDir = "build"; + + // Build civetweb + const civetweb = b.addObject("civetweb", null); + civetweb.addIncludePath("include"); + civetweb.setTarget(target); + civetweb.setBuildMode(mode); + civetweb.linkLibC(); + civetweb.addCSourceFiles(&.{"src/civetweb/civetweb.c"}, &.{ "-DNDEBUG", "-DNO_CACHING", "-DNO_CGI", "-DNO_SSL", "-DUSE_WEBSOCKET", if (target.isWindows()) "-DMUST_IMPLEMENT_CLOCK_GETTIME" else "" }); + + // Build WebUI + const webui = b.addObject("webui", null); + webui.addIncludePath("include"); + webui.setTarget(target); + webui.setBuildMode(mode); + webui.linkLibC(); + webui.addCSourceFiles(&.{"src/webui.c"}, &.{if (mode == .Debug) "-DWEBUI_LOG" else ""}); + + // Create a static library + const static = b.addStaticLibrary("libwebui-2-static", null); + static.setTarget(target); + static.setBuildMode(mode); + static.addObject(civetweb); + static.addObject(webui); + static.setOutputDir(buildDir); + static.install(); + + // Create a shared library + const shared = b.addSharedLibrary( + "webui-2", + null, + Kind.unversioned, + ); + shared.setTarget(target); + shared.setBuildMode(mode); + shared.addObject(civetweb); + shared.addObject(webui); + shared.setOutputDir(buildDir); + shared.strip = true; + webui.force_pic = true; + civetweb.force_pic = true; + if (target.isWindows()) { + shared.linkSystemLibrary("ws2_32"); + } + shared.install(); +} diff --git a/build/Linux/Clang/Makefile b/build/Linux/Clang/Makefile deleted file mode 100644 index a044d15cf..000000000 --- a/build/Linux/Clang/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -# WebUI Library -# Linux - Clang - -SOURCE=../../../src -INCLUDE=../../../include -INCLUDE_CIVETWEB=../../../src/civetweb - -all: release - -debug: -# Static with Debug info - @echo "Build WebUI Library (Clang Debug Static)..." - @clang -g -m64 -o civetweb.o -I "$(INCLUDE)" -c "$(SOURCE)/civetweb/civetweb.c" -DNDEBUG -DNO_CACHING -DNO_CGI -DNO_SSL -DUSE_WEBSOCKET - @clang -g -m64 -o webui.o -I "$(INCLUDE)" -c "$(SOURCE)/webui.c" -DWEBUI_LOG - @llvm-ar rc libwebui-2-static-x64.a webui.o civetweb.o - @llvm-ranlib libwebui-2-static-x64.a -# Dynamic with Debug info - @echo "Build WebUI Library (Clang Debug Dynamic)..." - @clang -g -fPIC -m64 -o civetweb.o -I "$(INCLUDE)" -c "$(SOURCE)/civetweb/civetweb.c" -DNDEBUG -DNO_CACHING -DNO_CGI -DNO_SSL -DUSE_WEBSOCKET - @clang -g -fPIC -m64 -o webui.o -I "$(INCLUDE)" -c "$(SOURCE)/webui.c" -DWEBUI_LOG - @clang -g -shared -o webui-2-x64.so webui.o civetweb.o -# Clean - @- rm -f *.o - @echo "Done." - -release: -# Static Release - @echo "Build WebUI Library (Clang Release Static)..." - @clang -Os -m64 -o civetweb.o -I "$(INCLUDE)" -c "$(SOURCE)/civetweb/civetweb.c" -DNDEBUG -DNO_CACHING -DNO_CGI -DNO_SSL -DUSE_WEBSOCKET - @clang -Os -m64 -o webui.o -I "$(INCLUDE)" -c "$(SOURCE)/webui.c" - @llvm-ar rc libwebui-2-static-x64.a webui.o civetweb.o - @llvm-ranlib libwebui-2-static-x64.a -# Dynamic Release - @echo "Build WebUI Library (Clang Release Dynamic)..." - @clang -O3 -fPIC -m64 -o civetweb.o -I "$(INCLUDE)" -c "$(SOURCE)/civetweb/civetweb.c" -DNDEBUG -DNO_CACHING -DNO_CGI -DNO_SSL -DUSE_WEBSOCKET - @clang -O3 -fPIC -m64 -o webui.o -I "$(INCLUDE)" -c "$(SOURCE)/webui.c" - @clang -shared -o webui-2-x64.so webui.o civetweb.o -# Clean - @- rm -f *.o - @echo "Done." - -clean: - - rm -f *.o - - rm -f *.so - - rm -f *.a diff --git a/build/Linux/Clang/libwebui-2-static-x64.a b/build/Linux/Clang/libwebui-2-static-x64.a deleted file mode 100644 index 6c29f4ba7..000000000 Binary files a/build/Linux/Clang/libwebui-2-static-x64.a and /dev/null differ diff --git a/build/Linux/Clang/webui-2-x64.so b/build/Linux/Clang/webui-2-x64.so deleted file mode 100644 index 24e2bc512..000000000 Binary files a/build/Linux/Clang/webui-2-x64.so and /dev/null differ diff --git a/build/Linux/GCC/Makefile b/build/Linux/GCC/Makefile deleted file mode 100644 index 003aaf7e8..000000000 --- a/build/Linux/GCC/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -# WebUI Library -# Linux - GCC - -SOURCE=../../../src -INCLUDE=../../../include -INCLUDE_CIVETWEB=../../../src/civetweb - -all: release - -debug: -# Static with Debug info - @echo "Build WebUI Library (GCC Debug Static)..." - @gcc -g -m64 -o civetweb.o -I "$(INCLUDE)" -c "$(SOURCE)/civetweb/civetweb.c" -DNDEBUG -DNO_CACHING -DNO_CGI -DNO_SSL -DUSE_WEBSOCKET - @gcc -g -m64 -o webui.o -I "$(INCLUDE)" -c "$(SOURCE)/webui.c" -DWEBUI_LOG - @ar rc libwebui-2-static-x64.a webui.o civetweb.o - @ranlib libwebui-2-static-x64.a -# Dynamic with Debug info - @echo "Build WebUI Library (GCC Debug Dynamic)..." - @gcc -g -fPIC -m64 -o civetweb.o -I "$(INCLUDE)" -c "$(SOURCE)/civetweb/civetweb.c" -DNDEBUG -DNO_CACHING -DNO_CGI -DNO_SSL -DUSE_WEBSOCKET - @gcc -g -fPIC -m64 -o webui.o -I "$(INCLUDE)" -c "$(SOURCE)/webui.c" -DWEBUI_LOG - @gcc -g -shared -o webui-2-x64.so webui.o civetweb.o -# Clean - @- rm -f *.o - @echo "Done." - -release: -# Static Release - @echo "Build WebUI Library (GCC Release Static)..." - @gcc -Os -m64 -o civetweb.o -I "$(INCLUDE)" -c "$(SOURCE)/civetweb/civetweb.c" -DNDEBUG -DNO_CACHING -DNO_CGI -DNO_SSL -DUSE_WEBSOCKET - @gcc -Os -m64 -o webui.o -I "$(INCLUDE)" -c "$(SOURCE)/webui.c" - @ar rc libwebui-2-static-x64.a webui.o civetweb.o - @ranlib libwebui-2-static-x64.a -# Dynamic Release - @echo "Build WebUI Library (GCC Release Dynamic)..." - @gcc -O3 -fPIC -m64 -o civetweb.o -I "$(INCLUDE)" -c "$(SOURCE)/civetweb/civetweb.c" -DNDEBUG -DNO_CACHING -DNO_CGI -DNO_SSL -DUSE_WEBSOCKET - @gcc -O3 -fPIC -m64 -o webui.o -I "$(INCLUDE)" -c "$(SOURCE)/webui.c" - @gcc -shared -o webui-2-x64.so webui.o civetweb.o -# Clean - @- rm -f *.o - @echo "Done." - -clean: - - rm -f *.o - - rm -f *.so - - rm -f *.a diff --git a/build/Linux/GCC/libwebui-2-static-x64.a b/build/Linux/GCC/libwebui-2-static-x64.a deleted file mode 100644 index bf629b7c1..000000000 Binary files a/build/Linux/GCC/libwebui-2-static-x64.a and /dev/null differ diff --git a/build/Linux/GCC/webui-2-x64.so b/build/Linux/GCC/webui-2-x64.so deleted file mode 100755 index ab5039cab..000000000 Binary files a/build/Linux/GCC/webui-2-x64.so and /dev/null differ diff --git a/build/Linux/README.md b/build/Linux/README.md deleted file mode 100644 index 3580d4546..000000000 --- a/build/Linux/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# Build WebUI Library - Linux - -- **GCC** -```sh -git clone https://github.com/alifcommunity/webui.git -cd webui\build\Linux\GCC -make -``` - -- **Clang** -```sh -git clone https://github.com/alifcommunity/webui.git -cd webui\build\Linux\Clang -make -``` diff --git a/build/README.md b/build/README.md deleted file mode 100644 index 85c9e9e2e..000000000 --- a/build/README.md +++ /dev/null @@ -1,27 +0,0 @@ -# Build WebUI Library - -To build the WebUI you will need a `C99` compiler. No dependencies is needed. - -### Manually build - -[Windows](https://github.com/alifcommunity/webui/tree/main/build/Windows) - -[Linux](https://github.com/alifcommunity/webui/tree/main/build/Linux) - -[macOS](https://github.com/alifcommunity/webui/tree/main/build/macOS) - -### Build WebUI in debug mode & Copy libs into examples folder - -Windows: `windows_build debug` - -Linux: `sh linux_build.sh debug` - -macOS: `sh macos_build.sh debug` - -### Build WebUI in release mode - -Windows: `windows_build` - -Linux: `sh linux_build.sh` - -macOS: `sh macos_build.sh` diff --git a/build/Windows/GCC/Makefile b/build/Windows/GCC/Makefile deleted file mode 100644 index 78593f6e4..000000000 --- a/build/Windows/GCC/Makefile +++ /dev/null @@ -1,47 +0,0 @@ -# WebUI Library -# Windows - GNU Compiler Collection - -SHELL=CMD -SOURCE=../../../src -INCLUDE=../../../include -INCLUDE_CIVETWEB=../../../src/civetweb - -all: release - -debug: -# Static with Debug info - @echo Build WebUI Library (GCC Debug Static)... - @gcc -g -m64 -o civetweb.o -I "$(INCLUDE_CIVETWEB)" -c "$(SOURCE)/civetweb/civetweb.c" -DNDEBUG -DNO_CACHING -DNO_CGI -DNO_SSL -DUSE_WEBSOCKET -DMUST_IMPLEMENT_CLOCK_GETTIME - @gcc -g -m64 -o webui.o -I "$(INCLUDE)" -c "$(SOURCE)/webui.c" -DWEBUI_LOG - @ar rc libwebui-2-static-x64.a webui.o civetweb.o - @ranlib libwebui-2-static-x64.a -# Dynamic with Debug info - @echo Build WebUI Library (GCC Debug Dynamic)... - @gcc -g -fPIC -m64 -o civetweb.o -I "$(INCLUDE_CIVETWEB)" -c "$(SOURCE)/civetweb/civetweb.c" -DNDEBUG -DNO_CACHING -DNO_CGI -DNO_SSL -DUSE_WEBSOCKET -DMUST_IMPLEMENT_CLOCK_GETTIME - @gcc -g -fPIC -m64 -o webui.o -I "$(INCLUDE)" -c "$(SOURCE)/webui.c" -DWEBUI_LOG - @gcc -g -shared -o webui-2-x64.dll webui.o civetweb.o -lws2_32 -# Clean - @- del *.o >nul 2>&1 - @echo Done. - -release: -# Static Release - @echo Build WebUI Library (GCC Release Static)... - @gcc -Os -m64 -o civetweb.o -I "$(INCLUDE_CIVETWEB)" -c "$(SOURCE)/civetweb/civetweb.c" -DNDEBUG -DNO_CACHING -DNO_CGI -DNO_SSL -DUSE_WEBSOCKET -DMUST_IMPLEMENT_CLOCK_GETTIME - @gcc -Os -m64 -o webui.o -I "$(INCLUDE)" -c "$(SOURCE)/webui.c" - @ar rc libwebui-2-static-x64.a webui.o civetweb.o - @ranlib libwebui-2-static-x64.a -# Dynamic Release - @echo Build WebUI Library (GCC Release Dynamic)... - @gcc -Os -fPIC -m64 -o civetweb.o -I "$(INCLUDE_CIVETWEB)" -c "$(SOURCE)/civetweb/civetweb.c" -DNDEBUG -DNO_CACHING -DNO_CGI -DNO_SSL -DUSE_WEBSOCKET -DMUST_IMPLEMENT_CLOCK_GETTIME - @gcc -O3 -fPIC -m64 -o webui.o -I "$(INCLUDE)" -c "$(SOURCE)/webui.c" - @gcc -shared -o webui-2-x64.dll webui.o civetweb.o -lws2_32 - @strip --strip-unneeded webui-2-x64.dll -# Clean - @- del *.o >nul 2>&1 - @echo Done. - -clean: - - del *.o >nul 2>&1 - - del *.dll >nul 2>&1 - - del *.a >nul 2>&1 diff --git a/build/Windows/GCC/libwebui-2-static-x64.a b/build/Windows/GCC/libwebui-2-static-x64.a deleted file mode 100644 index 36976f756..000000000 Binary files a/build/Windows/GCC/libwebui-2-static-x64.a and /dev/null differ diff --git a/build/Windows/GCC/webui-2-x64.dll b/build/Windows/GCC/webui-2-x64.dll deleted file mode 100644 index 3d746a2fa..000000000 Binary files a/build/Windows/GCC/webui-2-x64.dll and /dev/null differ diff --git a/build/Windows/MSVC/Makefile b/build/Windows/MSVC/Makefile deleted file mode 100644 index 6fa8f4a12..000000000 --- a/build/Windows/MSVC/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -# WebUI Library -# Windows - Microsoft Visual C - -all: release - -debug: -# Static with Debug info - @echo Build WebUI Library (MSVC Debug Static)... - @cl /Zl /Zi /Focivetweb.obj /c /EHsc "../../../src/civetweb/civetweb.c" /I "../../../src/civetweb/" -DNDEBUG -DNO_CACHING -DNO_CGI -DNO_SSL -DUSE_WEBSOCKET 1>NUL 2>&1 - @cl /Zl /Zi /Fowebui.obj /c /EHsc /DWEBUI_LOG "../../../src/webui.c" /I "../../../include" 1>NUL 2>&1 - @lib /OUT:webui-2-static-x64.lib webui.obj civetweb.obj 1>NUL 2>&1 -# Dynamic with Debug info - @echo Build WebUI Library (MSVC Debug Dynamic)... - @cl /Zi /Focivetweb.obj /c /EHsc "../../../src/civetweb/civetweb.c" /I "../../../src/civetweb/" -DNDEBUG -DNO_CACHING -DNO_CGI -DNO_SSL -DUSE_WEBSOCKET 1>NUL 2>&1 - @cl /Zi /Fowebui.obj /c /EHsc /DWEBUI_LOG "../../../src/webui.c" /I "../../../include" 1>NUL 2>&1 - @link /DLL /OUT:webui-2-x64.dll webui.obj civetweb.obj user32.lib Advapi32.lib 1>NUL 2>&1 -# Clean - @- del *.obj >nul 2>&1 - @echo Done. - -release: -# Static Release - @echo Build WebUI Library (MSVC Release Static)... - @cl /Zl /Focivetweb.obj /c /EHsc "../../../src/civetweb/civetweb.c" /I "../../../src/civetweb/" -DNDEBUG -DNO_CACHING -DNO_CGI -DNO_SSL -DUSE_WEBSOCKET 1>NUL 2>&1 - @cl /Zl /Fowebui.obj /c /EHsc "../../../src/webui.c" /I "../../../include" 1>NUL 2>&1 - @lib /OUT:webui-2-static-x64.lib webui.obj civetweb.obj 1>NUL 2>&1 -# Dynamic Release - @echo Build WebUI Library (MSVC Release Dynamic)... - @cl /Focivetweb.obj /c /EHsc "../../../src/civetweb/civetweb.c" /I "../../../src/civetweb/" -DNDEBUG -DNO_CACHING -DNO_CGI -DNO_SSL -DUSE_WEBSOCKET 1>NUL 2>&1 - @cl /Fowebui.obj /c /EHsc "../../../src/webui.c" /I "../../../include" 1>NUL 2>&1 - @link /DLL /OUT:webui-2-x64.dll webui.obj civetweb.obj user32.lib Advapi32.lib 1>NUL 2>&1 -# Clean - @- del *.obj >nul 2>&1 - @- del *.ilk >nul 2>&1 - @- del *.pdb >nul 2>&1 - @- del *.exp >nul 2>&1 - @echo Done. - -clean: - - del *.obj >nul 2>&1 - - del *.dll >nul 2>&1 - - del *.ilk >nul 2>&1 - - del *.pdb >nul 2>&1 - - del *.lib >nul 2>&1 - - del *.exp >nul 2>&1 diff --git a/build/Windows/MSVC/webui-2-static-x64.lib b/build/Windows/MSVC/webui-2-static-x64.lib deleted file mode 100644 index 7a71b4e54..000000000 Binary files a/build/Windows/MSVC/webui-2-static-x64.lib and /dev/null differ diff --git a/build/Windows/MSVC/webui-2-x64.dll b/build/Windows/MSVC/webui-2-x64.dll deleted file mode 100644 index 86b822fbb..000000000 Binary files a/build/Windows/MSVC/webui-2-x64.dll and /dev/null differ diff --git a/build/Windows/MSVC/webui-2-x64.lib b/build/Windows/MSVC/webui-2-x64.lib deleted file mode 100644 index 96667c63e..000000000 Binary files a/build/Windows/MSVC/webui-2-x64.lib and /dev/null differ diff --git a/build/Windows/README.md b/build/Windows/README.md deleted file mode 100644 index c3da1c823..000000000 --- a/build/Windows/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# Build WebUI Library - Windows - -- **Microsoft Visual Studio Build Tools** - -```sh -git clone https://github.com/alifcommunity/webui.git -cd webui\build\Windows\MSVC -nmake -``` - -- **MinGW** -```sh -git clone https://github.com/alifcommunity/webui.git -cd webui\build\Windows\GCC -mingw32-make -``` - -- **TCC** -```sh -git clone https://github.com/alifcommunity/webui.git -cd webui\build\Windows\TCC -mingw32-make -``` diff --git a/build/Windows/TCC/Makefile b/build/Windows/TCC/Makefile deleted file mode 100644 index 4cf02f988..000000000 --- a/build/Windows/TCC/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -# WebUI Library -# Windows - Tiny C Compiler - -SHELL=CMD -SOURCE=../../../src -INCLUDE=../../../include -INCLUDE_CIVETWEB=../../../src/civetweb - -all: release - -debug: -# Static with Debug info - @echo Build WebUI Library (TCC Debug Static)... - @tcc -g -m64 -o civetweb.o -I "$(INCLUDE_CIVETWEB)" -c "$(SOURCE)/civetweb/civetweb.c" -w -DNDEBUG -DNO_CACHING -DNO_CGI -DNO_SSL -DUSE_WEBSOCKET - @tcc -g -m64 -o webui.o -I "$(INCLUDE)" -c "$(SOURCE)/webui.c" -DWEBUI_LOG -w - @tcc -m64 -ar rcs libwebui-2-static-x64.a webui.o civetweb.o -# Dynamic with Debug info - @echo Build WebUI Library (TCC Debug Dynamic)... - @tcc -g -fPIC -m64 -o civetweb.o -I "$(INCLUDE_CIVETWEB)" -c "$(SOURCE)/civetweb/civetweb.c" -w -DNDEBUG -DNO_CACHING -DNO_CGI -DNO_SSL -DUSE_WEBSOCKET - @tcc -g -fPIC -m64 -o webui.o -I "$(INCLUDE)" -c "$(SOURCE)/webui.c" -DWEBUI_LOG -w - @tcc -g -shared -o webui-2-x64.dll webui.o civetweb.o -lws2_32 -lAdvapi32 -# Clean - @- del *.o >nul 2>&1 - @echo Done. - -release: -# Static Release - @echo Build WebUI Library (TCC Release Static)... - @tcc -m64 -o civetweb.o -I "$(INCLUDE_CIVETWEB)" -c "$(SOURCE)/civetweb/civetweb.c" -w -DNDEBUG -DNO_CACHING -DNO_CGI -DNO_SSL -DUSE_WEBSOCKET - @tcc -m64 -o webui.o -I "$(INCLUDE)" -c "$(SOURCE)/webui.c" -w - @tcc -m64 -ar rcs libwebui-2-static-x64.a webui.o civetweb.o -# Dynamic Release - @echo Build WebUI Library (TCC Release Dynamic)... - @tcc -fPIC -m64 -o civetweb.o -I "$(INCLUDE_CIVETWEB)" -c "$(SOURCE)/civetweb/civetweb.c" -w -DNDEBUG -DNO_CACHING -DNO_CGI -DNO_SSL -DUSE_WEBSOCKET - @tcc -fPIC -m64 -o webui.o -I "$(INCLUDE)" -c "$(SOURCE)/webui.c" -w - @tcc -shared -o webui-2-x64.dll webui.o civetweb.o -lws2_32 -lAdvapi32 -# Clean - @- del *.o >nul 2>&1 - @echo Done. - -clean: - - del *.o >nul 2>&1 - - del *.dll >nul 2>&1 - - del *.a >nul 2>&1 - - del *.def >nul 2>&1 diff --git a/build/Windows/TCC/libwebui-2-static-x64.a b/build/Windows/TCC/libwebui-2-static-x64.a deleted file mode 100644 index ab7d73ba4..000000000 Binary files a/build/Windows/TCC/libwebui-2-static-x64.a and /dev/null differ diff --git a/build/linux_build.sh b/build/linux_build.sh deleted file mode 100644 index e7dd9b0d0..000000000 --- a/build/linux_build.sh +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/bash - -WEBUI_VERSION=2.3.0 - -ARG1=$1 -if [ "$ARG1" = "debug" ]; then - CLANG_CMD="make debug" - GCC_CMD="make debug" -else - CLANG_CMD="make" - GCC_CMD="make" -fi - -echo ""; -echo "WebUI v$WEBUI_VERSION Build Script" -echo "Platform: Linux x64" -echo "Compiler: GCC and Clang" - -RootPath="$PWD/../" -cd "$RootPath" - -echo ""; -echo "Building WebUI using GCC..."; -echo ""; - -# Build WebUI Library using GCC -cd "$RootPath" -cd "build/Linux/GCC" -$GCC_CMD - -echo ""; -echo "Building WebUI using Clang..."; -echo ""; - -# Build WebUI Library using Clang -cd "$RootPath" -cd "build/Linux/Clang" -$CLANG_CMD - -echo ""; -echo "Copying WebUI libs to the examples folder..." -echo ""; - -cd "$RootPath" - -# Golang -cp -f "include/webui.h" "examples/Go/hello_world/webui/webui.h" -cp -f "build/Linux/GCC/libwebui-2-static-x64.a" "examples/Go/hello_world/webui/libwebui-2-static-x64.a" - -# Deno -cp -f "build/Linux/GCC/webui-2-x64.so" "examples/TypeScript/Deno/webui-2-x64.so" - -# Python -cp -f "build/Linux/GCC/webui-2-x64.so" "examples/Python/PyPI/Package/src/webui/webui-2-x64.so" - -# C++ (Minimal) -cp -f "include/webui.hpp" "examples/C++/minimal/webui.hpp" - -echo ""; -if [ "$ARG1" = "" ]; then - - echo "Copying WebUI libs to the release folder..." - echo ""; - - # Release Linux Include - cp -f "include/webui.h" "Release/Linux/include/webui.h" - cp -f "include/webui.hpp" "Release/Linux/include/webui.hpp" - - # Release Linux GCC - cp -f "build/Linux/GCC/webui-2-x64.so" "Release/Linux/GCC/webui-2-x64.so" - cp -f "build/Linux/GCC/libwebui-2-static-x64.a" "Release/Linux/GCC/libwebui-2-static-x64.a" - - # Release Linux Clang - cp -f "build/Linux/Clang/webui-2-x64.so" "Release/Linux/Clang/webui-2-x64.so" - cp -f "build/Linux/Clang/libwebui-2-static-x64.a" "Release/Linux/Clang/libwebui-2-static-x64.a" - - echo ""; - echo "Compressing the release folder..." - echo ""; - - TAR_OUT="webui-linux-x64-v$WEBUI_VERSION.zip" - cd "Release" - sleep 2 - tar -c -f $TAR_OUT Linux/* - cd "$RootPath" - - echo ""; - echo "Cleaning..." - echo ""; - - find ./ -type f -name "*.o" -exec rm -f {} \; -fi - -cd "build" diff --git a/build/macOS/Clang/Makefile b/build/macOS/Clang/Makefile deleted file mode 100644 index 6cb860758..000000000 --- a/build/macOS/Clang/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -# WebUI Library -# macOS - Clang - -SOURCE=../../../src -INCLUDE=../../../include -INCLUDE_CIVETWEB=../../../src/civetweb - -all: release - -debug: - # Static with Debug info - @echo "Build WebUI Library (Clang Debug Static)..." - @clang -g -m64 -o civetweb.o -I "$(INCLUDE)" -c "$(SOURCE)/civetweb/civetweb.c" -DNDEBUG -DNO_CACHING -DNO_CGI -DNO_SSL -DUSE_WEBSOCKET - @clang -DWEBUI_LOG -g -m64 -o webui.o -I "$(INCLUDE)" -c "$(SOURCE)/webui.c" -DWEBUI_LOG - @ar rc libwebui-2-static-x64.a webui.o civetweb.o - @ranlib libwebui-2-static-x64.a - # Dynamic with Debug info - @echo "Build WebUI Library (Clang Debug Dynamic)..." - @clang -g -fPIC -m64 -o civetweb.o -I "$(INCLUDE)" -c "$(SOURCE)/civetweb/civetweb.c" -DNDEBUG -DNO_CACHING -DNO_CGI -DNO_SSL -DUSE_WEBSOCKET - @clang -DWEBUI_LOG -g -fPIC -m64 -o webui.o -I "$(INCLUDE)" -c "$(SOURCE)/webui.c" -DWEBUI_LOG - @clang -g -shared -o webui-2-x64.dyn webui.o civetweb.o - #Clean - @- rm -f *.o - @echo "Done." - -release: - # Static Release - @echo "Build WebUI Library (Clang Release Static)..." - @clang -Os -m64 -o civetweb.o -I "$(INCLUDE)" -c "$(SOURCE)/civetweb/civetweb.c" -DNDEBUG -DNO_CACHING -DNO_CGI -DNO_SSL -DUSE_WEBSOCKET - @clang -Os -m64 -o webui.o -I "$(INCLUDE)" -c "$(SOURCE)/webui.c" - @ar rc libwebui-2-static-x64.a webui.o civetweb.o - @ranlib libwebui-2-static-x64.a - # Dynamic Release - @echo "Build WebUI Library (Clang Release Dynamic)..." - @clang -O3 -fPIC -m64 -o civetweb.o -I "$(INCLUDE)" -c "$(SOURCE)/civetweb/civetweb.c" -DNDEBUG -DNO_CACHING -DNO_CGI -DNO_SSL -DUSE_WEBSOCKET - @clang -O3 -fPIC -m64 -o webui.o -I "$(INCLUDE)" -c "$(SOURCE)/webui.c" - @clang -shared -o webui-2-x64.dyn webui.o civetweb.o - # Clean - @- rm -f *.o - @echo "Done." - -clean: - - rm -f *.o - - rm -f *.dylib - - rm -f *.a diff --git a/build/macOS/Clang/libwebui-2-static-x64.a b/build/macOS/Clang/libwebui-2-static-x64.a deleted file mode 100644 index 76c053ddd..000000000 Binary files a/build/macOS/Clang/libwebui-2-static-x64.a and /dev/null differ diff --git a/build/macOS/Clang/webui-2-x64.dyn b/build/macOS/Clang/webui-2-x64.dyn deleted file mode 100644 index 0232beae5..000000000 Binary files a/build/macOS/Clang/webui-2-x64.dyn and /dev/null differ diff --git a/build/macOS/README.md b/build/macOS/README.md deleted file mode 100644 index ef797e775..000000000 --- a/build/macOS/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Build WebUI Library - macOS - -- **Clang** - -```sh -git clone https://github.com/alifcommunity/webui.git -cd webui\build\macOS\Clang -make -``` diff --git a/build/macos_build.sh b/build/macos_build.sh deleted file mode 100644 index dbadb8ee5..000000000 --- a/build/macos_build.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/bash - -WEBUI_VERSION=2.3.0 - -ARG1=$1 -if [ "$ARG1" = "debug" ]; then - CLANG_CMD="make debug" - GCC_CMD="make debug" -else - CLANG_CMD="make" - GCC_CMD="make" -fi - -echo ""; -echo "WebUI v$WEBUI_VERSION Build Script" -echo "Platform: macOS x64" -echo "Compiler: Clang" - -RootPath="$PWD/../" -cd "$RootPath" - -echo ""; -echo "Building WebUI using Clang..."; -echo ""; - -# Build WebUI Library using Clang -cd "$RootPath" -cd "build/macOS/Clang" -$CLANG_CMD - -echo ""; -echo "Copying WebUI libs to the examples folder..." -echo ""; - -cd "$RootPath" - -# Golang -cp -f "include/webui.h" "examples/Go/hello_world/webui/webui.h" -cp -f "build/macOS/Clang/libwebui-2-static-x64.a" "examples/Go/hello_world/webui/libwebui-2-static-x64.a" - -# Deno -cp -f "build/macOS/Clang/webui-2-x64.dyn" "examples/TypeScript/Deno/webui-2-x64.dyn" - -# Python -cp -f "build/macOS/Clang/webui-2-x64.dyn" "examples/Python/PyPI/Package/src/webui/webui-2-x64.dyn" - -# C++ (Minimal) -cp -f "include/webui.hpp" "examples/C++/minimal/webui.hpp" - -echo ""; -if [ "$ARG1" = "" ]; then - - echo "Copying WebUI libs to the release folder..." - echo ""; - - # Release macOS Include - cp -f "include/webui.h" "Release/macOS/include/webui.h" - cp -f "include/webui.hpp" "Release/macOS/include/webui.hpp" - - # Release macOS Clang - cp -f "build/macOS/Clang/webui-2-x64.dyn" "Release/macOS/Clang/webui-2-x64.dyn" - cp -f "build/macOS/Clang/libwebui-2-static-x64.a" "Release/macOS/Clang/libwebui-2-static-x64.a" - - echo ""; - echo "Compressing the release folder..." - echo ""; - - TAR_OUT="webui-macos-x64-v$WEBUI_VERSION.zip" - cd "Release" - sleep 2 - tar -c -f $TAR_OUT macOS/* - cd "$RootPath" - - echo ""; - echo "Cleaning..." - echo ""; - - find ./ -type f -name "*.o" -exec rm -f {} \; -fi - -cd "build" diff --git a/build/windows_build.bat b/build/windows_build.bat deleted file mode 100644 index b754b6919..000000000 --- a/build/windows_build.bat +++ /dev/null @@ -1,124 +0,0 @@ -@echo off - -set WEBUI_VERSION=2.2.0 - -set ARG1=%1 -IF "%ARG1%"=="debug" ( - set MSVC_CMD=nmake debug - set GCC_CMD=mingw32-make debug -) else ( - set MSVC_CMD=nmake - set GCC_CMD=mingw32-make -) - -echo. -echo WebUI v%WEBUI_VERSION% Build Script -echo Platform: Microsoft Windows x64 -echo Compiler: MSVC, GCC and TCC - -Set RootPath=%CD%\..\ -cd "%RootPath%" - -echo. -echo Building WebUI using MSVC... - -REM Build WebUI Library using MSVC -cd "%RootPath%" -cd "build\Windows\MSVC" -%MSVC_CMD% - -echo. -echo Building WebUI using GCC... -echo. - -REM Build WebUI Library using GCC -cd "%RootPath%" -cd "build\Windows\GCC" -%GCC_CMD% - -echo. -echo Building WebUI using TCC... -echo. - -REM Build WebUI Library using TCC -cd "%RootPath%" -cd "build\Windows\TCC" -%GCC_CMD% - -echo. -echo Copying WebUI libs to the examples folder... -echo. - -cd "%RootPath%" - -REM Golang -copy /Y "include\webui.h" "examples\Go\hello_world\webui\webui.h" -copy /Y "build\Windows\GCC\libwebui-2-static-x64.a" "examples\Go\hello_world\webui\libwebui-2-static-x64.a" - -REM Deno -copy /Y "build\Windows\MSVC\webui-2-x64.dll" "examples\TypeScript\Deno\webui-2-x64.dll" - -REM Python -copy /Y "build\Windows\MSVC\webui-2-x64.dll" "examples\Python\PyPI\Package\src\webui\webui-2-x64.dll" - -REM C++ (Minimal) -copy /Y "include\webui.hpp" "examples\C++\minimal\webui.hpp" - -REM C++ (Visual Studio 2022) -copy /Y "include\webui.h" "examples\C++\VS2022\serve_a_folder\my_webui_app\webui.h" -copy /Y "include\webui.hpp" "examples\C++\VS2022\serve_a_folder\my_webui_app\webui.hpp" -copy /Y "build\Windows\MSVC\webui-2-static-x64.lib" "examples\C++\VS2022\serve_a_folder\my_webui_app\webui-2-static-x64.lib" - -REM C++ (Visual Studio 2019) -copy /Y "include\webui.h" "examples\C++\VS2019\serve_a_folder\my_webui_app\webui.h" -copy /Y "include\webui.hpp" "examples\C++\VS2019\serve_a_folder\my_webui_app\webui.hpp" -copy /Y "build\Windows\MSVC\webui-2-static-x64.lib" "examples\C++\VS2019\serve_a_folder\my_webui_app\webui-2-static-x64.lib" - -echo. -IF "%ARG1%"=="" ( - - echo Copying WebUI libs to the release folder... - echo. - - REM Release Windows Include - copy /Y "include\webui.h" "Release\Windows\include\webui.h" - - REM Release Windows MSVC - copy /Y "build\Windows\MSVC\webui-2-x64.dll" "Release\Windows\MSVC\webui-2-x64.dll" - copy /Y "build\Windows\MSVC\webui-2-x64.lib" "Release\Windows\MSVC\webui-2-x64.lib" - copy /Y "build\Windows\MSVC\webui-2-static-x64.lib" "Release\Windows\MSVC\webui-2-static-x64.lib" - - REM Release Windows GCC - copy /Y "build\Windows\GCC\webui-2-x64.dll" "Release\Windows\GCC\webui-2-x64.dll" - copy /Y "build\Windows\GCC\libwebui-2-static-x64.a" "Release\Windows\GCC\libwebui-2-static-x64.a" - - REM Release Windows TCC - copy /Y "build\Windows\TCC\webui-2-x64.dll" "Release\Windows\TCC\webui-2-x64.dll" - copy /Y "build\Windows\TCC\libwebui-2-static-x64.a" "Release\Windows\TCC\libwebui-2-static-x64.a" - copy /Y "build\Windows\TCC\webui-2-x64.def" "Release\Windows\TCC\webui-2-x64.def" - - echo. - echo Compressing the release folder... - - set TAR_OUT=webui-windows-x64-v%WEBUI_VERSION%.zip - cd "Release" - timeout 2 > NUL - tar.exe -c -f %TAR_OUT% Windows\* - cd "%RootPath%" - - echo. - echo Cleaning... - - DEL /Q /F /S "*.exe" >nul 2>&1 - DEL /Q /F /S "*.o" >nul 2>&1 - DEL /Q /F /S "*.exp" >nul 2>&1 - DEL /Q /F /S "*.pdb" >nul 2>&1 - DEL /Q /F /S "*.ilk" >nul 2>&1 - DEL /Q /F /S "*.obj" >nul 2>&1 - DEL /Q /F /S "*.iobj" >nul 2>&1 - DEL /Q /F /S "*.res" >nul 2>&1 - DEL /Q /F /S "*.bak" >nul 2>&1 - DEL /Q /F /S "*.DS_Store" >nul 2>&1 -) - -cd "build"