From f1e4f432e6ec46e1949765d02883337c0f215578 Mon Sep 17 00:00:00 2001 From: mdiluzio Date: Tue, 30 Dec 2014 18:32:17 +0000 Subject: [PATCH] Move top level cmakelist up to main directory --- source/CMakeLists.txt => CMakeLists.txt | 24 ++++++++++++++---------- bootstrap.sh | 16 +++++++--------- source/client/CMakeLists.txt | 2 +- source/gen/CMakeLists.txt | 2 +- 4 files changed, 23 insertions(+), 21 deletions(-) rename source/CMakeLists.txt => CMakeLists.txt (53%) diff --git a/source/CMakeLists.txt b/CMakeLists.txt similarity index 53% rename from source/CMakeLists.txt rename to CMakeLists.txt index 76cbf07..8b757b5 100644 --- a/source/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,19 +19,23 @@ if( CMAKE_BUILD_TYPE MATCHES "Debug" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g" ) endif() -# Add definitions for the version number -add_definitions( - -DTTRTS_VERSION_MAJOR=${TTRTS_VERSION_MAJOR} - -DTTRTS_VERSION_MINOR=${TTRTS_VERSION_MINOR} - -DTTRTS_VERSION_PATCH=${TTRTS_VERSION_PATCH} - -DTTRTS_VERSION_STRING=\"${TTRTS_VERSION_MAJOR}.${TTRTS_VERSION_MINOR}.${TTRTS_VERSION_PATCH}\" +# Add bash completion to install +install( FILES scripts/ttrts_complete DESTINATION /etc/bash_completion.d/ ) + +# Add target to generate man page +# Run the gen_usage script to generate our usage header +add_custom_target( + ttrts-gen-manpage ALL + ${CMAKE_SOURCE_DIR}/scripts/gen_manpage.sh "ttrts.6" "${CMAKE_SOURCE_DIR}/source/client/README.md" ) +# Install the ttrts man page +install( FILES "${CMAKE_BINARY_DIR}/ttrts.6" DESTINATION man/man6/ ) # Subprojects -add_subdirectory( ttrts ) -add_subdirectory( client ) +add_subdirectory( source/ttrts ) +add_subdirectory( source/client ) # Auxhilary binaries -add_subdirectory( test ) -add_subdirectory( gen ) +add_subdirectory( source/test ) +add_subdirectory( source/gen ) diff --git a/bootstrap.sh b/bootstrap.sh index 2a7688e..49f384b 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,7 +1,7 @@ #! /bin/bash # Double check for cmakelist -if [ ! -e "source/CMakeLists.txt" ]; then +if [ ! -e "CMakeLists.txt" ]; then echo "TTRTS: No source cmakelist found" exit fi @@ -10,7 +10,7 @@ fi echo "TTRTS: Running cmake" test ! -e build && mkdir build cd build/ -cmake ../source +cmake .. if [[ $? != 0 ]]; then echo "TTRTS: CMake failed, exiting Bootstrap" exit @@ -26,7 +26,7 @@ fi # Run tests echo "TTRTS: Running tests" -./test/ttrts-test +./source/test/ttrts-test if [[ $? != 0 ]]; then echo "TTRTS: Tests failed, build must be broken" exit @@ -34,23 +34,21 @@ fi # Generate maps echo "TTRTS: Generating maps" -./../scripts/gen_maps.sh "$PWD/gen/ttrts-gen" +cd .. +./scripts/gen_maps.sh "$PWD/build/source/gen/ttrts-gen" if [[ $? != 0 ]]; then echo "TTRTS: Failed to generate maps, exiting Bootstrap" exit fi -# Copy these maps into parent directory -cp -rf maps .. # Move binaries echo "TTRTS: Moving binaries" -cd .. -if [ ! -e build/client/ttrts ]; then +if [ ! -e build/source/client/ttrts ]; then echo "TTRTS: No TTRTS Binary found, something has gone wrong" exit fi -cp build/client/ttrts . +cp build/source/client/ttrts . chmod a+x ttrts echo "TTRTS: Bootstrap complete" diff --git a/source/client/CMakeLists.txt b/source/client/CMakeLists.txt index 81fdf72..7d12cef 100644 --- a/source/client/CMakeLists.txt +++ b/source/client/CMakeLists.txt @@ -28,7 +28,7 @@ install( TARGETS ${PROJECT_NAME} DESTINATION bin ) # Run the gen_usage script to generate our usage header add_custom_target( ttrts-client-usage - cd ${CMAKE_CURRENT_SOURCE_DIR} && ${CMAKE_SOURCE_DIR}/../scripts/gen_usage.sh "${CMAKE_CURRENT_BINARY_DIR}/usage.h" + cd ${CMAKE_CURRENT_SOURCE_DIR} && ${CMAKE_SOURCE_DIR}/scripts/gen_usage.sh "${CMAKE_CURRENT_BINARY_DIR}/usage.h" ) add_dependencies(${PROJECT_NAME} ttrts-client-usage) \ No newline at end of file diff --git a/source/gen/CMakeLists.txt b/source/gen/CMakeLists.txt index ef75c4a..7d0a030 100644 --- a/source/gen/CMakeLists.txt +++ b/source/gen/CMakeLists.txt @@ -19,7 +19,7 @@ target_link_libraries( ttrts-gen ttrts ) # 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" + ${CMAKE_SOURCE_DIR}/scripts/gen_maps.sh "${CMAKE_CURRENT_BINARY_DIR}/ttrts-gen" ) add_dependencies(ttrts-gen-maps ${PROJECT_NAME})