Skip to content

Commit

Permalink
Adds CMake install targets.
Browse files Browse the repository at this point in the history
  • Loading branch information
juzzlin committed Aug 10, 2012
1 parent 8b705ac commit 96a2dad
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 13 deletions.
34 changes: 33 additions & 1 deletion CMakeLists.txt
Expand Up @@ -9,8 +9,23 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fomit-frame-pointer -finline-functions
set(GAME_BINARY_NAME "dustrac-game")
set(EDITOR_BINARY_NAME "dustrac-editor")

option(ReleaseBuild "ReleaseBuild" OFF)

# Set install paths
set(CMAKE_INSTALL_PREFIX /usr)
set(DEST_PATH /opt/DustRacing)
set(BIN_PATH ${DEST_PATH})

if(ReleaseBuild)
message(STATUS "Release build.")
set(DATA_PATH ${DEST_PATH}/data)
else()
message(STATUS "Development build.")
set(DATA_PATH ./data)
endif()

# This is the main data path given to the game and editor binaries.
add_definitions(-DDATA_PATH="./data")
add_definitions(-DDATA_PATH="${DATA_PATH}")
add_definitions(-DGL_GLEXT_PROTOTYPES)

# Find Qt4
Expand All @@ -25,6 +40,7 @@ include(${QT_USE_FILE})
# game binary)
find_package(OpenGL REQUIRED)

# Enable CMake's unit test framework
enable_testing()

# Sub build: editor
Expand All @@ -34,3 +50,19 @@ add_subdirectory(src/game/MiniCore)
# Sub build: game binary
add_subdirectory(src/game)

# Install binaries & data
install(PROGRAMS dustrac-game DESTINATION ${BIN_PATH})
install(PROGRAMS dustrac-editor DESTINATION ${BIN_PATH})
install(FILES data/editorModels.conf data/textures.conf data/fonts.conf DESTINATION ${DATA_PATH})
install(DIRECTORY data/images DESTINATION ${DATA_PATH} FILES_MATCHING PATTERN "*.jpg")
install(DIRECTORY data/images DESTINATION ${DATA_PATH} FILES_MATCHING PATTERN "*.png")
install(DIRECTORY data/levels DESTINATION ${DATA_PATH} FILES_MATCHING PATTERN "*.trk")
install(DIRECTORY data/shaders DESTINATION ${DATA_PATH} FILES_MATCHING PATTERN "*.fsh")
install(DIRECTORY data/shaders DESTINATION ${DATA_PATH} FILES_MATCHING PATTERN "*.vsh")

# Install icons and the .desktop file
install(FILES dustrac-game.desktop DESTINATION share/applications)
install(FILES dustrac-editor.desktop DESTINATION share/applications)
install(FILES data/icons/DustRacing.png DESTINATION share/pixmaps)
install(FILES data/icons/DustRacing.png DESTINATION share/icons/hicolor/64x64/apps)

53 changes: 45 additions & 8 deletions INSTALL
Expand Up @@ -11,19 +11,58 @@ standard, so a C++11 compliant compiler is required (GCC >= 4.6).
Building in the command line on Linux (tested on Ubuntu 12.04)
--------------------------------------------------------------

Development build (the game can be run without installing anything):

1) Install Qt development files (libqt4-dev on Ubuntu).
2) Install CMake from the Software Center.
3) Go to the source directory and run:

$ ./configure

This runs CMake that generates the makefiles.
You can also run cmake directly. The configure script
is only for convenience.

If everything went ok, run:

$ make

This will build the editor and the game binaries.

Run the game:

$ ./dustrac-game

Run the editor:

$ ./dustrac-editor

Release build (game installs to /opt/DustRacing):

$ ./configure -DReleaseBuild=1

This runs CMake that generates the makefiles.
If everything went ok, run:

$ make

This will build the editor and the game binaries.

Install the binaries and data files:

$ sudo make install

This install also the desktop files so Dust Racing
should appear in your application menu.

Run the game:

$ /opt/DustRacing/dustrac-game

Run the editor:

$ /opt/DustRacing/dustrac-editor

Building by using QtCreator on Windows (tested on Windows 7)
------------------------------------------------------------

Expand All @@ -48,15 +87,13 @@ Building by using QtCreator on Linux (tested on Ubuntu 12.04)
Dust Racing source directory.
3) Run CMake and build.

Installing
----------

Any install steps are not currently required.
The binaries work when started from the directory
that contains the binary.
For packagers
-------------

The binaries only need to find the data-dir that includes
all the runtime data.
The binaries only need to find the data dir that includes
all the runtime data. This can be set in the main CMakeLists.txt
and is given to the game via -DDATA_PATH.

The release build should be used when packaging.

-- Jussi Lind <jussi.lind@iki.fi>
2 changes: 0 additions & 2 deletions TODO
Expand Up @@ -6,11 +6,9 @@ Game:
- Move car to the nearest track tile if stuck for too long
- Grandstands
- Global setting for shadow offsets
- Install target for CMake
- Full screen mode
- One big (long) wall object
- Restore support for circle-shaped objects
- Optimize particle performance
- Show total time
- Race record times separately for different lap counts

Expand Down
3 changes: 1 addition & 2 deletions configure
@@ -1,4 +1,3 @@
#!/bin/sh
rm -f CMakeCache.txt
cmake . && echo "Configuring compeleted. Now run \"make\"."

cmake . $@ && echo "Configuring compeleted. Now run \"make\"."
Binary file added data/icons/DustRacing.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions dustrac-editor.desktop
@@ -0,0 +1,8 @@
[Desktop Entry]
Name=Dust Racing Track Editor
Comment=2D racing game track editor
Exec=/opt/DustRacing/dustrac-editor
Icon=DustRacing
Type=Application
Categories=Games;
StartupNotify=true
8 changes: 8 additions & 0 deletions dustrac-game.desktop
@@ -0,0 +1,8 @@
[Desktop Entry]
Name=Dust Racing
Comment=2D racing game
Exec=/opt/DustRacing/dustrac-game
Icon=DustRacing
Type=Application
Categories=Games;
StartupNotify=true

0 comments on commit 96a2dad

Please sign in to comment.