mirror of
https://github.com/thepigeongenerator/mcaselector-lite.git
synced 2025-12-19 05:25:45 +01:00
Compare commits
7 Commits
7db3e97085
...
a1f1c841c0
| Author | SHA1 | Date | |
|---|---|---|---|
| a1f1c841c0 | |||
| d9ddae770a | |||
| c2e1b67b4c | |||
| 8548c2d037 | |||
| 7ec6a3b91a | |||
| 3f48a7abb2 | |||
| 667814fb72 |
30
.github/workflows/ci.yaml
vendored
Normal file
30
.github/workflows/ci.yaml
vendored
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
name: CI
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
compile-and-test:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
- ubuntu-latest
|
||||||
|
- ubuntu-24.04-arm
|
||||||
|
- windows-latest
|
||||||
|
- windows-11-arm
|
||||||
|
- macos-latest
|
||||||
|
runs-on: ${{matrix.os}}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v5
|
||||||
|
with:
|
||||||
|
repository: ${{github.repository}}
|
||||||
|
submodules: true
|
||||||
|
fetch-depth: 1
|
||||||
|
- uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: lib/obj/
|
||||||
|
key: ${{runner.os}}-lib/obj-${{github.sha}}
|
||||||
|
restore-keys: ${{runner.os}}-lib/obj-
|
||||||
|
- run: make libs
|
||||||
|
- run: make all
|
||||||
|
- run: make test
|
||||||
13
Makefile
13
Makefile
@@ -35,13 +35,13 @@ $(warning Detected Windows_NT, please refer to the documentation if you encounte
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
# TODO: find a better method to find all source files
|
# TODO: find a better method to find all source files
|
||||||
# WARN: find a better method for selecting the object files
|
|
||||||
# find all the source files using wildcards
|
# find all the source files using wildcards
|
||||||
# NOTE: MS-DOS and MS-Windows uses backslash `\`, this might break.
|
# NOTE: MS-DOS and MS-Windows uses backslash `\`, this might break.
|
||||||
RES := $(wildcard res/*.glsl)
|
RES := $(wildcard res/*)
|
||||||
SRC := $(wildcard src/*.c src/*/*.c src/*/*/*.c src/*/*/*/*.c src/*/*/*/*/*.c src/*/*/*/*/*/*.c src/*/*/*/*/*/*/*.c src/*/*/*/*/*/*/*/*.c) lib/glad/gl.c
|
SRC := $(wildcard src/*.c src/*/*.c src/*/*/*.c src/*/*/*/*.c src/*/*/*/*/*.c src/*/*/*/*/*/*.c src/*/*/*/*/*/*/*.c src/*/*/*/*/*/*/*/*.c) lib/glad/gl.c
|
||||||
OBJ := $(SRC:%.c=obj/%.o)
|
OBJ := $(SRC:%.c=obj/%.o) $(RES:%=obj/%.o)
|
||||||
TEST := $(wildcard test/*.c test/*/*.c test/*/*/*.c test/*/*/*/*.c test/*/*/*/*/*.c test/*/*/*/*/*/*.c test/*/*/*/*/*/*/*.c test/*/*/*/*/*/*/*/*.c)
|
TSRC := $(wildcard test/*.c test/*/*.c test/*/*/*.c test/*/*/*/*.c test/*/*/*/*/*.c test/*/*/*/*/*/*.c test/*/*/*/*/*/*/*.c test/*/*/*/*/*/*/*/*.c)
|
||||||
|
TOBJ := $(TSRC:%.c=obj/%.o)
|
||||||
|
|
||||||
# TODO: potentially automatically detect whether we should compile libs, or if we can just go ahead.
|
# TODO: potentially automatically detect whether we should compile libs, or if we can just go ahead.
|
||||||
.PHONY: all libs test clean clean-libs
|
.PHONY: all libs test clean clean-libs
|
||||||
@@ -67,8 +67,7 @@ bin/$(NAME): $(OBJ)
|
|||||||
@$(CC) -o $@ $^ $(LDFLAGS) $(LDLIBS)
|
@$(CC) -o $@ $^ $(LDFLAGS) $(LDLIBS)
|
||||||
|
|
||||||
# link together a testing binary
|
# link together a testing binary
|
||||||
# BUG: testing sources must be selected better
|
bin/TEST_$(NAME): $(TOBJ) $(filter-out main.o,$(OBJ))
|
||||||
bin/TEST_$(NAME): $(OBJ)
|
|
||||||
$(info [CC/LD] $@)
|
$(info [CC/LD] $@)
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
@$(CC) -o $@ $^ $(LDFLAGS) $(LDLIBS)
|
@$(CC) -o $@ $^ $(LDFLAGS) $(LDLIBS)
|
||||||
|
|||||||
@@ -1,46 +1,9 @@
|
|||||||
/* Copyright (c) 2025 Quinn
|
/* Copyright (c) 2025 Quinn
|
||||||
* Licensed under the MIT Licence. See LICENSE for details */
|
* Licensed under the MIT Licence. See LICENSE for details */
|
||||||
|
|
||||||
#ifndef PORTABLE_ENDIAN_H
|
#ifndef PORTABLE_ENDIAN_H
|
||||||
#define PORTABLE_ENDIAN_H 1
|
#define PORTABLE_ENDIAN_H 1
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
|
|
||||||
/* test for the byteswap header */
|
|
||||||
#if __has_include(<byteswap.h>)
|
|
||||||
#include <byteswap.h>
|
|
||||||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
|
||||||
#define le16toh(x) (x)
|
|
||||||
#define le32toh(x) (x)
|
|
||||||
#define le64toh(x) (x)
|
|
||||||
#define htole16(x) (x)
|
|
||||||
#define htole32(x) (x)
|
|
||||||
#define htole64(x) (x)
|
|
||||||
#define be16toh(x) bswap_16(x)
|
|
||||||
#define be32toh(x) bswap_32(x)
|
|
||||||
#define be64toh(x) bswap_64(x)
|
|
||||||
#define htobe16(x) bswap_16(x)
|
|
||||||
#define htobe32(x) bswap_32(x)
|
|
||||||
#define htobe64(x) bswap_64(x)
|
|
||||||
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
|
||||||
#define le16toh(x) bswap_16(x)
|
|
||||||
#define le32toh(x) bswap_32(x)
|
|
||||||
#define le64toh(x) bswap_64(x)
|
|
||||||
#define htole16(x) bswap_16(x)
|
|
||||||
#define htole32(x) bswap_32(x)
|
|
||||||
#define htole64(x) bswap_64(x)
|
|
||||||
#define be16toh(x) (x)
|
|
||||||
#define be32toh(x) (x)
|
|
||||||
#define be64toh(x) (x)
|
|
||||||
#define htobe16(x) (x)
|
|
||||||
#define htobe32(x) (x)
|
|
||||||
#define htobe64(x) (x)
|
|
||||||
#else
|
|
||||||
#error machine architecture unsupported! Expected either big-endian or little-endian, make sure to use a compiler which defines __BYTE_ORDER__ (like clang or gcc)
|
|
||||||
#endif /* byte order */
|
|
||||||
|
|
||||||
/* otherwise, utilise the compiler built-ins */
|
|
||||||
#else
|
|
||||||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||||
#define le16toh(x) __uint16_identity(x)
|
#define le16toh(x) __uint16_identity(x)
|
||||||
#define le32toh(x) __uint32_identity(x)
|
#define le32toh(x) __uint32_identity(x)
|
||||||
@@ -71,10 +34,7 @@
|
|||||||
#error machine architecture unsupported! Expected either big-endian or little-endian, make sure to use a compiler which defines __BYTE_ORDER__ (like clang or gcc)
|
#error machine architecture unsupported! Expected either big-endian or little-endian, make sure to use a compiler which defines __BYTE_ORDER__ (like clang or gcc)
|
||||||
#endif /* byte order */
|
#endif /* byte order */
|
||||||
|
|
||||||
#endif /* has byteswap.h */
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#error GNU C is unavailable
|
#error GNU C is unavailable
|
||||||
#endif /* __GNUC__ */
|
#endif /* __GNUC__ */
|
||||||
|
|
||||||
#endif /* PORTABLE_ENDIAN_H */
|
#endif /* PORTABLE_ENDIAN_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user