From 415361ac9c16d9478f8b06c1d996107eb6ba5e80 Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Tue, 30 Dec 2014 13:24:17 +0000 Subject: [PATCH] Update CMakelists Additional install targets for maps, and reworked dependencies --- .gitignore | 1 + bootstrap.sh | 21 +++++++++++++++++---- scripts/gen_maps.sh | 13 +++++++++++++ {source/scripts => scripts}/gen_usage.sh | 0 source/gen/CMakeLists.txt | 13 ++++++++++++- source/ttrts/CMakeLists.txt | 7 ++++--- 6 files changed, 47 insertions(+), 8 deletions(-) create mode 100755 scripts/gen_maps.sh rename {source/scripts => scripts}/gen_usage.sh (100%) diff --git a/.gitignore b/.gitignore index 379896d..502564d 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,5 @@ *.user *.sublime* *.idea +*~ diff --git a/bootstrap.sh b/bootstrap.sh index 9b9a839..dcba4b0 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,38 +1,51 @@ #! /bin/bash +# Double check +if [ ! -e "source/CMakeLists.txt" ]; then + echo "TTRTS: No source cmakelist found" + exit +fi + echo "TTRTS: Running cmake" test ! -e build && mkdir build cd build/ cmake ../source if [[ $? != 0 ]]; then echo "TTRTS: CMake failed, exiting Bootstrap" + exit fi echo "TTRTS: Running make" make if [[ $? != 0 ]]; then echo "TTRTS: make failed, exiting Bootstrap" + exit fi echo "TTRTS: Running tests" ./test/ttrts-test if [[ $? != 0 ]]; then echo "TTRTS: Tests failed, build must be broken" + exit fi echo "TTRTS: Generating maps" -test ! -e ../maps && mkdir ../maps -cd ../maps -./../build/gen/ttrts-gen +./../scripts/gen_maps.sh "$PWD/gen/ttrts-gen" if [[ $? != 0 ]]; then - echo "TTRTS: Generating maps, exiting Bootstrap" + echo "TTRTS: Failed to generate maps, exiting Bootstrap" + exit fi +# Copy these maps into parent directory +cp -rf maps .. echo "TTRTS: Moving binaries" cd .. if [ ! -e build/ttrts/ttrts ]; then echo "TTRTS: No TTRTS Binary found, something has gone wrong" + exit fi cp build/ttrts/ttrts . chmod a+x ttrts + +echo "TTRTS: Bootstrap complete" diff --git a/scripts/gen_maps.sh b/scripts/gen_maps.sh new file mode 100755 index 0000000..bb02331 --- /dev/null +++ b/scripts/gen_maps.sh @@ -0,0 +1,13 @@ +#! /bin/bash +# Use to generate the ttrts maps + +ttrtsgen=$1 + +test ! -e maps && mkdir maps # Make maps directory if needed +if [ ! -e maps ]; then + exit 1 +fi + +cd maps + +$ttrtsgen \ No newline at end of file diff --git a/source/scripts/gen_usage.sh b/scripts/gen_usage.sh similarity index 100% rename from source/scripts/gen_usage.sh rename to scripts/gen_usage.sh diff --git a/source/gen/CMakeLists.txt b/source/gen/CMakeLists.txt index 9eff3b8..5d17de9 100644 --- a/source/gen/CMakeLists.txt +++ b/source/gen/CMakeLists.txt @@ -14,4 +14,15 @@ set( SOURCES # Add the executable add_executable( ttrts-gen ${SOURCES} ) -target_link_libraries( ttrts-gen game ) \ No newline at end of file +target_link_libraries( ttrts-gen game ) + +# Run the gen_usage script to generate our usage header +add_custom_target( + ttrts-gen-maps ALL + ${CMAKE_SOURCE_DIR}/../scripts/gen_maps.sh "${CMAKE_CURRENT_BINARY_DIR}/ttrts-gen" +) + +add_dependencies(ttrts-gen-maps ${PROJECT_NAME}) + +# Installation target +install( DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/maps DESTINATION /usr/share/ttrts ) \ No newline at end of file diff --git a/source/ttrts/CMakeLists.txt b/source/ttrts/CMakeLists.txt index d7aa9da..19d01ea 100644 --- a/source/ttrts/CMakeLists.txt +++ b/source/ttrts/CMakeLists.txt @@ -23,7 +23,8 @@ install( TARGETS ${PROJECT_NAME} DESTINATION bin ) # Run the gen_usage script to generate our usage header add_custom_target( - gen_ttrts_usage - cd ${CMAKE_CURRENT_SOURCE_DIR} && ${CMAKE_SOURCE_DIR}/scripts/gen_usage.sh "${CMAKE_CURRENT_BINARY_DIR}/usage.h" + ttrts-client-usage + cd ${CMAKE_CURRENT_SOURCE_DIR} && ${CMAKE_SOURCE_DIR}/../scripts/gen_usage.sh "${CMAKE_CURRENT_BINARY_DIR}/usage.h" ) -add_dependencies(${PROJECT_NAME} gen_ttrts_usage) \ No newline at end of file + +add_dependencies(${PROJECT_NAME} ttrts-client-usage) \ No newline at end of file