Merge branch 'dev' of https://github.com/mdiluz/ttrts into dev

This commit is contained in:
mdiluzio 2014-12-31 18:40:05 +00:00
commit 082810de4a
6 changed files with 45 additions and 22 deletions

View file

@ -13,6 +13,14 @@ set( SOURCES
main.cpp
)
# Set defaults for ttrts maps and games
set( TTRTS_MAPS "/usr/local/share/ttrts/maps/" )
set( TTRTS_GAMES "/tmp/" )
# define these defaults in code
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTTRTS_MAPS=${TTRTS_MAPS}" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTTRTS_GAMES=${TTRTS_GAMES}" )
# Add the executable
add_executable( ${PROJECT_NAME} ${SOURCES} )

View file

@ -12,6 +12,9 @@
#include "game.h"
#define STRINGIFY(x) _STRINGIFY(x)
#define _STRINGIFY(x) #x
static const char* sk_usage =
#include "usage.h"
;
@ -69,7 +72,7 @@ int main(int argc, char* argv[])
std::string gameFile = argv[1];
// Default for maps
std::string ttrts_maps_dir = "/usr/share/ttrts/maps/";
std::string ttrts_maps_dir = STRINGIFY(TTRTS_MAPS);
if( getenv("TTRTS_MAPS") )
{
ttrts_maps_dir = getenv("TTRTS_MAPS");
@ -80,7 +83,7 @@ int main(int argc, char* argv[])
}
// Default for games
std::string ttrts_games_dir = "/tmp/";
std::string ttrts_games_dir = STRINGIFY(TTRTS_GAMES);
if( getenv("TTRTS_GAMES") )
{
ttrts_games_dir = getenv("TTRTS_GAMES");

View file

@ -25,4 +25,4 @@ add_custom_target(
add_dependencies(ttrts-gen-maps ${PROJECT_NAME})
# Installation target
install( DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/maps DESTINATION /usr/share/ttrts )
install( DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/maps DESTINATION /usr/local/share/ttrts )