diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml index 2294d2d..a55f576 100644 --- a/.github/actions/build/action.yml +++ b/.github/actions/build/action.yml @@ -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 diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index ae84c98..f8616d6 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -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 @@ -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 @@ -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/setup-godot@v2.1.1 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 diff --git a/SConstruct b/SConstruct index 4a428da..f89fb7a 100644 --- a/SConstruct +++ b/SConstruct @@ -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 -------------------------- @@ -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"]: @@ -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) diff --git a/demo/addons/s7/test/s7_scheme_tests.gd b/demo/addons/s7/test/s7_scheme_tests.gd index 63cc8ba..8951dc1 100644 --- a/demo/addons/s7/test/s7_scheme_tests.gd +++ b/demo/addons/s7/test/s7_scheme_tests.gd @@ -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") diff --git a/s7 b/s7 index 8521f28..828a36b 160000 --- a/s7 +++ b/s7 @@ -1 +1 @@ -Subproject commit 8521f288ed8434bcdd72b374182b37d88acf5683 +Subproject commit 828a36b8f02e87b75f78b691a6686ea512b83416 diff --git a/test/golden/s7_scheme_tests.txt b/test/golden/s7_scheme_tests.txt index c6ff6c4..1d09585 100644 --- a/test/golden/s7_scheme_tests.txt +++ b/test/golden/s7_scheme_tests.txt @@ -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) diff --git a/test/test-main.scm b/test/test-main.scm index 8c54a96..ba29c13 100644 --- a/test/test-main.scm +++ b/test/test-main.scm @@ -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