diff --git a/bootstrap.sh b/bootstrap.sh index dcba4b0..2a7688e 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,11 +1,12 @@ #! /bin/bash -# Double check +# Double check for cmakelist if [ ! -e "source/CMakeLists.txt" ]; then echo "TTRTS: No source cmakelist found" exit fi +# Run cmake echo "TTRTS: Running cmake" test ! -e build && mkdir build cd build/ @@ -15,6 +16,7 @@ if [[ $? != 0 ]]; then exit fi +# Run make echo "TTRTS: Running make" make if [[ $? != 0 ]]; then @@ -22,6 +24,7 @@ if [[ $? != 0 ]]; then exit fi +# Run tests echo "TTRTS: Running tests" ./test/ttrts-test if [[ $? != 0 ]]; then @@ -29,6 +32,7 @@ if [[ $? != 0 ]]; then exit fi +# Generate maps echo "TTRTS: Generating maps" ./../scripts/gen_maps.sh "$PWD/gen/ttrts-gen" if [[ $? != 0 ]]; then @@ -38,14 +42,15 @@ fi # Copy these maps into parent directory cp -rf maps .. +# Move binaries echo "TTRTS: Moving binaries" cd .. -if [ ! -e build/ttrts/ttrts ]; then +if [ ! -e build/client/ttrts ]; then echo "TTRTS: No TTRTS Binary found, something has gone wrong" exit fi -cp build/ttrts/ttrts . +cp build/client/ttrts . chmod a+x ttrts echo "TTRTS: Bootstrap complete" diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 1f5def4..76cbf07 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -30,7 +30,7 @@ add_definitions( # Subprojects add_subdirectory( ttrts ) -add_subdirectory( game ) +add_subdirectory( client ) # Auxhilary binaries add_subdirectory( test ) diff --git a/source/client/CMakeLists.txt b/source/client/CMakeLists.txt new file mode 100644 index 0000000..81fdf72 --- /dev/null +++ b/source/client/CMakeLists.txt @@ -0,0 +1,34 @@ +# ====================== ttrts ======================= +# Project name +project( ttrts-client ) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ../maths + ../ttrts +) + +# Add the sources +set( SOURCES + main.cpp +) + +# Add the executable +add_executable( ${PROJECT_NAME} ${SOURCES} ) + +# Set our output name to ttrts +set_target_properties( ${PROJECT_NAME} PROPERTIES OUTPUT_NAME ttrts ) + +# dependent on main ttrts libary +target_link_libraries( ${PROJECT_NAME} ttrts ) + +# Installation target +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" +) + +add_dependencies(${PROJECT_NAME} ttrts-client-usage) \ No newline at end of file diff --git a/source/ttrts/README.md b/source/client/README.md similarity index 100% rename from source/ttrts/README.md rename to source/client/README.md diff --git a/source/ttrts/main.cpp b/source/client/main.cpp similarity index 100% rename from source/ttrts/main.cpp rename to source/client/main.cpp diff --git a/source/ttrts/version.h b/source/client/version.h similarity index 100% rename from source/ttrts/version.h rename to source/client/version.h diff --git a/source/game/CMakeLists.txt b/source/game/CMakeLists.txt deleted file mode 100644 index 2ed80ff..0000000 --- a/source/game/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.7) - -# game project -project( game ) - -include_directories( - ../maths -) - -# Add the sources -set( SOURCES - game.cpp - unit.cpp - order.cpp -) - -add_library( game ${SOURCES} ) \ No newline at end of file diff --git a/source/gen/CMakeLists.txt b/source/gen/CMakeLists.txt index 5d17de9..ef75c4a 100644 --- a/source/gen/CMakeLists.txt +++ b/source/gen/CMakeLists.txt @@ -3,7 +3,7 @@ project( ttrts-gen ) include_directories( - ../game + ../ttrts ../maths ) @@ -14,7 +14,7 @@ set( SOURCES # Add the executable add_executable( ttrts-gen ${SOURCES} ) -target_link_libraries( ttrts-gen game ) +target_link_libraries( ttrts-gen ttrts ) # Run the gen_usage script to generate our usage header add_custom_target( diff --git a/source/test/CMakeLists.txt b/source/test/CMakeLists.txt index 3779ca8..179f7a8 100644 --- a/source/test/CMakeLists.txt +++ b/source/test/CMakeLists.txt @@ -4,7 +4,7 @@ project( ttrts-test ) include_directories( - ../game + ../ttrts ../maths ) @@ -15,4 +15,4 @@ set( SOURCES # Add the executable add_executable( ttrts-test ${SOURCES} ) -target_link_libraries( ttrts-test game ) +target_link_libraries( ttrts-test ttrts ) diff --git a/source/ttrts/CMakeLists.txt b/source/ttrts/CMakeLists.txt index 19d01ea..f77fc63 100644 --- a/source/ttrts/CMakeLists.txt +++ b/source/ttrts/CMakeLists.txt @@ -1,30 +1,19 @@ -# ====================== ttrts ======================= -# Project name +cmake_minimum_required(VERSION 2.8.7) + +# Main ttrts library project( ttrts ) +# Include the maths include_directories( - ${CMAKE_CURRENT_BINARY_DIR} ../maths - ../game ) -# Add the sources -set( SOURCES - main.cpp +# Add our sources +set( SOURCES + game.cpp + unit.cpp + order.cpp ) -# Add the executable -add_executable( ${PROJECT_NAME} ${SOURCES} ) - -target_link_libraries( ${PROJECT_NAME} game ) - -# Installation target -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" -) - -add_dependencies(${PROJECT_NAME} ttrts-client-usage) \ No newline at end of file +# Add this library +add_library( ttrts ${SOURCES} ) \ No newline at end of file diff --git a/source/game/game.cpp b/source/ttrts/game.cpp similarity index 100% rename from source/game/game.cpp rename to source/ttrts/game.cpp diff --git a/source/game/game.h b/source/ttrts/game.h similarity index 100% rename from source/game/game.h rename to source/ttrts/game.h diff --git a/source/game/gametypes.h b/source/ttrts/gametypes.h similarity index 100% rename from source/game/gametypes.h rename to source/ttrts/gametypes.h diff --git a/source/game/order.cpp b/source/ttrts/order.cpp similarity index 100% rename from source/game/order.cpp rename to source/ttrts/order.cpp diff --git a/source/game/order.h b/source/ttrts/order.h similarity index 100% rename from source/game/order.h rename to source/ttrts/order.h diff --git a/source/game/orderunitpair.h b/source/ttrts/orderunitpair.h similarity index 100% rename from source/game/orderunitpair.h rename to source/ttrts/orderunitpair.h diff --git a/source/game/unit.cpp b/source/ttrts/unit.cpp similarity index 100% rename from source/game/unit.cpp rename to source/ttrts/unit.cpp diff --git a/source/game/unit.h b/source/ttrts/unit.h similarity index 100% rename from source/game/unit.h rename to source/ttrts/unit.h