Skip to content

Commit

Permalink
Merge pull request #22 from OGSR/v2.1
Browse files Browse the repository at this point in the history
Import OpenXRay changes
  • Loading branch information
Brugarolas authored Jan 8, 2024
2 parents 9af18f5 + 60d81a5 commit 70d2ff3
Show file tree
Hide file tree
Showing 6 changed files with 316 additions and 10 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Main Workflow

on:
push:
pull_request:
release:
types:
- created

jobs:
build:
if: "!contains(github.event.head_commit.message, '[skip ci]') || github.event_name == 'release'"
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
Configuration: [Release]
Platform: [x86, x64]
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- name: Setup MSBuild
uses: microsoft/[email protected]
- name: MSBuild
shell: cmd
run: |
set APPVEYOR_BUILD_VERSION=2.1.${{ github.run_number }}
msbuild LuaJIT.sln /t:Rebuild /p:Configuration=${{ matrix.Configuration }} /p:Platform=${{ matrix.Platform }}
- name: Prepare artifacts
shell: cmd
run: |
set APPVEYOR_BUILD_VERSION=2.1.${{ github.run_number }}
set CONFIGURATION=${{ matrix.Configuration }}
set PLATFORM=${{ matrix.Platform }}
set ARTIFACT_NAME=LuaJIT_%PLATFORM%_%APPVEYOR_BUILD_VERSION%_%CONFIGURATION%.7z
cd bin\%PLATFORM%\
7z a -t7z -m0=LZMA2:d=96m:fb=273 -mx=9 -mmt=2 ..\..\%ARTIFACT_NAME% .\
- name: Upload OGSR artifact
uses: actions/[email protected]
with:
name: LuaJIT_${{ matrix.Platform }}_2.1.${{ github.run_number }}_${{ matrix.Configuration }}.7z
path: .\LuaJIT_${{ matrix.Platform }}_2.1.${{ github.run_number }}_${{ matrix.Configuration }}.7z

- name: Upload release asset
if: github.event_name == 'release'
uses: tanyagray/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: .\LuaJIT_${{ matrix.Platform }}_2.1.${{ github.run_number }}_${{ matrix.Configuration }}.7z
asset_name: LuaJIT_${{ matrix.Platform }}_2.1.${{ github.run_number }}_${{ matrix.Configuration }}.7z
asset_content_type: application/zip
36 changes: 26 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
*.[oa]
*.so
*.obj
*.lib
# Precompiled Headers
*.ipch

# Всякий ненужный мусор:
*.VC.*
*.suo
*.user
*.exp
*.dll
*.exe
*.manifest
*.dmp
*.swp
.tags
*.aps
*.TMP
*.ilk
*.pdb
*.log
*.cache

# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

/.vs
/bin*
25 changes: 25 additions & 0 deletions LuaJIT.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27703.2026
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LuaJIT", "src\luajit.vcxproj", "{632AEEB6-DC06-4E15-9551-B2B09A4B73C5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{632AEEB6-DC06-4E15-9551-B2B09A4B73C5}.Release|x64.ActiveCfg = Release|x64
{632AEEB6-DC06-4E15-9551-B2B09A4B73C5}.Release|x64.Build.0 = Release|x64
{632AEEB6-DC06-4E15-9551-B2B09A4B73C5}.Release|x86.ActiveCfg = Release|Win32
{632AEEB6-DC06-4E15-9551-B2B09A4B73C5}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E503F366-872D-4DD2-B2D9-29DFEE61E729}
EndGlobalSection
EndGlobal
25 changes: 25 additions & 0 deletions src/lj_lex.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,31 @@ static LexToken lex_scan(LexState *ls, TValue *tv)
}
case LEX_EOF:
return TK_eof;
//+RvP, дополнительно используются C-style комментарии
case '/':
lex_next(ls);
if (ls->c == '/') {
while (ls->c != '\n' && ls->c != LEX_EOF)
lex_next(ls);
continue;
}
else if (ls->c == '*') {
lex_next(ls);
while (ls->c != LEX_EOF) {
if (ls->c == '*') {
lex_next(ls);
if (ls->c == '/') {
lex_next(ls);
break;
}
}
lex_next(ls);
}
continue;
}
else
return '/';
//-RvP
default: {
LexChar c = ls->c;
lex_next(ls);
Expand Down
49 changes: 49 additions & 0 deletions src/luajit.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{632AEEB6-DC06-4E15-9551-B2B09A4B73C5}</ProjectGuid>
<Keyword>MakeFileProj</Keyword>
<ProjectName>LuaJIT</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration">
<ConfigurationType>Makefile</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<NMakeOutput>..\bin\$(PlatformShortName)\LuaJIT.dll</NMakeOutput>
<NMakeBuildCommandLine>
if not exist "..\bin\$(PlatformShortName)\LuaJIT.dll" (
call msvcbuild_new.bat $(PlatformShortName)
)
</NMakeBuildCommandLine>
<NMakeReBuildCommandLine>
RD /S/Q ..\bin
call msvcbuild_new.bat $(PlatformShortName)
</NMakeReBuildCommandLine>
<NMakeCleanCommandLine>RD /S/Q ..\bin</NMakeCleanCommandLine>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
134 changes: 134 additions & 0 deletions src/msvcbuild_new.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
@rem Script to build LuaJIT with MSVC.
@rem Copyright (C) 2005-2023 Mike Pall. See Copyright Notice in luajit.h
@rem
@rem Either open a "Visual Studio .NET Command Prompt"
@rem (Note that the Express Edition does not contain an x64 compiler)
@rem -or-
@rem Open a "Windows SDK Command Shell" and set the compiler environment:
@rem setenv /release /x86
@rem -or-
@rem setenv /release /x64
@rem
@rem Then cd to this directory and run this script.

@if not defined INCLUDE goto :FAIL

@setlocal
@set LJCOMPILE=cl /nologo /MP /Zi /c /O2 /W3 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_STDIO_INLINE=__declspec(dllexport)__inline
@set LJLINK=link /nologo /DEBUG
@set LJMT=mt /nologo
@set LJLIB=lib /nologo /nodefaultlib
@set DASMDIR=..\dynasm
@set DASM=%DASMDIR%\dynasm.lua
@set LJTARGETARCH=%1
@set DASC=vm_%LJTARGETARCH%.dasc
@set LJBINPATH=..\bin\
@if defined LJTARGETARCH (
@set LJBINPATH=%LJBINPATH%%LJTARGETARCH%\
)
@if not exist %LJBINPATH% (
@mkdir %LJBINPATH%
)
@set LJDLLNAME=%LJBINPATH%LuaJIT.dll
@set LJLIBNAME=%LJBINPATH%LuaJIT.lib
@set ALL_LIB=lib_base.c lib_math.c lib_bit.c lib_string.c lib_table.c lib_io.c lib_os.c lib_package.c lib_debug.c lib_jit.c lib_ffi.c lib_buffer.c

%LJCOMPILE% host\minilua.c
@if errorlevel 1 goto :BAD
%LJLINK% /out:minilua.exe minilua.obj
@if errorlevel 1 goto :BAD
if exist minilua.exe.manifest^
%LJMT% -manifest minilua.exe.manifest -outputresource:minilua.exe

@set DASMFLAGS=-D WIN -D JIT -D FFI -D P64
@set LJARCH=x64
@minilua
@if errorlevel 8 goto :X64
@set DASMFLAGS=-D WIN -D JIT -D FFI
@set LJARCH=x86
:X64
@set LJCOMPILE=%LJCOMPILE% /DLUAJIT_ENABLE_GC64
minilua %DASM% -LN %DASMFLAGS% -o host\buildvm_arch.h %DASC%
@if errorlevel 1 goto :BAD

git show -s --format="%%ct" >luajit_relver.txt
minilua host\genversion.lua

%LJCOMPILE% /I "." /I %DASMDIR% host\buildvm*.c
@if errorlevel 1 goto :BAD
%LJLINK% /out:buildvm.exe buildvm*.obj
@if errorlevel 1 goto :BAD
if exist buildvm.exe.manifest^
%LJMT% -manifest buildvm.exe.manifest -outputresource:buildvm.exe

buildvm -m peobj -o lj_vm.obj
@if errorlevel 1 goto :BAD
buildvm -m bcdef -o lj_bcdef.h %ALL_LIB%
@if errorlevel 1 goto :BAD
buildvm -m ffdef -o lj_ffdef.h %ALL_LIB%
@if errorlevel 1 goto :BAD
buildvm -m libdef -o lj_libdef.h %ALL_LIB%
@if errorlevel 1 goto :BAD
buildvm -m recdef -o lj_recdef.h %ALL_LIB%
@if errorlevel 1 goto :BAD
buildvm -m vmdef -o jit\vmdef.lua %ALL_LIB%
@if errorlevel 1 goto :BAD
buildvm -m folddef -o lj_folddef.h lj_opt_fold.c
@if errorlevel 1 goto :BAD

@if "%2" neq "debug" goto :NODEBUG
@shift
@set LJLINK=%LJLINK% /opt:ref /opt:icf /incremental:no
:NODEBUG
@if "%2"=="amalg" goto :AMALGDLL
@if "%2"=="static" goto :STATIC
%LJCOMPILE% /MD /DLUA_BUILD_AS_DLL lj_*.c lib_*.c
@if errorlevel 1 goto :BAD
%LJLINK% /DLL /out:%LJDLLNAME% lj_*.obj lib_*.obj
@if errorlevel 1 goto :BAD
@goto :MTDLL
:STATIC
%LJCOMPILE% lj_*.c lib_*.c
@if errorlevel 1 goto :BAD
%LJLIB% /OUT:%LJLIBNAME% lj_*.obj lib_*.obj
@if errorlevel 1 goto :BAD
@goto :MTDLL
:AMALGDLL
%LJCOMPILE% /MD /DLUA_BUILD_AS_DLL ljamalg.c
@if errorlevel 1 goto :BAD
%LJLINK% /DLL /out:%LJDLLNAME% ljamalg.obj lj_vm.obj
@if errorlevel 1 goto :BAD
:MTDLL
if exist %LJDLLNAME%.manifest^
%LJMT% -manifest %LJDLLNAME%.manifest -outputresource:%LJDLLNAME%;2

%LJCOMPILE% luajit.c
@if errorlevel 1 goto :BAD
%LJLINK% /out:%LJBINPATH%Lua_JIT.exe luajit.obj %LJLIBNAME%
@if errorlevel 1 goto :BAD
if exist %LJBINPATH%Lua_JIT.exe.manifest^
%LJMT% -manifest %LJBINPATH%Lua_JIT.exe.manifest -outputresource:%LJBINPATH%Lua_JIT.exe

if not exist %LJBINPATH%lua\*.* (
md %LJBINPATH%lua\
)
if not exist %LJBINPATH%lua\jit\*.* (
md %LJBINPATH%lua\jit\
)
copy /Y jit\*.* %LJBINPATH%lua\jit\

@del *.obj *.manifest minilua.exe minilua.exp minilua.lib buildvm.exe buildvm.exp buildvm.lib jit\vmdef.lua
@del host\buildvm_arch.h
@del lj_bcdef.h lj_ffdef.h lj_libdef.h lj_recdef.h lj_folddef.h
@echo.
@echo === Successfully built LuaJIT for Windows/%LJARCH% ===
@goto :END
:BAD
@echo.
@echo *******************************************************
@echo *** Build FAILED -- Please check the error messages ***
@echo *******************************************************
@goto :END
:FAIL
@echo You must open a "Visual Studio .NET Command Prompt" to run this script
:END

0 comments on commit 70d2ff3

Please sign in to comment.