Merge pull request #178 from ZoneMinder/cmake
Add cmake to ZoneMinder thanks to @mastertheknife
This commit is contained in:
commit
ff4b2c0908
30
.travis.yml
30
.travis.yml
|
@ -9,13 +9,17 @@ env:
|
|||
- LD_LIBRARY_PATH="/usr/local/lib:/opt/libjpeg-turbo/lib:$LD_LIBRARY_PATH"
|
||||
- DEB_HOST_GNU_TYPE=$(dpkg-architecture -qDEB_HOST_GNU_TYPE)
|
||||
- DEB_BUILD_GNU_TYPE=$(dpkg-architecture -qDEB_BUILD_GNU_TYPE)
|
||||
- CXXFLAGS=" -DZM_FFMPEG_CVS -DHAVE_LIBCRYPTO -msse2 -I/usr/local/include"
|
||||
- CFLAGS="-DZM_FFMPEG_CVS -DHAVE_LIBCRYPTO -I/usr/local/include"
|
||||
- CXXFLAGS="$CFLAGS"
|
||||
matrix:
|
||||
- ZM_BUILDMETHOD=cmake
|
||||
- ZM_BUILDMETHOD=autotools
|
||||
compiler:
|
||||
- gcc
|
||||
before_install:
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get upgrade -y -qq
|
||||
- sudo apt-get install -y -qq apache2 mysql-server php5 php5-mysql build-essential libmysqlclient-dev libssl-dev libbz2-dev libpcre3-dev libdbi-perl libarchive-zip-perl libdate-manip-perl libdevice-serialport-perl libmime-perl libpcre3 libwww-perl libdbd-mysql-perl libsys-mmap-perl yasm subversion automake autoconf libjpeg-turbo8-dev libjpeg-turbo8 apache2-mpm-prefork libapache2-mod-php5 php5-cli libtheora-dev libvorbis-dev libvpx-dev libx264-dev 2>&1 > /dev/null
|
||||
- sudo apt-get install -y -qq apache2 mysql-server php5 php5-mysql build-essential libmysqlclient-dev libssl-dev libbz2-dev libpcre3-dev libdbi-perl libarchive-zip-perl libdate-manip-perl libdevice-serialport-perl libmime-perl libpcre3 libwww-perl libdbd-mysql-perl libsys-mmap-perl yasm subversion automake autoconf cmake libjpeg-turbo8-dev libjpeg-turbo8 apache2-mpm-prefork libapache2-mod-php5 php5-cli libtheora-dev libvorbis-dev libvpx-dev libx264-dev 2>&1 > /dev/null
|
||||
install:
|
||||
- git clone --depth=10 --branch=master git://source.ffmpeg.org/ffmpeg.git
|
||||
- cd ffmpeg
|
||||
|
@ -25,17 +29,19 @@ install:
|
|||
- sudo make install-libs
|
||||
before_script:
|
||||
- cd $TRAVIS_BUILD_DIR
|
||||
- libtoolize --force
|
||||
- aclocal
|
||||
- autoheader
|
||||
- automake --force-missing --add-missing
|
||||
- autoconf
|
||||
- mysql -e 'create database zm;'
|
||||
- if [ "$ZM_BUILDMETHOD" = "autotools" ]; then libtoolize --force; fi
|
||||
- if [ "$ZM_BUILDMETHOD" = "autotools" ]; then aclocal; fi
|
||||
- if [ "$ZM_BUILDMETHOD" = "autotools" ]; then autoheader; fi
|
||||
- if [ "$ZM_BUILDMETHOD" = "autotools" ]; then automake --force-missing --add-missing; fi
|
||||
- if [ "$ZM_BUILDMETHOD" = "autotools" ]; then autoconf; fi
|
||||
script:
|
||||
- CXXFLAGS="$CXXFLAGS" ./configure --with-libarch=lib/$DEB_HOST_GNU_TYPE --disable-debug --host=$DEB_HOST_GNU_TYPE --build=$DEB_BUILD_GNU_TYPE --with-mysql=/usr --with-webdir=/var/www/zm --with-ffmpeg=/usr --with-cgidir=/usr/lib/cgi-bin --with-webuser=www-data --with-webgroup=www-data --enable-crashtrace=no --enable-mmap=yes ZM_SSL_LIB=openssl ZM_DB_USER=travis ZM_DB_PASS='' ZM_DB_NAME=zm
|
||||
- if [ "$ZM_BUILDMETHOD" = "autotools" ]; then ./configure --prefix=/usr --with-libarch=lib/$DEB_HOST_GNU_TYPE --host=$DEB_HOST_GNU_TYPE --build=$DEB_BUILD_GNU_TYPE --with-mysql=/usr --with-ffmpeg=/usr --with-webdir=/usr/share/zoneminder/www --with-cgidir=/usr/libexec/zoneminder/cgi-bin --with-webuser=www-data --with-webgroup=www-data --enable-crashtrace=yes --disable-debug --enable-mmap=yes ZM_SSL_LIB=openssl ZM_DB_USER="travis"; fi
|
||||
- if [ "$ZM_BUILDMETHOD" = "cmake" ]; then cmake -DCMAKE_INSTALL_PREFIX="/usr" -DZM_DB_USER="travis"; fi
|
||||
- make
|
||||
- sed -i 's/zmpass//' zm.conf
|
||||
- sudo make install
|
||||
- mysql -u travis < db/zm_create.sql
|
||||
- mysql -u travis zm < db/test.monitor.sql
|
||||
after_success:
|
||||
- if [ "$ZM_BUILDMETHOD" = "cmake" ]; then sudo ./zmlinkcontent.sh; fi
|
||||
- mysql -e "SET PASSWORD FOR travis = PASSWORD('zmpass')"
|
||||
- mysql -utravis -pzmpass < db/zm_create.sql
|
||||
- mysql -utravis -pzmpass zm < db/test.monitor.sql
|
||||
- sudo zmpkg.pl start
|
||||
|
|
|
@ -0,0 +1,364 @@
|
|||
# Main CMake file for the ZoneMinder project.
|
||||
# Created by mastertheknife (Kfir Itzhak)
|
||||
# The goal is to ease up the installation of zoneminder.
|
||||
# Our current installation method (using autotools) is outdated, slow and breaks now and then.
|
||||
# The CMake installation method will require no parameters at all, default should sufficient and reliable.
|
||||
# It will be still possible to install ZoneMinder using autotools, they don't conflict with each other. The cmake way is a complete re-write (different syntax) and aims to be identical to the autotools way,
|
||||
# by having options using the same name and leaving ZM totally unmodified, while providing exactly the same things that ZM expects (config.h, configuration in *.in files, etc).
|
||||
#
|
||||
# For more information and installation, see the INSTALL file
|
||||
#
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
project (ZoneMinder)
|
||||
# ZoneMinder version
|
||||
set(ZoneMinder_VERSION "1.26.3")
|
||||
# Default build type. To change the build type, use the CMAKE_BUILD_TYPE configuration option.
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type: Release or Debug" FORCE)
|
||||
endif(NOT CMAKE_BUILD_TYPE)
|
||||
|
||||
# Can make finding problems easier when troubleshooting.
|
||||
#set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||
#set(CMAKE_INSTALL_ALWAYS ON)
|
||||
|
||||
# Default CLFAGS and CXXFLAGS:
|
||||
set(CMAKE_C_FLAGS_RELEASE "-Wall -D__STDC_CONSTANT_MACROS -O2")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-Wall -D__STDC_CONSTANT_MACROS -O2")
|
||||
set(CMAKE_C_FLAGS_DEBUG "-Wall -D__STDC_CONSTANT_MACROS -g")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -D__STDC_CONSTANT_MACROS -g")
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
|
||||
# Modules that we need:
|
||||
include (GNUInstallDirs)
|
||||
include (CheckIncludeFile)
|
||||
include (CheckIncludeFiles)
|
||||
include (CheckFunctionExists)
|
||||
include (CheckPrototypeDefinition)
|
||||
include (CheckTypeSize)
|
||||
include (CheckStructHasMember)
|
||||
|
||||
# Default variables for some configuration options
|
||||
mark_as_advanced(FORCE ZM_EXTRA_LIBS ZM_MYSQL_ENGINE ZM_NO_MMAP ZM_NO_CRASHTRACE CMAKE_INSTALL_FULL_BINDIR)
|
||||
set(ZM_RUNDIR "/var/run/zm" CACHE PATH "Location of transient process files, default: /var/run/zm")
|
||||
set(ZM_TMPDIR "/tmp/zm" CACHE PATH "Location of temporary files, default: /tmp/zm")
|
||||
set(ZM_LOGDIR "/var/log/zm" CACHE PATH "Location of generated log files, default: /var/log/zm")
|
||||
set(ZM_WEBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/zoneminder/www" CACHE PATH "Location of the web files, default: <prefix>/${CMAKE_INSTALL_DATADIR}/zoneminder/www")
|
||||
set(ZM_CGIDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBEXECDIR}/zoneminder/cgi-bin" CACHE PATH "Location of the cgi-bin files, default: <prefix>/${CMAKE_INSTALL_LIBEXECDIR}/zoneminder/cgi-bin")
|
||||
set(ZM_CONTENTDIR "/var/lib/zoneminder" CACHE PATH "Location of dynamic content (events and images), default: /var/lib/zoneminder")
|
||||
# This one is not needed anymore. we do automatic detection of whats available, let ZM know and have ZM decide
|
||||
#set(ZM_SSL_LIB "openssl" CACHE STRING "Library to use for ssl functions, default: openssl")
|
||||
set(ZM_DB_HOST "localhost" CACHE STRING "Hostname where ZoneMinder database located, default: localhost")
|
||||
set(ZM_DB_NAME "zm" CACHE STRING "Name of ZoneMinder database, default: zm")
|
||||
set(ZM_DB_USER "zmuser" CACHE STRING "Name of ZoneMinder database user, default: zmuser")
|
||||
set(ZM_DB_PASS "zmpass" CACHE STRING "Password of ZoneMinder database user, default: zmpass")
|
||||
set(ZM_WEB_USER "" CACHE STRING "The user apache or the local web server runs on. Leave empty for automatic detection. If that fails, you can use this variable to force")
|
||||
set(ZM_WEB_GROUP "" CACHE STRING "The group apache or the local web server runs on, Leave empty to be the same as the web user")
|
||||
# Advanced
|
||||
set(ZM_EXTRA_LIBS "" CACHE STRING "A list of optional libraries, separated by space, e.g. libpng")
|
||||
set(ZM_MYSQL_ENGINE "InnoDB" CACHE STRING "MySQL engine to use with database, default: InnoDB")
|
||||
set(ZM_NO_MMAP "OFF" CACHE BOOL "Set to ON to not use mmap shared memory. Shouldn't be enabled unless you experience problems with the shared memory. default: OFF")
|
||||
set(ZM_NO_CRASHTRACE "OFF" CACHE BOOL "Set to ON to skip crash trace code. Useful if zm_signal.cpp fails to compile. default: OFF")
|
||||
# Only required for cmakecacheimport:
|
||||
set(CMAKE_INSTALL_FULL_BINDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}" CACHE PATH "Override default binary directory")
|
||||
|
||||
# Required for certain checks to work
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} stdio.h stdlib.h math.h signal.h)
|
||||
# Required for including headers from the this folder
|
||||
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
|
||||
# This is required to enable searching in lib64 (if exists), do not change
|
||||
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ON)
|
||||
|
||||
# Check for misc required stuff
|
||||
check_include_file("linux/videodev.h" HAVE_LINUX_VIDEODEV_H)
|
||||
check_include_file("linux/videodev2.h" HAVE_LINUX_VIDEODEV2_H)
|
||||
check_include_file("execinfo.h" HAVE_EXECINFO_H)
|
||||
check_include_file("sys/sendfile.h" HAVE_SYS_SENDFILE_H)
|
||||
check_include_file("sys/syscall.h" HAVE_SYS_SYSCALL_H)
|
||||
check_function_exists("sendfile" HAVE_SENDFILE)
|
||||
check_function_exists("backtrace" HAVE_DECL_BACKTRACE)
|
||||
check_function_exists("posix_memalign" HAVE_POSIX_MEMALIGN)
|
||||
check_function_exists("strsignal" HAVE_STRSIGNAL)
|
||||
check_prototype_definition("round" "double round (double x)" "0.0" "math.h" HAVE_DECL_ROUND)
|
||||
check_type_size("siginfo_t" SIGINFO_T)
|
||||
check_type_size("ucontext_t" UCONTEXT_T)
|
||||
check_type_size("struct sigcontext" STRUCT_SIGCONTEXT)
|
||||
check_struct_has_member("struct sigcontext" eip signal.h HAVE_STRUCT_SIGCONTEXT_EIP)
|
||||
|
||||
# *** LIBRARY CHECKS ***
|
||||
|
||||
# zlib
|
||||
find_package(ZLIB)
|
||||
if(ZLIB_FOUND)
|
||||
set(HAVE_LIBZLIB 1)
|
||||
list(APPEND ZM_BIN_LIBS ${ZLIB_LIBRARIES})
|
||||
include_directories(${ZLIB_INCLUDE_DIR})
|
||||
check_include_file("zlib.h" HAVE_ZLIB_H)
|
||||
else(ZLIB_FOUND)
|
||||
message(FATAL_ERROR "zm requires zlib but it was not found on your system")
|
||||
endif(ZLIB_FOUND)
|
||||
|
||||
# jpeg
|
||||
find_package(JPEG)
|
||||
if(JPEG_FOUND)
|
||||
set(HAVE_LIBJPEG 1)
|
||||
list(APPEND ZM_BIN_LIBS ${JPEG_LIBRARIES})
|
||||
include_directories(${JPEG_INCLUDE_DIR})
|
||||
check_include_files("stdio.h;jpeglib.h" HAVE_JPEGLIB_H)
|
||||
#link_directories(${JPEG_LIBRARY})
|
||||
else(JPEG_FOUND)
|
||||
message(FATAL_ERROR "zm requires jpeg but it was not found on your system")
|
||||
endif(JPEG_FOUND)
|
||||
|
||||
# OpenSSL
|
||||
find_package(OpenSSL)
|
||||
if(OPENSSL_FOUND)
|
||||
set(HAVE_LIBOPENSSL 1)
|
||||
list(APPEND ZM_BIN_LIBS ${OPENSSL_LIBRARIES})
|
||||
include_directories(${OPENSSL_INCLUDE_DIR})
|
||||
check_include_file("openssl/md5.h" HAVE_OPENSSL_MD5_H)
|
||||
endif(OPENSSL_FOUND)
|
||||
# crypto using find_library.
|
||||
# This library should be a part of the OpenSSL package but just need to be sure
|
||||
# In any case, we still need to define HAVE_LIBCRYPTO for zm if its available
|
||||
find_library(CRYPTO_LIBRARIES crypto)
|
||||
if(CRYPTO_LIBRARIES)
|
||||
set(HAVE_LIBCRYPTO 1)
|
||||
list(APPEND ZM_BIN_LIBS ${CRYPTO_LIBRARIES})
|
||||
endif(CRYPTO_LIBRARIES)
|
||||
|
||||
# pthread using find_library
|
||||
find_library(PTHREAD_LIBRARIES pthread)
|
||||
if(PTHREAD_LIBRARIES)
|
||||
set(HAVE_LIBPTHREAD 1)
|
||||
list(APPEND ZM_BIN_LIBS ${PTHREAD_LIBRARIES})
|
||||
check_include_file("pthread.h" HAVE_PTHREAD_H)
|
||||
else(PTHREAD_LIBRARIES)
|
||||
message(FATAL_ERROR "zm requires pthread but it was not found on your system")
|
||||
endif(PTHREAD_LIBRARIES)
|
||||
|
||||
# pcre using find_library
|
||||
find_library(PCRE_LIBRARIES pcre)
|
||||
if(PCRE_LIBRARIES)
|
||||
set(HAVE_LIBPCRE 1)
|
||||
list(APPEND ZM_BIN_LIBS ${PCRE_LIBRARIES})
|
||||
check_include_file("pcre.h" HAVE_PCRE_H)
|
||||
endif(PCRE_LIBRARIES)
|
||||
|
||||
# gcrypt using find_library
|
||||
find_library(GCRYPT_LIBRARIES gcrypt)
|
||||
if(GCRYPT_LIBRARIES)
|
||||
set(HAVE_LIBGCRYPT 1)
|
||||
list(APPEND ZM_BIN_LIBS ${GCRYPT_LIBRARIES})
|
||||
check_include_file("gcrypt.h" HAVE_GCRYPT_H)
|
||||
else(GCRYPT_LIBRARIES)
|
||||
message(FATAL_ERROR "zm requires gcrypt but it was not found on your system")
|
||||
endif(GCRYPT_LIBRARIES)
|
||||
|
||||
# gnutls using find_library
|
||||
find_library(GNUTLS_LIBRARIES gnutls)
|
||||
if(GNUTLS_LIBRARIES)
|
||||
set(HAVE_LIBGNUTLS 1)
|
||||
list(APPEND ZM_BIN_LIBS ${GNUTLS_LIBRARIES})
|
||||
check_include_file("gnutls/openssl.h" HAVE_GNUTLS_OPENSSL_H)
|
||||
check_include_file("gnutls/gnutls.h" HAVE_GNUTLS_GNUTLS_H)
|
||||
#else(GNUTLS_LIBRARIES)
|
||||
# message(FATAL_ERROR "zm requires gnutls but it was not found on your system")
|
||||
endif(GNUTLS_LIBRARIES)
|
||||
|
||||
# mysqlclient using find_library
|
||||
find_library(MYSQLCLIENT_LIBRARIES mysqlclient PATH_SUFFIXES mysql)
|
||||
if(MYSQLCLIENT_LIBRARIES)
|
||||
set(HAVE_LIBMYSQLCLIENT 1)
|
||||
list(APPEND ZM_BIN_LIBS ${MYSQLCLIENT_LIBRARIES})
|
||||
check_include_file("mysql/mysql.h" HAVE_MYSQL_H)
|
||||
else(MYSQLCLIENT_LIBRARIES)
|
||||
message(FATAL_ERROR "zm requires mysqlclient but it was not found on your system")
|
||||
endif(MYSQLCLIENT_LIBRARIES)
|
||||
|
||||
# avformat using find_library
|
||||
find_library(AVFORMAT_LIBRARIES avformat)
|
||||
if(AVFORMAT_LIBRARIES)
|
||||
set(HAVE_LIBAVFORMAT 1)
|
||||
list(APPEND ZM_BIN_LIBS ${AVFORMAT_LIBRARIES})
|
||||
check_include_file("libavformat/avformat.h" HAVE_LIBAVFORMAT_AVFORMAT_H)
|
||||
endif(AVFORMAT_LIBRARIES)
|
||||
|
||||
# avcodec using find_library
|
||||
find_library(AVCODEC_LIBRARIES avcodec)
|
||||
if(AVCODEC_LIBRARIES)
|
||||
set(HAVE_LIBAVCODEC 1)
|
||||
list(APPEND ZM_BIN_LIBS ${AVCODEC_LIBRARIES})
|
||||
check_include_file("libavcodec/avcodec.h" HAVE_LIBAVCODEC_AVCODEC_H)
|
||||
endif(AVCODEC_LIBRARIES)
|
||||
|
||||
# avdevice using find_library
|
||||
find_library(AVDEVICE_LIBRARIES avdevice)
|
||||
if(AVDEVICE_LIBRARIES)
|
||||
set(HAVE_LIBAVDEVICE 1)
|
||||
list(APPEND ZM_BIN_LIBS ${AVDEVICE_LIBRARIES})
|
||||
check_include_file("libavdevice/avdevice.h" HAVE_LIBAVDEVICE_AVDEVICE_H)
|
||||
endif(AVDEVICE_LIBRARIES)
|
||||
|
||||
# avutil using find_library
|
||||
find_library(AVUTIL_LIBRARIES avutil)
|
||||
if(AVUTIL_LIBRARIES)
|
||||
set(HAVE_LIBAVUTIL 1)
|
||||
list(APPEND ZM_BIN_LIBS ${AVUTIL_LIBRARIES})
|
||||
check_include_file("libavutil/avutil.h" HAVE_LIBAVUTIL_AVUTIL_H)
|
||||
check_include_file("libavutil/mathematics.h" HAVE_LIBAVUTIL_MATHEMATICS_H)
|
||||
endif(AVUTIL_LIBRARIES)
|
||||
|
||||
# swscale using find_library
|
||||
find_library(SWSCALE_LIBRARIES swscale)
|
||||
if(SWSCALE_LIBRARIES)
|
||||
set(HAVE_LIBSWSCALE 1)
|
||||
list(APPEND ZM_BIN_LIBS ${SWSCALE_LIBRARIES})
|
||||
check_include_file("libswscale/swscale.h" HAVE_LIBSWSCALE_SWSCALE_H)
|
||||
endif(SWSCALE_LIBRARIES)
|
||||
|
||||
# *** END OF LIBRARY CHECKS ***
|
||||
|
||||
# Check for gnutls or crypto
|
||||
if((NOT HAVE_LIBCRYPTO) AND (NOT HAVE_LIBGNUTLS))
|
||||
message(FATAL_ERROR " zm requires crypto or gnutls but none were found on your system")
|
||||
endif((NOT HAVE_LIBCRYPTO) AND (NOT HAVE_LIBGNUTLS))
|
||||
|
||||
# Check for absolutely required headers:
|
||||
if(NOT HAVE_MYSQL_H)
|
||||
message(FATAL_ERROR "zm requires MySQL headers - check that MySQL development packages are installed")
|
||||
endif(NOT HAVE_MYSQL_H)
|
||||
if(NOT HAVE_JPEGLIB_H)
|
||||
message(FATAL_ERROR " zm requires libjpeg headers - check that libjpeg development packages are installed")
|
||||
endif(NOT HAVE_JPEGLIB_H)
|
||||
if(NOT HAVE_PTHREAD_H)
|
||||
message(FATAL_ERROR " zm requires pthread headers - check that pthread development packages are installed")
|
||||
endif(NOT HAVE_PTHREAD_H)
|
||||
|
||||
# Check for V4L header files and enable ZM_HAS_V4L, ZM_HAS_V4L1, ZM_HAS_V4L2 accordingly
|
||||
# Setting to zeros first is required because ZM uses #define for these
|
||||
set(ZM_HAS_V4L 0)
|
||||
set(ZM_HAS_V4L1 0)
|
||||
set(ZM_HAS_V4L2 0)
|
||||
if(HAVE_LINUX_VIDEODEV_H)
|
||||
set(ZM_HAS_V4L 1)
|
||||
set(ZM_HAS_V4L1 1)
|
||||
endif(HAVE_LINUX_VIDEODEV_H)
|
||||
if(HAVE_LINUX_VIDEODEV2_H)
|
||||
set(ZM_HAS_V4L 1)
|
||||
set(ZM_HAS_V4L2 1)
|
||||
endif(HAVE_LINUX_VIDEODEV2_H)
|
||||
if((NOT HAVE_LINUX_VIDEODEV_H) AND (NOT HAVE_LINUX_VIDEODEV2_H))
|
||||
message(AUTHOR_WARNING " Video 4 Linux headers weren't found - Analog and USB camera support will not be available")
|
||||
endif((NOT HAVE_LINUX_VIDEODEV_H) AND (NOT HAVE_LINUX_VIDEODEV2_H))
|
||||
# Check for PCRE and enable ZM_PCRE accordingly
|
||||
set(ZM_PCRE 0)
|
||||
if(HAVE_LIBPCRE AND HAVE_PCRE_H)
|
||||
set(ZM_PCRE 1)
|
||||
endif(HAVE_LIBPCRE AND HAVE_PCRE_H)
|
||||
|
||||
|
||||
# Check for authenication functions
|
||||
if(HAVE_OPENSSL_MD5_H)
|
||||
check_prototype_definition(MD5 "unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md)" "NULL" "openssl/md5.h" HAVE_MD5_OPENSSL)
|
||||
endif(HAVE_OPENSSL_MD5_H)
|
||||
if(HAVE_GNUTLS_OPENSSL_H)
|
||||
check_prototype_definition(MD5 "unsigned char *MD5 (const unsigned char *buf, unsigned long len, unsigned char *md)" "NULL" "gnutls/openssl.h" HAVE_MD5_GNUTLS)
|
||||
endif(HAVE_GNUTLS_OPENSSL_H)
|
||||
if(HAVE_GNUTLS_GNUTLS_H)
|
||||
check_prototype_definition(gnutls_fingerprint "int gnutls_fingerprint (gnutls_digest_algorithm_t algo, const gnutls_datum_t * data, void *result, size_t * result_size)" "0" "stdlib.h;gnutls/gnutls.h" HAVE_DECL_GNUTLS_FINGERPRINT)
|
||||
endif(HAVE_GNUTLS_GNUTLS_H)
|
||||
if(HAVE_MD5_OPENSSL OR HAVE_MD5_GNUTLS)
|
||||
set(HAVE_DECL_MD5 1)
|
||||
else(HAVE_MD5_OPENSSL OR HAVE_MD5_GNUTLS)
|
||||
message(AUTHOR_WARNING " ZM requires a working MD5 function for hashed authenication but none were found - hashed authenication will not be available")
|
||||
endif(HAVE_MD5_OPENSSL OR HAVE_MD5_GNUTLS)
|
||||
# Dirty fix for zm_user only using openssl's md5 if gnutls and gcrypt are not available.
|
||||
# This needs to be fixed in zm_user.[h,cpp] but such fix will also require changes to configure.ac
|
||||
if(HAVE_LIBCRYPTO AND HAVE_OPENSSL_MD5_H AND HAVE_MD5_OPENSSL)
|
||||
set(HAVE_GCRYPT_H 0)
|
||||
set(HAVE_GNUTLS_OPENSSL_H 0)
|
||||
endif(HAVE_LIBCRYPTO AND HAVE_OPENSSL_MD5_H AND HAVE_MD5_OPENSSL)
|
||||
|
||||
# Disable backtrace if not available
|
||||
if((NOT ZM_NO_CRASHTRACE) AND ((NOT HAVE_DECL_BACKTRACE) OR (NOT HAVE_EXECINFO_H)))
|
||||
message(AUTHOR_WARNING " Backtrace is not available. disabling")
|
||||
set(ZM_NO_CRASHTRACE ON)
|
||||
set(HAVE_EXECINFO_H 0)
|
||||
set(HAVE_DECL_BACKTRACE 0)
|
||||
endif((NOT ZM_NO_CRASHTRACE) AND ((NOT HAVE_DECL_BACKTRACE) OR (NOT HAVE_EXECINFO_H)))
|
||||
|
||||
|
||||
if(NOT ZM_NO_MMAP)
|
||||
set(ZM_MMAP_PERLPACKAGE "Sys::Mmap")
|
||||
endif(NOT ZM_NO_MMAP)
|
||||
# Check for Perl. Version checking is removed because its ignored before CMake 2.8.8 and it seems that Perl is being detected as 5.16. instead of 5.6.0 ??
|
||||
find_package(Perl)
|
||||
if(NOT PERL_FOUND)
|
||||
message(FATAL_ERROR "zm requires Perl 5.6.0 or newer but it was not found on your system")
|
||||
endif(NOT PERL_FOUND)
|
||||
# Checking for perl modules requires FindPerlModules.cmake
|
||||
# Check all required modules at once
|
||||
# TODO: Add checking for the optional modules
|
||||
find_package(PerlModules COMPONENTS Sys::Syslog DBI DBD::mysql Getopt::Long Time::HiRes Date::Manip LWP::UserAgent ExtUtils::MakeMaker ${ZM_MMAP_PERLPACKAGE})
|
||||
if(NOT PERLMODULES_FOUND)
|
||||
message(FATAL_ERROR "Not all required perl modules were found on your system")
|
||||
endif(NOT PERLMODULES_FOUND)
|
||||
|
||||
# Attempt to check which user apache (or other web server) runs on by searching for a user beginning with apache or www and then cutting the user from the first matching user line
|
||||
if(ZM_WEB_USER STREQUAL "")
|
||||
# Check for a user matching ^apache and cut the username from the userline in the first match
|
||||
file(STRINGS "/etc/passwd" userline_apache REGEX "^apache")
|
||||
file(STRINGS "/etc/passwd" userline_www REGEX "^www")
|
||||
if(NOT (userline_apache STREQUAL ""))
|
||||
execute_process(COMMAND echo ${userline_apache} COMMAND cut -d: -f1 OUTPUT_VARIABLE ZM_WEB_USER OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
elseif(NOT (userline_www STREQUAL ""))
|
||||
execute_process(COMMAND echo ${userline_www} COMMAND cut -d: -f1 OUTPUT_VARIABLE ZM_WEB_USER OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
endif(NOT (userline_apache STREQUAL ""))
|
||||
message(STATUS "Detected web server user: ${ZM_WEB_USER}")
|
||||
endif(ZM_WEB_USER STREQUAL "")
|
||||
# Check if webgroup contains anything. If not, use the web user as the web group
|
||||
if(NOT ZM_WEB_GROUP)
|
||||
set(ZM_WEB_GROUP ${ZM_WEB_USER})
|
||||
endif(NOT ZM_WEB_GROUP)
|
||||
message(STATUS "Using web user: ${ZM_WEB_USER}")
|
||||
message(STATUS "Using web group: ${ZM_WEB_GROUP}")
|
||||
|
||||
# Some variables that zm expects
|
||||
set(ZM_PID "${ZM_RUNDIR}/zm.pid")
|
||||
set(ZM_CONFIG "/${CMAKE_INSTALL_SYSCONFDIR}/zm.conf")
|
||||
set(VERSION "${ZoneMinder_VERSION}")
|
||||
set(PATH_BUILD "${PROJECT_SOURCE_DIR}")
|
||||
set(TIME_BUILD "1000000") # Don't have a solution for this one yet
|
||||
set(BINDIR "${CMAKE_INSTALL_FULL_BINDIR}")
|
||||
set(LIBDIR "${CMAKE_INSTALL_FULL_LIBDIR}")
|
||||
set(SYSCONFDIR "/${CMAKE_INSTALL_SYSCONFDIR}")
|
||||
set(WEB_PREFIX "${ZM_WEBDIR}")
|
||||
set(CGI_PREFIX "${ZM_CGIDIR}")
|
||||
set(WEB_USER "${ZM_WEB_USER}")
|
||||
set(WEB_GROUP "${ZM_WEB_GROUP}")
|
||||
|
||||
# Generate files from the .in files
|
||||
configure_file(zoneminder-config.cmake config.h @ONLY)
|
||||
configure_file(zm.conf.in zm.conf @ONLY)
|
||||
configure_file(zmconfgen.pl.in zmconfgen.pl @ONLY)
|
||||
configure_file(zmlinkcontent.sh.in zmlinkcontent.sh @ONLY)
|
||||
|
||||
# Process subdirectories
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(scripts)
|
||||
add_subdirectory(db)
|
||||
add_subdirectory(misc)
|
||||
add_subdirectory(web)
|
||||
|
||||
# Run ZM configuration generator
|
||||
message(STATUS "Running ZoneMinder configuration generator")
|
||||
execute_process(COMMAND perl ./zmconfgen.pl RESULT_VARIABLE zmconfgen_result)
|
||||
if(zmconfgen_result EQUAL 0)
|
||||
message(STATUS "ZoneMinder configuration generator completed successfully")
|
||||
else(zmconfgen_result EQUAL 0)
|
||||
message(FATAL_ERROR "ZoneMinder configuration generator failed. Exit code: ${zmconfgen_result}")
|
||||
endif(zmconfgen_result EQUAL 0)
|
||||
|
||||
# Install zm.conf
|
||||
install(FILES zm.conf DESTINATION "/${CMAKE_INSTALL_SYSCONFDIR}")
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
Installing ZoneMinder with cmake
|
||||
--------------------------------
|
||||
Starting with ZoneMinder 1.26.4, ZoneMinder can now be installed using cmake. This requires cmake version 2.6 or newer.
|
||||
cmake is an alternative to the autotools collection (libtool, autoconf, automake, autoheader and such). Its more recent and has many advantages, including, but not limited to:
|
||||
* One program (cmake) instead of multiple. (libtool, autoconf, automake, etc)
|
||||
* One file per directory (CMakeLists.txt) instead of multiple. (configure.ac, Makefile.am and sometimes more)
|
||||
* One syntax (cmake's syntax) instead of multiple. (bash and m4)
|
||||
* Generation of makefiles for many platforms, including Windows.
|
||||
* Newer than autotools and is being actively developed.
|
||||
* Generates colored makefiles with progress indicator.
|
||||
* Slightly faster because its based on C and not bash.
|
||||
|
||||
At this point, its still possible to use autotools for the ZoneMinder project. Choosing cmake or autotools is now a matter of preference.
|
||||
Hopefully in the future, cmake will become the default way to install ZoneMinder.
|
||||
|
||||
Important differences
|
||||
---------------------
|
||||
* Unlike the autotools way, the cmake way does not require any options. It attempts to detect some things by its own (system directories, libarch, web user and group) and uses defaults for others (installation paths and such).
|
||||
* Unlike the autotools way, which links the binaries to a fixed list of libraries, the cmake way only links to libraries that it found on the system. If a library is not found, but required, a fatal error will be shown during the configuration step.
|
||||
* Unlike the autotools way, the cmake way does not modify the system in any way it shouldnt. It only does what its supposed to do: Install files to your system. Nothing else and nothing leaks out of the DESTDIR environment variable (if used). This means that depending on your configuration, there might be an extra required step after installation: to link WEB_PATH/events and WEB_PATH/images folders to the correct places.
|
||||
* Currently there is no "make uninstall" target for cmake. However, its possible to do this manually. The file install_manifest.txt contains the list of files installed to the system. This can be used in many ways to delete all files installed by cmake, such as: xargs rm < install_manifest.txt
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
cmake by default does not require any parameters, but its possible to override the defaults with the options below.
|
||||
|
||||
Configuration can be done in 4 ways:
|
||||
1) As a command line parameter, e.g. cmake -DCMAKE_VERBOSE_MAKEFILE=ON .
|
||||
2) Using cmake-gui
|
||||
4) Providing cmake with an initial cache file with the -C option
|
||||
4) By editing the cache file CMakeCache.txt (after it has been generated) - Not recommended
|
||||
|
||||
Possible configuration options:
|
||||
ZM_RUNDIR Location of transient process files, default: /var/run/zm
|
||||
ZM_TMPDIR Location of temporary files, default: /tmp/zm
|
||||
ZM_LOGDIR Location of generated log files, default: /var/log/zm
|
||||
ZM_WEBDIR Location of the web files, default: <prefix>/share/zoneminder/www
|
||||
ZM_CGIDIR Location of the cgi-bin files, default: <prefix>/libexec/zoneminder/cgi-bin
|
||||
ZM_CONTENTDIR Location of dynamic content (events and images), default: /var/lib/zoneminder
|
||||
ZM_DB_HOST Hostname where ZoneMinder database located, default: localhost
|
||||
ZM_DB_NAME Name of ZoneMinder database, default: zm
|
||||
ZM_DB_USER Name of ZoneMinder database user, default: zmuser
|
||||
ZM_DB_PASS Password of ZoneMinder database user, default: zmpass
|
||||
ZM_WEB_USER The user apache or the local web server runs on. Leave empty for automatic detection. If that fails, you can use this variable to force
|
||||
ZM_WEB_GROUP The group apache or the local web server runs on, Leave empty to be the same as the web user
|
||||
Advanced:
|
||||
ZM_EXTRA_LIBS A list of optional libraries, separated by space, e.g. libpng
|
||||
ZM_MYSQL_ENGINE MySQL engine to use with database, default: InnoDB
|
||||
ZM_NO_MMAP Set to ON to not use mmap shared memory. Shouldn't be enabled unless you experience problems with the shared memory. default: OFF
|
||||
ZM_NO_CRASHTRACE Set to ON to skip crash trace code. Useful if zm_signal.cpp fails to compile. default: OFF
|
||||
|
||||
|
||||
Useful configuration options provided by cmake:
|
||||
CMAKE_VERBOSE_MAKEFILE - Set this to ON (default OFF) to see what cmake is doing. Very useful for troubleshooting.
|
||||
CMAKE_BUILD_TYPE - Set this to Debug (default Release) to build ZoneMinder with debugging enabled.
|
||||
CMAKE_INSTALL_PREFIX - Use this to change the prefix (default /usr/local). This option behaves like --prefix from autoconf. Package maintainers will probably want to set this to "/usr".
|
||||
CMAKE_INCLUDE_PATH - Use this to change the include search path.
|
||||
CMAKE_LIBRARY_PATH - Use this to change the library search path.
|
||||
Also see CMAKE_PREFIX_PATH for overriding both and some others.
|
||||
|
||||
CFLAGS, CPPFLAGS and other environment variables:
|
||||
To append to the CFLAGS and CXXFLAGS, please use the CFLAGS and CXXFLAGS environment variables.
|
||||
Or use the CMAKE_C_FLAGS and CMAKE_CXX_FLAGS configuration options.
|
||||
To replace the CFLAGS and CXXFLAGS entirely:
|
||||
* For the Release build type: use CMAKE_C_FLAGS_RELEASE for the CFLAGS and CMAKE_CXX_FLAGS_RELEASE for the CXXFLAGS
|
||||
* For the Debug build type: use CMAKE_C_FLAGS_DEBUG for the CFLAGS and CMAKE_CXX_FLAGS_DEBUG for the CXXFLAGS
|
||||
Other important environment variables (such as LDFLAGS) are also supported.
|
||||
|
||||
The DESTDIR environment variable is also supported.
|
||||
For more information about DESTDIR, see:
|
||||
* http://www.gnu.org/prep/standards/html_node/DESTDIR.html
|
||||
|
||||
Basic steps for installing ZoneMinder on a fresh system
|
||||
-------------------------------------------------------
|
||||
1) After installing all the required dependencies, in the project directory, run "cmake [extra options] ."
|
||||
This behaves like ./configure. It is also possible to supply configuration options, e.g. cmake -DZM_DB_PASS="mypass" .
|
||||
2) Run "make" to compile ZoneMinder
|
||||
3) Run "make install" (as root, or use sudo) to install ZoneMinder to your system.
|
||||
4) Create a directory for the content and the necessary symlinks by running zmlinkcontent.sh with the directory you want to use. e.g. ./zmlinkcontent.sh /nfs/zm
|
||||
5) Create a database for zoneminder, called "zm".
|
||||
6) Create a user for the zoneminder database, called zmuser with password and full privileges to the "zm" database.
|
||||
NOTE: The database server, database name, user and password can be different and adjusted during configuration step with the options in this file, or by editing /etc/zm.conf
|
||||
7) Populate the zoneminder database using the script zm_create.sql. This should be found in <prefix>/share/zoneminder/db or in the project/db directory.
|
||||
|
||||
8) Create an apache virtual host for ZoneMinder. Make sure to use the same paths as ZM_WEBDIR and ZM_CGIDIR in /etc/zm.conf
|
||||
9) Create other config if desired (e.g. rsyslog, logrotate and such). Some of this can be found in <prefix>/share/zoneminder/misc or project/misc directory
|
||||
10) Setup an init script for your system. Its also possible to use "zmpkg.pl start" and "zmpkg.pl stop" if you can't find a one.
|
||||
|
||||
Basic steps for upgrading ZoneMinder
|
||||
------------------------------------
|
||||
1) If you wish to use the same paths and configuration as the currently installed ZoneMinder, you need to provide cmake with options that match your current installation.
|
||||
You can provide those options in the command line to cmake, e.g. cmake -DZM_DB_PASS="blah" -DZM_WEBDIR="/usr/local/share/zoneminder/www" -DCMAKE_INSTALL_FULL_BINDIR="/usr/bin" .
|
||||
Or alternatively, for convenience, use the cmakecacheimport.sh script. This reads a zoneminder configuration file (zm.conf) and creates a cmake initial cache file called zm_conf.cmake, which you can then provide to cmake.
|
||||
For example:
|
||||
./cmakecacheimport.sh /etc/zm.conf
|
||||
cmake -C zm_conf.cmake [extra options] .
|
||||
|
||||
2) Run "make" to compile ZoneMinder
|
||||
3) Run "make install" (as root, or use sudo) to install ZoneMinder to your system.
|
||||
4) Depending on your configuration: If the DIR_EVENTS and DIR_IMAGES options are set to default (pointing to web directory/events and web directory/images), You will need to update the symlinks in the web directory to the correct folders. e.g. web directory/events should point to the real events directory, and likewise for the images directory.
|
||||
You can use the zmlinkcontent.sh script for this. For example, if /var/lib/zoneminder is the folder that contains the "images" and "events" directories, you can use:
|
||||
./zmlinkcontent.sh /var/lib/zoneminder
|
||||
By default, the content directory for new installations is /var/lib/zoneminder. This can be overridden in cmake with the ZM_CONTENTDIR option. e.g. cmake -DZM_CONTENTDIR="/some/big/storage/zm" .
|
||||
|
||||
5) Run zmupdate.pl to update the database layout to the new version.
|
||||
|
||||
Contributions:
|
||||
--------------
|
||||
Please visit our GitHub at http://github.com/ZoneMinder/ZoneMinder
|
||||
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
@CHECK_PROTOTYPE_DEFINITION_HEADER@
|
||||
|
||||
static void cmakeRequireSymbol(int dummy, ...) {
|
||||
(void) dummy;
|
||||
}
|
||||
|
||||
static void checkSymbol(void) {
|
||||
#ifndef @CHECK_PROTOTYPE_DEFINITION_SYMBOL@
|
||||
cmakeRequireSymbol(0, &@CHECK_PROTOTYPE_DEFINITION_SYMBOL@);
|
||||
#endif
|
||||
}
|
||||
|
||||
@CHECK_PROTOTYPE_DEFINITION_PROTO@ {
|
||||
return @CHECK_PROTOTYPE_DEFINITION_RETURN@;
|
||||
}
|
||||
|
||||
#ifdef __CLASSIC_C__
|
||||
int main() {
|
||||
int ac;
|
||||
char*av[];
|
||||
#else
|
||||
int main(int ac, char *av[]) {
|
||||
#endif
|
||||
checkSymbol();
|
||||
if (ac > 1000) {
|
||||
return *av[0];
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
# - Check if the protoype we expect is correct.
|
||||
# check_prototype_definition(FUNCTION PROTOTYPE RETURN HEADER VARIABLE)
|
||||
# FUNCTION - The name of the function (used to check if prototype exists)
|
||||
# PROTOTYPE- The prototype to check.
|
||||
# RETURN - The return value of the function.
|
||||
# HEADER - The header files required.
|
||||
# VARIABLE - The variable to store the result.
|
||||
# Example:
|
||||
# check_prototype_definition(getpwent_r
|
||||
# "struct passwd *getpwent_r(struct passwd *src, char *buf, int buflen)"
|
||||
# "NULL"
|
||||
# "unistd.h;pwd.h"
|
||||
# SOLARIS_GETPWENT_R)
|
||||
# The following variables may be set before calling this macro to
|
||||
# modify the way the check is run:
|
||||
#
|
||||
# CMAKE_REQUIRED_FLAGS = string of compile command line flags
|
||||
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
|
||||
# CMAKE_REQUIRED_INCLUDES = list of include directories
|
||||
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2005-2009 Kitware, Inc.
|
||||
# Copyright 2010-2011 Andreas Schneider <asn@cryptomilk.org>
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
#
|
||||
|
||||
|
||||
get_filename_component(__check_proto_def_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
|
||||
|
||||
function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIABLE)
|
||||
|
||||
if ("${_VARIABLE}" MATCHES "^${_VARIABLE}$")
|
||||
set(CHECK_PROTOTYPE_DEFINITION_CONTENT "/* */\n")
|
||||
|
||||
set(CHECK_PROTOTYPE_DEFINITION_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
||||
if (CMAKE_REQUIRED_LIBRARIES)
|
||||
set(CHECK_PROTOTYPE_DEFINITION_LIBS
|
||||
LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
|
||||
else()
|
||||
set(CHECK_PROTOTYPE_DEFINITION_LIBS)
|
||||
endif()
|
||||
if (CMAKE_REQUIRED_INCLUDES)
|
||||
set(CMAKE_SYMBOL_EXISTS_INCLUDES
|
||||
"-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
|
||||
else()
|
||||
set(CMAKE_SYMBOL_EXISTS_INCLUDES)
|
||||
endif()
|
||||
|
||||
foreach(_FILE ${_HEADER})
|
||||
set(CHECK_PROTOTYPE_DEFINITION_HEADER
|
||||
"${CHECK_PROTOTYPE_DEFINITION_HEADER}#include <${_FILE}>\n")
|
||||
endforeach()
|
||||
|
||||
set(CHECK_PROTOTYPE_DEFINITION_SYMBOL ${_FUNCTION})
|
||||
set(CHECK_PROTOTYPE_DEFINITION_PROTO ${_PROTOTYPE})
|
||||
set(CHECK_PROTOTYPE_DEFINITION_RETURN ${_RETURN})
|
||||
|
||||
configure_file("${__check_proto_def_dir}/CheckPrototypeDefinition.c.in"
|
||||
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckPrototypeDefinition.c" @ONLY)
|
||||
|
||||
file(READ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckPrototypeDefinition.c _SOURCE)
|
||||
|
||||
try_compile(${_VARIABLE}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckPrototypeDefinition.c
|
||||
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
|
||||
${CHECK_PROTOTYPE_DEFINITION_LIBS}
|
||||
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CHECK_PROTOTYPE_DEFINITION_FLAGS}
|
||||
"${CMAKE_SYMBOL_EXISTS_INCLUDES}"
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
|
||||
if (${_VARIABLE})
|
||||
set(${_VARIABLE} 1 CACHE INTERNAL "Have correct prototype for ${_FUNCTION}")
|
||||
message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - True")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Determining if the prototype ${_FUNCTION} exists for ${_VARIABLE} passed with the following output:\n"
|
||||
"${OUTPUT}\n\n")
|
||||
else ()
|
||||
message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - False")
|
||||
set(${_VARIABLE} 0 CACHE INTERNAL "Have correct prototype for ${_FUNCTION}")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
||||
"Determining if the prototype ${_FUNCTION} exists for ${_VARIABLE} failed with the following output:\n"
|
||||
"${OUTPUT}\n\n${_SOURCE}\n\n")
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
endfunction()
|
|
@ -0,0 +1,78 @@
|
|||
# - try to find perl modules, passed as COMPONENTS
|
||||
#
|
||||
# Non-cache variable you might use in your CMakeLists.txt:
|
||||
# PERLMODULES_FOUND
|
||||
#
|
||||
# Requires these CMake modules:
|
||||
# FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
|
||||
#
|
||||
# Original Author:
|
||||
# 2012 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
|
||||
# http://academic.cleardefinition.com
|
||||
# Iowa State University HCI Graduate Program/VRAC
|
||||
#
|
||||
# Copyright Iowa State University 2012.
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
if(NOT PERL_FOUND)
|
||||
find_package(Perl QUIET)
|
||||
endif()
|
||||
|
||||
set(_deps_check)
|
||||
if(PERL_FOUND)
|
||||
foreach(module ${PerlModules_FIND_COMPONENTS})
|
||||
string(REPLACE "::" "/" modfilename "${module}.pm")
|
||||
string(REPLACE "::" "_" modvarname "PERLMODULES_${module}_MODULE")
|
||||
string(TOUPPER "${modvarname}" modvarname)
|
||||
list(APPEND _deps_check ${modvarname})
|
||||
if(NOT ${modvarname})
|
||||
if(NOT PerlModules_FIND_QUIETLY)
|
||||
message(STATUS "Checking for perl module ${module}")
|
||||
endif()
|
||||
execute_process(COMMAND
|
||||
"${PERL_EXECUTABLE}"
|
||||
"-e"
|
||||
"use ${module}; print \$INC{\"${modfilename}\"}"
|
||||
RESULT_VARIABLE result_code
|
||||
OUTPUT_VARIABLE filename
|
||||
ERROR_VARIABLE error_info
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(result_code EQUAL 0)
|
||||
if(NOT PerlModules_FIND_QUIETLY)
|
||||
message(STATUS
|
||||
"Checking for perl module ${module} - found at ${filename}")
|
||||
endif()
|
||||
set(${modvarname}
|
||||
"${filename}"
|
||||
CACHE
|
||||
FILEPATH
|
||||
"Location found for module ${module}"
|
||||
FORCE)
|
||||
mark_as_advanced(${modvarname})
|
||||
else()
|
||||
if(NOT PerlModules_FIND_QUIETLY)
|
||||
message(STATUS "Checking for perl module ${module} - failed")
|
||||
endif()
|
||||
set(${modvarname}
|
||||
"NOTFOUND"
|
||||
CACHE
|
||||
FILEPATH
|
||||
"No location found for module ${module}"
|
||||
FORCE)
|
||||
file(APPEND
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
||||
"Determining if the Perl module ${module} exists failed with the following error output:\n"
|
||||
"${error_info}\n\n")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(PerlModules
|
||||
DEFAULT_MSG
|
||||
PERL_FOUND
|
||||
${_deps_check})
|
||||
|
|
@ -0,0 +1,188 @@
|
|||
# - Define GNU standard installation directories
|
||||
# Provides install directory variables as defined for GNU software:
|
||||
# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
|
||||
# Inclusion of this module defines the following variables:
|
||||
# CMAKE_INSTALL_<dir> - destination for files of a given type
|
||||
# CMAKE_INSTALL_FULL_<dir> - corresponding absolute path
|
||||
# where <dir> is one of:
|
||||
# BINDIR - user executables (bin)
|
||||
# SBINDIR - system admin executables (sbin)
|
||||
# LIBEXECDIR - program executables (libexec)
|
||||
# SYSCONFDIR - read-only single-machine data (etc)
|
||||
# SHAREDSTATEDIR - modifiable architecture-independent data (com)
|
||||
# LOCALSTATEDIR - modifiable single-machine data (var)
|
||||
# LIBDIR - object code libraries (lib or lib64 or lib/<multiarch-tuple> on Debian)
|
||||
# INCLUDEDIR - C header files (include)
|
||||
# OLDINCLUDEDIR - C header files for non-gcc (/usr/include)
|
||||
# DATAROOTDIR - read-only architecture-independent data root (share)
|
||||
# DATADIR - read-only architecture-independent data (DATAROOTDIR)
|
||||
# INFODIR - info documentation (DATAROOTDIR/info)
|
||||
# LOCALEDIR - locale-dependent data (DATAROOTDIR/locale)
|
||||
# MANDIR - man documentation (DATAROOTDIR/man)
|
||||
# DOCDIR - documentation root (DATAROOTDIR/doc/PROJECT_NAME)
|
||||
# Each CMAKE_INSTALL_<dir> value may be passed to the DESTINATION options of
|
||||
# install() commands for the corresponding file type. If the includer does
|
||||
# not define a value the above-shown default will be used and the value will
|
||||
# appear in the cache for editing by the user.
|
||||
# Each CMAKE_INSTALL_FULL_<dir> value contains an absolute path constructed
|
||||
# from the corresponding destination by prepending (if necessary) the value
|
||||
# of CMAKE_INSTALL_PREFIX.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2011 Nikita Krupen'ko <krnekit@gmail.com>
|
||||
# Copyright 2011 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
# Installation directories
|
||||
#
|
||||
if(NOT DEFINED CMAKE_INSTALL_BINDIR)
|
||||
set(CMAKE_INSTALL_BINDIR "bin" CACHE PATH "user executables (bin)")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_INSTALL_SBINDIR)
|
||||
set(CMAKE_INSTALL_SBINDIR "sbin" CACHE PATH "system admin executables (sbin)")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_INSTALL_LIBEXECDIR)
|
||||
set(CMAKE_INSTALL_LIBEXECDIR "libexec" CACHE PATH "program executables (libexec)")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_INSTALL_SYSCONFDIR)
|
||||
set(CMAKE_INSTALL_SYSCONFDIR "etc" CACHE PATH "read-only single-machine data (etc)")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_INSTALL_SHAREDSTATEDIR)
|
||||
set(CMAKE_INSTALL_SHAREDSTATEDIR "com" CACHE PATH "modifiable architecture-independent data (com)")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_INSTALL_LOCALSTATEDIR)
|
||||
set(CMAKE_INSTALL_LOCALSTATEDIR "var" CACHE PATH "modifiable single-machine data (var)")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
|
||||
set(_LIBDIR_DEFAULT "lib")
|
||||
# Override this default 'lib' with 'lib64' iff:
|
||||
# - we are on Linux system but NOT cross-compiling
|
||||
# - we are NOT on debian
|
||||
# - we are on a 64 bits system
|
||||
# reason is: amd64 ABI: http://www.x86-64.org/documentation/abi.pdf
|
||||
# For Debian with multiarch, use 'lib/${CMAKE_LIBRARY_ARCHITECTURE}' if
|
||||
# CMAKE_LIBRARY_ARCHITECTURE is set (which contains e.g. "i386-linux-gnu"
|
||||
# See http://wiki.debian.org/Multiarch
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux"
|
||||
AND NOT CMAKE_CROSSCOMPILING)
|
||||
if (EXISTS "/etc/debian_version") # is this a debian system ?
|
||||
if(CMAKE_LIBRARY_ARCHITECTURE)
|
||||
set(_LIBDIR_DEFAULT "lib/${CMAKE_LIBRARY_ARCHITECTURE}")
|
||||
endif()
|
||||
else() # not debian, rely on CMAKE_SIZEOF_VOID_P:
|
||||
if(NOT DEFINED CMAKE_SIZEOF_VOID_P)
|
||||
message(AUTHOR_WARNING
|
||||
"Unable to determine default CMAKE_INSTALL_LIBDIR directory because no target architecture is known. "
|
||||
"Please enable at least one language before including GNUInstallDirs.")
|
||||
else()
|
||||
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
|
||||
set(_LIBDIR_DEFAULT "lib64")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
set(CMAKE_INSTALL_LIBDIR "${_LIBDIR_DEFAULT}" CACHE PATH "object code libraries (${_LIBDIR_DEFAULT})")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_INSTALL_INCLUDEDIR)
|
||||
set(CMAKE_INSTALL_INCLUDEDIR "include" CACHE PATH "C header files (include)")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_INSTALL_OLDINCLUDEDIR)
|
||||
set(CMAKE_INSTALL_OLDINCLUDEDIR "/usr/include" CACHE PATH "C header files for non-gcc (/usr/include)")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CMAKE_INSTALL_DATAROOTDIR)
|
||||
set(CMAKE_INSTALL_DATAROOTDIR "share" CACHE PATH "read-only architecture-independent data root (share)")
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Values whose defaults are relative to DATAROOTDIR. Store empty values in
|
||||
# the cache and store the defaults in local variables if the cache values are
|
||||
# not set explicitly. This auto-updates the defaults as DATAROOTDIR changes.
|
||||
|
||||
if(NOT CMAKE_INSTALL_DATADIR)
|
||||
set(CMAKE_INSTALL_DATADIR "" CACHE PATH "read-only architecture-independent data (DATAROOTDIR)")
|
||||
set(CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_DATAROOTDIR}")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_INSTALL_INFODIR)
|
||||
set(CMAKE_INSTALL_INFODIR "" CACHE PATH "info documentation (DATAROOTDIR/info)")
|
||||
set(CMAKE_INSTALL_INFODIR "${CMAKE_INSTALL_DATAROOTDIR}/info")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_INSTALL_LOCALEDIR)
|
||||
set(CMAKE_INSTALL_LOCALEDIR "" CACHE PATH "locale-dependent data (DATAROOTDIR/locale)")
|
||||
set(CMAKE_INSTALL_LOCALEDIR "${CMAKE_INSTALL_DATAROOTDIR}/locale")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_INSTALL_MANDIR)
|
||||
set(CMAKE_INSTALL_MANDIR "" CACHE PATH "man documentation (DATAROOTDIR/man)")
|
||||
set(CMAKE_INSTALL_MANDIR "${CMAKE_INSTALL_DATAROOTDIR}/man")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_INSTALL_DOCDIR)
|
||||
set(CMAKE_INSTALL_DOCDIR "" CACHE PATH "documentation root (DATAROOTDIR/doc/PROJECT_NAME)")
|
||||
set(CMAKE_INSTALL_DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME}")
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
mark_as_advanced(
|
||||
CMAKE_INSTALL_BINDIR
|
||||
CMAKE_INSTALL_SBINDIR
|
||||
CMAKE_INSTALL_LIBEXECDIR
|
||||
CMAKE_INSTALL_SYSCONFDIR
|
||||
CMAKE_INSTALL_SHAREDSTATEDIR
|
||||
CMAKE_INSTALL_LOCALSTATEDIR
|
||||
CMAKE_INSTALL_LIBDIR
|
||||
CMAKE_INSTALL_INCLUDEDIR
|
||||
CMAKE_INSTALL_OLDINCLUDEDIR
|
||||
CMAKE_INSTALL_DATAROOTDIR
|
||||
CMAKE_INSTALL_DATADIR
|
||||
CMAKE_INSTALL_INFODIR
|
||||
CMAKE_INSTALL_LOCALEDIR
|
||||
CMAKE_INSTALL_MANDIR
|
||||
CMAKE_INSTALL_DOCDIR
|
||||
)
|
||||
|
||||
# Result directories
|
||||
#
|
||||
foreach(dir
|
||||
BINDIR
|
||||
SBINDIR
|
||||
LIBEXECDIR
|
||||
SYSCONFDIR
|
||||
SHAREDSTATEDIR
|
||||
LOCALSTATEDIR
|
||||
LIBDIR
|
||||
INCLUDEDIR
|
||||
OLDINCLUDEDIR
|
||||
DATAROOTDIR
|
||||
DATADIR
|
||||
INFODIR
|
||||
LOCALEDIR
|
||||
MANDIR
|
||||
DOCDIR
|
||||
)
|
||||
if(NOT IS_ABSOLUTE ${CMAKE_INSTALL_${dir}})
|
||||
set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}")
|
||||
else()
|
||||
set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_${dir}}")
|
||||
endif()
|
||||
endforeach()
|
|
@ -0,0 +1,79 @@
|
|||
#!/bin/bash
|
||||
# The purpose of this file is to add entries from zm.conf to cmake's cache.
|
||||
|
||||
echo "*** This bash script imports configuration from zm.conf into cmake initial cache file"
|
||||
echo "*** The file can be used with cmake like so: cmake -C zm_conf.cmake [extra cmake options] ."
|
||||
echo "*** Usage: ./cmakecacheimport.sh [PATH TO ZM.CONF]"
|
||||
echo ""
|
||||
|
||||
# Check for too many prameters
|
||||
if [[ "$#" -gt "0" && "$#" -ne "1" ]]; then
|
||||
echo "Error: Too many parameters!"
|
||||
exit 50
|
||||
fi
|
||||
|
||||
# Check if zm.conf was supplied as an argument and that it exists
|
||||
if [ "$#" -eq "1" ]; then
|
||||
ZM_CONFIG="$1"
|
||||
if [ ! -f "$ZM_CONFIG" ]; then
|
||||
echo "The zoneminder configuration file $ZM_CONFIG does not exist!"
|
||||
exit 40
|
||||
fi
|
||||
fi
|
||||
|
||||
# Load zm.conf
|
||||
if [ -n "$ZM_CONFIG" ]; then
|
||||
echo "Using custom zm.conf $ZM_CONFIG"
|
||||
source "$ZM_CONFIG"
|
||||
elif [ -f "/etc/zm.conf" ]; then
|
||||
echo "Using system zm.conf"
|
||||
source "/etc/zm.conf"
|
||||
elif [ -f "zm.conf" ]; then
|
||||
echo "Using local zm.conf"
|
||||
source "zm.conf"
|
||||
else
|
||||
echo "Failed locating zoneminder configuration file (zm.conf)\nPlease specify the full path to the zoneminder configuration file"
|
||||
exit 45
|
||||
fi
|
||||
|
||||
# Create the file
|
||||
touch "zm_conf.cmake"
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "Failed creating zm_conf.cmake in the current directory"
|
||||
exit 10
|
||||
fi
|
||||
|
||||
# Print some information
|
||||
echo "Executables directory : $ZM_PATH_BIN"
|
||||
#echo "Libraries directory : $ZM_PATH_LIB"
|
||||
#echo "System config directory : $ZM_PATH_CONF"
|
||||
echo "Web directory : $ZM_PATH_WEB"
|
||||
echo "CGI directory : $ZM_PATH_CGI"
|
||||
echo "Web user : $ZM_WEB_USER"
|
||||
echo "Web group : $ZM_WEB_GROUP"
|
||||
echo "Database host : $ZM_DB_HOST"
|
||||
echo "Database name : $ZM_DB_NAME"
|
||||
echo "Database user : $ZM_DB_USER"
|
||||
echo "Database password : Not shown"
|
||||
|
||||
|
||||
CMPATH="CACHE PATH \"Imported by cmakecacheimport.sh\" FORCE"
|
||||
CMSTRING="CACHE STRING \"Imported by cmakecacheimport.sh\" FORCE"
|
||||
# Write
|
||||
echo "# Generated by cmakecacheimport.sh">zm_conf.cmake
|
||||
echo "set(CMAKE_INSTALL_FULL_BINDIR \"$ZM_PATH_BIN\" $CMPATH)">>zm_conf.cmake
|
||||
#echo "set(CMAKE_INSTALL_FULL_LIBDIR \"$ZM_PATH_LIB\" $CMPATH)">>zm_conf.cmake
|
||||
#echo "set(CMAKE_INSTALL_FULL_SYSCONFDIR \"$ZM_PATH_CONF\" $CMPATH)">>zm_conf.cmake
|
||||
echo "set(ZM_WEBDIR \"$ZM_PATH_WEB\" $CMPATH)">>zm_conf.cmake
|
||||
echo "set(ZM_CGIDIR \"$ZM_PATH_CGI\" $CMPATH)">>zm_conf.cmake
|
||||
echo "set(ZM_WEB_USER \"$ZM_WEB_USER\" $CMSTRING)">>zm_conf.cmake
|
||||
echo "set(ZM_WEB_GROUP \"$ZM_WEB_GROUP\" $CMSTRING)">>zm_conf.cmake
|
||||
echo "set(ZM_DB_HOST \"$ZM_DB_HOST\" $CMSTRING)">>zm_conf.cmake
|
||||
echo "set(ZM_DB_NAME \"$ZM_DB_NAME\" $CMSTRING)">>zm_conf.cmake
|
||||
echo "set(ZM_DB_USER \"$ZM_DB_USER\" $CMSTRING)">>zm_conf.cmake
|
||||
echo "set(ZM_DB_PASS \"$ZM_DB_PASS\" $CMSTRING)">>zm_conf.cmake
|
||||
|
||||
echo ""
|
||||
echo "Wrote zm_conf.cmake"
|
||||
echo ""
|
||||
echo "All done"
|
|
@ -0,0 +1,11 @@
|
|||
# CMakeLists.txt for the ZoneMinder database scripts
|
||||
|
||||
# Create files from the .in files
|
||||
configure_file(zm_create.sql.in ${CMAKE_CURRENT_SOURCE_DIR}/zm_create.sql @ONLY)
|
||||
|
||||
# Glob all files matching zm*.sql (to exclude *.in files and autotools's files)
|
||||
file(GLOB dbfileslist RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "zm*.sql")
|
||||
|
||||
# Install the database scripts, exclude makefiles and cmake stuff
|
||||
install(FILES ${dbfileslist} DESTINATION "${CMAKE_INSTALL_DATADIR}/zoneminder/db")
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
# CMakeLists.txt for the ZoneMinder misc files
|
||||
|
||||
# Create files from the .in files
|
||||
configure_file(apache.conf.in ${CMAKE_CURRENT_SOURCE_DIR}/apache.conf @ONLY)
|
||||
configure_file(logrotate.conf.in ${CMAKE_CURRENT_SOURCE_DIR}/logrotate.conf @ONLY)
|
||||
configure_file(syslog.conf.in ${CMAKE_CURRENT_SOURCE_DIR}/syslog.conf @ONLY)
|
||||
|
||||
# Install the misc files
|
||||
install(FILES apache.conf logrotate.conf syslog.conf DESTINATION "${CMAKE_INSTALL_DATADIR}/zoneminder/misc")
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
# CMakeLists.txt for the ZoneMinder perl scripts.
|
||||
|
||||
# Process the perl modules subdirectory
|
||||
add_subdirectory(ZoneMinder ZoneMinder)
|
||||
|
||||
# Create the directory for the final files to be copied
|
||||
file(MAKE_DIRECTORY output)
|
||||
|
||||
# Create files from the .in files
|
||||
configure_file(zmaudit.pl.in ${CMAKE_CURRENT_SOURCE_DIR}/output/zmaudit.pl @ONLY)
|
||||
configure_file(zmcontrol.pl.in ${CMAKE_CURRENT_SOURCE_DIR}/output/zmcontrol.pl @ONLY)
|
||||
configure_file(zmdc.pl.in ${CMAKE_CURRENT_SOURCE_DIR}/output/zmdc.pl @ONLY)
|
||||
configure_file(zmfilter.pl.in ${CMAKE_CURRENT_SOURCE_DIR}/output/zmfilter.pl @ONLY)
|
||||
configure_file(zmpkg.pl.in ${CMAKE_CURRENT_SOURCE_DIR}/output/zmpkg.pl @ONLY)
|
||||
configure_file(zmtrack.pl.in ${CMAKE_CURRENT_SOURCE_DIR}/output/zmtrack.pl @ONLY)
|
||||
configure_file(zmtrigger.pl.in ${CMAKE_CURRENT_SOURCE_DIR}/output/zmtrigger.pl @ONLY)
|
||||
configure_file(zmupdate.pl.in ${CMAKE_CURRENT_SOURCE_DIR}/output/zmupdate.pl @ONLY)
|
||||
configure_file(zmvideo.pl.in ${CMAKE_CURRENT_SOURCE_DIR}/output/zmvideo.pl @ONLY)
|
||||
configure_file(zmwatch.pl.in ${CMAKE_CURRENT_SOURCE_DIR}/output/zmwatch.pl @ONLY)
|
||||
configure_file(zmx10.pl.in ${CMAKE_CURRENT_SOURCE_DIR}/output/zmx10.pl @ONLY)
|
||||
#configure_file(zmdbbackup.in ${CMAKE_CURRENT_SOURCE_DIR}/output/zmdbbackup @ONLY)
|
||||
#configure_file(zmdbrestore.in ${CMAKE_CURRENT_SOURCE_DIR}/output/zmdbrestore @ONLY)
|
||||
#configure_file(zm.in ${CMAKE_CURRENT_SOURCE_DIR}/output/zm @ONLY)
|
||||
#configure_file(zmeventdump.in ${CMAKE_CURRENT_SOURCE_DIR}/output/zmeventdump @ONLY)
|
||||
|
||||
# Install the perl scripts
|
||||
install(DIRECTORY output/ DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}" FILE_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
|
@ -0,0 +1,19 @@
|
|||
# CMakeLists.txt for the ZoneMinder perl module.
|
||||
|
||||
# Create files from the .in files
|
||||
configure_file(lib/ZoneMinder/Base.pm.in ${CMAKE_CURRENT_SOURCE_DIR}/lib/ZoneMinder/Base.pm @ONLY)
|
||||
configure_file(lib/ZoneMinder/Config.pm.in ${CMAKE_CURRENT_SOURCE_DIR}/lib/ZoneMinder/Config.pm @ONLY)
|
||||
configure_file(lib/ZoneMinder/Memory.pm.in ${CMAKE_CURRENT_SOURCE_DIR}/lib/ZoneMinder/Memory.pm @ONLY)
|
||||
configure_file(lib/ZoneMinder/ConfigData.pm.in ${CMAKE_CURRENT_SOURCE_DIR}/lib/ZoneMinder/ConfigData.pm @ONLY)
|
||||
|
||||
# Add build target for the perl modules
|
||||
add_custom_target(zmperlmodules ALL perl Makefile.PL FIRST_MAKEFILE=MakefilePerl INSTALL_BASE=output INSTALLPRIVLIB="output/${CMAKE_INSTALL_LIBDIR}/perl5" INSTALLARCHLIB="optout/${CMAKE_INSTALL_LIBDIR}/perl5/arch" INSTALLSITELIB="output/${CMAKE_INSTALL_LIBDIR}/perl5" INSTALLSITEARCH="optout/${CMAKE_INSTALL_LIBDIR}/perl5/arch" COMMAND make --makefile=MakefilePerl COMMAND make --makefile=MakefilePerl pure_install COMMENT "Building ZoneMinder perl modules")
|
||||
|
||||
# Add install target for the perl modules
|
||||
install(DIRECTORY output/ DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
# CMakeLists.txt for the ZoneMinder binaries
|
||||
|
||||
# Create files from the .in files
|
||||
configure_file(zm_config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/zm_config.h @ONLY)
|
||||
|
||||
# Group together all the source files that are used by all the binaries (zmc, zma, zmu, zms etc)
|
||||
set(ZM_BIN_SRC_FILES zm_box.cpp zm_buffer.cpp zm_camera.cpp zm_comms.cpp zm_config.cpp zm_coord.cpp zm.cpp zm_db.cpp zm_logger.cpp zm_event.cpp zm_exception.cpp zm_file_camera.cpp zm_ffmpeg_camera.cpp zm_image.cpp zm_jpeg.cpp zm_local_camera.cpp zm_monitor.cpp zm_ffmpeg.cpp zm_mpeg.cpp zm_poly.cpp zm_regexp.cpp zm_remote_camera.cpp zm_remote_camera_http.cpp zm_remote_camera_rtsp.cpp zm_rtp.cpp zm_rtp_ctrl.cpp zm_rtp_data.cpp zm_rtp_source.cpp zm_rtsp.cpp zm_sdp.cpp zm_signal.cpp zm_stream.cpp zm_thread.cpp zm_time.cpp zm_timer.cpp zm_user.cpp zm_utils.cpp zm_zone.cpp)
|
||||
|
||||
# A fix for cmake recompiling the source files for every target.
|
||||
add_library(zm STATIC ${ZM_BIN_SRC_FILES})
|
||||
|
||||
add_executable(zmc zmc.cpp)
|
||||
add_executable(zma zma.cpp)
|
||||
add_executable(zmu zmu.cpp)
|
||||
add_executable(zmf zmf.cpp)
|
||||
add_executable(zms zms.cpp)
|
||||
add_executable(nph-zms zms.cpp)
|
||||
add_executable(zmstreamer zmstreamer.cpp)
|
||||
add_executable(zmfix zmfix.cpp zm_config.cpp zm_regexp.cpp zm_logger.cpp zm_utils.cpp zm_db.cpp zm.cpp)
|
||||
|
||||
target_link_libraries(zmc zm ${ZM_EXTRA_LIBS} ${ZM_BIN_LIBS})
|
||||
target_link_libraries(zma zm ${ZM_EXTRA_LIBS} ${ZM_BIN_LIBS})
|
||||
target_link_libraries(zmu zm ${ZM_EXTRA_LIBS} ${ZM_BIN_LIBS})
|
||||
target_link_libraries(zmf zm ${ZM_EXTRA_LIBS} ${ZM_BIN_LIBS})
|
||||
target_link_libraries(zms zm ${ZM_EXTRA_LIBS} ${ZM_BIN_LIBS})
|
||||
target_link_libraries(nph-zms zm ${ZM_EXTRA_LIBS} ${ZM_BIN_LIBS})
|
||||
target_link_libraries(zmstreamer zm ${ZM_EXTRA_LIBS} ${ZM_BIN_LIBS})
|
||||
target_link_libraries(zmfix ${ZM_EXTRA_LIBS} ${ZM_BIN_LIBS})
|
||||
|
||||
install(TARGETS zmc zma zmu zmf zmstreamer zmfix RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}" PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
install(TARGETS zms nph-zms RUNTIME DESTINATION "${ZM_CGIDIR}" PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
# CMakeLists.txt for the ZoneMinder web files
|
||||
|
||||
# Process the tools/mootools subdirectory
|
||||
add_subdirectory(tools/mootools tools/mootools)
|
||||
|
||||
# Create files from the .in files
|
||||
configure_file(includes/config.php.in ${CMAKE_CURRENT_SOURCE_DIR}/includes/config.php @ONLY)
|
||||
|
||||
# Install the web files
|
||||
install(DIRECTORY ajax css graphics includes js lang skins tools views DESTINATION "${ZM_WEBDIR}" PATTERN "*.in" EXCLUDE PATTERN "*Make*" EXCLUDE)
|
||||
install(FILES index.php README.md DESTINATION "${ZM_WEBDIR}")
|
|
@ -0,0 +1,34 @@
|
|||
# CMakeLists.txt for the Mootools
|
||||
# The only purpose of this file is to create the symlinks required.
|
||||
|
||||
# Find the latest mootools-core version and create a symlink mootools-core.js to it
|
||||
file(GLOB mtcorelist RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "mootools-core-*.js")
|
||||
if(NOT mtcorelist)
|
||||
message(WARNING " Unable to find mootools-core files")
|
||||
else(NOT mtcorelist)
|
||||
list(SORT mtcorelist)
|
||||
list(LENGTH mtcorelist mtcorelistcount)
|
||||
math(EXPR mtcoreindex "${mtcorelistcount} - 1")
|
||||
list(GET mtcorelist ${mtcoreindex} mtcorelatest)
|
||||
message(STATUS "Using mootools core file: ${mtcorelatest}")
|
||||
execute_process(COMMAND ln -f -s "${mtcorelatest}" "${CMAKE_CURRENT_SOURCE_DIR}/mootools-core.js" RESULT_VARIABLE mtcoreresult)
|
||||
if(mtcoreresult)
|
||||
message(WARNING " Failed creating the required symlinks for mootools-core. Exit code: ${mtcoreresult}")
|
||||
endif(mtcoreresult)
|
||||
endif(NOT mtcorelist)
|
||||
|
||||
# Find the latest mootools-more version and create a symlink mootools-more.js to it
|
||||
file(GLOB mtmorelist RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "mootools-more-*.js")
|
||||
if(NOT mtmorelist)
|
||||
message(WARNING " Unable to find mootools-more files")
|
||||
else(NOT mtmorelist)
|
||||
list(SORT mtmorelist)
|
||||
list(LENGTH mtmorelist mtmorelistcount)
|
||||
math(EXPR mtmoreindex "${mtmorelistcount} - 1")
|
||||
list(GET mtmorelist ${mtmoreindex} mtmorelatest)
|
||||
message(STATUS "Using mootools more file: ${mtmorelatest}")
|
||||
execute_process(COMMAND ln -f -s "${mtmorelatest}" "${CMAKE_CURRENT_SOURCE_DIR}/mootools-more.js" RESULT_VARIABLE mtmoreresult)
|
||||
if(mtmoreresult)
|
||||
message(WARNING " Failed creating the required symlinks for mootools-more. Exit code: ${mtmoreresult}")
|
||||
endif(mtmoreresult)
|
||||
endif(NOT mtmorelist)
|
|
@ -0,0 +1,266 @@
|
|||
#!/bin/bash
|
||||
# The purpose of this file is to create the symlinks in the web folder to the content folder. It can use an existing content folder or create a new one.
|
||||
|
||||
# Set the content dir default to be the one supplied to cmake
|
||||
ZM_PATH_CONTENT="@ZM_CONTENTDIR@"
|
||||
|
||||
echo "*** This bash script creates the nessecary symlinks for the zoneminder content"
|
||||
echo "*** It can use an existing content folder or create a new one"
|
||||
echo "*** For usage: use -h"
|
||||
echo "*** The default content directory is: $ZM_PATH_CONTENT"
|
||||
echo ""
|
||||
|
||||
usage()
|
||||
{
|
||||
cat <<EOF
|
||||
Usage: $0 [-q] [-z zm.conf] [-w WEB DIRECTORY] [CONTENT DIRECTORY]
|
||||
|
||||
OPTIONS:
|
||||
-h Show this message and quit
|
||||
-z ZoneMinder configuration file
|
||||
-w Override the web directory from zm.conf
|
||||
-q Quick mode. Do not change ownership recursively.
|
||||
|
||||
If the -w option is not used to specify the path to the web directory,
|
||||
the script will use the path from zoneminder's configuration file.
|
||||
If the -z option is used, the argument will be used instead of zm.conf
|
||||
Otherwise, it will attempt to read zm.conf from the local directory.
|
||||
If that fails, it will try from /etc/zm.conf
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
while getopts "hz:w:q" OPTION
|
||||
do
|
||||
case $OPTION in
|
||||
h)
|
||||
usage
|
||||
exit 50
|
||||
;;
|
||||
z)
|
||||
ZM_CONFIG=$OPTARG
|
||||
;;
|
||||
w)
|
||||
ZM_PATH_WEB_FORCE=$OPTARG
|
||||
;;
|
||||
q)
|
||||
QUICK=1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $(( OPTIND - 1 ))
|
||||
|
||||
# Lets check that we are root
|
||||
if [ "$(id -u)" != "0" ]; then
|
||||
echo "Error: This script needs to run as root."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if zm.conf was supplied as an argument and that it exists
|
||||
if [[ -n "$ZM_CONFIG" && ! -f "$ZM_CONFIG" ]]; then
|
||||
echo "The zoneminder configuration file $ZM_CONFIG does not exist!"
|
||||
exit 40
|
||||
fi
|
||||
|
||||
# Load zm.conf
|
||||
if [ -n "$ZM_CONFIG" ]; then
|
||||
echo "Using custom zm.conf $ZM_CONFIG"
|
||||
source "$ZM_CONFIG"
|
||||
elif [ -f "zm.conf" ]; then
|
||||
echo "Using local zm.conf"
|
||||
source "zm.conf"
|
||||
elif [ -f "/etc/zm.conf"]; then
|
||||
echo "Using system zm.conf"
|
||||
source "/etc/zm.conf"
|
||||
else
|
||||
echo "Failed locating zoneminder configuration file (zm.conf)\nUse the -z option to specify the full path to the zoneminder configuration file"
|
||||
exit 45
|
||||
fi
|
||||
|
||||
# Override the web directory path from zm.conf
|
||||
if [ -n "$ZM_PATH_WEB_FORCE" ]; then
|
||||
ZM_PATH_WEB="$(readlink -f $ZM_PATH_WEB_FORCE)"
|
||||
fi
|
||||
|
||||
# Override the default content path
|
||||
if [[ -n "$@" ]]; then
|
||||
ZM_PATH_CONTENT="$(readlink -f $@)"
|
||||
fi
|
||||
|
||||
# Print some information
|
||||
echo "Web folder : $ZM_PATH_WEB"
|
||||
echo "Content folder : $ZM_PATH_CONTENT"
|
||||
echo ""
|
||||
|
||||
# Verify the web folder is a real directory
|
||||
echo -n "Verifying the web folder is a directory... "
|
||||
if [ -d "$ZM_PATH_WEB" ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Failed"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
# Check if the content folder exists, and if not, create it
|
||||
echo -n "Checking if the content folder exists... "
|
||||
if [ -d "$ZM_PATH_CONTENT" ]; then
|
||||
echo "Yes"
|
||||
else
|
||||
echo "No"
|
||||
echo -n "Creating the content folder... "
|
||||
mkdir "$ZM_PATH_CONTENT"
|
||||
if [ "$?" = "0" ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Failed"
|
||||
exit 4
|
||||
fi
|
||||
fi
|
||||
# Check if the content/images folder exists, and if not, create it
|
||||
echo -n "Checking if the images folder exists inside the content folder... "
|
||||
if [ -d "$ZM_PATH_CONTENT/images" ]; then
|
||||
echo "Yes"
|
||||
else
|
||||
echo "No"
|
||||
echo -n "Creating the images folder inside the content folder... "
|
||||
mkdir "$ZM_PATH_CONTENT/images"
|
||||
if [ "$?" = "0" ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Failed"
|
||||
exit 6
|
||||
fi
|
||||
fi
|
||||
# Check if the content/events folder exists, and if not, create it
|
||||
echo -n "Checking if the events folder exists inside the content folder... "
|
||||
if [ -d "$ZM_PATH_CONTENT/events" ]; then
|
||||
echo "Yes"
|
||||
else
|
||||
echo "No"
|
||||
echo -n "Creating the events folder inside the content folder... "
|
||||
mkdir "$ZM_PATH_CONTENT/events"
|
||||
if [ "$?" = "0" ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Failed"
|
||||
exit 7
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -d "$ZM_PATH_WEB/images" ]; then
|
||||
if [ -L "$ZM_PATH_WEB/images" ]; then
|
||||
echo -n "Unlinking current symlink for the images folder... "
|
||||
unlink "$ZM_PATH_WEB/images"
|
||||
if [ "$?" = "0" ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Failed"
|
||||
exit 35
|
||||
fi
|
||||
else
|
||||
echo "Existing $ZM_PATH_WEB/images is not a symlink. Aborting to prevent data loss"
|
||||
exit 10
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -d "$ZM_PATH_WEB/events" ]; then
|
||||
if [ -L "$ZM_PATH_WEB/events" ]; then
|
||||
echo -n "Unlinking current symlink for the events folder... "
|
||||
unlink "$ZM_PATH_WEB/events"
|
||||
if [ "$?" = "0" ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Failed"
|
||||
exit 36
|
||||
fi
|
||||
else
|
||||
echo "Existing $ZM_PATH_WEB/events is not a symlink. Aborting to prevent data loss"
|
||||
exit 11
|
||||
fi
|
||||
fi
|
||||
|
||||
# Create the symlink for the images folder
|
||||
echo -n "Creating the symlink for the images folder... "
|
||||
ln -s -f "$ZM_PATH_CONTENT/images" "$ZM_PATH_WEB/images"
|
||||
if [ "$?" = "0" ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Failed"
|
||||
exit 15
|
||||
fi
|
||||
|
||||
# Create the symlink for the events folder
|
||||
echo -n "Creating the symlink for the events folder... "
|
||||
ln -s -f "$ZM_PATH_CONTENT/events" "$ZM_PATH_WEB/events"
|
||||
if [ "$?" = "0" ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Failed"
|
||||
exit 16
|
||||
fi
|
||||
|
||||
# change ownership for the images folder. do it recursively unless -q is used
|
||||
if [ -n "$QUICK" ]; then
|
||||
echo -n "Changing ownership of the images folder to ${ZM_WEB_USER} ${ZM_WEB_GROUP}... "
|
||||
chown ${ZM_WEB_USER}:${ZM_WEB_GROUP} "$ZM_PATH_WEB/images"
|
||||
if [ "$?" = "0" ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Failed"
|
||||
exit 20
|
||||
fi
|
||||
else
|
||||
echo -n "Changing ownership of the images folder recursively to ${ZM_WEB_USER} ${ZM_WEB_GROUP}... "
|
||||
chown -R ${ZM_WEB_USER}:${ZM_WEB_GROUP} "$ZM_PATH_WEB/images"
|
||||
if [ "$?" = "0" ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Failed"
|
||||
exit 21
|
||||
fi
|
||||
fi
|
||||
|
||||
# change ownership for the events folder. do it recursively unless -q is used
|
||||
if [ -n "$QUICK" ]; then
|
||||
echo -n "Changing ownership of the events folder to ${ZM_WEB_USER} ${ZM_WEB_GROUP}... "
|
||||
chown ${ZM_WEB_USER}:${ZM_WEB_GROUP} "$ZM_PATH_WEB/events"
|
||||
if [ "$?" = "0" ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Failed"
|
||||
exit 25
|
||||
fi
|
||||
else
|
||||
echo -n "Changing ownership of the events folder recursively to ${ZM_WEB_USER} ${ZM_WEB_GROUP}... "
|
||||
chown -R ${ZM_WEB_USER}:${ZM_WEB_GROUP} "$ZM_PATH_WEB/events"
|
||||
if [ "$?" = "0" ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Failed"
|
||||
exit 26
|
||||
fi
|
||||
fi
|
||||
|
||||
# Change directory permissions for the images folder
|
||||
echo -n "Changing permissions of the images folder to 775... "
|
||||
chmod 775 "$ZM_PATH_WEB/images"
|
||||
if [ "$?" = "0" ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Failed"
|
||||
exit 30
|
||||
fi
|
||||
|
||||
|
||||
# Change directory permissions for the events folder
|
||||
echo -n "Changing permissions of the events folder to 775... "
|
||||
chmod 775 "$ZM_PATH_WEB/events"
|
||||
if [ "$?" = "0" ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Failed"
|
||||
exit 31
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "All done"
|
|
@ -0,0 +1,61 @@
|
|||
#ifndef ZM_CMAKE_CONFIG_H
|
||||
#define ZM_CMAKE_CONFIG_H
|
||||
|
||||
/* This file is used by cmake to create config.h for ZM */
|
||||
|
||||
/* General system checks */
|
||||
#cmakedefine HAVE_LINUX_VIDEODEV_H 1
|
||||
#cmakedefine HAVE_LINUX_VIDEODEV2_H 1
|
||||
#cmakedefine HAVE_EXECINFO_H 1
|
||||
#cmakedefine HAVE_SYS_SENDFILE_H 1
|
||||
#cmakedefine HAVE_SYS_SYSCALL_H 1
|
||||
#cmakedefine HAVE_SENDFILE 1
|
||||
#cmakedefine HAVE_DECL_BACKTRACE 1
|
||||
#cmakedefine HAVE_POSIX_MEMALIGN 1
|
||||
#cmakedefine HAVE_STRSIGNAL 1
|
||||
#cmakedefine HAVE_DECL_ROUND 1
|
||||
#cmakedefine HAVE_SIGINFO_T 1
|
||||
#cmakedefine HAVE_UCONTEXT_T 1
|
||||
#cmakedefine HAVE_STRUCT_SIGCONTEXT 1
|
||||
#cmakedefine HAVE_STRUCT_SIGCONTEXT_EIP 1
|
||||
|
||||
/* Library checks and their header files */
|
||||
|
||||
#cmakedefine HAVE_LIBZLIB 1
|
||||
#cmakedefine HAVE_ZLIB_H 1
|
||||
#cmakedefine HAVE_LIBJPEG 1
|
||||
#cmakedefine HAVE_JPEGLIB_H 1
|
||||
#cmakedefine HAVE_LIBOPENSSL 1
|
||||
#cmakedefine HAVE_OPENSSL_MD5_H 1
|
||||
#cmakedefine HAVE_LIBCRYPTO 1
|
||||
#cmakedefine HAVE_LIBPTHREAD 1
|
||||
#cmakedefine HAVE_PTHREAD_H
|
||||
#cmakedefine HAVE_LIBPCRE 1
|
||||
#cmakedefine HAVE_PCRE_H 1
|
||||
#cmakedefine HAVE_LIBGCRYPT 1
|
||||
#cmakedefine HAVE_GCRYPT_H 1
|
||||
#cmakedefine HAVE_LIBGNUTLS 1
|
||||
#cmakedefine HAVE_GNUTLS_OPENSSL_H 1
|
||||
#cmakedefine HAVE_GNUTLS_GNUTLS_H 1
|
||||
#cmakedefine HAVE_LIBMYSQLCLIENT 1
|
||||
#cmakedefine HAVE_MYSQL_H 1
|
||||
#cmakedefine HAVE_LIBAVFORMAT 1
|
||||
#cmakedefine HAVE_LIBAVFORMAT_AVFORMAT_H 1
|
||||
#cmakedefine HAVE_LIBAVCODEC 1
|
||||
#cmakedefine HAVE_LIBAVCODEC_AVCODEC_H 1
|
||||
#cmakedefine HAVE_LIBAVDEVICE 1
|
||||
#cmakedefine HAVE_LIBAVDEVICE_AVDEVICE_H
|
||||
#cmakedefine HAVE_LIBAVUTIL 1
|
||||
#cmakedefine HAVE_LIBAVUTIL_AVUTIL_H 1
|
||||
#cmakedefine HAVE_LIBAVUTIL_MATHEMATICS_H 1
|
||||
#cmakedefine HAVE_LIBSWSCALE 1
|
||||
#cmakedefine HAVE_LIBSWSCALE_SWSCALE_H 1
|
||||
|
||||
/* Authenication checks */
|
||||
#cmakedefine HAVE_DECL_MD5 1
|
||||
#cmakedefine HAVE_DECL_GNUTLS_FINGERPRINT 1
|
||||
|
||||
/* Its safe to assume that signal return type is void. This is a fix for zm_signal.h */
|
||||
#define RETSIGTYPE void
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue