Skip to content

Commit

Permalink
Add workflow for building examples
Browse files Browse the repository at this point in the history
  • Loading branch information
fwsGonzo committed Nov 26, 2024
1 parent cd952c3 commit 362f843
Show file tree
Hide file tree
Showing 12 changed files with 90 additions and 10 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Godot Sandbox Examples

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

env:
BUILD_TYPE: Release

jobs:
build:
runs-on: ubuntu-24.04
env:
CC: riscv64-linux-gnu-gcc-14
CXX: riscv64-linux-gnu-g++-14

steps:
- uses: actions/checkout@v2

- name: Install dependencies
run: |
sudo apt update
sudo apt install -y g++-14-riscv64-linux-gnu git
git submodule update --init
- name: Build all examples
working-directory: ${{github.workspace}}
run: |
cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
cmake --build build --parallel 8
- name: Delete draft release(s)
uses: hugo19941994/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Archive
shell: sh
run: |
ls
mkdir -p examples
cp build/bin/* examples/
zip -r "examples.zip" examples
- name: Release
uses: softprops/action-gh-release@v2
with:
name: Examples Nightly
files: |
examples.zip
generate_release_notes: true
draft: true
prerelease: true
fail_on_unmatched_files: true
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
cmake_minimum_required(VERSION 3.10)
project (examples)

add_subdirectory(asm)
add_subdirectory(libtcc)
add_subdirectory(luajit)
add_subdirectory(mir)

set_target_properties(asm PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set_target_properties(cjit PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set_target_properties(lua PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set_target_properties(mirjit PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
9 changes: 7 additions & 2 deletions asm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
cmake_minimum_required(VERSION 3.10)
project(asmjit)

if (NOT TARGET sandbox_api)
add_subdirectory(../cmake cmake)
endif()

add_subdirectory(asmjit)

include(FetchContent)
FetchContent_Declare(
Expand All @@ -14,8 +18,9 @@ FetchContent_MakeAvailable(libriscv)
target_compile_definitions(riscv PRIVATE RISCV_DISABLE_URANDOM=1)

# Add the asmjit sandbox program
add_sandbox_program(asmjit
add_sandbox_program(asm
main.cpp
)

target_link_libraries(asmjit PRIVATE -static riscv)
target_link_libraries(asm PRIVATE -static riscv)
add_dependencies(asm assembler)
4 changes: 2 additions & 2 deletions asm/asmjit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ set_target_properties(riscv_asmjit PROPERTIES
target_link_libraries(riscv_asmjit INTERFACE zlibstatic)

# Add the asmjit sandbox program
add_executable(asmjit
add_executable(assembler
asmjit_main.c
)
target_link_libraries(asmjit PRIVATE -static riscv_asmjit)
target_link_libraries(assembler PRIVATE -static riscv_asmjit)
Binary file added asm/asmjit/libRiscvAsmLib.a
Binary file not shown.
2 changes: 1 addition & 1 deletion asm/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ using AsmCallback = Variant(*)();
using namespace riscv;
using machine_t = riscv::Machine<riscv::RISCV64>;

EMBED_BINARY(asmjit, "../asmjit/.build/asmjit");
EMBED_BINARY(asmjit, "asmjit/assembler");
static const std::string_view asmjit_bin(asmjit, asmjit_size);

static Variant assemble(String input) {
Expand Down
7 changes: 6 additions & 1 deletion libtcc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
cmake_minimum_required(VERSION 3.10)
project(cjit)

if (NOT TARGET sandbox_api)
add_subdirectory(../cmake cmake)
endif()

add_sandbox_program(cjit
main.cpp
Expand All @@ -14,11 +16,14 @@ FetchContent_Declare(tinycc
)
FetchContent_MakeAvailable(tinycc)

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/_deps/tinycc-src/config.h)
set(CONFIG_H_LOCATION "${CMAKE_BINARY_DIR}/_deps/tinycc-src/config.h")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CONFIG_H_LOCATION})
set_source_files_properties(${CONFIG_H_LOCATION} PROPERTIES GENERATED TRUE)

add_library(libtcc STATIC
${tinycc_SOURCE_DIR}/libtcc.c
${tinycc_SOURCE_DIR}/libtcc.h
${CONFIG_H_LOCATION}
)
target_compile_definitions(libtcc PRIVATE
CONFIG_TCC_PREDEFS=1
Expand Down
2 changes: 2 additions & 0 deletions lua/CMakeLists.txt → luajit/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
cmake_minimum_required(VERSION 3.10)
project(lua)

if (NOT TARGET sandbox_api)
add_subdirectory(../cmake cmake)
endif()

add_sandbox_program(lua
main.cpp
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 6 additions & 4 deletions mir/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
cmake_minimum_required(VERSION 3.10)
project(cjit)
project(mirjit)

if (NOT TARGET sandbox_api)
add_subdirectory(../cmake cmake)
endif()

add_sandbox_program(cjit
add_sandbox_program(mirjit
main.cpp
)

Expand All @@ -15,5 +17,5 @@ FetchContent_Declare(libmir
)
FetchContent_MakeAvailable(libmir)

target_link_libraries(cjit PRIVATE mir_static)
target_include_directories(cjit PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/_deps/libmir-src")
target_link_libraries(mirjit PRIVATE mir_static)
target_include_directories(mirjit PRIVATE "${CMAKE_BINARY_DIR}/_deps/libmir-src")

0 comments on commit 362f843

Please sign in to comment.