Skip to content

Commit

Permalink
Finish v0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
hsandt committed Jul 9, 2020
2 parents 07c30f8 + a4d6787 commit 4944a9f
Show file tree
Hide file tree
Showing 6 changed files with 135 additions and 31 deletions.
31 changes: 22 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# Reference:
# https://github.com/Microsoft/GSL/blob/master/.travis.yml

if: NOT branch = feature/appveyor
# Do not trigger Travis if any of these are true:
# - we are working on the appveyor branch (mostly modifying appveyor.yml only)
# - the commit message contains "(WIP)" or "#no_travis" (case-insensitive)
if: NOT branch = feature/appveyor AND commit_message !~ /(\(WIP\)|#no_travis)/

language: cpp

Expand All @@ -10,11 +13,7 @@ dist: bionic

env:
global:
- PREMAKE_VERSION="5.0.0-alpha15"
linux:
- JOBS="$(nproc)" # should be ~2
osx:
- JOBS="$(sysctl -n hw.ncpu)" # should be 2
PREMAKE_VERSION="5.0.0-alpha15"

addons:
apt:
Expand Down Expand Up @@ -141,6 +140,11 @@ script:
- pushd build
- |
if [[ "${PREMAKE_GENERATOR}" == "gmake"* ]]; then
if [[ $TRAVIS_OS_NAME == "linux" ]]; then
export JOBS="$(sysctl -n hw.ncpu)" # should be 2
elif [[ $TRAVIS_OS_NAME == "osx" ]]; then
export JOBS="$(nproc)" # should be ~2
fi
config=release make -j${JOBS}
elif [[ "${PREMAKE_GENERATOR}" == "xcode"* ]]; then
xcodebuild -project Game.xcodeproj -target Game -configuration Release
Expand All @@ -151,8 +155,17 @@ deploy:
- provider: releases
api_key:
secure: IhrVPJTMBqjDyaM2384WfLGlctyQKPWPLABaVWtLef9hEsGr2U1zSzvdTpChFfgFT8Rc6BZSyFeQTVUoNGMAx3Sb3ei44VBL7b3L4xPuRglnjesmgd0CwMmQjYYLn1eL8D599cxkobhkwMxgl4ynDXS/1e07g0HwDdw5e/MVguotnLvsu0PXmHJEJ6Vt7lgkCQb4qK207D2RDfxWHZYry9uLsC+RWG3c0rrEF+oYnUfrb7248OPGzOBQCzZtNcOzxP2YWw+Em2/cn2HbOjiYClM7gjZnVgisE+x4Xel7OPNKur2LtYEuoEMrvGd7r3m4xMmiNLWOb3XWzAQncqUiK1nLBoAdA9MQm7lIS8I+mpV0i9wvsWLmFM98gAKjY/bv5tcpjPC4iRlbWZCMm50+Oxpg4Jwkw60Te0teG2tSCdWEbqVYku6PIv699f6EfpADA4vyteC832sIirIJ/Q+XawnSJpHII/OcGgOzPujk/IzGLk8IZyM3z6ZVaXB0NSmdYKP7AdylsS3GKxIFCL+hf9hRQniXDgmZyf2ehGt1kdLuWayPjkmaWpu5rnen1JJARLAx8n2ozhMHQt32SrPOpDBxX4z05g1UR/rgbtN9ij65puHOcwXO0mOLwRlC5mb+/1PBYKfcC+9O2Gw6IrMlx4wbwah3cEBHVs7Vp3f8mVQ=
# both Linux and OSX generate a 'Game' executable, as we didn't set Xcode to produce an .app
file: build/bin/Release/Game
skip_cleanup: 'true'
file: build/bin/linux_Release/Game
cleanup: false
on:
condition: $TRAVIS_OS_NAME = linux
tags: true
- provider: releases
api_key:
secure: IhrVPJTMBqjDyaM2384WfLGlctyQKPWPLABaVWtLef9hEsGr2U1zSzvdTpChFfgFT8Rc6BZSyFeQTVUoNGMAx3Sb3ei44VBL7b3L4xPuRglnjesmgd0CwMmQjYYLn1eL8D599cxkobhkwMxgl4ynDXS/1e07g0HwDdw5e/MVguotnLvsu0PXmHJEJ6Vt7lgkCQb4qK207D2RDfxWHZYry9uLsC+RWG3c0rrEF+oYnUfrb7248OPGzOBQCzZtNcOzxP2YWw+Em2/cn2HbOjiYClM7gjZnVgisE+x4Xel7OPNKur2LtYEuoEMrvGd7r3m4xMmiNLWOb3XWzAQncqUiK1nLBoAdA9MQm7lIS8I+mpV0i9wvsWLmFM98gAKjY/bv5tcpjPC4iRlbWZCMm50+Oxpg4Jwkw60Te0teG2tSCdWEbqVYku6PIv699f6EfpADA4vyteC832sIirIJ/Q+XawnSJpHII/OcGgOzPujk/IzGLk8IZyM3z6ZVaXB0NSmdYKP7AdylsS3GKxIFCL+hf9hRQniXDgmZyf2ehGt1kdLuWayPjkmaWpu5rnen1JJARLAx8n2ozhMHQt32SrPOpDBxX4z05g1UR/rgbtN9ij65puHOcwXO0mOLwRlC5mb+/1PBYKfcC+9O2Gw6IrMlx4wbwah3cEBHVs7Vp3f8mVQ=
# OSX currently generates a 'Game' executable even with Xcode, never an .app
file: build/bin/osx_Release/Game
cleanup: false
on:
condition: $TRAVIS_OS_NAME = osx
tags: true
15 changes: 9 additions & 6 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@
"name": "gdb - Build and debug project",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/bin/Debug/Game",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [
{
"environment": [{
"name": "LD_LIBRARY_PATH",
"value": "engine/third-party/build/SFML/lib:${env:LD_LIBRARY_PATH}"
}
],
}],
"linux": {
"program": "${workspaceFolder}/build/linux_Debug/bin/Game",
},
"osx": {
"program": "${workspaceFolder}/build/osx_Debug/bin/Game",
},
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
Expand All @@ -27,7 +30,7 @@
"ignoreFailures": true
}
],
"preLaunchTask": "make (g++)",
"preLaunchTask": "make (g++, debug)",
"miDebuggerPath": "/usr/bin/gdb"
}
]
Expand Down
52 changes: 46 additions & 6 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@
"group": "build",
},
{
"label": "make (g++)",
"label": "make (g++, debug)",
"type": "shell",
"command": "make",
"options": {
"cwd": "build",
"env": {"CXX": "g++-10"}
"env": {"CXX": "g++-10", "config": "debug"}
},
"problemMatcher": [],
"group": {
Expand All @@ -92,21 +92,61 @@
"dependsOn": ["premake5 gmake", "build dependencies (g++)"]
},
{
"label": "make (clang++)",
"label": "make (g++, release)",
"type": "shell",
"command": "make",
"options": {
"cwd": "build",
"env": {"CXX": "clang++-10", "CC": "clang-10"}
"env": {"CXX": "g++-10", "config": "release"}
},
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
},
"dependsOn": ["premake5 gmake", "build dependencies (g++)"]
},
{
"label": "make (clang++, debug)",
"type": "shell",
"command": "make",
"options": {
"cwd": "build",
"env": {"CXX": "clang++-10", "CC": "clang-10", "config": "debug"}
},
"osx": {
"options": {
"env": {"CXX": "clang++", "CC": "clang"}
"env": {"CXX": "clang++", "CC": "clang", "config": "debug"}
}
},
"windows": {
"options": {
"env": {"CXX": "clang++", "CC": "clang"}
"env": {"CXX": "clang++", "CC": "clang", "config": "debug"}
}
},
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
},
"dependsOn": ["premake5 gmake", "build dependencies (clang++)"]
},
{
"label": "make (clang++, release)",
"type": "shell",
"command": "make",
"options": {
"cwd": "build",
"env": {"CXX": "clang++-10", "CC": "clang-10", "config": "release"}
},
"osx": {
"options": {
"env": {"CXX": "clang++", "CC": "clang", "config": "release"}
}
},
"windows": {
"options": {
"env": {"CXX": "clang++", "CC": "clang", "config": "release"}
}
},
"problemMatcher": [],
Expand Down
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

<!-- ## [Unreleased] -->
## [Unreleased]

## [0.0.1] - 2020-07-09
### Added
Expand All @@ -16,5 +16,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- .vscode folder for tasks, launch, general and C++ settings
- YAML for Travis (working) and AppVeyor (experimental)

<!-- [Unreleased]: https://github.com/hsandt/cpp-platform-adventure/compare/v0.0.1...HEAD -->
[1.0.0]: https://github.com/olivierlacan/keep-a-changelog/releases/tag/v0.0.1
[Unreleased]: https://github.com/hsandt/cpp-platform-adventure/compare/v0.0.1...HEAD
[0.0.1]: https://github.com/hsandt/cpp-platform-adventure/releases/tag/v0.0.1
57 changes: 50 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
[![Build Status: master](https://travis-ci.org/hsandt/cpp-platform-adventure.svg?branch=master)](https://travis-ci.org/hsandt/cpp-platform-adventure)
[![Build Status: develop](https://travis-ci.org/hsandt/cpp-platform-adventure.svg?branch=develop)](https://travis-ci.org/hsandt/cpp-platform-adventure)

# C++ Platform Adventure Game

A personal game dev project to train making a game in C++20 with low-level libraries, and gradually extracting components to make a more generic engine.

## Changelog

See [CHANGELOG.md].
See [CHANGELOG](CHANGELOG.md).

## Supported platforms

Only Linux is currently supported. Build is tested on Ubuntu and Mint, and probably works with other Debian-based distributions.

However, premake will make it easier to support Windows and OSX in a later version.

## Required compiler toolchain
## How to build

### Required compiler toolchain

This project will use C++20 (in particular concepts), so to build it you will need either GCC 10 (`g++-10`), LLVM 10/11 (`clang++-10` or just `clang++` on OSX) or Visual Studio 2019 (16.3+) depending on your platform.

Expand All @@ -30,27 +35,27 @@ Currently, only the current configurations are tested in CI:

You are free to install the toolchains as you wish as long as they are accessible in the `PATH`. Below I give a few instructions for supported platforms.

### Linux Ubuntu with g++-10
#### Linux Ubuntu with g++-10

```shell
$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test
$ sudo apt-get update
$ sudo apt install g++-10
```

### Linux Ubuntu with latest stable LLVM (currently 10)
#### Linux Ubuntu with latest stable LLVM (currently 10)

Follow the instructions on https://apt.llvm.org/.

There is an install script for Debian and Ubuntu, and instructions to install the packages for Debian-based distributions.

### OSX with latest LLVM (currently 11)
#### OSX with latest LLVM (currently 11)

On OSX, I recommend to install the latest Xcode (currently 11) and the lastest clang (currently 11) will be provided.

## Dependencies
### Dependencies

### Linux
#### Linux

To build SFML, you need the libraries mentioned in https://www.sfml-dev.org/tutorials/2.5/compile-with-cmake.php. I modified the list slightly to match the libraries I actually needed in [premake5.lua]'s `links` (in particular, I use GL instead of OpenGL to include GLX/GLExtensions). Exact names may vary depending on your distribution, I'll give the name of Debian packages below.

Expand Down Expand Up @@ -78,3 +83,41 @@ Here is a one-liner you can use for a quick setup:
```shell
$ sudo apt install build-essential libx11-dev libxrandr-dev libudev-dev libgl1-mesa-dev libflac-dev libogg-dev libvorbis-dev libvorbisenc2 libvorbisfile3 libopenal-dev
```

### Building commands

Once you have installed the toolchains and dependencies mentioned above, you can start compiling the project.

The [Travis config](.travis.yml) is a good reference for the building procedure on Linux and OSX, line by line. It also refers to some of the toolchains and dependencies mentioned above (although fewer, since Travis images are pre-bundled with a number of libraries).

If you use VS Code, you can directly use the [tasks](.vscode/tasks.json).

Otherwise, following the instructions below.

#### gmake (Linux, OSX)

From the repository root:

```shell
# build third-party dependencies
$ engine/third-party/build_sfml.py
# build the game
$ premake gmake
$ config=release make -j2
```

The game executable will be created at build/bin/Release/Game.

#### Xcode (OSX)

From the repository root:

```shell
# build third-party dependencies
$ engine/third-party/build_sfml.py
# build the game
$ premake xcode4
$ xcodebuild -project Game.xcodeproj -target Game -configuration Release
```

The game executable will be created at build/bin/Release/Game.
5 changes: 5 additions & 0 deletions premake5.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
-- ex: build/Linux_debug
output_dir = "build/%{cfg.system}_%{cfg.buildcfg}"

workspace "C++_Platform_Adventure"
configurations { "Debug", "Release" }
location "build"
targetdir(output_dir .. "/bin")
objdir(output_dir .. "/obj")

project "Game"
kind "WindowedApp"
Expand Down

0 comments on commit 4944a9f

Please sign in to comment.