diff --git a/README.md b/README.md index 9ac55e9..8ca0a5d 100644 --- a/README.md +++ b/README.md @@ -140,22 +140,22 @@ closereq (only thing really missing, will need to figure out how to deal with mu Linux or MinGW `g++` (C++): ``` cd build -g++ -o ../ -I../../HUI -L. -lHUI +g++ -o ../ -I../../HUI/{c,c++} -L. -lHUI ``` Linux or MinGW `gcc` (C): ``` cd build -gcc -o ../ -I../../HUI -L. -lHUI +gcc -o ../ -I../../HUI/c -L. -lHUI ``` Windows MSVC `cl.exe` (C++): ``` cd build -cl /EHsc /Fe:.exe ../ /I../../HUI /link /LIBPATH:. libHUI.lib +cl /EHsc /Fe:.exe ../ /I../../HUI/c /I../../HUI/c++ /link /LIBPATH:. libHUI.lib ``` Windows MSVC `cl.exe` (C): ``` cd build -cl /Fe:.exe ../ /I../../HUI /link /LIBPATH:. libHUI.lib +cl /Fe:.exe ../ /I../../HUI/c /link /LIBPATH:. libHUI.lib ``` Rust (first, copy your project into HUI root): ``` @@ -229,7 +229,7 @@ HUI 'newnew' - attempt to reimplement HUI from beginning \ - [ ] single master build script for everything + make it possible to combine windowcontrols/webview/windowembeder in different languages at linkage time - [ ] debug control flag/rust --debug/release -- [ ] c, cpp, rust, python bindings in own directories +- [x] c, cpp, rust, python bindings in own directories - [ ] put backends in own directories + make it possible to build webview and controls separately - [ ] handle hui.js and hui.css as define/text replace (so we dont need quoting) - [ ] create master build script that calls others + build scripts directory + release naming ( HUI-{platform}-{backend}_{version or commit hash}_{more info} ) diff --git a/build_linux_dummy.sh b/build_linux_dummy.sh index 26094a7..4931d90 100644 --- a/build_linux_dummy.sh +++ b/build_linux_dummy.sh @@ -29,7 +29,7 @@ cd $BUILD ## Build # build -g++ -shared -fPIC -o ./libHUI.so ../hui_webview__dummy.cc ../hui_controls__dummy.cc -I.. +g++ -shared -fPIC -o ./libHUI.so ../hui_webview__dummy.cc ../hui_controls__dummy.cc -I../{c,c++} ## Deploy @@ -43,7 +43,7 @@ fi ## Tests if [[ " $@ " =~ " --tests " ]]; then # build tests - g++ -o test_webview_js_api ../tests/test_webview_js_api.cc -I.. -L. -lHUI + g++ -o test_webview_js_api ../tests/test_webview_js_api.cc -I../{c,c++} -L. -lHUI fi diff --git a/build_linux_gtk3.sh b/build_linux_gtk3.sh index a7eabdb..9c959f6 100644 --- a/build_linux_gtk3.sh +++ b/build_linux_gtk3.sh @@ -29,9 +29,9 @@ cd $BUILD ## Build # build -g++ -fPIC -c -o ./libHUIwebview.o ../hui_webview__webkit_gtk3.cc -I.. `pkg-config --cflags --libs gtk+-3.0 webkit2gtk-4.1` -g++ -fPIC -c -o ./libHUIcontrols.o ../hui_windowcontrols__gtk3.cc -I.. `pkg-config --cflags --libs gtk+-3.0 gtk-layer-shell-0` -g++ -shared -fPIC -o ./libHUI.so ./libHUIwebview.o ./libHUIcontrols.o -I.. `pkg-config --cflags --libs gtk+-3.0 webkit2gtk-4.1 gtk-layer-shell-0` +g++ -fPIC -c -o ./libHUIwebview.o ../hui_webview__webkit_gtk3.cc -I../{c,c++} `pkg-config --cflags gtk+-3.0 webkit2gtk-4.1` +g++ -fPIC -c -o ./libHUIcontrols.o ../hui_windowcontrols__gtk3.cc -I../{c,c++} `pkg-config --cflags gtk+-3.0 gtk-layer-shell-0` +g++ -shared -fPIC -o ./libHUI.so ./libHUIwebview.o ./libHUIcontrols.o `pkg-config --libs gtk+-3.0 webkit2gtk-4.1 gtk-layer-shell-0` ## Deploy @@ -45,7 +45,7 @@ fi ## Tests if [[ " $@ " =~ " --tests " ]]; then # build tests - g++ -o test_webview_js_api ../tests/test_webview_js_api.cc -I.. -L. -lHUI + g++ -o test_webview_js_api ../tests/test_webview_js_api.cc -I../{c,c++} -L. -lHUI fi diff --git a/build_linux_qt5.sh b/build_linux_qt5.sh index 1b68f97..4d1c87e 100644 --- a/build_linux_qt5.sh +++ b/build_linux_qt5.sh @@ -27,7 +27,7 @@ cd $BUILD ## Build # build -g++ -shared -fPIC -o ./libHUI.so ../hui_webview__webkit_qt5.cc ../hui_windowcontrols__qt5.cc -I.. `pkg-config --cflags --libs Qt5Widgets Qt5WebKitWidgets` +g++ -shared -fPIC -o ./libHUI.so ../hui_webview__webkit_qt5.cc ../hui_windowcontrols__qt5.cc -I../{c,c++} `pkg-config --cflags --libs Qt5Widgets Qt5WebKitWidgets` # TODO: qmake *.moc @@ -43,7 +43,7 @@ fi ## Tests if [[ " $@ " =~ " --tests " ]]; then # build tests - g++ -o test_webview_js_api ../tests/test_webview_js_api.cc -I.. -L. -lHUI + g++ -o test_webview_js_api ../tests/test_webview_js_api.cc -I../{c,c++} -L. -lHUI fi diff --git a/build_mingw_dummy.bat b/build_mingw_dummy.bat index dd846a0..61b52ed 100644 --- a/build_mingw_dummy.bat +++ b/build_mingw_dummy.bat @@ -40,7 +40,7 @@ cd $BUILD ## Build # build with simple g++ -g++ -shared -fPIC -o ./libHUI.dll ../hui_webview__dummy.cc ../hui_controls__dummy.cc -I.. +g++ -shared -fPIC -o ./libHUI.dll ../hui_webview__dummy.cc ../hui_controls__dummy.cc -I../{c,c++} ## Deploy @@ -60,7 +60,7 @@ if [[ " $@ " =~ " --tests " ]]; then #ldd | grep -vE /c/WINDOWS\|System32\|SYSTEM32 | awk '{print $3}' | xargs -I {} sh -c '[ -f {} ] && cp {} .' # build tests - g++ -o test_webview_js_api.exe ../tests/test_webview_js_api.cc -I.. -L. -lHUI + g++ -o test_webview_js_api.exe ../tests/test_webview_js_api.cc -I../{c,c++} -L. -lHUI fi diff --git a/build_mingw_dummy.sh b/build_mingw_dummy.sh index 1b1cc1b..8a62b23 100644 --- a/build_mingw_dummy.sh +++ b/build_mingw_dummy.sh @@ -22,7 +22,7 @@ cd $BUILD ## Build # build with simple g++ -g++ -shared -fPIC -o ./libHUI.dll ../hui_webview__dummy.cc ../hui_controls__dummy.cc -I.. +g++ -shared -fPIC -o ./libHUI.dll ../hui_webview__dummy.cc ../hui_controls__dummy.cc -I../{c,c++} ## Deploy @@ -42,7 +42,7 @@ if [[ " $@ " =~ " --tests " ]]; then #ldd | grep -vE /c/WINDOWS\|System32\|SYSTEM32 | awk '{print $3}' | xargs -I {} sh -c '[ -f {} ] && cp {} .' # build tests - g++ -o test_webview_js_api.exe ../tests/test_webview_js_api.cc -I.. -L. -lHUI + g++ -o test_webview_js_api.exe ../tests/test_webview_js_api.cc -I../{c,c++} -L. -lHUI fi diff --git a/build_mingw_qt5.sh b/build_mingw_qt5.sh index 3956623..1cb7eca 100644 --- a/build_mingw_qt5.sh +++ b/build_mingw_qt5.sh @@ -27,7 +27,7 @@ cd $BUILD ## Build # build with simple g++ -g++ -shared -fPIC -o ./libHUI.dll ../hui_webview__webkit_qt5.cc ../hui_windowcontrols__qt5.cc -I.. `pkg-config --cflags --libs Qt5Widgets Qt5WebKitWidgets` +g++ -shared -fPIC -o ./libHUI.dll ../hui_webview__webkit_qt5.cc ../hui_windowcontrols__qt5.cc -I../{c,c++} `pkg-config --cflags --libs Qt5Widgets Qt5WebKitWidgets` ## Deploy @@ -54,7 +54,7 @@ if [[ " $@ " =~ " --tests " ]]; then #ldd | grep -vE /c/WINDOWS\|System32\|SYSTEM32 | awk '{print $3}' | xargs -I {} sh -c '[ -f {} ] && cp {} .' # build tests - g++ -o test_webview_js_api.exe ../tests/test_webview_js_api.cc -I.. -L. -lHUI + g++ -o test_webview_js_api.exe ../tests/test_webview_js_api.cc -I../{c,c++} -L. -lHUI fi diff --git a/build_win_cef.bat b/build_win_cef.bat index a4daf4c..bb212b7 100644 --- a/build_win_cef.bat +++ b/build_win_cef.bat @@ -91,7 +91,7 @@ REM Tests if not "%ARGS%" == "%ARGS: --tests =%" ( :: build tests - cl /EHsc /Fe:test_webview_js_api.exe ../tests/test_webview_js_api.cc /I.. /link /LIBPATH:. libHUI.lib + cl /EHsc /Fe:test_webview_js_api.exe ../tests/test_webview_js_api.cc /I..\c /I..\c++ /link /LIBPATH:. libHUI.lib ) diff --git a/build_win_dummy.bat b/build_win_dummy.bat index 4dc3dae..48405d4 100644 --- a/build_win_dummy.bat +++ b/build_win_dummy.bat @@ -32,7 +32,7 @@ REM Build call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" :: build -cl /LD /EHsc /D"and=&" /Fe:libHUI.dll ..\hui_webview__dummy.cc ..\hui_controls__dummy.cc +cl /LD /EHsc /D"and=&" /Fe:libHUI.dll ..\hui_webview__dummy.cc ..\hui_controls__dummy.cc /I..\c /I..\c++ :: create definiton file (dumpbin output edited to be "EXPORTS \n HUI_ \n ...") - its easier to have the file prepared and just copy it ::dumpbin.exe /EXPORTS HUI.dll > HUI.def @@ -55,7 +55,7 @@ REM Tests if not "%ARGS%" == "%ARGS: --tests =%" ( :: build tests - cl /EHsc /Fe:test_webview_js_api.exe ../tests/test_webview_js_api.cc /I.. /link /LIBPATH:. libHUI.lib + cl /EHsc /Fe:test_webview_js_api.exe ../tests/test_webview_js_api.cc /I..\c /I..\c++ /link /LIBPATH:. libHUI.lib ) diff --git a/HUI.hh b/c++/HUI.hh similarity index 100% rename from HUI.hh rename to c++/HUI.hh diff --git a/hui_datatypes.h b/c++/hui_datatypes.h similarity index 100% rename from hui_datatypes.h rename to c++/hui_datatypes.h diff --git a/HUI.h b/c/HUI.h similarity index 100% rename from HUI.h rename to c/HUI.h diff --git a/cef_CMakeLists.txt b/cef_CMakeLists.txt index 6722b5d..d5867d5 100644 --- a/cef_CMakeLists.txt +++ b/cef_CMakeLists.txt @@ -47,6 +47,8 @@ foreach(flag_var endforeach() # Additional include and link directories +include_directories(../c) +include_directories(../c++) include_directories(${CEF_ROOT}/include) include_directories(${CEF_ROOT}) diff --git a/hui_webview__webkit_gtk3.cc b/hui_webview__webkit_gtk3.cc index 00f2cda..e6884ba 100644 --- a/hui_webview__webkit_gtk3.cc +++ b/hui_webview__webkit_gtk3.cc @@ -4,7 +4,7 @@ #define _hui_webview_use_common_code #include "HUI.hh" -#include "./hui_datatypes.h" +#include "hui_datatypes.h" #include #include #include diff --git a/hui_webview__webkit_qt5.cc b/hui_webview__webkit_qt5.cc index 76fd022..6ffbb7c 100644 --- a/hui_webview__webkit_qt5.cc +++ b/hui_webview__webkit_qt5.cc @@ -6,7 +6,7 @@ #include "HUI.hh" -#include "./hui_datatypes.h" +#include "hui_datatypes.h" #include #include #include diff --git a/hui_windowcontrols__gtk3.cc b/hui_windowcontrols__gtk3.cc index bcf0dbf..d00e5a9 100644 --- a/hui_windowcontrols__gtk3.cc +++ b/hui_windowcontrols__gtk3.cc @@ -4,7 +4,7 @@ #include "HUI.hh" -#include "./hui_datatypes.h" +#include "hui_datatypes.h" #include #include #include diff --git a/hui_windowcontrols__qt5.cc b/hui_windowcontrols__qt5.cc index 0eee7eb..482103b 100644 --- a/hui_windowcontrols__qt5.cc +++ b/hui_windowcontrols__qt5.cc @@ -4,7 +4,7 @@ #include "HUI.hh" -#include "./hui_datatypes.h" +#include "hui_datatypes.h" #include #include #include diff --git a/python/build.py b/python/build.py index d80786a..fa417c8 100644 --- a/python/build.py +++ b/python/build.py @@ -14,7 +14,7 @@ print("installing dependencies...") os.system("pacman -S --noconfirm --needed mingw-w64-x86_64-pybind11") print("running build...") - os.system('bash -c "g++ -O3 -shared -fPIC ../python/hui_python.cc -o HUI$(python3-config --extension-suffix) -I.. -L. -lHUI $(python3 -m pybind11 --includes) -lpython'+str(sys.version_info.major)+'.'+str(sys.version_info.minor)+'"') # '-lpython3.12' needed to avoid 'undefined reference to' + os.system('bash -c "g++ -O3 -shared -fPIC ../python/hui_python.cc -o HUI$(python3-config --extension-suffix) -I../c -I../c++ -L. -lHUI $(python3 -m pybind11 --includes) -lpython'+str(sys.version_info.major)+'.'+str(sys.version_info.minor)+'"') # '-lpython3.12' needed to avoid 'undefined reference to' else: print("building on windows (msvc)...") @@ -27,7 +27,7 @@ pyname = "python"+str(sys.version_info.major)+str(sys.version_info.minor) # python312 suffix = sysconfig.get_config_var('EXT_SUFFIX') # .cp312-win_amd64.pyd #os.system("call \"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat\" && cl /LD /EHsc /O2 /Fe:HUI"+suffix+" ../python/hui_python.cc "+includes+" /I\"..\" /link /LIBPATH:\""+libpath+"\\libs"+"\" "+pyname+".lib libHUI.lib") - os.system("cl /LD /EHsc /O2 /Fe:HUI"+suffix+" ../python/hui_python.cc "+includes+" /I\"..\" /link /LIBPATH:\""+libpath+"\\libs"+"\" "+pyname+".lib libHUI.lib") + os.system("cl /LD /EHsc /O2 /Fe:HUI"+suffix+" ../python/hui_python.cc "+includes+" /I\"..\\c\" /I\"..\\c++\" /link /LIBPATH:\""+libpath+"\\libs"+"\" "+pyname+".lib libHUI.lib") print("done") @@ -48,7 +48,7 @@ print("unknown linux distro, hope you have everything installed...") print("running build...") - os.system("g++ -O3 -shared -fPIC ../python/hui_python.cc -o HUI$(python3-config --extension-suffix) -I.. -L. -lHUI $(python3 -m pybind11 --includes)") + os.system("g++ -O3 -shared -fPIC ../python/hui_python.cc -o HUI$(python3-config --extension-suffix) -I../c -I../c++ -L. -lHUI $(python3 -m pybind11 --includes)") print("done")