Move maps to /usr/local and allow these settings to get defaults from the cmakelists

This commit is contained in:
Marc Di Luzio 2014-12-31 14:07:34 +00:00
parent 3f76b6430b
commit 3f892ec2aa
3 changed files with 14 additions and 3 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 )