Skip to content

Commit

Permalink
Merge branch 'master' of github.com:AMDmi3/hoverboard-sdl
Browse files Browse the repository at this point in the history
  • Loading branch information
AMDmi3 committed Dec 4, 2015
2 parents 27e0e20 + 059809b commit ad35fc6
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 25 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# CMake files
CMakeCache.txt
CMakeFiles
Makefile
cmake_install.cmake

# Generated files
misc/hoverboard.desktop

# Binaries
hoverboard
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ before_install:
- sudo sed -i -e 's|friend class hash|friend struct hash|' /usr/include/c++/4.8/bits/stl_bvector.h
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi
script:
- cmake -DCMAKE_CXX_FLAGS=-Werror -DCMAKE_INSTALL_PREFIX=prefix .
- cmake -DCMAKE_CXX_FLAGS=-Werror -DCMAKE_INSTALL_PREFIX=prefix -DSYSTEMWIDE=ON .
- make
- make install
34 changes: 14 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,22 @@ PROJECT(hoverboard-sdl)
# meta
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
MESSAGE("")
MESSAGE("*** Building for inplace run")
MESSAGE("*** Specify CMAKE_INSTALL_PREFIX if you want to install")
MESSAGE("")

SET(SYSTEMWIDE 0)
ELSE(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
MESSAGE("")
MESSAGE("*** Building for installation into ${CMAKE_INSTALL_PREFIX}")
MESSAGE("")

SET(SYSTEMWIDE 1)
ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)

# options
OPTION(SYSTEMWIDE "Build for systemwide installation" OFF)
OPTION(STANDALONE "Build for creating standalone package" OFF)

IF(SYSTEMWIDE)
SET(BINDIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE STRING "Where to install binaries")
SET(DATAROOTDIR "${CMAKE_INSTALL_PREFIX}/share" CACHE STRING "Root directory for data files")
SET(DATADIR "${DATAROOTDIR}/hoverboard" CACHE STRING "Where to install data files")
SET(ICONDIR "${DATAROOTDIR}/pixmaps" CACHE STRING "Where to install icon")
SET(DESKTOPDIR "${DATAROOTDIR}/applications" CACHE STRING "Where to install .desktop file")
ELSEIF(STANDALONE)
SET(BINDIR "." CACHE STRING "Where to install binaries")
SET(DATAROOTDIR "." CACHE STRING "Root directory for data files")
SET(DATADIR "data" CACHE STRING "Where to install data files")
SET(ICONDIR "." CACHE STRING "Where to install icon")
SET(DESKTOPDIR "." CACHE STRING "Where to install .desktop file")
ENDIF(SYSTEMWIDE)

# flags
Expand All @@ -42,11 +36,11 @@ ADD_SUBDIRECTORY(extlibs/libSDL2pp)
FIND_PACKAGE(Threads)

# datadir
IF(SYSTEMWIDE)
IF(SYSTEMWIDE OR STANDALONE)
ADD_DEFINITIONS(-DDATADIR="${DATADIR}")
ELSE(SYSTEMWIDE)
ELSE(SYSTEMWIDE OR STANDALONE)
ADD_DEFINITIONS(-DDATADIR="${PROJECT_SOURCE_DIR}/data")
ENDIF(SYSTEMWIDE)
ENDIF(SYSTEMWIDE OR STANDALONE)

# sources
SET(SOURCES
Expand All @@ -71,11 +65,11 @@ ADD_EXECUTABLE(hoverboard ${SOURCES} ${HEADERS})
TARGET_LINK_LIBRARIES(hoverboard ${SDL2PP_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})

# installation
IF(SYSTEMWIDE)
IF(SYSTEMWIDE OR STANDALONE)
CONFIGURE_FILE(misc/hoverboard.desktop.in misc/hoverboard.desktop)

INSTALL(TARGETS hoverboard RUNTIME DESTINATION ${BINDIR})
INSTALL(DIRECTORY data/ DESTINATION ${DATADIR})
INSTALL(FILES misc/xkcd.ico DESTINATION ${ICONDIR} RENAME hoverboard.ico)
INSTALL(FILES ${PROJECT_BINARY_DIR}/misc/hoverboard.desktop DESTINATION ${DESKTOPDIR})
ENDIF(SYSTEMWIDE)
ENDIF(SYSTEMWIDE OR STANDALONE)
24 changes: 21 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,39 @@ Dependencies:
* [SDL2_image](https://www.libsdl.org/projects/SDL_image/)
* [SDL2_ttf](https://www.libsdl.org/projects/SDL_ttf/)

To install these on apt-using system sych as Debian or Ubuntu, run:

```
apt-get install cmake libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev
```

The project also uses libSDL2pp, C++11 bindings library for SDL2.
It's included into git repository as a submodule, so if you've
obtained source through git, don't forget to run ```git submodule
init && git submodule update```.

To build and run the game:
To build and run the game without installation:

```
cmake . && make && ./hoverboard
cmake .
make
./hoverboard
```

To install systemwide:

```
cmake -DCMAKE_INSTALL_PREFIX=/usr/local . && make && make install
cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DSYSTEMWIDE=ON
make
make install
```

To create self-contained directory for standalone package:

```
cmake -DCMAKE_INSTALL_PREFIX=./package -DSTANDALONE=ON
make
make install
```

## Author
Expand Down
2 changes: 1 addition & 1 deletion src/game.cc
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ void Game::DepositCoins() {
else if (numcoins == 17)
message = "you found all the coins! great job!";
else if (numcoins == 42)
message = "you found all the coins! great job!";
message = "no answers here.";
else if (numcoins == coin_locations_.size())
message = "are you gandalf?";

Expand Down

0 comments on commit ad35fc6

Please sign in to comment.