Skip to content

Commit

Permalink
Retrieve godot-sandbox through FetchContent
Browse files Browse the repository at this point in the history
  • Loading branch information
fwsGonzo committed Dec 10, 2024
1 parent 4bbffbf commit 9de033d
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/zig-cross.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion ext/godot-sandbox
Submodule godot-sandbox deleted from 36b181
12 changes: 10 additions & 2 deletions programs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 6 additions & 0 deletions programs/hello-world/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Sandbox>();
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");
Expand Down

0 comments on commit 9de033d

Please sign in to comment.