From 5f80f1b76af0f46f2042b15cc9989329204cb169 Mon Sep 17 00:00:00 2001 From: Brendan LE GLAUNEC Date: Fri, 20 May 2016 17:02:33 +0200 Subject: [PATCH] Add dependencies & improve readme --- CMakeLists.txt | 4 + README.md | 9 +- deps/CMakeLists.txt | 23 ++++++ .../deps.jsoncpp-build.cmake | 20 +++++ .../deps.jsoncpp-configure.cmake | 20 +++++ .../deps.jsoncpp-download-err.log | 0 .../deps.jsoncpp-download-out.log | 1 + .../deps.jsoncpp-download.cmake | 20 +++++ .../deps.jsoncpp-gitinfo.txt | 3 + .../src/deps.jsoncpp-stamp/deps.jsoncpp-mkdir | 0 deps/jsoncpp/tmp/deps.jsoncpp-cfgcmd.txt | 1 + deps/jsoncpp/tmp/deps.jsoncpp-cfgcmd.txt.in | 1 + deps/jsoncpp/tmp/deps.jsoncpp-gitclone.cmake | 82 +++++++++++++++++++ 13 files changed, 183 insertions(+), 1 deletion(-) create mode 100644 deps/CMakeLists.txt create mode 100644 deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-build.cmake create mode 100644 deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-configure.cmake create mode 100644 deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-download-err.log create mode 100644 deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-download-out.log create mode 100644 deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-download.cmake create mode 100644 deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-gitinfo.txt create mode 100644 deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-mkdir create mode 100644 deps/jsoncpp/tmp/deps.jsoncpp-cfgcmd.txt create mode 100644 deps/jsoncpp/tmp/deps.jsoncpp-cfgcmd.txt.in create mode 100644 deps/jsoncpp/tmp/deps.jsoncpp-gitclone.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 7712166..e07e4f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,9 @@ set(CMAKE_MACOSX_RPATH 1) # list of all cache managers set (CAMERADAR_CACHE_MANAGERS "") +# dependencies directory +set(DEPS_DIR ${CMAKE_SOURCE_DIR}/deps) + # output path for cache managers set (CCTV_CACHE_MANAGER_OUTPUT_FOLDER cache_managers) set (CCTV_CACHE_MANAGER_OUTPUT_PATH ${CMAKE_BINARY_DIR}/${CCTV_CACHE_MANAGER_OUTPUT_FOLDER}) @@ -44,5 +47,6 @@ include_directories ( ) #build cache managers +add_subdirectory (deps) add_subdirectory (cameradar_standalone) add_subdirectory (cache_managers) diff --git a/README.md b/README.md index 2fcd8ed..f0de86f 100644 --- a/README.md +++ b/README.md @@ -30,10 +30,17 @@ Of course, you can also call for individual tasks if you plug in a Database to C ## Installation +### Dependencies + +To install Cameradar you will need these packages + +* cmake (`cmake`) +* gstreamer1.x (`libgstreamer1.0-dev`) + The simplest way would be to follow these steps : 1. `git clone git@github.com:EtixLabs/cameradar.git` -2. Go into the Cameradar repository, create a directory named `build` +2. Go into the Cameradar repository, create a directory named `build` and go in it 3. In the build directory, run `cmake ..` This will generate the Makefiles you need to build Cameradar 4. Run the command `make` 5. This should compile Cameradar. Go into the `cameradar_standalone` directory diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt new file mode 100644 index 0000000..7d56105 --- /dev/null +++ b/deps/CMakeLists.txt @@ -0,0 +1,23 @@ +## Copyright 2016 Etix Labs +## +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. + +cmake_minimum_required (VERSION 2.8.1) + +# Lib subdirectory + +include (jsoncpp) +# include (boost) + +set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM ON) +set (CCTV_INSTALL_DEPENDENCIES ${CCTV_INSTALL_DEPENDENCIES} PARENT_SCOPE) diff --git a/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-build.cmake b/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-build.cmake new file mode 100644 index 0000000..e9030d5 --- /dev/null +++ b/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-build.cmake @@ -0,0 +1,20 @@ + + +set(command "/usr/bin/make") +execute_process( + COMMAND ${command} + RESULT_VARIABLE result + OUTPUT_FILE "/home/ullaakut/Work/cameradar/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-build-out.log" + ERROR_FILE "/home/ullaakut/Work/cameradar/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-build-err.log" + ) +if(result) + set(msg "Command failed: ${result}\n") + foreach(arg IN LISTS command) + set(msg "${msg} '${arg}'") + endforeach() + set(msg "${msg}\nSee also\n /home/ullaakut/Work/cameradar/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-build-*.log") + message(FATAL_ERROR "${msg}") +else() + set(msg "deps.jsoncpp build command succeeded. See also /home/ullaakut/Work/cameradar/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-build-*.log") + message(STATUS "${msg}") +endif() diff --git a/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-configure.cmake b/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-configure.cmake new file mode 100644 index 0000000..0dc32a8 --- /dev/null +++ b/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-configure.cmake @@ -0,0 +1,20 @@ + + +set(command "/usr/bin/cmake;-DCMAKE_INSTALL_PREFIX=/home/ullaakut/Work/cameradar/deps/jsoncpp;-DBUILD_TYPE=Release;-DBUILD_STATIC_LIBS=OFF;-DBUILD_SHARED_LIBS=ON;-DJSONCPP_WITH_TESTS=OFF;-DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF;/home/ullaakut/Work/cameradar/deps/jsoncpp/src/deps.jsoncpp") +execute_process( + COMMAND ${command} + RESULT_VARIABLE result + OUTPUT_FILE "/home/ullaakut/Work/cameradar/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-configure-out.log" + ERROR_FILE "/home/ullaakut/Work/cameradar/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-configure-err.log" + ) +if(result) + set(msg "Command failed: ${result}\n") + foreach(arg IN LISTS command) + set(msg "${msg} '${arg}'") + endforeach() + set(msg "${msg}\nSee also\n /home/ullaakut/Work/cameradar/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-configure-*.log") + message(FATAL_ERROR "${msg}") +else() + set(msg "deps.jsoncpp configure command succeeded. See also /home/ullaakut/Work/cameradar/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-configure-*.log") + message(STATUS "${msg}") +endif() diff --git a/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-download-err.log b/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-download-err.log new file mode 100644 index 0000000..e69de29 diff --git a/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-download-out.log b/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-download-out.log new file mode 100644 index 0000000..57f217e --- /dev/null +++ b/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-download-out.log @@ -0,0 +1 @@ +Cloning into 'deps.jsoncpp'... diff --git a/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-download.cmake b/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-download.cmake new file mode 100644 index 0000000..237bce4 --- /dev/null +++ b/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-download.cmake @@ -0,0 +1,20 @@ + + +set(command "/usr/bin/cmake;-P;/home/ullaakut/Work/cameradar/deps/jsoncpp/tmp/deps.jsoncpp-gitclone.cmake") +execute_process( + COMMAND ${command} + RESULT_VARIABLE result + OUTPUT_FILE "/home/ullaakut/Work/cameradar/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-download-out.log" + ERROR_FILE "/home/ullaakut/Work/cameradar/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-download-err.log" + ) +if(result) + set(msg "Command failed: ${result}\n") + foreach(arg IN LISTS command) + set(msg "${msg} '${arg}'") + endforeach() + set(msg "${msg}\nSee also\n /home/ullaakut/Work/cameradar/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-download-*.log") + message(FATAL_ERROR "${msg}") +else() + set(msg "deps.jsoncpp download command succeeded. See also /home/ullaakut/Work/cameradar/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-download-*.log") + message(STATUS "${msg}") +endif() diff --git a/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-gitinfo.txt b/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-gitinfo.txt new file mode 100644 index 0000000..1e374c9 --- /dev/null +++ b/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-gitinfo.txt @@ -0,0 +1,3 @@ +repository='https://github.com/open-source-parsers/jsoncpp.git' +module='' +tag='' diff --git a/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-mkdir b/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-mkdir new file mode 100644 index 0000000..e69de29 diff --git a/deps/jsoncpp/tmp/deps.jsoncpp-cfgcmd.txt b/deps/jsoncpp/tmp/deps.jsoncpp-cfgcmd.txt new file mode 100644 index 0000000..31a9b68 --- /dev/null +++ b/deps/jsoncpp/tmp/deps.jsoncpp-cfgcmd.txt @@ -0,0 +1 @@ +cmd='/usr/bin/cmake;-DCMAKE_INSTALL_PREFIX=/home/ullaakut/Work/cameradar/deps/jsoncpp;-DBUILD_TYPE=Release;-DBUILD_STATIC_LIBS=OFF;-DBUILD_SHARED_LIBS=ON;-DJSONCPP_WITH_TESTS=OFF;-DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF;' diff --git a/deps/jsoncpp/tmp/deps.jsoncpp-cfgcmd.txt.in b/deps/jsoncpp/tmp/deps.jsoncpp-cfgcmd.txt.in new file mode 100644 index 0000000..b3f09ef --- /dev/null +++ b/deps/jsoncpp/tmp/deps.jsoncpp-cfgcmd.txt.in @@ -0,0 +1 @@ +cmd='@cmd@' diff --git a/deps/jsoncpp/tmp/deps.jsoncpp-gitclone.cmake b/deps/jsoncpp/tmp/deps.jsoncpp-gitclone.cmake new file mode 100644 index 0000000..346dc0d --- /dev/null +++ b/deps/jsoncpp/tmp/deps.jsoncpp-gitclone.cmake @@ -0,0 +1,82 @@ +if("master" STREQUAL "") + message(FATAL_ERROR "Tag for git checkout should not be empty.") +endif() + +set(run 0) + +if("/home/ullaakut/Work/cameradar/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-gitinfo.txt" IS_NEWER_THAN "/home/ullaakut/Work/cameradar/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-gitclone-lastrun.txt") + set(run 1) +endif() + +if(NOT run) + message(STATUS "Avoiding repeated git clone, stamp file is up to date: '/home/ullaakut/Work/cameradar/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-gitclone-lastrun.txt'") + return() +endif() + +execute_process( + COMMAND ${CMAKE_COMMAND} -E remove_directory "/home/ullaakut/Work/cameradar/deps/jsoncpp/src/deps.jsoncpp" + RESULT_VARIABLE error_code + ) +if(error_code) + message(FATAL_ERROR "Failed to remove directory: '/home/ullaakut/Work/cameradar/deps/jsoncpp/src/deps.jsoncpp'") +endif() + +# try the clone 3 times incase there is an odd git clone issue +set(error_code 1) +set(number_of_tries 0) +while(error_code AND number_of_tries LESS 3) + execute_process( + COMMAND "/usr/bin/git" clone "https://github.com/open-source-parsers/jsoncpp.git" "deps.jsoncpp" + WORKING_DIRECTORY "/home/ullaakut/Work/cameradar/deps/jsoncpp/src" + RESULT_VARIABLE error_code + ) + math(EXPR number_of_tries "${number_of_tries} + 1") +endwhile() +if(number_of_tries GREATER 1) + message(STATUS "Had to git clone more than once: + ${number_of_tries} times.") +endif() +if(error_code) + message(FATAL_ERROR "Failed to clone repository: 'https://github.com/open-source-parsers/jsoncpp.git'") +endif() + +execute_process( + COMMAND "/usr/bin/git" checkout master + WORKING_DIRECTORY "/home/ullaakut/Work/cameradar/deps/jsoncpp/src/deps.jsoncpp" + RESULT_VARIABLE error_code + ) +if(error_code) + message(FATAL_ERROR "Failed to checkout tag: 'master'") +endif() + +execute_process( + COMMAND "/usr/bin/git" submodule init + WORKING_DIRECTORY "/home/ullaakut/Work/cameradar/deps/jsoncpp/src/deps.jsoncpp" + RESULT_VARIABLE error_code + ) +if(error_code) + message(FATAL_ERROR "Failed to init submodules in: '/home/ullaakut/Work/cameradar/deps/jsoncpp/src/deps.jsoncpp'") +endif() + +execute_process( + COMMAND "/usr/bin/git" submodule update --recursive + WORKING_DIRECTORY "/home/ullaakut/Work/cameradar/deps/jsoncpp/src/deps.jsoncpp" + RESULT_VARIABLE error_code + ) +if(error_code) + message(FATAL_ERROR "Failed to update submodules in: '/home/ullaakut/Work/cameradar/deps/jsoncpp/src/deps.jsoncpp'") +endif() + +# Complete success, update the script-last-run stamp file: +# +execute_process( + COMMAND ${CMAKE_COMMAND} -E copy + "/home/ullaakut/Work/cameradar/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-gitinfo.txt" + "/home/ullaakut/Work/cameradar/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-gitclone-lastrun.txt" + WORKING_DIRECTORY "/home/ullaakut/Work/cameradar/deps/jsoncpp/src/deps.jsoncpp" + RESULT_VARIABLE error_code + ) +if(error_code) + message(FATAL_ERROR "Failed to copy script-last-run stamp file: '/home/ullaakut/Work/cameradar/deps/jsoncpp/src/deps.jsoncpp-stamp/deps.jsoncpp-gitclone-lastrun.txt'") +endif() +