forked from redo/BlockLua
make
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
build/
|
build/
|
||||||
|
.cache/
|
||||||
|
|||||||
23
.vscode/settings.json
vendored
23
.vscode/settings.json
vendored
@@ -1,12 +1,11 @@
|
|||||||
{
|
{
|
||||||
"Lua.diagnostics.globals": [
|
"Lua.diagnostics.globals": [
|
||||||
"_bllua_ts",
|
"_bllua_ts",
|
||||||
"_bllua_requiresecure",
|
"_bllua_requiresecure",
|
||||||
"_bllua_on_unload"
|
"_bllua_on_unload"
|
||||||
],
|
],
|
||||||
"Lua.runtime.version": "Lua 5.1",
|
"Lua.runtime.version": "Lua 5.1",
|
||||||
"Lua.diagnostics.disable": [
|
"Lua.diagnostics.disable": ["lowercase-global", "undefined-global"],
|
||||||
"lowercase-global",
|
"C_Cpp.default.compileCommands": "${workspaceFolder}/build/compile_commands.json",
|
||||||
"undefined-global"
|
"C_Cpp.default.compilerPath": "C:/msys64/mingw32/bin/g++.exe"
|
||||||
]
|
}
|
||||||
}
|
|
||||||
|
|||||||
56
CMakeLists.txt
Normal file
56
CMakeLists.txt
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
|
||||||
|
project(BlockLua CXX)
|
||||||
|
|
||||||
|
# Export compile_commands.json for VSCode IntelliSense
|
||||||
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
|
# Output directories to mirror compile.bat's build folder
|
||||||
|
set(OUTPUT_DIR ${CMAKE_SOURCE_DIR}/build)
|
||||||
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIR})
|
||||||
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_DIR})
|
||||||
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${OUTPUT_DIR})
|
||||||
|
|
||||||
|
# Global compile options to mirror compile.bat
|
||||||
|
add_compile_options(
|
||||||
|
-Wall
|
||||||
|
-Werror
|
||||||
|
-m32
|
||||||
|
-static-libgcc
|
||||||
|
-static-libstdc++
|
||||||
|
)
|
||||||
|
|
||||||
|
# Include paths
|
||||||
|
include_directories(
|
||||||
|
${CMAKE_SOURCE_DIR}/src
|
||||||
|
${CMAKE_SOURCE_DIR}/inc/tsfuncs
|
||||||
|
${CMAKE_SOURCE_DIR}/inc/lua
|
||||||
|
)
|
||||||
|
|
||||||
|
# Link directories (for -L.) and libraries from compile.bat
|
||||||
|
link_directories(
|
||||||
|
${CMAKE_SOURCE_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Safe DLL
|
||||||
|
add_library(BlockLua SHARED src/bllua4.cpp)
|
||||||
|
# Ensure output name matches compile.bat
|
||||||
|
set_target_properties(BlockLua PROPERTIES OUTPUT_NAME "BlockLua")
|
||||||
|
# Linker flags and libraries
|
||||||
|
if(MSVC)
|
||||||
|
# Not expected with mingw, but keep placeholder
|
||||||
|
else()
|
||||||
|
target_link_libraries(BlockLua PRIVATE psapi lua5.1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Unsafe DLL (with BLLUA_UNSAFE definition)
|
||||||
|
add_library(BlockLuaUnsafe SHARED src/bllua4.cpp)
|
||||||
|
set_target_properties(BlockLuaUnsafe PROPERTIES OUTPUT_NAME "BlockLua-Unsafe")
|
||||||
|
|
||||||
|
target_compile_definitions(BlockLuaUnsafe PRIVATE BLLUA_UNSAFE)
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
# Not expected with mingw, but keep placeholder
|
||||||
|
else()
|
||||||
|
target_link_libraries(BlockLuaUnsafe PRIVATE psapi lua5.1)
|
||||||
|
endif()
|
||||||
27
make.bat
Normal file
27
make.bat
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
@echo off
|
||||||
|
cd /d %~dp0
|
||||||
|
|
||||||
|
REM Ensure MinGW32 toolchain is first in PATH (matches compile.bat)
|
||||||
|
set "PATH=C:\msys64\mingw32\bin;%PATH%"
|
||||||
|
|
||||||
|
REM Configure CMake (generate into build/)
|
||||||
|
cmake -S . -B build -G "MinGW Makefiles"
|
||||||
|
if errorlevel 1 goto :error
|
||||||
|
|
||||||
|
REM Build (Release by default)
|
||||||
|
cmake --build build --config Release -j
|
||||||
|
if errorlevel 1 goto :error
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo Build completed.
|
||||||
|
echo Outputs in .\build :
|
||||||
|
echo - BlockLua.dll
|
||||||
|
|
||||||
|
echo - BlockLua-Unsafe.dll
|
||||||
|
|
||||||
|
exit /b 0
|
||||||
|
|
||||||
|
:error
|
||||||
|
echo.
|
||||||
|
echo Build failed. See errors above.
|
||||||
|
exit /b 1
|
||||||
Reference in New Issue
Block a user