Skip to content
This repository has been archived by the owner on Oct 27, 2021. It is now read-only.

Commit

Permalink
Add contributing recommendation, clang-format config and update README
Browse files Browse the repository at this point in the history
  • Loading branch information
a1batross committed Apr 1, 2016
1 parent b684393 commit 7591595
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 17 deletions.
33 changes: 33 additions & 0 deletions .clang-format
@@ -0,0 +1,33 @@
#BasedOnStyle: WebKit
IndentWidth: 4
TabWidth: 4
UseTab: ForIndentation

BreakBeforeBraces: Allman

AlignAfterOpenBracket: true
AlignConsecutiveAssignments: true
AlignOperands: true

AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false

NamespaceIndentation: Inner

SpaceAfterCStyleCast: false
SpaceBeforeParens: true
SpaceInEmptyParentheses: true
SpacesInAngles: true
SpacesInParentheses: true
SpacesBeforeTrailingComments: 1

IndentCaseLabels: false
IndentWrappedFunctionNames: true

PointerAlignment: Right

ColumnLimit: 0
BinPackArguments: false
53 changes: 53 additions & 0 deletions CONTRIBUTING.md
@@ -0,0 +1,53 @@
# Contributing to Xash3D SDL

Third-party patches for Xash3D SDL are great idea.
But if you want your patch to be accepted, we can give you few guidelines.

## If you are reporting bugs

1. Check you are using latest version. You can build latest Xash3D for yourself, look to README.md.
2. Check open issues is your bug is already reported and closed issues if it reported and fixed. Don't send bug if it's already reported.
3. Now you can write bugreport.
4. Write down steps to reproduce bug.
5. Write down OS and architecture you are using.
6. Re-run engine with `-dev 5 -log` arguments, reproduce bug and post engine.log which can be found in your working directory.
7. Attach screenshot if it will help clarify the sitation.
8. Wait for answer.

## If you are contributing code

### Which branch?

* We recommend using `master` branch. But you still can use any of our branches, if they are up-to-date.

### Third-party libraries

* Philosophy of any Xash Project by Uncle Mike: don't be bloated. We follow it too.
* There is allowed only these libraries, which is used in Linux GoldSrc version or if there is a REAL reason to use library.

### Portability level

* Xash3D have it's own crt library. It's recommended to use it. It most cases it's just a wrappers around standart C library.
* If your feature need platform-specific code, try to implement to every supported OS and every supported compiler.
* You must put it under appopriate macro. It's a rule: Xash3D SDL must compile everywhere.

| OS | Macro |
| -- | ----- |
| Linux | `defined(__linux__)`|
| *BSD | `defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)` |
| Windows | `defined(_WIN32)` |
| Android | `defined(__ANDROID__)` |

### Licensing

* Look COPYING file in repository, if you are unsure.

### Code style

* This project uses Quake's C code style convention.
* In short:
* Use spaces in parenthesis. Even in empty.
* Use tabs, not spaces, for indentation.
* Any brace must have it's own line.
* Short blocks, if statements and loops on single line is allowed.
* You can use clang-format here. Config is located in `.clang-format` file in repository's root .
50 changes: 33 additions & 17 deletions README.md
@@ -1,4 +1,4 @@
# Xash3D Engine [![Build Status](https://travis-ci.org/SDLash3D/xash3d.svg)](https://travis-ci.org/SDLash3D/xash3d) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/github/SDLash3D/xash3d?branch=master&svg=true)](https://ci.appveyor.com/project/a1batross/xash3d)
# Xash3D SDL Engine [![Build Status](https://travis-ci.org/SDLash3D/xash3d.svg)](https://travis-ci.org/SDLash3D/xash3d) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/github/SDLash3D/xash3d?branch=master&svg=true)](https://ci.appveyor.com/project/a1batross/xash3d)
Latest version of the library is available at:
https://github.com/SDLash3D/xash3d

Expand All @@ -11,11 +11,16 @@ The multiplayer part is not yet completed, multiplayer mods should work just
fine, but bear in mind that some features may not work at all or work not
exactly the way they do in Gold Source Engine.

# How to build on Linux with CMake
Xash3D SDL is a fork of Xash3D Engine, which aims on crossplatform and compability
with original Xash3D and Gold Source.

# How to build with CMake (recommended for non-Windows)

If you want to enable VGUI support, you need [Half-Life 1 SDK](https://github.com/SDLash3D/halflife)
to build vgui_support library.
If you are using non-x86 architecture, you may skip this

**NOTE**: VGUI is exists only for Linux/MacOSX/Windows and only for x86.
Disable it by `-DXASH_VGUI=no` if you are targetting non-supported architecture.

Clone it with git:

Expand All @@ -32,31 +37,38 @@ build Xash3D as:

# How to run

Copy **valve** folder from Half-Life:

cp -r $HOME/.steam/steam/SteamApps/common/Half-Life/valve $HOME/Games/Xash3D

**NOTE**: If you build with CMake, you can now use `make install`. It will install binaries where
they must be located. So just run `xash3d` from command line in directory where is gamedata is located.
For additional info look to the CMakeLists.txt in repo root and xash3d.sh script.

After a successful build, copy the next files to some other directory where you want to run Xash3D:

cp engine/libxash.so game_launch/xash3d mainui/libxashmenu.so $HOME/Games/Xash3D

If you built it with XASH_VGUI, also copy vgui.so:

cp /opt/halflife/linux/vgui.so $HOME/Games/Xash3D

Copy **valve** folder from Half-Life:

cp -r $HOME/.steam/steam/SteamApps/common/Half-Life/valve $HOME/Games/Xash3D
cp ../hlsdk/linux/vgui.so vgui_support/vgui_support.so $HOME/Games/Xash3D

Copy script:

cp ../xash3d.sh $HOME/Games/Xash3D

Run:

$HOME/Games/Xash3D/xash3d.sh
cd $HOME/Games/Xash3D
./xash3d.sh

# Building on linux manually without CMake
# Manual build and run (without CMake)

## Building engine
## Build
### Building Engine

If you want to build Xash3D for some embedded device or just do not want to use CMake, use Makefile.linux instead
If you want to build Xash3D for some embedded device or just do not want to use CMake,
use Makefile.linux instead

cd (xash3d)/engine
make -f Makefile.linux XASH_VGUI=1
Expand All @@ -79,7 +91,7 @@ or

make -f Makefile.linux XASH_DEDICATED=1 XASH_DLL_LOADER=1

## After building engine, build launch binary:
### After building engine, build launch binary:

cd (xash3d)/game_launch
gcc xash.c -o xash -ldl -lrt -lm
Expand All @@ -104,7 +116,7 @@ Put vgui_support.dll from windows build to your game data folder and run:

LD_LIBRARY_PATH=. ./xash -dev 5 -vguilib vgui.dll -clientlib valve/cl_dlls/client.dll -dll dlls/hl.dll

# Building and running on Windows with Visual Studio 2013
# Building and running on Windows with Visual Studio 2013 (recommended for Windows)

Download latest prebuilt SDL2 from

Expand All @@ -115,7 +127,10 @@ Unzip and rename `SDL2-2.0.4` folder to `SDL2` and put it next to xash3d project
..\xash3d\
..\SDL2\

Open `xash.sln` with Visual Studio 2013 and make a build. After building, copy contents of `Debug` or `Release` folder to directory you choose. Copy `valve` folder and `vgui.dll` from your Half Life game installation folder and `SDL2.dll` form `\SDL2\lib\x86\` to it. Move `vgui_support.dll` into `valve` folder.
Open `xash.sln` with Visual Studio 2013 and make a build. After building, copy contents of `Debug` or
`Release` folder to directory you choose. Copy `valve` folder and `vgui.dll` from your Half Life game
installation folder and `SDL2.dll` form `\SDL2\lib\x86\` to it.
Move `vgui_support.dll` into `valve` folder.

..\valve\
..\valve\vgui_support.dll
Expand Down Expand Up @@ -169,9 +184,10 @@ All mods that ported to android may be build to linux using Android.mk with micr

[https://github.com/SDLash3D/microndk]

Clone microndk repo somewhere, change xash3d_cinfig to preffered configuration (change arch to x86 for example)
Clone microndk repo somewhere, change xash3d_cinfig to preffered configuration (change arch to x86
for example)

Go to dlls folder if you are building server or cl_dlls if you are building client and dp:
Go to dlls folder if you are building server or cl_dlls if you are building client and do:

make -f /path/to/microndk/microndk.mk -j4

Expand Down

0 comments on commit 7591595

Please sign in to comment.