Re-organise source directory and targets

ttrts -> client
game -> ttrts
This commit is contained in:
Marc Di Luzio 2014-12-30 13:24:19 +00:00
parent 415361ac9c
commit d9b9f3d7dd
18 changed files with 58 additions and 47 deletions

View file

@ -1,11 +1,12 @@
#! /bin/bash #! /bin/bash
# Double check # Double check for cmakelist
if [ ! -e "source/CMakeLists.txt" ]; then if [ ! -e "source/CMakeLists.txt" ]; then
echo "TTRTS: No source cmakelist found" echo "TTRTS: No source cmakelist found"
exit exit
fi fi
# Run cmake
echo "TTRTS: Running cmake" echo "TTRTS: Running cmake"
test ! -e build && mkdir build test ! -e build && mkdir build
cd build/ cd build/
@ -15,6 +16,7 @@ if [[ $? != 0 ]]; then
exit exit
fi fi
# Run make
echo "TTRTS: Running make" echo "TTRTS: Running make"
make make
if [[ $? != 0 ]]; then if [[ $? != 0 ]]; then
@ -22,6 +24,7 @@ if [[ $? != 0 ]]; then
exit exit
fi fi
# Run tests
echo "TTRTS: Running tests" echo "TTRTS: Running tests"
./test/ttrts-test ./test/ttrts-test
if [[ $? != 0 ]]; then if [[ $? != 0 ]]; then
@ -29,6 +32,7 @@ if [[ $? != 0 ]]; then
exit exit
fi fi
# Generate maps
echo "TTRTS: Generating maps" echo "TTRTS: Generating maps"
./../scripts/gen_maps.sh "$PWD/gen/ttrts-gen" ./../scripts/gen_maps.sh "$PWD/gen/ttrts-gen"
if [[ $? != 0 ]]; then if [[ $? != 0 ]]; then
@ -38,14 +42,15 @@ fi
# Copy these maps into parent directory # Copy these maps into parent directory
cp -rf maps .. cp -rf maps ..
# Move binaries
echo "TTRTS: Moving binaries" echo "TTRTS: Moving binaries"
cd .. cd ..
if [ ! -e build/ttrts/ttrts ]; then if [ ! -e build/client/ttrts ]; then
echo "TTRTS: No TTRTS Binary found, something has gone wrong" echo "TTRTS: No TTRTS Binary found, something has gone wrong"
exit exit
fi fi
cp build/ttrts/ttrts . cp build/client/ttrts .
chmod a+x ttrts chmod a+x ttrts
echo "TTRTS: Bootstrap complete" echo "TTRTS: Bootstrap complete"

View file

@ -30,7 +30,7 @@ add_definitions(
# Subprojects # Subprojects
add_subdirectory( ttrts ) add_subdirectory( ttrts )
add_subdirectory( game ) add_subdirectory( client )
# Auxhilary binaries # Auxhilary binaries
add_subdirectory( test ) add_subdirectory( test )

View file

@ -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)

View file

@ -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} )

View file

@ -3,7 +3,7 @@
project( ttrts-gen ) project( ttrts-gen )
include_directories( include_directories(
../game ../ttrts
../maths ../maths
) )
@ -14,7 +14,7 @@ set( SOURCES
# Add the executable # Add the executable
add_executable( ttrts-gen ${SOURCES} ) 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 # Run the gen_usage script to generate our usage header
add_custom_target( add_custom_target(

View file

@ -4,7 +4,7 @@
project( ttrts-test ) project( ttrts-test )
include_directories( include_directories(
../game ../ttrts
../maths ../maths
) )
@ -15,4 +15,4 @@ set( SOURCES
# Add the executable # Add the executable
add_executable( ttrts-test ${SOURCES} ) add_executable( ttrts-test ${SOURCES} )
target_link_libraries( ttrts-test game ) target_link_libraries( ttrts-test ttrts )

View file

@ -1,30 +1,19 @@
# ====================== ttrts ======================= cmake_minimum_required(VERSION 2.8.7)
# Project name
# Main ttrts library
project( ttrts ) project( ttrts )
# Include the maths
include_directories( include_directories(
${CMAKE_CURRENT_BINARY_DIR}
../maths ../maths
../game
) )
# Add the sources # Add our sources
set( SOURCES set( SOURCES
main.cpp game.cpp
unit.cpp
order.cpp
) )
# Add the executable # Add this library
add_executable( ${PROJECT_NAME} ${SOURCES} ) add_library( ttrts ${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)