Skip to content

Commit

Permalink
Add raylib extension
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiosvm committed Jan 7, 2025
1 parent 58a44ec commit d67fbce
Show file tree
Hide file tree
Showing 7 changed files with 1,016 additions and 16 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/macos-build-extensions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ jobs:
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
sudo cmake --install build
- name: Installing dependency raylib
run: |
git clone https://github.com/raysan5/raylib.git
cd raylib
mkdir build && cd build
cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON ..
make
sudo make install
- name: Configure CMake
run: |
cmake -B ${{ github.workspace }}/build -DCMAKE_BUILD_TYPE=Debug -DBUILD_EXTENSIONS=1
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/ubuntu-build-extensions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ jobs:
./configure
make
sudo make install
- name: Installing dependency raylib
run: |
sudo apt install build-essential git
sudo apt install libasound2-dev libx11-dev libxrandr-dev libxi-dev libgl1-mesa-dev libglu1-mesa-dev libxcursor-dev libxinerama-dev
git clone https://github.com/raysan5/raylib.git
cd raylib
mkdir build && cd build
cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON ..
make
sudo make install
- name: Configure CMake
run: |
cmake -B ${{ github.workspace }}/build -DCMAKE_BUILD_TYPE=Debug -DBUILD_EXTENSIONS=1
Expand Down
16 changes: 16 additions & 0 deletions examples/raylib.hk
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// raylib.hk
//

import raylib as rl;

rl.InitWindow(800, 450, "raylib [core] example - basic window");

while (!rl.WindowShouldClose()) {
rl.BeginDrawing();
rl.ClearBackground(rl.RAYWHITE);
rl.DrawText("Congrats! You created your first window!", 190, 200, 20, rl.LIGHTGRAY);
rl.EndDrawing();
}

rl.CloseWindow();
7 changes: 7 additions & 0 deletions extensions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ add_library(geohash_mod SHARED
"deps/geohash.c"
)

add_library(raylib_mod SHARED
"raylib_mod.c"
)

target_link_libraries(sqlite_mod ${STATIC_LIB_TARGET})
target_link_libraries(curl_mod ${STATIC_LIB_TARGET})
target_link_libraries(redis_mod ${STATIC_LIB_TARGET})
Expand All @@ -120,6 +124,7 @@ target_link_libraries(crypto_mod ${STATIC_LIB_TARGET})
target_link_libraries(regex_mod ${STATIC_LIB_TARGET})
target_link_libraries(uuid_mod ${STATIC_LIB_TARGET})
target_link_libraries(geohash_mod ${STATIC_LIB_TARGET})
target_link_libraries(raylib_mod ${STATIC_LIB_TARGET})

set_target_properties(sqlite_mod PROPERTIES PREFIX "")
set_target_properties(curl_mod PROPERTIES PREFIX "")
Expand All @@ -134,6 +139,7 @@ set_target_properties(crypto_mod PROPERTIES PREFIX "")
set_target_properties(regex_mod PROPERTIES PREFIX "")
set_target_properties(uuid_mod PROPERTIES PREFIX "")
set_target_properties(geohash_mod PROPERTIES PREFIX "")
set_target_properties(raylib_mod PROPERTIES PREFIX "")

if(MSVC)
target_link_libraries(sqlite_mod PRIVATE SQLite::SQLite3)
Expand All @@ -158,3 +164,4 @@ endif()
target_link_libraries(redis_mod hiredis)
target_link_libraries(fastcgi_mod fcgi)
target_link_libraries(bigint_mod gmp)
target_link_libraries(raylib_mod raylib)
Loading

0 comments on commit d67fbce

Please sign in to comment.