Skip to content

Commit

Permalink
Update to latest lape
Browse files Browse the repository at this point in the history
  • Loading branch information
ollydev committed Jan 20, 2022
1 parent c287e18 commit 34f0025
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 55 deletions.
69 changes: 25 additions & 44 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
runs-on: ${{ matrix.config.runs-on }}
defaults:
run:
shell: bash
Expand All @@ -20,86 +20,67 @@ jobs:
matrix:
config:
- name: Windows 64
os: windows-latest
cpu: x86_64
runs-on: windows-latest
build-mode: SIMBA_WIN64
binary: Simba-Win64.exe
test: Simba-Win64.exe

- name: Windows 32
os: windows-latest
cpu: i386
runs-on: windows-latest
build-mode: SIMBA_WIN32
binary: Simba-Win32.exe
test: Simba-Win32.exe

- name: Linux 64
os: ubuntu-latest
cpu: x86_64
runs-on: ubuntu-latest
build-mode: SIMBA_LINUX64
binary: Simba-Linux64
test: Simba-Linux64

- name: AArch64
os: ubuntu-latest
cpu: aarch64
runs-on: ubuntu-latest
build-mode: SIMBA_AARCH64
binary: Simba-AArch64

- name: MacOS 64
os: macos-latest
cpu: x86_64
runs-on: macos-latest
build-mode: SIMBA_DARWIN64
binary: Simba-Darwin64.zip
test: Simba-Darwin64

steps:
- uses: actions/checkout@v2.3.4
- uses: actions/checkout@v2.4.0
with:
submodules: true

- name: Install Lazarus
uses: ollydev/setup-lazarus-fpcup@v2.1
uses: ollydev/setup-lazarus-fpcup@v2.4
with:
cpu: ${{ matrix.config.cpu }}
laz-branch: lazarus_2_0_12
fpc-branch: release_3_2_0
laz-branch: lazarus_2_2_0
fpc-branch: release_3_2_2
fpcup-release: v2.2.0h

- name: Build Simba
run: |
export GITHUB_SHORT_SHA=$(git rev-parse --short HEAD)
lazbuild --build-mode=${{ matrix.config.build-mode }} "Source/Simba/Simba.lpi"
- name: Test Simba
if: matrix.config.test != ''
run: |
export DISPLAY=:1
Xvfb :1 &
chmod +x ${{ matrix.config.test }}
./${{ matrix.config.test }} --run Tests/simba
if [ "${{ matrix.config.runs-on }}" = "ubuntu-latest" ]; then
export DISPLAY=:1
Xvfb :1 & sleep 2
fi
if [ "${{ matrix.config.runs-on }}" != "windows-latest" ]; then
chmod +x ${{ matrix.config.test }}
fi
./${{ matrix.config.test }} --silent --run "Tests/simba"
- name: Upload Binary
uses: actions/[email protected]
with:
path: ${{ matrix.config.binary }}

release:
if: github.ref == 'refs/heads/simba1400' && github.event_name == 'push'
needs: build
runs-on: ubuntu-latest
steps:
- name: Download Artifacts
uses: actions/[email protected]

- name: Update Release
uses: Brandon-T/update-release-action@v1
uses: actions/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
file: 'artifact/*'
is_file_glob: true
suffix_branch_name: true
tag: 'autobuild'
release_name: 'autobuild'
release_notes: "Binaries for the most recent commit of this branch. Don't worry about the release date, it's wrong!"
retry_count: 5
bump_tag: true
overwrite: true
name: ${{ matrix.config.binary }}
path: ${{ matrix.config.binary }}
2 changes: 2 additions & 0 deletions Source/Simba/script/imports/simba.script_import_math.pas
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ procedure Lape_Import_Math(Compiler: TSimbaScript_Compiler);
begin
Section := 'Math';

Globals['InRange'].Free();

addGlobalFunc('function RiemannGauss(Xstart, StepSize, Sigma: Extended; AmountSteps: Int32): Extended', @Lape_RiemannGauss);
addGlobalFunc('function DiscreteGauss(Xstart, Xend: Int32; sigma: Extended): TExtendedArray', @Lape_DiscreteGauss);
addGlobalFunc('function GaussMatrix(N: Int32; sigma: Extended): T2DExtendedArray', @Lape_GaussMatrix);
Expand Down
7 changes: 0 additions & 7 deletions Source/Simba/script/simba.script_compiler.pas
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ TManagedImportClosure = class(TLapeDeclaration)
procedure addClass(Name: lpString; Parent: lpString = 'TObject'); virtual;
procedure addClassVar(Obj, Item, Typ: lpString; ARead: Pointer; AWrite: Pointer = nil; Arr: Boolean = False; ArrType: lpString = 'UInt32'); virtual;

procedure addBaseDefine(Define, Value: lpString); virtual; overload;

procedure Import; virtual;
function Compile: Boolean; override;

Expand Down Expand Up @@ -253,10 +251,5 @@ function TSimbaScript_Compiler.addGlobalFunc(AHeader: lpString; Value: Pointer):
Include(FOptions, lcoLooseSemicolon);
end;

procedure TSimbaScript_Compiler.addBaseDefine(Define, Value: lpString);
begin
FBaseDefines[Define] := Value;
end;

end.

6 changes: 3 additions & 3 deletions Source/Simba/script/simba.script_dump.pas
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ TCompilerDump = class(TSimbaScript_Compiler)
procedure WriteMethod(Header: String);
procedure Write(Header: String);
public
procedure addBaseDefine(Define: lpString); override;
procedure addBaseDefine(Define: lpString; AValue: lpString = ''); override;

function addDelayedCode(Code: lpString; AFileName: lpString = ''; AfterCompilation: Boolean = True; IsGlobal: Boolean = True): TLapeTree_Base; override;
function addGlobalFunc(Header: lpString; Value: Pointer): TLapeGlobalVar; override;
Expand Down Expand Up @@ -164,9 +164,9 @@ function TCompilerDump.addDelayedCode(Code: lpString; AFileName: lpString; After
Write(Code);
end;

procedure TCompilerDump.addBaseDefine(Define: lpString);
procedure TCompilerDump.addBaseDefine(Define: lpString; AValue: lpString);
begin
inherited addBaseDefine(Define);
inherited addBaseDefine(Define, AValue);

Write(Format('{$DEFINE %s}', [Define]));
end;
Expand Down

0 comments on commit 34f0025

Please sign in to comment.