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

@ -30,7 +30,15 @@ add_custom_target(
)
# Install the ttrts man page
install( FILES "${CMAKE_BINARY_DIR}/ttrts.6" DESTINATION man/man6/ )
if( ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" )
set ( MANPAGE_LOC share/man/man6 )
elseif( ${CMAKE_SYSTEM_NAME} MATCHES "Linux" )
set ( MANPAGE_LOC man/man6 )
else()
message(ERROR "Unsupported system detected")
endif()
install( FILES "${CMAKE_BINARY_DIR}/ttrts.6" DESTINATION ${MANPAGE_LOC} )
# Subprojects
add_subdirectory( source/ttrts )

View file

@ -1,13 +1,15 @@
#! /bin/bash
# Used to a man page from markdown
echo ".\" Man page for the ttrts project" > $4
echo ".\" this man page is auto-generated, do not edit directly" >> $4
echo ".TH TTRTS\ v$1.$2.$3 6 $(date +%Y-%m-%d) http://mdiluz.github.io/ttrts/" >> $4
# NOTE: For the OSX version of sed we use -E, which on linux appears be an undocumented switch for -r
# we also have to use [A-Za-z] instead of \w for some reason
# as well as escaped new line characters and literal tabs instead of \n and \t
# sections to section headers
# sub-sections in man page sub-sections
# 4-space lines to tabs
@ -19,13 +21,15 @@ echo ".TH TTRTS\ v$1.$2.$3 6 $(date +%Y-%m-%d) http://mdiluz.github.io/ttrts/" >
# underline mapfile opt
# ensure name section uses correct
cat "$5" \
| sed -r 's/^# (\w+)/.SH \1/g' \
| sed -r 's/^##+ (\w+)/.SS \1/g' \
| sed -r 's/^ (.*)$/\n\t\1\n/g' \
| sed -r 's/^\t//g' \
| sed -r 's/\$\{(\w+)\}/\\fB\$\1\\fR/g' \
| sed -r 's/\{(\w+)\}/\\fI\1\\fR/g' \
| sed -r 's/-----+//g' \
| sed -r 's/`(.*?)`/\\fB\1\\fR/g' \
| sed -r 's/MAPFILE/\\fImapfile\\fR/g' \
| sed -r 's/\tttrts -/\tttrts \\-/g' >> $4
| sed -E 's/^# ([A-Za-z]+)/.SH \1/g' \
| sed -E 's/^##+ ([A-Za-z]+)/.SS \1/g' \
| sed -E 's/^ (.*)$/\
\1\
/g' \
| sed -E 's/^ //g' \
| sed -E 's/\$\{([A-Za-z]+)\}/\\fB\$\1\\fR/g' \
| sed -E 's/\{([A-Za-z]+)\}/\\fI\1\\fR/g' \
| sed -E 's/-----+//g' \
| sed -E 's/`(.*)`/\\fB\1\\fR/g' \
| sed -E 's/MAPFILE/\\fImapfile\\fR/g' \
| sed -E 's/ ttrts -/ ttrts \\-/g' >> $4

View file

@ -1,10 +1,10 @@
#! /bin/bash
# Used to generate usage text from markdown
cat README.md \
| sed 's/^#\+ //g' \
| sed 's/^\t/\\t/g' \
| sed 's/^ /\\t/g' \
| sed ':a;N;$!ba;s/\n/\\n\n/g' \
| sed 's/^/\"/' \
| sed 's/$/\"/' \
| sed -E 's/^#+ //g' \
| sed -E 's/^ /\\t/g' \
| sed -E 's/^ /\\t/g' \
| sed -E 's/^/\"/' \
| sed -E 's/$/\\n\"/' \
> $1

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 )