Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update s7 revision to 1-Dec-2024 release #2

Merged
merged 11 commits into from
Dec 1, 2024
2 changes: 1 addition & 1 deletion .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ runs:
emcc -v
# Windows only
- name: Windows - Setup MinGW for Windows/MinGW build
uses: egor-tensin/setup-mingw@v2
uses: egor-tensin/setup-mingw@v2.2.0
if: ${{ inputs.platform == 'windows' }}
with:
version: 12.2.0
Expand Down
49 changes: 26 additions & 23 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ jobs:
target-type: template_debug
os: ubuntu-20.04

# - platform: windows
# float-precision: single
# arch: x86_32
# target-type: template_debug
# os: windows-latest

# - platform: windows
# float-precision: single
# arch: x86_64
# target-type: template_debug
# os: windows-latest
- platform: windows
float-precision: single
arch: x86_32
target-type: template_debug
os: windows-latest

- platform: windows
float-precision: single
arch: x86_64
target-type: template_debug
os: windows-latest

- platform: macos
float-precision: single
Expand Down Expand Up @@ -144,17 +144,17 @@ jobs:
target-type: template_debug
os: ubuntu-20.04

# - platform: windows
# float-precision: double
# arch: x86_32
# target-type: template_debug
# os: windows-latest
- platform: windows
float-precision: double
arch: x86_32
target-type: template_debug
os: windows-latest

# - platform: windows
# float-precision: double
# arch: x86_64
# target-type: template_debug
# os: windows-latest
- platform: windows
float-precision: double
arch: x86_64
target-type: template_debug
os: windows-latest

- platform: macos
float-precision: double
Expand Down Expand Up @@ -286,13 +286,16 @@ jobs:

# Test
- name: Setup Godot Action
if: ${{ matrix.float-precision == 'single' && matrix.target-type == 'template_debug' && (matrix.platform == 'linux' || matrix.platform == 'macos' || matrix.platform == 'windows') }}
if: ${{ matrix.float-precision == 'single' && matrix.target-type == 'template_debug' && (matrix.platform == 'linux' || matrix.platform == 'macos' || (matrix.platform == 'windows' && matrix.arch == 'x86_64')) }}
uses: chickensoft-games/[email protected]
with:
version: 4.3.0
use-dotnet: false
- name: Set GODOT_EXE on windows
if: ${{ matrix.platform == 'windows' }}
run: echo "GODOT_EXE=C:\Users\runneradmin\godot\Godot_v4.3-stable_win64.exe" >> $env:GITHUB_ENV
- name: Test
if: ${{ matrix.float-precision == 'single' && matrix.target-type == 'template_debug' && (matrix.platform == 'linux' || matrix.platform == 'macos' || matrix.platform == 'windows') }}
if: ${{ matrix.float-precision == 'single' && matrix.target-type == 'template_debug' && (matrix.platform == 'linux' || matrix.platform == 'macos' || (matrix.platform == 'windows' && matrix.arch == 'x86_64')) }}
run: make test -j

# Sign
Expand Down
17 changes: 11 additions & 6 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const char* {constant_name} = R"({file_content})";
""")

def is_submodule_initialized(path):
return os.path.isdir(path) and os.listdir(path)
return os.path.isdir(path) and os.listdir(path)

# -------------------------- Build definition --------------------------

Expand Down Expand Up @@ -64,15 +64,20 @@ env.Append(
"DISABLE_AUTOLOAD": "1",
"WITH_C_LOADER": "0",
"WITH_MULTITHREAD_CHECKS": "0",
"WITH_SYSTEM_EXTRAS": "0",
"HAVE_COMPLEX_NUMBERS": "0" if env["platform"] == "windows" else "1"
"WITH_SYSTEM_EXTRAS": "0"
}
)

s7_env = env.Clone()
s7_obj = s7_env.SharedObject(target='s7', source='s7/s7.c')
if s7_env["platform"] == "windows":
s7_env.Append(
CCFLAGS=['/std:c17']
)

sources = [
Glob("src/*.cpp"),
Glob("src/repl/*.cpp"),
Glob("s7/s7.c")
Glob("src/repl/*.cpp")
]

if env["target"] in ["editor", "template_debug"]:
Expand All @@ -92,7 +97,7 @@ if env["platform"] == "macos" or env["platform"] == "ios":
library_file = "bin/{}/{}{}".format(env["platform"], file_path, file)
library = env.SharedLibrary(
library_file,
source=sources,
source=sources + [s7_obj],
)

copy = env.InstallAs("{}/bin/{}/{}lib{}".format(project_dir, env["platform"], file_path, file), library)
Expand Down
2 changes: 1 addition & 1 deletion demo/addons/s7/test/s7_scheme_tests.gd
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func apply(symbol: String, args: Array):
return r

func can_exchange_primitive_values():
eval("(format #t \"Hello from Scheme!\n\")")
eval("(format #f \"Hello from Scheme!~%\")")

define("an-integer", 41)
eval("an-integer")
Expand Down
2 changes: 1 addition & 1 deletion s7
Submodule s7 updated 4 files
+323 −276 s7.c
+10 −4 s7.h
+79 −24 s7test.scm
+25 −0 tools/tcomplex.scm
4 changes: 1 addition & 3 deletions test/golden/s7_scheme_tests.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
Godot Engine v4.3.stable.official.77dcf97d8 - https://godotengine.org

Hello from Scheme!
(format #t "Hello from Scheme!
")=>String(Hello from Scheme!
(format #f "Hello from Scheme!~%")=>String(Hello from Scheme!
)
an-integer=>int(41)
(+ 1 an-integer)=>int(42)
Expand Down
13 changes: 10 additions & 3 deletions test/test-main.scm
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,25 @@
(error 'assertion-error "ERROR~%# (assert-equals ~a ~a)~%## ~a~%`~a`~%## ~a~%`~a`" lq rq lq l' rq r')))))

(define (godot scene)
(system (format #f "godot --path demo ~a --headless --quit" scene) #t))
(let* ((program (or (getenv "GODOT_EXE") (getenv "GODOT") "godot"))
(cmd (format #f "\"~a\" --path demo ~a --headless --quit" program scene)))
(format #t "~a~%" cmd)
(system cmd #t)))

(define (read-file path)
(call-with-input-file path
(lambda (p) (read-string 65535 p))))

(define (diff file1 file2)
(system (format #f "diff --strip-trailing-cr --color=auto -u ~a ~a" file1 file2)))

(define* (golden-scene-test scene golden-file)
(let ((output-file "bin/s7_scheme_tests.txt"))
(call-with-output-file output-file
(lambda (p) (write-string (godot scene) p)))
(unless (= 0 (system (format #f "diff --color=auto -u ~a ~a" golden-file output-file)))
(error 'assertion-error "ERROR: output of scene `~a` doesn't match golden file `~a`." scene golden-file))))
(unless (= 0 (diff golden-file output-file))
(error 'assertion-error
"ERROR: output of scene `~a` doesn't match golden file `~a`." scene golden-file))))

(define (golden-scene-tests)
(golden-scene-test
Expand Down