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
+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()
|
||||
Reference in new issue
Block a user