Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,15 @@ find_package(Doxygen)
find_package(BoostCertify REQUIRED)

if (CHATTERINO_PLUGINS)
set(LUA_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/lib/lua/src")
add_subdirectory(lib/lua)

find_package(Lua 5.4)

if (NOT Lua_FOUND)
set(LUA_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/lib/lua/src")
add_subdirectory(lib/lua)
else()
set(LUA_INCLUDE_DIRS "${Lua_INCLUDE_DIRS}")
endif()

find_package(Sol2 REQUIRED)
endif()
Expand Down
8 changes: 6 additions & 2 deletions cmake/FindSol2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ if (Sol2_FOUND)
)
target_compile_definitions(Sol2 INTERFACE
SOL_ALL_SAFETIES_ON=1
SOL_USING_CXX_LUA=1
SOL_USING_CXX_LUA=0
Copy link

@LecrisUT LecrisUT Nov 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This likely needs to be conditional based on what lua version we detect. But evidently there is some non_trivial source chaanges needed as well based om the test failures that bult lua from scratch (although that one should still be building the cxx version: https://github.com/Chatterino/chatterino2/blob/115428d7f475c75c0ae6c211f0db4c81004ce49b/lib/lua/CMakeLists.txt)

SOL_NO_NIL=0
)
target_link_libraries(Sol2 INTERFACE lua)
if(TARGET Lua::Lua)
target_link_libraries(Sol2 INTERFACE Lua::Lua)
else()
target_link_libraries(Sol2 INTERFACE lua)
endif()
add_library(sol2::sol2 ALIAS Sol2)
endif ()

Expand Down
Loading