C++ Improvement

* Set C++11 as minimal standard
* Fix C++ Makefile in macOS
* Update the C++ WebUI header to use references (https://github.com/webui-dev/webui/issues/103)
* Update `webui_return_string()` argument from `char*` to `const char*`
This commit is contained in:
Hassan DRAGA 2023-05-21 12:20:54 -04:00
parent e955ee2228
commit cdf67b17ac
23 changed files with 135 additions and 118 deletions

View File

@ -13,10 +13,10 @@ debug:
@cd "$(LIB)" && $(MAKE) debug
# Static with Debug info
@echo "Build C++ Example (Static Debug)..."
@clang -lstdc++ -g -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
@clang -std=c++11 -lstdc++ -g -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
# Dynamic with Debug info
@echo "Build C++ Example (Dynamic Debug)..."
@clang -lstdc++ -g -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.so" -lpthread -lm
@clang -std=c++11 -lstdc++ -g -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.so" -lpthread -lm
# Clean
@- rm -f *.o
@echo "Done."
@ -26,11 +26,11 @@ release:
@cd "$(LIB)" && $(MAKE)
# Static Release
@echo "Build C++ Example (Static Release)..."
@clang -lstdc++ -Os -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
@clang -std=c++11 -lstdc++ -Os -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
@llvm-strip --strip-all main
# Dynamic Release
@echo "Build C++ Example (Dynamic Release)..."
@clang -lstdc++ -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.so" -lpthread -lm
@clang -std=c++11 -lstdc++ -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.so" -lpthread -lm
@llvm-strip --strip-all main-dyn
# Clean
@- rm -f *.o

View File

@ -13,10 +13,10 @@ debug:
@cd "$(LIB)" && $(MAKE) debug
# Static with Debug info
@echo "Build C++ Example (Static Debug)..."
@g++ -g -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
@g++ -std=c++11 -g -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
# Dynamic with Debug info
@echo "Build C++ Example (Dynamic Debug)..."
@g++ -g -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.so" -lpthread -lm
@g++ -std=c++11 -g -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.so" -lpthread -lm
# Clean
@- rm -f *.o
@echo "Done."
@ -26,11 +26,11 @@ release:
@cd "$(LIB)" && $(MAKE)
# Static Release
@echo "Build C++ Example (Static Release)..."
@g++ -Os -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
@g++ -std=c++11 -Os -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
@strip --strip-all main
# Dynamic Release
@echo "Build C++ Example (Dynamic Release)..."
@g++ -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.so" -lpthread -lm
@g++ -std=c++11 -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.so" -lpthread -lm
@strip --strip-all main-dyn
# Clean
@- rm -f *.o

View File

@ -15,11 +15,11 @@ debug:
# Static with Debug info
@echo Build C++ Example (Debug Static)...
@windres win.rc -O coff -o win.res
@g++ -g -static -m64 -o main.exe "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" win.res -lwebui-2-static-x64 -lws2_32 -Wall -Wl,-subsystem=console -luser32
@g++ -std=c++11 -g -static -m64 -o main.exe "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" win.res -lwebui-2-static-x64 -lws2_32 -Wall -Wl,-subsystem=console -luser32
# Dynamic with Debug info
@echo Build C++ Example (Debug Dynamic)...
@windres win.rc -O coff -o win.res
@g++ -g -m64 -o main-dyn.exe "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" win.res "$(LIB)/webui-2-x64.dll" -lws2_32 -Wall -Wl,-subsystem=console -luser32
@g++ -std=c++11 -g -m64 -o main-dyn.exe "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" win.res "$(LIB)/webui-2-x64.dll" -lws2_32 -Wall -Wl,-subsystem=console -luser32
# Clean
@- del *.o >nul 2>&1
@- del *.res >nul 2>&1
@ -31,12 +31,12 @@ release:
# Static Release
@echo Build C++ Example (Release Static)...
@windres win.rc -O coff -o win.res
@g++ -static -Os -m64 -o main.exe "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" win.res -lwebui-2-static-x64 -lws2_32 -Wall -Wl,-subsystem=windows -luser32
@g++ -std=c++11 -static -Os -m64 -o main.exe "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" win.res -lwebui-2-static-x64 -lws2_32 -Wall -Wl,-subsystem=windows -luser32
@strip --strip-all main.exe
# Dynamic Release
@echo Build C++ Example (Release Dynamic)...
@windres win.rc -O coff -o win.res
@g++ -m64 -o main-dyn.exe "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" win.res "$(LIB)/webui-2-x64.dll" -lws2_32 -Wall -Wl,-subsystem=windows -luser32
@g++ -std=c++11 -m64 -o main-dyn.exe "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" win.res "$(LIB)/webui-2-x64.dll" -lws2_32 -Wall -Wl,-subsystem=windows -luser32
@strip --strip-all main-dyn.exe
# Clean
@- del *.o >nul 2>&1

View File

@ -1,6 +1,6 @@
# WebUI Library 2.3.0
# C++ Example
# Windows - Microsoft Visual C
# Windows - Microsoft Visual C++
SHELL=CMD
_LIB=../../../../../build/Windows/MSVC/
@ -15,11 +15,11 @@ debug:
# Static with Debug info
@echo Build C++ Example (Debug Static)...
@rc win.rc 1>NUL 2>&1
@cl /Zi "$(_SOURCE)/main.cpp" /I "$(_INCLUDE)" /link /LIBPATH:"$(_LIB)" /MACHINE:X64 /SUBSYSTEM:CONSOLE win.res webui-2-static-x64.lib user32.lib Advapi32.lib /OUT:main.exe 1>NUL 2>&1
@cl /Zi /EHsc /std:c++11 "$(_SOURCE)/main.cpp" /I "$(_INCLUDE)" /link /LIBPATH:"$(_LIB)" /MACHINE:X64 /SUBSYSTEM:CONSOLE win.res webui-2-static-x64.lib user32.lib Advapi32.lib /OUT:main.exe 1>NUL 2>&1
# Dynamic with Debug info
@echo Build C++ Example (Debug Dynamic)...
@rc win.rc 1>NUL 2>&1
@cl /Zi "$(_SOURCE)/main.cpp" /I "$(_INCLUDE)" /link /LIBPATH:"$(_LIB)" /MACHINE:X64 /SUBSYSTEM:CONSOLE win.res webui-2-x64.lib user32.lib Advapi32.lib /OUT:main-dyn.exe 1>NUL 2>&1
@cl /Zi /EHsc /std:c++11 "$(_SOURCE)/main.cpp" /I "$(_INCLUDE)" /link /LIBPATH:"$(_LIB)" /MACHINE:X64 /SUBSYSTEM:CONSOLE win.res webui-2-x64.lib user32.lib Advapi32.lib /OUT:main-dyn.exe 1>NUL 2>&1
release:
# Build Lib
@ -27,11 +27,11 @@ release:
# Static Release
@echo Build C++ Example (Release Static)...
@rc win.rc 1>NUL 2>&1
@cl "$(_SOURCE)/main.cpp" /I "$(_INCLUDE)" /link /LIBPATH:"$(_LIB)" /MACHINE:X64 /SUBSYSTEM:WINDOWS win.res webui-2-static-x64.lib user32.lib Advapi32.lib /OUT:main.exe 1>NUL 2>&1
@cl /EHsc /std:c++11 "$(_SOURCE)/main.cpp" /I "$(_INCLUDE)" /link /LIBPATH:"$(_LIB)" /MACHINE:X64 /SUBSYSTEM:WINDOWS win.res webui-2-static-x64.lib user32.lib Advapi32.lib /OUT:main.exe 1>NUL 2>&1
# Dynamic Release
@echo Build C++ Example (Release Dynamic)...
@rc win.rc 1>NUL 2>&1
@cl "$(_SOURCE)/main.cpp" /I "$(_INCLUDE)" /link /LIBPATH:"$(_LIB)" /MACHINE:X64 /SUBSYSTEM:WINDOWS win.res webui-2-x64.lib user32.lib Advapi32.lib /OUT:main-dyn.exe 1>NUL 2>&1
@cl /EHsc /std:c++11 "$(_SOURCE)/main.cpp" /I "$(_INCLUDE)" /link /LIBPATH:"$(_LIB)" /MACHINE:X64 /SUBSYSTEM:WINDOWS win.res webui-2-x64.lib user32.lib Advapi32.lib /OUT:main-dyn.exe 1>NUL 2>&1
# Clean
@- del *.res >nul 2>&1
@- del *.obj >nul 2>&1

View File

@ -1,5 +1,5 @@
# WebUI Library 2.3.0
# C99 Example
# C++ Example
# macOS - Clang
LIB=../../../../../build/macOS/Clang
@ -12,11 +12,11 @@ debug:
# Build Lib
@cd "$(LIB)" && $(MAKE) debug
# Static with Debug info
@echo "Build C99 Example (Static Debug)..."
@clang -g -m64 -o main "$(SOURCE)/main.c" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
@echo "Build C++ Example (Static Debug)..."
@clang -std=c++11 -g -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
# Dynamic with Debug info
@echo "Build C99 Example (Dynamic Debug)..."
@clang -g -m64 -o main-dyn "$(SOURCE)/main.c" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.dyn" -lpthread -lm
@echo "Build C++ Example (Dynamic Debug)..."
@clang -std=c++11 -g -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.dyn" -lpthread -lm
# Clean
@- rm -f *.o
@- rm -rf *.dSYM
@ -26,11 +26,11 @@ release:
# Build Lib
@cd "$(LIB)" && $(MAKE)
# Static Release
@echo "Build C99 Example (Static Release)..."
@clang -lstdc++ -Os -m64 -o main "$(SOURCE)/main.c" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
@echo "Build C++ Example (Static Release)..."
@clang -std=c++11 -lstdc++ -Os -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
# Dynamic Release
@echo "Build C99 Example (Dynamic Release)..."
@clang -lstdc++ -m64 -o main-dyn "$(SOURCE)/main.c" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.dyn" -lpthread -lm
@echo "Build C++ Example (Dynamic Release)..."
@clang -std=c++11 -lstdc++ -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.dyn" -lpthread -lm
# Clean
@- rm -f *.o
@- rm -rf *.dSYM

View File

@ -13,10 +13,10 @@ debug:
@cd "$(LIB)" && $(MAKE) debug
# Static with Debug info
@echo "Build C++ Example (Static Debug)..."
@clang -lstdc++ -g -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
@clang -std=c++11 -lstdc++ -g -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
# Dynamic with Debug info
@echo "Build C++ Example (Dynamic Debug)..."
@clang -lstdc++ -g -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.so" -lpthread -lm
@clang -std=c++11 -lstdc++ -g -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.so" -lpthread -lm
# Clean
@- rm -f *.o
@echo "Done."
@ -26,11 +26,11 @@ release:
@cd "$(LIB)" && $(MAKE)
# Static Release
@echo "Build C++ Example (Static Release)..."
@clang -lstdc++ -Os -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
@clang -std=c++11 -lstdc++ -Os -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
@llvm-strip --strip-all main
# Dynamic Release
@echo "Build C++ Example (Dynamic Release)..."
@clang -lstdc++ -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.so" -lpthread -lm
@clang -std=c++11 -lstdc++ -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.so" -lpthread -lm
@llvm-strip --strip-all main-dyn
# Clean
@- rm -f *.o

View File

@ -13,10 +13,10 @@ debug:
@cd "$(LIB)" && $(MAKE) debug
# Static with Debug info
@echo "Build C++ Example (Static Debug)..."
@g++ -g -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
@g++ -std=c++11 -g -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
# Dynamic with Debug info
@echo "Build C++ Example (Dynamic Debug)..."
@g++ -g -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.so" -lpthread -lm
@g++ -std=c++11 -g -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.so" -lpthread -lm
# Clean
@- rm -f *.o
@echo "Done."
@ -26,11 +26,11 @@ release:
@cd "$(LIB)" && $(MAKE)
# Static Release
@echo "Build C++ Example (Static Release)..."
@g++ -Os -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
@g++ -std=c++11 -Os -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
@strip --strip-all main
# Dynamic Release
@echo "Build C++ Example (Dynamic Release)..."
@g++ -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.so" -lpthread -lm
@g++ -std=c++11 -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.so" -lpthread -lm
@strip --strip-all main-dyn
# Clean
@- rm -f *.o

View File

@ -15,11 +15,11 @@ debug:
# Static with Debug info
@echo Build C++ Example (Debug Static)...
@windres win.rc -O coff -o win.res
@g++ -g -static -m64 -o main.exe "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" win.res -lwebui-2-static-x64 -lws2_32 -Wall -Wl,-subsystem=console -luser32
@g++ -std=c++11 -g -static -m64 -o main.exe "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" win.res -lwebui-2-static-x64 -lws2_32 -Wall -Wl,-subsystem=console -luser32
# Dynamic with Debug info
@echo Build C++ Example (Debug Dynamic)...
@windres win.rc -O coff -o win.res
@g++ -g -m64 -o main-dyn.exe "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" win.res "$(LIB)/webui-2-x64.dll" -lws2_32 -Wall -Wl,-subsystem=console -luser32
@g++ -std=c++11 -g -m64 -o main-dyn.exe "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" win.res "$(LIB)/webui-2-x64.dll" -lws2_32 -Wall -Wl,-subsystem=console -luser32
# Clean
@- del *.o >nul 2>&1
@- del *.res >nul 2>&1
@ -31,12 +31,12 @@ release:
# Static Release
@echo Build C++ Example (Release Static)...
@windres win.rc -O coff -o win.res
@g++ -static -Os -m64 -o main.exe "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" win.res -lwebui-2-static-x64 -lws2_32 -Wall -Wl,-subsystem=windows -luser32
@g++ -std=c++11 -static -Os -m64 -o main.exe "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" win.res -lwebui-2-static-x64 -lws2_32 -Wall -Wl,-subsystem=windows -luser32
@strip --strip-all main.exe
# Dynamic Release
@echo Build C++ Example (Release Dynamic)...
@windres win.rc -O coff -o win.res
@g++ -m64 -o main-dyn.exe "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" win.res "$(LIB)/webui-2-x64.dll" -lws2_32 -Wall -Wl,-subsystem=windows -luser32
@g++ -std=c++11 -m64 -o main-dyn.exe "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" win.res "$(LIB)/webui-2-x64.dll" -lws2_32 -Wall -Wl,-subsystem=windows -luser32
@strip --strip-all main-dyn.exe
# Clean
@- del *.o >nul 2>&1

View File

@ -1,6 +1,6 @@
# WebUI Library 2.3.0
# C++ Example
# Windows - Microsoft Visual C
# Windows - Microsoft Visual C++
SHELL=CMD
_LIB=../../../../../build/Windows/MSVC/
@ -15,11 +15,11 @@ debug:
# Static with Debug info
@echo Build C++ Example (Debug Static)...
@rc win.rc 1>NUL 2>&1
@cl /Zi "$(_SOURCE)/main.cpp" /I "$(_INCLUDE)" /link /LIBPATH:"$(_LIB)" /MACHINE:X64 /SUBSYSTEM:CONSOLE win.res webui-2-static-x64.lib user32.lib Advapi32.lib /OUT:main.exe 1>NUL 2>&1
@cl /Zi /EHsc /std:c++11 "$(_SOURCE)/main.cpp" /I "$(_INCLUDE)" /link /LIBPATH:"$(_LIB)" /MACHINE:X64 /SUBSYSTEM:CONSOLE win.res webui-2-static-x64.lib user32.lib Advapi32.lib /OUT:main.exe 1>NUL 2>&1
# Dynamic with Debug info
@echo Build C++ Example (Debug Dynamic)...
@rc win.rc 1>NUL 2>&1
@cl /Zi "$(_SOURCE)/main.cpp" /I "$(_INCLUDE)" /link /LIBPATH:"$(_LIB)" /MACHINE:X64 /SUBSYSTEM:CONSOLE win.res webui-2-x64.lib user32.lib Advapi32.lib /OUT:main-dyn.exe 1>NUL 2>&1
@cl /Zi /EHsc /std:c++11 "$(_SOURCE)/main.cpp" /I "$(_INCLUDE)" /link /LIBPATH:"$(_LIB)" /MACHINE:X64 /SUBSYSTEM:CONSOLE win.res webui-2-x64.lib user32.lib Advapi32.lib /OUT:main-dyn.exe 1>NUL 2>&1
release:
# Build Lib
@ -27,11 +27,11 @@ release:
# Static Release
@echo Build C++ Example (Release Static)...
@rc win.rc 1>NUL 2>&1
@cl "$(_SOURCE)/main.cpp" /I "$(_INCLUDE)" /link /LIBPATH:"$(_LIB)" /MACHINE:X64 /SUBSYSTEM:WINDOWS win.res webui-2-static-x64.lib user32.lib Advapi32.lib /OUT:main.exe 1>NUL 2>&1
@cl /EHsc /std:c++11 "$(_SOURCE)/main.cpp" /I "$(_INCLUDE)" /link /LIBPATH:"$(_LIB)" /MACHINE:X64 /SUBSYSTEM:WINDOWS win.res webui-2-static-x64.lib user32.lib Advapi32.lib /OUT:main.exe 1>NUL 2>&1
# Dynamic Release
@echo Build C++ Example (Release Dynamic)...
@rc win.rc 1>NUL 2>&1
@cl "$(_SOURCE)/main.cpp" /I "$(_INCLUDE)" /link /LIBPATH:"$(_LIB)" /MACHINE:X64 /SUBSYSTEM:WINDOWS win.res webui-2-x64.lib user32.lib Advapi32.lib /OUT:main-dyn.exe 1>NUL 2>&1
@cl /EHsc /std:c++11 "$(_SOURCE)/main.cpp" /I "$(_INCLUDE)" /link /LIBPATH:"$(_LIB)" /MACHINE:X64 /SUBSYSTEM:WINDOWS win.res webui-2-x64.lib user32.lib Advapi32.lib /OUT:main-dyn.exe 1>NUL 2>&1
# Clean
@- del *.res >nul 2>&1
@- del *.obj >nul 2>&1

View File

@ -1,5 +1,5 @@
# WebUI Library 2.3.0
# C99 Example
# C++ Example
# macOS - Clang
LIB=../../../../../build/macOS/Clang
@ -12,11 +12,11 @@ debug:
# Build Lib
@cd "$(LIB)" && $(MAKE) debug
# Static with Debug info
@echo "Build C99 Example (Static Debug)..."
@clang -g -m64 -o main "$(SOURCE)/main.c" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
@echo "Build C++ Example (Static Debug)..."
@clang -std=c++11 -g -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
# Dynamic with Debug info
@echo "Build C99 Example (Dynamic Debug)..."
@clang -g -m64 -o main-dyn "$(SOURCE)/main.c" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.dyn" -lpthread -lm
@echo "Build C++ Example (Dynamic Debug)..."
@clang -std=c++11 -g -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.dyn" -lpthread -lm
# Clean
@- rm -f *.o
@- rm -rf *.dSYM
@ -26,11 +26,11 @@ release:
# Build Lib
@cd "$(LIB)" && $(MAKE)
# Static Release
@echo "Build C99 Example (Static Release)..."
@clang -lstdc++ -Os -m64 -o main "$(SOURCE)/main.c" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
@echo "Build C++ Example (Static Release)..."
@clang -std=c++11 -lstdc++ -Os -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
# Dynamic Release
@echo "Build C99 Example (Dynamic Release)..."
@clang -lstdc++ -m64 -o main-dyn "$(SOURCE)/main.c" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.dyn" -lpthread -lm
@echo "Build C++ Example (Dynamic Release)..."
@clang -std=c++11 -lstdc++ -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.dyn" -lpthread -lm
# Clean
@- rm -f *.o
@- rm -rf *.dSYM

View File

@ -13,10 +13,10 @@ debug:
@cd "$(LIB)" && $(MAKE) debug
# Static with Debug info
@echo "Build C++ Example (Static Debug)..."
@clang -lstdc++ -g -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
@clang -std=c++11 -lstdc++ -g -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
# Dynamic with Debug info
@echo "Build C++ Example (Dynamic Debug)..."
@clang -lstdc++ -g -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.so" -lpthread -lm
@clang -std=c++11 -lstdc++ -g -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.so" -lpthread -lm
# Clean
@- rm -f *.o
@echo "Done."
@ -26,11 +26,11 @@ release:
@cd "$(LIB)" && $(MAKE)
# Static Release
@echo "Build C++ Example (Static Release)..."
@clang -lstdc++ -Os -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
@clang -std=c++11 -lstdc++ -Os -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
@llvm-strip --strip-all main
# Dynamic Release
@echo "Build C++ Example (Dynamic Release)..."
@clang -lstdc++ -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.so" -lpthread -lm
@clang -std=c++11 -lstdc++ -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.so" -lpthread -lm
@llvm-strip --strip-all main-dyn
# Clean
@- rm -f *.o

View File

@ -13,10 +13,10 @@ debug:
@cd "$(LIB)" && $(MAKE) debug
# Static with Debug info
@echo "Build C++ Example (Static Debug)..."
@g++ -g -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
@g++ -std=c++11 -g -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
# Dynamic with Debug info
@echo "Build C++ Example (Dynamic Debug)..."
@g++ -g -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.so" -lpthread -lm
@g++ -std=c++11 -g -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.so" -lpthread -lm
# Clean
@- rm -f *.o
@echo "Done."
@ -26,11 +26,11 @@ release:
@cd "$(LIB)" && $(MAKE)
# Static Release
@echo "Build C++ Example (Static Release)..."
@g++ -Os -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
@g++ -std=c++11 -Os -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
@strip --strip-all main
# Dynamic Release
@echo "Build C++ Example (Dynamic Release)..."
@g++ -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.so" -lpthread -lm
@g++ -std=c++11 -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.so" -lpthread -lm
@strip --strip-all main-dyn
# Clean
@- rm -f *.o

View File

@ -15,11 +15,11 @@ debug:
# Static with Debug info
@echo Build C++ Example (Debug Static)...
@windres win.rc -O coff -o win.res
@g++ -g -static -m64 -o main.exe "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" win.res -lwebui-2-static-x64 -lws2_32 -Wall -Wl,-subsystem=console -luser32
@g++ -std=c++11 -g -static -m64 -o main.exe "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" win.res -lwebui-2-static-x64 -lws2_32 -Wall -Wl,-subsystem=console -luser32
# Dynamic with Debug info
@echo Build C++ Example (Debug Dynamic)...
@windres win.rc -O coff -o win.res
@g++ -g -m64 -o main-dyn.exe "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" win.res "$(LIB)/webui-2-x64.dll" -lws2_32 -Wall -Wl,-subsystem=console -luser32
@g++ -std=c++11 -g -m64 -o main-dyn.exe "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" win.res "$(LIB)/webui-2-x64.dll" -lws2_32 -Wall -Wl,-subsystem=console -luser32
# Clean
@- del *.o >nul 2>&1
@- del *.res >nul 2>&1
@ -31,12 +31,12 @@ release:
# Static Release
@echo Build C++ Example (Release Static)...
@windres win.rc -O coff -o win.res
@g++ -static -Os -m64 -o main.exe "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" win.res -lwebui-2-static-x64 -lws2_32 -Wall -Wl,-subsystem=windows -luser32
@g++ -std=c++11 -static -Os -m64 -o main.exe "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" win.res -lwebui-2-static-x64 -lws2_32 -Wall -Wl,-subsystem=windows -luser32
@strip --strip-all main.exe
# Dynamic Release
@echo Build C++ Example (Release Dynamic)...
@windres win.rc -O coff -o win.res
@g++ -m64 -o main-dyn.exe "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" win.res "$(LIB)/webui-2-x64.dll" -lws2_32 -Wall -Wl,-subsystem=windows -luser32
@g++ -std=c++11 -m64 -o main-dyn.exe "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" win.res "$(LIB)/webui-2-x64.dll" -lws2_32 -Wall -Wl,-subsystem=windows -luser32
@strip --strip-all main-dyn.exe
# Clean
@- del *.o >nul 2>&1

View File

@ -1,6 +1,6 @@
# WebUI Library 2.3.0
# C++ Example
# Windows - Microsoft Visual C
# Windows - Microsoft Visual C++
SHELL=CMD
_LIB=../../../../../build/Windows/MSVC/
@ -15,11 +15,11 @@ debug:
# Static with Debug info
@echo Build C++ Example (Debug Static)...
@rc win.rc 1>NUL 2>&1
@cl /Zi "$(_SOURCE)/main.cpp" /I "$(_INCLUDE)" /link /LIBPATH:"$(_LIB)" /MACHINE:X64 /SUBSYSTEM:CONSOLE win.res webui-2-static-x64.lib user32.lib Advapi32.lib /OUT:main.exe 1>NUL 2>&1
@cl /Zi /EHsc /std:c++11 "$(_SOURCE)/main.cpp" /I "$(_INCLUDE)" /link /LIBPATH:"$(_LIB)" /MACHINE:X64 /SUBSYSTEM:CONSOLE win.res webui-2-static-x64.lib user32.lib Advapi32.lib /OUT:main.exe 1>NUL 2>&1
# Dynamic with Debug info
@echo Build C++ Example (Debug Dynamic)...
@rc win.rc 1>NUL 2>&1
@cl /Zi "$(_SOURCE)/main.cpp" /I "$(_INCLUDE)" /link /LIBPATH:"$(_LIB)" /MACHINE:X64 /SUBSYSTEM:CONSOLE win.res webui-2-x64.lib user32.lib Advapi32.lib /OUT:main-dyn.exe 1>NUL 2>&1
@cl /Zi /EHsc /std:c++11 "$(_SOURCE)/main.cpp" /I "$(_INCLUDE)" /link /LIBPATH:"$(_LIB)" /MACHINE:X64 /SUBSYSTEM:CONSOLE win.res webui-2-x64.lib user32.lib Advapi32.lib /OUT:main-dyn.exe 1>NUL 2>&1
release:
# Build Lib
@ -27,11 +27,11 @@ release:
# Static Release
@echo Build C++ Example (Release Static)...
@rc win.rc 1>NUL 2>&1
@cl "$(_SOURCE)/main.cpp" /I "$(_INCLUDE)" /link /LIBPATH:"$(_LIB)" /MACHINE:X64 /SUBSYSTEM:WINDOWS win.res webui-2-static-x64.lib user32.lib Advapi32.lib /OUT:main.exe 1>NUL 2>&1
@cl /EHsc /std:c++11 "$(_SOURCE)/main.cpp" /I "$(_INCLUDE)" /link /LIBPATH:"$(_LIB)" /MACHINE:X64 /SUBSYSTEM:WINDOWS win.res webui-2-static-x64.lib user32.lib Advapi32.lib /OUT:main.exe 1>NUL 2>&1
# Dynamic Release
@echo Build C++ Example (Release Dynamic)...
@rc win.rc 1>NUL 2>&1
@cl "$(_SOURCE)/main.cpp" /I "$(_INCLUDE)" /link /LIBPATH:"$(_LIB)" /MACHINE:X64 /SUBSYSTEM:WINDOWS win.res webui-2-x64.lib user32.lib Advapi32.lib /OUT:main-dyn.exe 1>NUL 2>&1
@cl /EHsc /std:c++11 "$(_SOURCE)/main.cpp" /I "$(_INCLUDE)" /link /LIBPATH:"$(_LIB)" /MACHINE:X64 /SUBSYSTEM:WINDOWS win.res webui-2-x64.lib user32.lib Advapi32.lib /OUT:main-dyn.exe 1>NUL 2>&1
# Clean
@- del *.res >nul 2>&1
@- del *.obj >nul 2>&1

View File

@ -1,5 +1,5 @@
# WebUI Library 2.3.0
# C99 Example
# C++ Example
# macOS - Clang
LIB=../../../../../build/macOS/Clang
@ -12,11 +12,11 @@ debug:
# Build Lib
@cd "$(LIB)" && $(MAKE) debug
# Static with Debug info
@echo "Build C99 Example (Static Debug)..."
@clang -g -m64 -o main "$(SOURCE)/main.c" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
@echo "Build C++ Example (Static Debug)..."
@clang -std=c++11 -g -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
# Dynamic with Debug info
@echo "Build C99 Example (Dynamic Debug)..."
@clang -g -m64 -o main-dyn "$(SOURCE)/main.c" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.dyn" -lpthread -lm
@echo "Build C++ Example (Dynamic Debug)..."
@clang -std=c++11 -g -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.dyn" -lpthread -lm
# Clean
@- rm -f *.o
@- rm -rf *.dSYM
@ -26,11 +26,11 @@ release:
# Build Lib
@cd "$(LIB)" && $(MAKE)
# Static Release
@echo "Build C99 Example (Static Release)..."
@clang -lstdc++ -Os -m64 -o main "$(SOURCE)/main.c" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
@echo "Build C++ Example (Static Release)..."
@clang -std=c++11 -lstdc++ -Os -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
# Dynamic Release
@echo "Build C99 Example (Dynamic Release)..."
@clang -lstdc++ -m64 -o main-dyn "$(SOURCE)/main.c" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.dyn" -lpthread -lm
@echo "Build C++ Example (Dynamic Release)..."
@clang -std=c++11 -lstdc++ -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.dyn" -lpthread -lm
# Clean
@- rm -f *.o
@- rm -rf *.dSYM

View File

@ -13,10 +13,10 @@ debug:
@cd "$(LIB)" && $(MAKE) debug
# Static with Debug info
@echo "Build C++ Example (Static Debug)..."
@clang -lstdc++ -g -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
@clang -std=c++11 -lstdc++ -g -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
# Dynamic with Debug info
@echo "Build C++ Example (Dynamic Debug)..."
@clang -lstdc++ -g -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.so" -lpthread -lm
@clang -std=c++11 -lstdc++ -g -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.so" -lpthread -lm
# Clean
@- rm -f *.o
@echo "Done."
@ -26,11 +26,11 @@ release:
@cd "$(LIB)" && $(MAKE)
# Static Release
@echo "Build C++ Example (Static Release)..."
@clang -lstdc++ -Os -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
@clang -std=c++11 -lstdc++ -Os -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
@llvm-strip --strip-all main
# Dynamic Release
@echo "Build C++ Example (Dynamic Release)..."
@clang -lstdc++ -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.so" -lpthread -lm
@clang -std=c++11 -lstdc++ -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.so" -lpthread -lm
@llvm-strip --strip-all main-dyn
# Clean
@- rm -f *.o

View File

@ -13,10 +13,10 @@ debug:
@cd "$(LIB)" && $(MAKE) debug
# Static with Debug info
@echo "Build C++ Example (Static Debug)..."
@g++ -g -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
@g++ -std=c++11 -g -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
# Dynamic with Debug info
@echo "Build C++ Example (Dynamic Debug)..."
@g++ -g -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.so" -lpthread -lm
@g++ -std=c++11 -g -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.so" -lpthread -lm
# Clean
@- rm -f *.o
@echo "Done."
@ -26,11 +26,11 @@ release:
@cd "$(LIB)" && $(MAKE)
# Static Release
@echo "Build C++ Example (Static Release)..."
@g++ -Os -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
@g++ -std=c++11 -Os -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
@strip --strip-all main
# Dynamic Release
@echo "Build C++ Example (Dynamic Release)..."
@g++ -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.so" -lpthread -lm
@g++ -std=c++11 -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.so" -lpthread -lm
@strip --strip-all main-dyn
# Clean
@- rm -f *.o

View File

@ -15,11 +15,11 @@ debug:
# Static with Debug info
@echo Build C++ Example (Debug Static)...
@windres win.rc -O coff -o win.res
@g++ -g -static -m64 -o main.exe "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" win.res -lwebui-2-static-x64 -lws2_32 -Wall -Wl,-subsystem=console -luser32
@g++ -std=c++11 -g -static -m64 -o main.exe "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" win.res -lwebui-2-static-x64 -lws2_32 -Wall -Wl,-subsystem=console -luser32
# Dynamic with Debug info
@echo Build C++ Example (Debug Dynamic)...
@windres win.rc -O coff -o win.res
@g++ -g -m64 -o main-dyn.exe "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" win.res "$(LIB)/webui-2-x64.dll" -lws2_32 -Wall -Wl,-subsystem=console -luser32
@g++ -std=c++11 -g -m64 -o main-dyn.exe "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" win.res "$(LIB)/webui-2-x64.dll" -lws2_32 -Wall -Wl,-subsystem=console -luser32
# Clean
@- del *.o >nul 2>&1
@- del *.res >nul 2>&1
@ -31,12 +31,12 @@ release:
# Static Release
@echo Build C++ Example (Release Static)...
@windres win.rc -O coff -o win.res
@g++ -static -Os -m64 -o main.exe "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" win.res -lwebui-2-static-x64 -lws2_32 -Wall -Wl,-subsystem=windows -luser32
@g++ -std=c++11 -static -Os -m64 -o main.exe "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" win.res -lwebui-2-static-x64 -lws2_32 -Wall -Wl,-subsystem=windows -luser32
@strip --strip-all main.exe
# Dynamic Release
@echo Build C++ Example (Release Dynamic)...
@windres win.rc -O coff -o win.res
@g++ -m64 -o main-dyn.exe "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" win.res "$(LIB)/webui-2-x64.dll" -lws2_32 -Wall -Wl,-subsystem=windows -luser32
@g++ -std=c++11 -m64 -o main-dyn.exe "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" win.res "$(LIB)/webui-2-x64.dll" -lws2_32 -Wall -Wl,-subsystem=windows -luser32
@strip --strip-all main-dyn.exe
# Clean
@- del *.o >nul 2>&1

View File

@ -1,6 +1,6 @@
# WebUI Library 2.3.0
# C++ Example
# Windows - Microsoft Visual C
# Windows - Microsoft Visual C++
SHELL=CMD
_LIB=../../../../../build/Windows/MSVC/
@ -15,11 +15,11 @@ debug:
# Static with Debug info
@echo Build C++ Example (Debug Static)...
@rc win.rc 1>NUL 2>&1
@cl /Zi "$(_SOURCE)/main.cpp" /I "$(_INCLUDE)" /link /LIBPATH:"$(_LIB)" /MACHINE:X64 /SUBSYSTEM:CONSOLE win.res webui-2-static-x64.lib user32.lib Advapi32.lib /OUT:main.exe 1>NUL 2>&1
@cl /Zi /EHsc /std:c++11 "$(_SOURCE)/main.cpp" /I "$(_INCLUDE)" /link /LIBPATH:"$(_LIB)" /MACHINE:X64 /SUBSYSTEM:CONSOLE win.res webui-2-static-x64.lib user32.lib Advapi32.lib /OUT:main.exe 1>NUL 2>&1
# Dynamic with Debug info
@echo Build C++ Example (Debug Dynamic)...
@rc win.rc 1>NUL 2>&1
@cl /Zi "$(_SOURCE)/main.cpp" /I "$(_INCLUDE)" /link /LIBPATH:"$(_LIB)" /MACHINE:X64 /SUBSYSTEM:CONSOLE win.res webui-2-x64.lib user32.lib Advapi32.lib /OUT:main-dyn.exe 1>NUL 2>&1
@cl /Zi /EHsc /std:c++11 "$(_SOURCE)/main.cpp" /I "$(_INCLUDE)" /link /LIBPATH:"$(_LIB)" /MACHINE:X64 /SUBSYSTEM:CONSOLE win.res webui-2-x64.lib user32.lib Advapi32.lib /OUT:main-dyn.exe 1>NUL 2>&1
release:
# Build Lib
@ -27,11 +27,11 @@ release:
# Static Release
@echo Build C++ Example (Release Static)...
@rc win.rc 1>NUL 2>&1
@cl "$(_SOURCE)/main.cpp" /I "$(_INCLUDE)" /link /LIBPATH:"$(_LIB)" /MACHINE:X64 /SUBSYSTEM:WINDOWS win.res webui-2-static-x64.lib user32.lib Advapi32.lib /OUT:main.exe 1>NUL 2>&1
@cl /EHsc /std:c++11 "$(_SOURCE)/main.cpp" /I "$(_INCLUDE)" /link /LIBPATH:"$(_LIB)" /MACHINE:X64 /SUBSYSTEM:WINDOWS win.res webui-2-static-x64.lib user32.lib Advapi32.lib /OUT:main.exe 1>NUL 2>&1
# Dynamic Release
@echo Build C++ Example (Release Dynamic)...
@rc win.rc 1>NUL 2>&1
@cl "$(_SOURCE)/main.cpp" /I "$(_INCLUDE)" /link /LIBPATH:"$(_LIB)" /MACHINE:X64 /SUBSYSTEM:WINDOWS win.res webui-2-x64.lib user32.lib Advapi32.lib /OUT:main-dyn.exe 1>NUL 2>&1
@cl /EHsc /std:c++11 "$(_SOURCE)/main.cpp" /I "$(_INCLUDE)" /link /LIBPATH:"$(_LIB)" /MACHINE:X64 /SUBSYSTEM:WINDOWS win.res webui-2-x64.lib user32.lib Advapi32.lib /OUT:main-dyn.exe 1>NUL 2>&1
# Clean
@- del *.res >nul 2>&1
@- del *.obj >nul 2>&1

View File

@ -1,5 +1,5 @@
# WebUI Library 2.3.0
# C99 Example
# C++ Example
# macOS - Clang
LIB=../../../../../build/macOS/Clang
@ -12,11 +12,11 @@ debug:
# Build Lib
@cd "$(LIB)" && $(MAKE) debug
# Static with Debug info
@echo "Build C99 Example (Static Debug)..."
@clang -g -m64 -o main "$(SOURCE)/main.c" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
@echo "Build C++ Example (Static Debug)..."
@clang -std=c++11 -g -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
# Dynamic with Debug info
@echo "Build C99 Example (Dynamic Debug)..."
@clang -g -m64 -o main-dyn "$(SOURCE)/main.c" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.dyn" -lpthread -lm
@echo "Build C++ Example (Dynamic Debug)..."
@clang -std=c++11 -g -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.dyn" -lpthread -lm
# Clean
@- rm -f *.o
@- rm -rf *.dSYM
@ -26,11 +26,11 @@ release:
# Build Lib
@cd "$(LIB)" && $(MAKE)
# Static Release
@echo "Build C99 Example (Static Release)..."
@clang -lstdc++ -Os -m64 -o main "$(SOURCE)/main.c" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
@echo "Build C++ Example (Static Release)..."
@clang -std=c++11 -lstdc++ -Os -m64 -o main "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" -lwebui-2-static-x64 -lpthread -lm
# Dynamic Release
@echo "Build C99 Example (Dynamic Release)..."
@clang -lstdc++ -m64 -o main-dyn "$(SOURCE)/main.c" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.dyn" -lpthread -lm
@echo "Build C++ Example (Dynamic Release)..."
@clang -std=c++11 -lstdc++ -m64 -o main-dyn "$(SOURCE)/main.cpp" -I "$(INCLUDE)" -L "$(LIB)" "$(LIB)/webui-2-x64.dyn" -lpthread -lm
# Clean
@- rm -f *.o
@- rm -rf *.dSYM

View File

@ -190,7 +190,7 @@ WEBUI_EXPORT bool webui_get_bool(webui_event_t* e);
// Return the response to JavaScript as integer.
WEBUI_EXPORT void webui_return_int(webui_event_t* e, long long int n);
// Return the response to JavaScript as string.
WEBUI_EXPORT void webui_return_string(webui_event_t* e, char* s);
WEBUI_EXPORT void webui_return_string(webui_event_t* e, const char* s);
// Return the response to JavaScript as boolean.
WEBUI_EXPORT void webui_return_bool(webui_event_t* e, bool b);
// Base64 encoding. Use this to safely send text based data to the UI. If it fails it will return NULL.

View File

@ -103,7 +103,7 @@ namespace webui {
}
// Bind a specific html element click event with a function. Empty element means all events.
void bind(std::string element, void (*func)(webui::event* e)) {
void bind(const std::string& element, void (*func)(webui::event* e)) {
// Get unique ID
unsigned int id = webui_bind(this->webui_window, element.c_str(), webui::event_handler);
@ -116,12 +116,12 @@ namespace webui {
}
// Show a window using a embedded HTML, or a file. If the window is already opened then it will be refreshed.
bool show(std::string content) {
bool show(const std::string& content) {
return webui_show(this->webui_window, content.c_str());
}
// Same as show(). But with a specific web browser.
bool show_browser(std::string content, unsigned int browser) {
bool show_browser(const std::string& content, unsigned int browser) {
return webui_show_browser(this->webui_window, content.c_str(), browser);
}
@ -142,7 +142,7 @@ namespace webui {
}
// Set the default embedded HTML favicon
void set_icon(std::string icon, std::string icon_type) {
void set_icon(const std::string& icon, const std::string& icon_type) {
webui_set_icon(this->webui_window, icon.c_str(), icon_type.c_str());
}
@ -153,12 +153,12 @@ namespace webui {
// -- JavaScript ----------------------
// Quickly run a JavaScript (no response waiting).
void run(std::string script) {
void run(const std::string& script) {
webui_run(this->webui_window, script.c_str());
}
// Run a JavaScript, and get the response back (Make sure your local buffer can hold the response).
bool script(std::string script, unsigned int timeout, char* buffer, size_t buffer_length) {
bool script(const std::string& script, unsigned int timeout, char* buffer, size_t buffer_length) {
return webui_script(this->webui_window, script.c_str(), timeout, buffer, buffer_length);
}
@ -199,9 +199,9 @@ namespace webui {
}
// Return the response to JavaScript as string.
void return_string(webui::event* e, std::string s) {
void return_string(webui::event* e, const std::string& s) {
webui_event_t* c_e = convert_event_to_webui_event(e);
webui_return_string(c_e, &s[0]);
webui_return_string(c_e, s.c_str());
delete c_e;
}
@ -229,13 +229,13 @@ namespace webui {
}
// Base64 encoding. Use this to safely send text based data to the UI. If it fails it will return NULL.
std::string encode(std::string str) {
std::string encode(const std::string& str) {
std::string ret = std::string(webui_encode(str.c_str()));
return ret;
}
// Base64 decoding. Use this to safely decode received Base64 text from the UI. If it fails it will return NULL.
std::string decode(std::string str) {
std::string decode(const std::string& str) {
std::string ret = std::string(webui_decode(str.c_str()));
return ret;
}

View File

@ -676,8 +676,25 @@ void webui_set_icon(size_t window, const char* icon, const char* icon_type) {
if(_webui_core.wins[window] == NULL) return;
_webui_window_t* win = _webui_core.wins[window];
win->icon = icon;
win->icon_type = icon_type;
// Some wrappers does not guarantee `icon` to
// stay valid, so, let's make our own copy.
// Icon
size_t len = _webui_strlen(icon);
const char* icon_cpy = (const char*)_webui_malloc(len);
memcpy((char*)icon_cpy, icon, len);
// Icon Type
len = _webui_strlen(icon_type);
const char* icon_type_cpy = (const char*)_webui_malloc(len);
memcpy((char*)icon_type_cpy, icon_type, len);
// Clean old sets if any
if(win->icon != NULL)
_webui_free_mem((void*)win->icon);
if(win->icon_type != NULL)
_webui_free_mem((void*)win->icon_type);
win->icon = icon_cpy;
win->icon_type = icon_type_cpy;
}
bool webui_show(size_t window, const char* content) {
@ -828,7 +845,7 @@ void webui_return_int(webui_event_t* e, long long int n) {
*response = buf;
}
void webui_return_string(webui_event_t* e, char* s) {
void webui_return_string(webui_event_t* e, const char* s) {
#ifdef WEBUI_LOG
printf("[User] webui_return_string([%s])...\n", s);