# CMakeLists files in this project can
# refer to the root source directory of the project as ${HELLO_SOURCE_DIR} and
# to the root binary directory of the project as ${HELLO_BINARY_DIR}.
cmake_minimum_required (VERSION 2.8.11)

project (Domo)

set(EXECUTABLE_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/build/bin")
set(LIBRARY_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/build/lib")
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake-modules/")

add_subdirectory (3P)
add_subdirectory (lib)
add_subdirectory (src)


add_custom_target (deploy
	COMMAND echo "Deploying to ${PI}"

	COMMAND mkdir -p  ${CMAKE_SOURCE_DIR}/build/install
	COMMAND mkdir -p  ${CMAKE_SOURCE_DIR}/build/install/bin/
	COMMAND mkdir -p  ${CMAKE_SOURCE_DIR}/build/install/lib/
	COMMAND mkdir -p  ${CMAKE_SOURCE_DIR}/build/install/rsc/

	#COMMAND cp ${CMAKE_SOURCE_DIR}/scripts/Domo.sh ${CMAKE_SOURCE_DIR}/build/install
	COMMAND cp ${CMAKE_SOURCE_DIR}/build/bin/* ${CMAKE_SOURCE_DIR}/build/install/bin/
	COMMAND cp ${CMAKE_SOURCE_DIR}/build/lib/*.so ${CMAKE_SOURCE_DIR}/build/install/lib/
	COMMAND cp -a ${CMAKE_SOURCE_DIR}/build/html ${CMAKE_SOURCE_DIR}/build/install/

	COMMAND rsync -av --delete ${CMAKE_SOURCE_DIR}/build/install/* root@${PI}:/opt/Domo/

	COMMAND rsync -av --delete ${CMAKE_SOURCE_DIR}/src/data/* root@${PI}:/home/rpi/domo/
)
