Skip to content

Commit 5591da9

Browse files
committed
add Makefile.linux
typo libpng-dev linux: ar + libpng typo arm cd badge libprism.a default target ARCH=`uname -m` typo
1 parent 732435f commit 5591da9

File tree

9 files changed

+71
-11
lines changed

9 files changed

+71
-11
lines changed

.github/workflows/cd.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: CD
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
9+
defaults:
10+
run:
11+
shell: bash
12+
13+
# required for upload
14+
permissions:
15+
contents: write
16+
17+
jobs:
18+
19+
Linux:
20+
runs-on: ${{ matrix.runner }}
21+
strategy:
22+
matrix:
23+
runner: [ ubuntu-24.04, ubuntu-24.04-arm ]
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- name: Install dependencies
28+
run: sudo apt update -y && sudo apt install -y libsdl2-dev libglew-dev libpng-dev zip
29+
30+
- name: Build
31+
run: |
32+
make -f Makefile.linux libprism.a
33+
ARCH=`uname -m`
34+
cd bin && zip -9 -r ../libprism-linux-${ARCH} libprism.a
35+
36+
37+
- name: Create GitHub Release
38+
if: startsWith(github.ref, 'refs/tags/')
39+
uses: softprops/action-gh-release@v2
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
with:
43+
files: |
44+
*.zip

Makefile.linux

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
include Makefile.common
2+
3+
CXXFLAGS += -Wall -O2 -std=c++17 -DLINUX -I ./include `pkg-config --libs --cflags sdl2` `pkg-config --libs --cflags libpng`
4+
5+
libprism.a: $(OBJS)
6+
ar rcs $@ $(OBJS)
7+
-mkdir -p bin
8+
mv $@ bin/$@
9+
10+
clean:
11+
-rm -f *.o
12+
-rm -r -f bin

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
# Prism - Library for Dreamcast / Windows game development
1+
[![CD](https://github.com/humbertodias/prism/actions/workflows/cd.yml/badge.svg)](https://github.com/humbertodias/prism/actions/workflows/cd.yml)
22

3-
A loose collection of components that are often used in games (e.g.: physics, collisions, animations, etc.). The Dreamcast part requires KallistiOS, the Windows part requires SDL.
3+
# Prism - Library for Dreamcast / Windows / Linux game development
4+
5+
A loose collection of components that are often used in games (e.g.: physics, collisions, animations, etc.). The Dreamcast part requires KallistiOS, the Windows/Linux part requires SDL2.
46

57
## Dreamcast Usage
68
Clone in your `$(KOS_ROOT)/addons` folder and compile this library with `make`.

include/prism/datastructures.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include <string>
44
#include <vector>
5+
#include <cstdint>
56

67
namespace prism {
78

include/prism/file.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace prism {
1818

1919
typedef int FileHandler;
2020

21-
#elif defined _WIN32 || defined __EMSCRIPTEN__ || defined VITA
21+
#elif defined _WIN32 || defined __EMSCRIPTEN__ || defined VITA || defined LINUX
2222

2323
#define O_RDONLY 0x1
2424
#define O_WRONLY 0x2

include/prism/memoryhandler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
namespace prism {
1010
typedef pvr_ptr_t Texture;
1111

12-
#elif defined _WIN32 || defined __EMSCRIPTEN__
12+
#elif defined _WIN32 || defined __EMSCRIPTEN__ || defined LINUX
1313
#include <SDL.h>
1414
#include <GL/glew.h>
1515

include/prism/memorypool.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <stdlib.h>
44
#include <stdbool.h>
55
#include <inttypes.h>
6+
#include <stdint.h>
67

78
namespace prism {
89

memoryhandler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ namespace prism {
6363
#define virtualizeTextureHW virtualizeTextureDreamcast
6464
#define unvirtualizeTextureHW unvirtualizeTextureDreamcast
6565

66-
#elif defined _WIN32 || defined __EMSCRIPTEN__
66+
#elif defined _WIN32 || defined __EMSCRIPTEN__ || defined LINUX
6767
void* allocGLTexture(size_t) {
6868
GLTextureData* data = (GLTextureData*)malloc(sizeof(GLTextureData));
6969
return data;

memorypool.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ namespace prism {
5050
typedef struct _wof_chunk_hdr_t {
5151
int prev;
5252

53-
int allocator;
53+
intptr_t allocator;
5454
/* flags */
5555
int last : 1;
5656
int used : 1;
@@ -393,7 +393,7 @@ namespace prism {
393393
extra->prev = chunk->len;
394394
extra->used = FALSE;
395395
extra->jumbo = FALSE;
396-
extra->allocator = (int)allocator;
396+
extra->allocator = reinterpret_cast<intptr_t>(allocator);
397397

398398
/* Correctly update the following chunk's back-pointer */
399399
if (!last) {
@@ -442,7 +442,7 @@ namespace prism {
442442
extra->prev = chunk->len;
443443
extra->used = FALSE;
444444
extra->jumbo = FALSE;
445-
extra->allocator = (int)allocator;
445+
extra->allocator = reinterpret_cast<intptr_t>(allocator);
446446

447447
/* Correctly update the following chunk's back-pointer */
448448
if (!last) {
@@ -504,7 +504,7 @@ namespace prism {
504504
chunk->last = TRUE;
505505
chunk->prev = 0;
506506
chunk->len = WOF_BLOCK_SIZE - WOF_BLOCK_HEADER_SIZE;
507-
chunk->allocator = (int)allocator;
507+
chunk->allocator = reinterpret_cast<intptr_t>(allocator);
508508

509509
/* now push that chunk onto the master list */
510510
wof_push_master(allocator, chunk);
@@ -555,7 +555,7 @@ namespace prism {
555555
chunk->last = TRUE;
556556
chunk->used = TRUE;
557557
chunk->jumbo = TRUE;
558-
chunk->allocator = (int)allocator;
558+
chunk->allocator = reinterpret_cast<intptr_t>(allocator);
559559
chunk->len = 0;
560560
chunk->prev = 0;
561561

@@ -937,7 +937,7 @@ namespace prism {
937937
wof_allocator_t* allocator = (wof_allocator_t*)tPool;
938938
wof_chunk_hdr_t* chunk;
939939
chunk = WOF_DATA_TO_CHUNK(ptr);
940-
return chunk->allocator == (int)allocator;
940+
return chunk->allocator == reinterpret_cast<intptr_t>(allocator);
941941
}
942942

943943
}

0 commit comments

Comments
 (0)