diff --git a/.github/workflows/zig-cross.yml b/.github/workflows/zig-cross.yml index 671c5fa..c93fe42 100644 --- a/.github/workflows/zig-cross.yml +++ b/.github/workflows/zig-cross.yml @@ -35,7 +35,7 @@ jobs: working-directory: ${{github.workspace}} run: | export PATH=$PWD/zig-linux-x86_64-0.14.0-dev.2414+ba37a4369:$PATH - cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DSTRIPPED=ON -DCMAKE_TOOLCHAIN_FILE="cmake/zig-toolchain.cmake" + cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DSTRIPPED=ON cmake --build build --parallel 8 - name: Delete draft release(s) diff --git a/.gitmodules b/.gitmodules index de90da2..d690d13 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "ext/godot-sandbox"] - path = ext/godot-sandbox - url = https://github.com/libriscv/godot-sandbox.git [submodule "ext/eigen"] path = ext/eigen url = https://gitlab.com/libeigen/eigen.git diff --git a/ext/godot-sandbox b/ext/godot-sandbox deleted file mode 160000 index 36b1817..0000000 --- a/ext/godot-sandbox +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 36b18177ca57a39e541dca76fd81c9883fc82257 diff --git a/programs/CMakeLists.txt b/programs/CMakeLists.txt index fed7735..90d5282 100644 --- a/programs/CMakeLists.txt +++ b/programs/CMakeLists.txt @@ -1,5 +1,13 @@ -# Add the sandbox program CMake API -add_subdirectory(../ext/godot-sandbox/program/cpp/cmake cmake) +# Fetch godot-sandbox repository (add_subdirectory is implicitly called) +include(FetchContent) +FetchContent_Declare( + godot-sandbox + GIT_REPOSITORY https://github.com/libriscv/godot-sandbox.git + GIT_TAG main + GIT_PROGRESS TRUE + SOURCE_SUBDIR "program/cpp/cmake" +) +FetchContent_MakeAvailable(godot-sandbox) # Download the run-time generated API from the v0.1 release file(DOWNLOAD diff --git a/programs/hello-world/main.cpp b/programs/hello-world/main.cpp index d60ea31..1e4f6df 100644 --- a/programs/hello-world/main.cpp +++ b/programs/hello-world/main.cpp @@ -26,6 +26,12 @@ static int meaning_of_life = 42; int main() { print("Hello, world!"); + // The entire Godot API is available + Sandbox sandbox = get_node(); + print(sandbox.is_binary_translated() + ? "The current program is accelerated by binary translation." + : "The current program is running in interpreter mode."); + // Add public API ADD_API_FUNCTION(hello_world, "String", "", "Returns the string 'Hello, world!'"); ADD_API_FUNCTION(print_string, "void", "String str", "Prints a string to the console");