Merge branch 'dev' of https://github.com/mdiluz/ttrts into dev
This commit is contained in:
commit
082810de4a
6 changed files with 45 additions and 22 deletions
|
@ -30,7 +30,15 @@ add_custom_target(
|
||||||
)
|
)
|
||||||
|
|
||||||
# Install the ttrts man page
|
# 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
|
# Subprojects
|
||||||
add_subdirectory( source/ttrts )
|
add_subdirectory( source/ttrts )
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
# Used to a man page from markdown
|
# Used to a man page from markdown
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
echo ".\" Man page for the ttrts project" > $4
|
echo ".\" Man page for the ttrts project" > $4
|
||||||
echo ".\" this man page is auto-generated, do not edit directly" >> $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
|
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
|
# sections to section headers
|
||||||
# sub-sections in man page sub-sections
|
# sub-sections in man page sub-sections
|
||||||
# 4-space lines to tabs
|
# 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
|
# underline mapfile opt
|
||||||
# ensure name section uses correct
|
# ensure name section uses correct
|
||||||
cat "$5" \
|
cat "$5" \
|
||||||
| sed -r 's/^# (\w+)/.SH \1/g' \
|
| sed -E 's/^# ([A-Za-z]+)/.SH \1/g' \
|
||||||
| sed -r 's/^##+ (\w+)/.SS \1/g' \
|
| sed -E 's/^##+ ([A-Za-z]+)/.SS \1/g' \
|
||||||
| sed -r 's/^ (.*)$/\n\t\1\n/g' \
|
| sed -E 's/^ (.*)$/\
|
||||||
| sed -r 's/^\t//g' \
|
\1\
|
||||||
| sed -r 's/\$\{(\w+)\}/\\fB\$\1\\fR/g' \
|
/g' \
|
||||||
| sed -r 's/\{(\w+)\}/\\fI\1\\fR/g' \
|
| sed -E 's/^ //g' \
|
||||||
| sed -r 's/-----+//g' \
|
| sed -E 's/\$\{([A-Za-z]+)\}/\\fB\$\1\\fR/g' \
|
||||||
| sed -r 's/`(.*?)`/\\fB\1\\fR/g' \
|
| sed -E 's/\{([A-Za-z]+)\}/\\fI\1\\fR/g' \
|
||||||
| sed -r 's/MAPFILE/\\fImapfile\\fR/g' \
|
| sed -E 's/-----+//g' \
|
||||||
| sed -r 's/\tttrts -/\tttrts \\-/g' >> $4
|
| sed -E 's/`(.*)`/\\fB\1\\fR/g' \
|
||||||
|
| sed -E 's/MAPFILE/\\fImapfile\\fR/g' \
|
||||||
|
| sed -E 's/ ttrts -/ ttrts \\-/g' >> $4
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
# Used to generate usage text from markdown
|
# Used to generate usage text from markdown
|
||||||
|
|
||||||
cat README.md \
|
cat README.md \
|
||||||
| sed 's/^#\+ //g' \
|
| sed -E 's/^#+ //g' \
|
||||||
| sed 's/^\t/\\t/g' \
|
| sed -E 's/^ /\\t/g' \
|
||||||
| sed 's/^ /\\t/g' \
|
| sed -E 's/^ /\\t/g' \
|
||||||
| sed ':a;N;$!ba;s/\n/\\n\n/g' \
|
| sed -E 's/^/\"/' \
|
||||||
| sed 's/^/\"/' \
|
| sed -E 's/$/\\n\"/' \
|
||||||
| sed 's/$/\"/' \
|
|
||||||
> $1
|
> $1
|
||||||
|
|
|
@ -13,6 +13,14 @@ set( SOURCES
|
||||||
main.cpp
|
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 the executable
|
||||||
add_executable( ${PROJECT_NAME} ${SOURCES} )
|
add_executable( ${PROJECT_NAME} ${SOURCES} )
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,9 @@
|
||||||
|
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
|
|
||||||
|
#define STRINGIFY(x) _STRINGIFY(x)
|
||||||
|
#define _STRINGIFY(x) #x
|
||||||
|
|
||||||
static const char* sk_usage =
|
static const char* sk_usage =
|
||||||
#include "usage.h"
|
#include "usage.h"
|
||||||
;
|
;
|
||||||
|
@ -69,7 +72,7 @@ int main(int argc, char* argv[])
|
||||||
std::string gameFile = argv[1];
|
std::string gameFile = argv[1];
|
||||||
|
|
||||||
// Default for maps
|
// Default for maps
|
||||||
std::string ttrts_maps_dir = "/usr/share/ttrts/maps/";
|
std::string ttrts_maps_dir = STRINGIFY(TTRTS_MAPS);
|
||||||
if( getenv("TTRTS_MAPS") )
|
if( getenv("TTRTS_MAPS") )
|
||||||
{
|
{
|
||||||
ttrts_maps_dir = getenv("TTRTS_MAPS");
|
ttrts_maps_dir = getenv("TTRTS_MAPS");
|
||||||
|
@ -80,7 +83,7 @@ int main(int argc, char* argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default for games
|
// Default for games
|
||||||
std::string ttrts_games_dir = "/tmp/";
|
std::string ttrts_games_dir = STRINGIFY(TTRTS_GAMES);
|
||||||
if( getenv("TTRTS_GAMES") )
|
if( getenv("TTRTS_GAMES") )
|
||||||
{
|
{
|
||||||
ttrts_games_dir = getenv("TTRTS_GAMES");
|
ttrts_games_dir = getenv("TTRTS_GAMES");
|
||||||
|
|
|
@ -25,4 +25,4 @@ add_custom_target(
|
||||||
add_dependencies(ttrts-gen-maps ${PROJECT_NAME})
|
add_dependencies(ttrts-gen-maps ${PROJECT_NAME})
|
||||||
|
|
||||||
# Installation target
|
# 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 )
|
Loading…
Add table
Reference in a new issue