Working on web, change python to lua
This commit is contained in:
1 parent
90e2a369f4
commit
178f69967b
14 files changed
+327
-162
No files matched your search
@@ -48,5 +48,8 @@ check_and_download("https://download.savannah.gnu.org/releases/freetype/freetype
|
||||
# 8) SDL_ttf
|
||||
check_and_download("https://github.com/libsdl-org/SDL_ttf/archive/refs/tags/release-2.24.0.zip" "release-2.24.0.zip" "SDL_ttf-release-2.24.0" "CMakeLists.txt")
|
||||
|
||||
# 9) pybind11
|
||||
check_and_download("https://github.com/pybind/pybind11/archive/refs/tags/v3.0.3.zip" "pybind11-v3.0.3.zip" "pybind11-3.0.3" "CMakeLists.txt")
|
||||
# 9) Lua
|
||||
check_and_download("https://github.com/lua/lua/archive/refs/tags/v5.4.8.zip" "lua-v5.4.8.zip" "lua-5.4.8" "lapi.c")
|
||||
|
||||
# 10) sol2 (header-only C++ bindings for Lua)
|
||||
check_and_download("https://github.com/ThePhD/sol2/archive/refs/tags/v3.3.0.zip" "sol2-v3.3.0.zip" "sol2-3.3.0" "include/sol/sol.hpp")
|
||||
+56
-6
@@ -8,6 +8,11 @@ endmacro()
|
||||
|
||||
set(BUILD_CONFIGS Debug Release)
|
||||
|
||||
# Map MinSizeRel and RelWithDebInfo to Release libs for all imported targets.
|
||||
# Without this CMake warns that IMPORTED_LOCATION is missing for those configs.
|
||||
set(CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL Release)
|
||||
set(CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO Release)
|
||||
|
||||
|
||||
# ===========================================
|
||||
# 1) ZLIB (zlib131.zip → zlib-1.3.2) - без изменений
|
||||
@@ -549,12 +554,57 @@ if(NOT TARGET boost_external_lib)
|
||||
endif()
|
||||
|
||||
# ===========================================
|
||||
# 9) pybind11 (3.0.3) - Python embedding
|
||||
# 9) Lua (5.5.0) - embedded scripting language
|
||||
# ===========================================
|
||||
set(PYBIND11_SRC_DIR "${THIRDPARTY_DIR}/pybind11-3.0.3")
|
||||
set(LUA_SRC_DIR "${THIRDPARTY_DIR}/lua-5.4.8")
|
||||
|
||||
if(NOT TARGET pybind11::headers)
|
||||
# pybind11 is header-only; add_subdirectory gives us pybind11::embed which
|
||||
# also locates and links the Python interpreter and development libraries.
|
||||
add_subdirectory("${PYBIND11_SRC_DIR}" "${CMAKE_BINARY_DIR}/pybind11_build" EXCLUDE_FROM_ALL)
|
||||
if(NOT TARGET lua_static)
|
||||
file(GLOB LUA_SOURCES "${LUA_SRC_DIR}/*.c")
|
||||
# Exclude the standalone interpreter, compiler, and unity-build wrapper.
|
||||
# onelua.c #includes all other .c files — compiling it alongside them
|
||||
# causes every symbol to be defined twice.
|
||||
list(REMOVE_ITEM LUA_SOURCES
|
||||
"${LUA_SRC_DIR}/lua.c"
|
||||
"${LUA_SRC_DIR}/luac.c"
|
||||
"${LUA_SRC_DIR}/onelua.c"
|
||||
)
|
||||
|
||||
add_library(lua_static STATIC ${LUA_SOURCES})
|
||||
target_include_directories(lua_static PUBLIC "${LUA_SRC_DIR}")
|
||||
target_compile_definitions(lua_static PRIVATE _CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
# ===========================================
|
||||
# 10) sol2 (3.3.0) - header-only C++ bindings for Lua
|
||||
# ===========================================
|
||||
set(SOL2_SRC_DIR "${THIRDPARTY_DIR}/sol2-3.3.0")
|
||||
|
||||
# Apply patch for Clang/Emscripten compatibility in optional<T&>::emplace().
|
||||
# The sentinel file prevents re-applying on subsequent cmake runs.
|
||||
set(_sol2_sentinel "${SOL2_SRC_DIR}/.patched")
|
||||
if(NOT EXISTS "${_sol2_sentinel}")
|
||||
find_package(Git QUIET)
|
||||
if(GIT_FOUND)
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} apply --ignore-whitespace
|
||||
"${CMAKE_CURRENT_LIST_DIR}/patches/sol2-3.3.0-clang-optional.patch"
|
||||
WORKING_DIRECTORY "${SOL2_SRC_DIR}"
|
||||
RESULT_VARIABLE _sol2_patch_res
|
||||
)
|
||||
if(_sol2_patch_res EQUAL 0)
|
||||
file(WRITE "${_sol2_sentinel}" "patched\n")
|
||||
message(STATUS "Applied sol2 Clang optional patch")
|
||||
else()
|
||||
message(WARNING "sol2 patch failed (exit ${_sol2_patch_res}) — Clang/Emscripten builds may not compile")
|
||||
endif()
|
||||
else()
|
||||
message(WARNING "Git not found — cannot apply sol2 patch automatically. "
|
||||
"Apply cmake/patches/sol2-3.3.0-clang-optional.patch manually.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT TARGET sol2_external_lib)
|
||||
add_library(sol2_external_lib INTERFACE)
|
||||
target_include_directories(sol2_external_lib INTERFACE "${SOL2_SRC_DIR}/include")
|
||||
target_link_libraries(sol2_external_lib INTERFACE lua_static)
|
||||
endif()
|
||||
@@ -0,0 +1,14 @@
|
||||
--- a/include/sol/optional_implementation.hpp
|
||||
+++ b/include/sol/optional_implementation.hpp
|
||||
@@ -2189,7 +2189,10 @@
|
||||
template <class... Args>
|
||||
T& emplace(Args&&... args) noexcept {
|
||||
static_assert(std::is_constructible<T, Args&&...>::value, "T must be constructible with Args");
|
||||
|
||||
*this = nullopt;
|
||||
- this->construct(std::forward<Args>(args)...);
|
||||
+ // Reference specialization stores a pointer; set it directly.
|
||||
+ // construct() only exists in the non-reference specialization.
|
||||
+ m_value = std::addressof(std::forward<Args>(args)...);
|
||||
+ return *m_value;
|
||||
}
|
||||
Reference in new issue
Block a user