diff options
| -rw-r--r-- | CMakeLists.txt | 20 | ||||
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | flake.nix | 2 | ||||
| -rw-r--r-- | src/main.cpp | 16 |
4 files changed, 35 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index d3f001a..c3c5c33 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,19 +1,31 @@ cmake_minimum_required(VERSION 3.16) +set(PROJECT "web-browser") + set(CMAKE_EXPORT_COMPILE_COMMANDS ON) -project(web-browser +project(${PROJECT} VERSION 0.0.0) set(CMAKE_CXX_STANDARD 17) -# add_definitions(-DCEF_USE_QT_EVENT_LOOP) +find_package(PkgConfig REQUIRED) # set(CEF_PACKAGE_PATH "$ENV{CEF_PACKAGE_PATH}") # message(STATUS "CEF path: ${CEF_PACKAGE_PATH}") # include_directories(${CEF_PACKAGE_PATH} ${CEF_PACKAGE_PATH}/include) # link_directories(${CEF_PACKAGE_PATH}/lib) +# Qt find_package(Qt6 REQUIRED COMPONENTS Widgets WebEngineWidgets) -add_executable(web-browser src/main.cpp) -target_link_libraries(web-browser Qt6::Widgets Qt6::WebEngineWidgets cef cef_dll_wrapper) +# LuaJIT +pkg_check_modules(LuaJIT REQUIRED luajit) +include_directories(${LuaJIT_INCLUDE_DIRS}) +link_directories(${LuaJIT_LIBRARY_DIRS}) +message(STATUS ":::: Lua path = ${LuaJIT_INCLUDE_DIRS} ${LuaJIT_LINK_LIBRARIES}") + +add_executable(${PROJECT} src/main.cpp) +target_link_libraries(${PROJECT} + Qt6::Widgets + Qt6::WebEngineWidgets + ${LuaJIT_LINK_LIBRARIES}) @@ -4,7 +4,7 @@ all: build build: @mkdir -p build - @cd build/ && cmake .. && make + @cd build/ && cmake .. && make -j4 # cp --no-preserve=mode,ownership -r ${CEF_PACKAGE_PATH}/lib/* ./build/lib/ # cp --no-preserve=mode,ownership -r ${CEF_PACKAGE_PATH}/share/cef/* ./build/lib/ cp build/compile_commands.json . @@ -15,6 +15,8 @@ clang-tools pkgs.qt6.full + luajit + # lua51Packages.lua # libcef # nss ]; diff --git a/src/main.cpp b/src/main.cpp index 03bc7c2..8fbfee1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,8 +2,24 @@ #include <QVBoxLayout> #include <QWebEngineView> #include <QWidget> +#include <lua.hpp> int main(int argc, char *argv[]) { + auto L = luaL_newstate(); + + luaL_openlibs(L); /* Load Lua libraries */ + + /* Load the file containing the script we are going to run */ + auto status = luaL_dostring(L, "print(500 + 10 * 3)"); + if (status) { + /* If something went wrong, error message is at the top of */ + /* the stack */ + fprintf(stderr, "Couldn't load file: %s\n", lua_tostring(L, -1)); + exit(1); + } + lua_close(L); + exit(0); + QApplication app(argc, argv); QWidget mainWindow; mainWindow.setWindowTitle("web-browser"); |
