-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
334 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: Linux Binary | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
paths: | ||
- 'ext/rubyraylib/**' | ||
- 'CMakeLists.txt' | ||
- 'third_party/**' | ||
- '.github/workflows/linux.yml' | ||
- '!ext/rubyraylib/rubyraylib.cpp' | ||
- '!ext/rubyraylib/rubyraylib.hpp' | ||
pull_request: | ||
paths: | ||
- 'ext/rubyraylib/**' | ||
- 'CMakeLists.txt' | ||
- 'third_party/**' | ||
- '.github/workflows/linux.yml' | ||
- '!ext/rubyraylib/rubyraylib.cpp' | ||
- '!ext/rubyraylib/rubyraylib.hpp' | ||
|
||
jobs: | ||
build-linux: | ||
name: linux-x86_64 | ||
runs-on: ubuntu-latest | ||
env: | ||
OS: linux | ||
ARCH: x86_64 | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: 'recursive' | ||
|
||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 3.3 | ||
|
||
- name: Update package database | ||
run: sudo apt update -qq | ||
|
||
- name: Install required packages | ||
run: | | ||
sudo apt-get install gcc-multilib cmake ninja-build | ||
sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev libwayland-dev libxkbcommon-dev | ||
- name: Configure CMake | ||
run: cmake -B build -G Ninja -DCMAKE_BUILD_TYPE:STRING=Release | ||
|
||
- name: Build | ||
run: cmake --build build --config Release --target all | ||
|
||
- name: Strip Shared Libraries | ||
run: strip --strip-unneeded ${{ github.workspace }}/build/libruby.so | ||
|
||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: raylib-cruby-${{ env.ARCH }} | ||
path: | | ||
${{ github.workspace }}/build/raylib-cruby-${{ env.ARCH }} | ||
${{ github.workspace }}/build/*.so | ||
retention-days: 90 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Windows Binary | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
paths: | ||
- 'ext/rubyraylib/**' | ||
- 'CMakeLists.txt' | ||
- 'third_party/**' | ||
- '.github/workflows/windows.yml' | ||
- '!ext/rubyraylib/rubyraylib.cpp' | ||
- '!ext/rubyraylib/rubyraylib.hpp' | ||
pull_request: | ||
paths: | ||
- 'ext/rubyraylib/**' | ||
- 'CMakeLists.txt' | ||
- 'third_party/**' | ||
- '.github/workflows/windows.yml' | ||
- '!ext/rubyraylib/rubyraylib.cpp' | ||
- '!ext/rubyraylib/rubyraylib.hpp' | ||
|
||
jobs: | ||
build-windows: | ||
name: windows-x86_64 | ||
runs-on: windows-latest | ||
env: | ||
OS: windows | ||
ARCH: x86_64 | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: 'recursive' | ||
|
||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 3.3 | ||
|
||
- name: Configure CMake | ||
run: cmake -B build -DCMAKE_BUILD_TYPE:STRING=Release | ||
|
||
- name: Build CMake | ||
run: cmake --build build --config Release --target all | ||
|
||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: raylib-cruby-${{ env.ARCH }} | ||
path: | | ||
${{ github.workspace }}/build/raylib-cruby-${{ env.ARCH }} | ||
${{ github.workspace }}/build/*.dll | ||
retention-days: 90 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,4 @@ | |
mkmf.log | ||
|
||
/.config/ | ||
/build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
cmake_minimum_required(VERSION 3.20) | ||
|
||
# Project Settings | ||
project(Game VERSION 0.1.0) | ||
|
||
# Set C++ standard and required flag | ||
set(CMAKE_CXX_STANDARD 20) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
# Set Rpath | ||
set(CMAKE_SKIP_BUILD_RPATH FALSE) | ||
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) | ||
set(CMAKE_INSTALL_RPATH "\${ORIGIN}") | ||
|
||
# Set directories | ||
set(SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ext/rubyraylib") | ||
set(THIRD_PARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party) | ||
|
||
# set(OPENGL_VERSION "4.3") | ||
# set(PLATFORM RGFW CACHE STRING "" FORCE) | ||
# set(PLATFORM SDL CACHE STRING "" FORCE) | ||
|
||
# Set up third-party libraries | ||
set(LIBRARIES | ||
raylib | ||
raygui | ||
reasings | ||
) | ||
|
||
foreach(LIB ${LIBRARIES}) | ||
set(LIB_DIR ${THIRD_PARTY_DIR}/${LIB}) | ||
set(LIB_BUILD_DIR ${CMAKE_BINARY_DIR}/third_party/${LIB}) | ||
|
||
add_subdirectory(${LIB_DIR}) | ||
|
||
if(${LIB} STREQUAL "raylib") | ||
include_directories(${LIB_BUILD_DIR}/raylib/include) | ||
target_compile_definitions(${LIB} PRIVATE PLATFORM_DESKTOP_RGFW) | ||
else() | ||
include_directories(${LIB_BUILD_DIR}/include) | ||
endif() | ||
|
||
if(${LIB} STREQUAL "raygui") | ||
target_compile_definitions(${LIB} PRIVATE RAYGUI_IMPLEMENTATION) | ||
endif() | ||
endforeach() | ||
|
||
# Executable definition | ||
file(GLOB SRC_FILES ${SRC_DIR}/*.cpp) | ||
add_executable(game ${SRC_FILES}) | ||
set_target_properties(game PROPERTIES OUTPUT_NAME "raylib-cruby-${CMAKE_SYSTEM_PROCESSOR}") | ||
|
||
add_dependencies(game ${LIBRARIES}) | ||
|
||
# Find Ruby | ||
find_package(Ruby 3.3 REQUIRED) | ||
|
||
# Set up include directories | ||
target_include_directories(game | ||
PUBLIC | ||
$<INSTALL_INTERFACE:include> | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> | ||
PRIVATE | ||
${CMAKE_CURRENT_SOURCE_DIR} | ||
${RUBY_INCLUDE_PATH} | ||
) | ||
|
||
# Set up link libraries | ||
target_link_libraries(game PRIVATE ${LIBRARIES} ${RUBY_LIBRARY}) | ||
|
||
# Copy Ruby library to output directory | ||
add_custom_command(TARGET game POST_BUILD | ||
COMMAND ${CMAKE_COMMAND} -E copy_if_different | ||
${RUBY_LIBRARY} | ||
$<TARGET_FILE_DIR:game> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.