Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 15 additions & 37 deletions .github/workflows/makefile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,40 +34,24 @@ jobs:

- name: format_check
working-directory: ./
run: ./format.sh --dry
run: ./tools/format.sh --dry

- name: cpp_check
working-directory: ./
run: ./cpp_check.sh
run: make cppcheck

- name: unit_tests
working-directory: build/tests
run: |
cmake -S . -B build
cmake --build build
./build/osp2_tests

- name: build-qvm
working-directory: build/qvm
run: |
make

- name: build-so
working-directory: build/library
run: |
make
working-directory: ./
run: make tests

- uses: actions/upload-artifact@v4
with:
name: qvm
path: build/qvm/zz-osp-pak8.pk3
if-no-files-found: error
retention-days: 5
- name: release
working-directory: ./
run: make

- uses: actions/upload-artifact@v4
with:
name: so
path: build/library/build/release-linux-x86_64/osp2/cgamex86_64.so
name: osp2_linux
path: osp2_linux.tar.gz
if-no-files-found: error
retention-days: 5

Expand All @@ -87,20 +71,15 @@ jobs:
with:
submodules: recursive

- name: build-qvm
working-directory: build/qvm
run: |
make

- name: build-dll
working-directory: build/library
- name: release
working-directory: ./
run: |
make

- uses: actions/upload-artifact@v4
with:
name: dll
path: build/library/build/release-mingw64-x86_64/osp2/cgamex86_64.dll
name: osp2_windows
path: osp2_windows.zip
if-no-files-found: error
retention-days: 5

Expand All @@ -121,9 +100,8 @@ jobs:
prerelease: false
title: Latest Build
files: |
qvm
so
dll
osp2_windows
osp2_linux



3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ build/qvm/vm/
build/qvm/zz-osp-pak8.pk3
build/library/build/
build/tests/build/
osp/
osp2_linux.tar.gz
osp2_windows.zip
100 changes: 100 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
FORMAT_COMMAND=./tools/format.sh
CPPCHECK_COMMAND=./tools/cpp_check.sh

LIB_ROOT_DIR=./build/library
PK3_ROOT_DIR=./build/qvm
TESTS_ROOT_DIR=./build/tests
MOD_ROOT_DIR=./osp
DOC_ROOT_DIR=$(MOD_ROOT_DIR)/Docs

LIB_BUILD_DIR=$(LIB_ROOT_DIR)/build
PK3_BUILD_DIR=$(PK3_ROOT_DIR)/build
TESTS_BUILD_DIR=$(TESTS_ROOT_DIR)/build
LIB_BUILD_CLIENT_DIR=$(LIB_BUILD_DIR)/release-linux-x86_64/osp2

TESTS_FILE=osp2_tests
PK3_CLIENT_FILE=zz-osp-pak8.pk3
LIB_CLIENT_FILE=cgamex86_64.so
RELEASE_FILE=osp2_linux.tar.gz

MAKE_RELEASE_ARCHIVE=tar czf $(RELEASE_FILE) $(MOD_ROOT_DIR)


# check platform
COMPILE_PLATFORM=$(shell uname | sed -e 's/_.*//' | tr '[:upper:]' '[:lower:]' | sed -e 's/\//_/g')

ifndef PLATFORM
PLATFORM=$(COMPILE_PLATFORM)
endif

ifeq ($(PLATFORM),mingw32)
WINDOWS=1
endif
ifeq ($(PLATFORM),mingw64)
WINDOWS=1
endif
ifeq ($(PLATFORM),windows)
WINDOWS=1
endif

# change varibles for windows
ifdef WINDOWS
LIB_CLIENT_FILE=cgamex86_64.dll
RELEASE_FILE=osp2_windows.zip
LIB_BUILD_CLIENT_DIR=$(LIB_BUILD_DIR)/release-$(PLATFORM)-x86_64/osp2
MAKE_RELEASE_ARCHIVE=$(PK3_ROOT_DIR)/tools/7za.exe u $(RELEASE_FILE) $(MOD_ROOT_DIR)
endif

.PHONY: all clean client server osp2 format cppcheck pk3 lib dirs docs

all: $(RELEASE_FILE)

clean:
@rm -rf $(LIB_BUILD_DIR)
@rm -rf $(PK3_ROOT_DIR)/vm
@rm -rf $(PK3_ROOT_DIR)/$(PK3_CLIENT_FILE)
@rm -rf $(MOD_ROOT_DIR)
@rm -f $(RELEASE_FILE)
@rm -rf $(TESTS_BUILD_DIR)

dirs:
@mkdir -p $(MOD_ROOT_DIR)
@mkdir -p $(DOC_ROOT_DIR)
@mkdir -p $(DOC_ROOT_DIR)/RUS

format:
$(FORMAT_COMMAND)

cppcheck:
$(CPPCHECK_COMMAND)

pk3:
@make -C $(PK3_ROOT_DIR)

lib:
@make -C $(LIB_ROOT_DIR)

docs: dirs
@rm -f $(DOC_ROOT_DIR)/RUS/osp2-q3-ClientReadme.txt
@install -v docs/osp2-q3-ClientReadme.md $(DOC_ROOT_DIR)/RUS/osp2-q3-ClientReadme.txt
@rm -f $(DOC_ROOT_DIR)/RUS/osp2-q3-SuperHUD.txt
@install -v docs/osp2-q3-SuperHUD.md $(DOC_ROOT_DIR)/RUS/osp2-q3-SuperHUD.txt

osp2: pk3 lib dirs docs
@rm -f $(MOD_ROOT_DIR)/$(LIB_CLIENT_FILE)
@install -v $(LIB_BUILD_CLIENT_DIR)/$(LIB_CLIENT_FILE) $(MOD_ROOT_DIR)
@rm -f $(MOD_ROOT_DIR)/$(PK3_CLIENT_FILE)
@install -v $(PK3_ROOT_DIR)/$(PK3_CLIENT_FILE) $(MOD_ROOT_DIR)

$(RELEASE_FILE): osp2
$(MAKE_RELEASE_ARCHIVE)

$(TESTS_BUILD_DIR):
@cmake -S $(TESTS_ROOT_DIR) -B $(TESTS_BUILD_DIR)

$(TESTS_FILE): $(TESTS_BUILD_DIR)
@cmake --build $(TESTS_BUILD_DIR)

tests: $(TESTS_FILE)
$(TESTS_BUILD_DIR)/$(TESTS_FILE)

20 changes: 6 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,30 +38,22 @@ Telegram [chat](https://t.me/q3_osp2).

## New commands

See [docs/commands.md](docs/commands.md)
See [docs/osp2-q3-ClientReadme.md](docs/osp2-q3-ClientReadme.md)

Example config: OSP2.cfg inside mod.

## How to install

- Install Quake3 and OSP mod v1.03
- copy pk3 file (and so/dll library if you want) into `osp` folder
- Unpack zip or tar.gz into your Quake3 directory.

## How to build

### Windows

Install [mingw](https://github.com/skeeto/w64devkit/releases) (just unzip and add bin folder to system PATH).

### pk3
### Linux

`cd build/qvm`
Run 'make' from OSP2 directory.

`make`

### dll/so

`cd build/library`
### Windows

`make`
Install [mingw](https://github.com/skeeto/w64devkit/releases) (just unzip and add bin folder to system PATH) and run 'make' from OSP2 directory.

3 changes: 0 additions & 3 deletions cpp_check.sh

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions tools/cpp_check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
RET="$(cppcheck -D__GNUC__ -q -j32 --enable=warning,performance,portability --std=c89 --suppressions-list=./tools/cppcheck_suppress.txt --error-exitcode=1 ./code)"
exit $RET
File renamed without changes.
2 changes: 1 addition & 1 deletion format.sh → tools/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ declare -a FORMAT_PATHS=( \
)
DRY_RUN=0

ASTYLE="astyle --formatted --errors-to-stdout --options=./astyle.conf"
ASTYLE="astyle --formatted --errors-to-stdout --options=./tools/astyle.conf"

if [[ $1 = "--dry" ]]; then
ASTYLE=$ASTYLE" --dry-run"
Expand Down