Commit 8fb84760 authored by Pierre Aubert's avatar Pierre Aubert
Browse files

Initial commit

parents
build
build2
.kdev4/
*.kdev4
image: gitlab-registry.in2p3.fr/cta-lapp/phoenix_libs/phoenix/phoenix_minimal:0.2
stages:
- BuildTestinstall
- DocCoverage
- deploy
#- build
#- test
#- deploy
dailyBuildMasterAll:
#cache:
#untracked: true
#paths:
#- build/
stage: BuildTestinstall
script:
- export LD_LIBRARY_PATH=/usr/lib
- env
- mkdir -p build
- cd build
- >
cmake ..
-DCMAKE_INSTALL_PREFIX=/usr
-DRELEASE_MODE=yes
-DSELF_TESTS_MODE=yes
- make all
- make install
- make test
only:
- branches
- tags
tags:
TestCoverage:
stage: DocCoverage
script:
- export LD_LIBRARY_PATH=/usr/lib
- env
- mkdir -p build coverage
- cd build
- >
cmake ..
-DCMAKE_INSTALL_PREFIX=/usr
-DRELEASE_MODE=yes
-DSELF_TESTS_MODE=yes
-DCMAKE_BUILD_TYPE=Coverage
- make all
- make install
- make test
- make ExperimentalCoverage
- cd ../coverage
- gcovr -r ../ --html cov_report.html --html-details
- gcovr -r ../ --xml Coverage.xml
artifacts:
paths:
- coverage
expire_in: 1d
only:
- branches
- tags
tags:
Doc:
stage: DocCoverage
script:
- export LD_LIBRARY_PATH=/usr/lib
- env
- rm -fr build public
- mkdir -p build
- mkdir -p public
- cd build
- >
cmake ..
-DCMAKE_INSTALL_PREFIX=/usr
-DRELEASE_MODE=yes
-DDOC_MODE=yes
- make all
- make doc
- scp -r doc/html/* ../public
artifacts:
paths:
- public
expire_in: 1d
only:
- branches
- tags
tags:
pages:
stage: deploy
script:
- mv coverage public/
artifacts:
paths:
- public
expire_in: 1d
project(Phoenix)
cmake_minimum_required(VERSION 2.8)
add_subdirectory(cmake)
phoenix_base_project("PhoenixNotify" "1.4.1"
"Library to ease the use of os notifications"
"https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS/PhoenixNotify")
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
phoenix_create_find(PhoenixNotify phoenix_notify PNotify.h "")
add_subdirectory(src)
if(SELF_TESTS_MODE)
include(CTest)
add_subdirectory(TESTS)
endif(SELF_TESTS_MODE)
set(PHOENIX_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src;${PHOENIX_INCLUDE_DIRS}" CACHE INTERNAL "list of Phoenix include dirs")
![PLIBS_9 logo](doc/logo.png)
----
Code
----
https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS/PhoenixNotify
Documentation
----
https://cta-lapp.pages.in2p3.fr//PHOENIX_LIBS/PhoenixNotify/
Requirements
------------
- c++ compiler >=5.3.1
- cmake > 3
- make
Installation for Users
----------------------
$ git clone https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS/PhoenixNotify.git
$ cd PhoenixNotify
$ ./install.sh
project(Phoenix)
cmake_minimum_required(VERSION 2.8)
project(Phoenix)
cmake_minimum_required(VERSION 2.8)
include(createLinuxPackages.cmake)
include(phoenix_base_project.cmake)
if(NOT MODULE_MODE)
include(rpath_utils.cmake)
include(create_doc.cmake)
include(create_find_project.cmake)
endif()
# Commands to create debian package with cmake
function(createLinuxPackages)
if(NOT MODULE_MODE)
set(CPACK_PACKAGE_NAME "${PROGRAM_NAME}" CACHE STRING "Name of the program")
set(CPACK_PACKAGE_VERSION "${PROGRAM_VERSION}" CACHE STRING "Version of the program")
set(CPACK_PACKAGE_VENDOR "Pierre Aubert" CACHE STRING "Vendor of the program")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${PROGRAM_DESCRIPTION_NO_QUOTE} CACHE STRING "Description of the program")
set(CPACK_RESOURCE_FILE_README ${CMAKE_SOURCE_DIR}/README.md CACHE STRING "DOC of the program")
set(CPACK_RESOURCE_FILE_WELCOME ${CMAKE_SOURCE_DIR}/README.md CACHE STRING "Welcome of the program")
set(CPACK_PACKAGE_HOMEPAGE_URL ${PROGRAM_HOMEPAGE} CACHE STRING "Homepage of the program")
set(CPACK_PACKAGE_CONTACT "pierre.aubert@lapp.in2p3.fr" CACHE STRING "Contact of the program")
set(CPACK_PACKAGE_ICON ${CMAKE_SOURCE_DIR}/doc/icon.bmp CACHE STRING "Icon of the program")
set(CPACK_PACKAGE_DESCRIPTION ${PROGRAM_DESCRIPTION_NO_QUOTE} CACHE STRING "Desription with quote of the program")
if(CREATE_DEB) #Ok for UBUNTU
set(CPACK_GENERATOR "DEB" CACHE STRING "Package type of the program")
set(CPACK_DEBIAN_PACKAGE_VERSION "${PROGRAM_VERSION}" CACHE STRING "Version of the program")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "pierre.aubert@lapp.in2p3.fr" CACHE STRING "Package maintainer of the program") #required
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE ${PROGRAM_HOMEPAGE} CACHE STRING "Homepage of the program") #For the debian installer only
set(CPACK_DEBIAN_PACKAGE_DEPENDS "" CACHE STRING "Depends of the program")
endif(CREATE_DEB)
if(CREATE_RPM) #Need to install rmp package on ubuntu which contains rpmbuild
set(CPACK_GENERATOR "RPM" CACHE STRING "Package type of the program")
set(CPACK_RPM_PACKAGE_AUTOREQ "NO" CACHE STRING "Caracteristics of the program")
set(CPACK_RPM_PACKAGE_REQUIRES "" CACHE STRING "Depends of the program")
set(LIBRARY_DIRECTORY "lib64" CACHE STRING "define the library directory (especially for Fedora with the wtf lib64)" FORCE)
endif(CREATE_RPM)
# if(CREATE_DMG) #We should use DragNDrop or PackageMaker of osx
# set(CPACK_GENERATOR "DMG")
# endif(CREATE_DMG)
include(CPack)
# Has to be used :
# cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCREATE_DEB=yes -DSSE4.2=yes # Or whatever extension
# make -j 8
# cpack
endif()
endfunction(createLinuxPackages)
# Create the target to create the documentation of the current project
# projectName : name of the project to be used
# doxyfileName : name of the Doxyfile cmake macro to be used to generate the documentation
function(phoenix_create_doc projectName doxyfileName)
find_path(doxygen_BINNARY_DIR
NAMES doxygen
PATHS "${PHOENIX_PREFIX}/bin" ${CMAKE_INSTALL_PREFIX}/bin ${CMAKE_INCLUDE_PATH}/bin /usr/bin /usr/local/bin /bin $ENV{HOME}/usr/bin
)
if(doxygen_BINNARY_DIR)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html)
message(STATUS "program doxygen found create doc target by project ${projectName}")
file(GLOB_RECURSE allDocFiles ${CMAKE_SOURCE_DIR}/*.cpp *.h *.dox)
string(REGEX REPLACE "${CMAKE_BINARY_DIR}[^;]+;?" "" allDocFiles "${allDocFiles}")
set(PROJECT_LOGO ${CMAKE_CURRENT_SOURCE_DIR}/logo.png)
set(OUTPUT_DOC_DIR ${CMAKE_CURRENT_BINARY_DIR}/)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${doxyfileName} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
set(targetName "phoenix_doc_${projectName}")
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/doc.txt
OUTPUT ${targetName}
COMMENT "doxygen documentation generation for project ${projectName}"
COMMAND doxygen ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
DEPENDS ${allDocFiles}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
add_custom_target(${targetName} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/doc.txt)
if(NOT TARGET doc)
add_custom_target(doc)
endif()
add_dependencies(doc ${targetName})
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION share/${projectName}/doc)
else()
message(STATUS "program doxygen not found for project ${projectName}")
endif()
endfunction(phoenix_create_doc)
set(FIND_PROJECT_TEMPLATE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/template_find_project.cmake" CACHE STRING "Name of the file which contains the template to generate FindProgram.cmake files")
set(FIND_HEADER_PROJECT_TEMPLATE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/template_find_header_project.cmake" CACHE STRING "Name of the file which contains the template to generate FindProgram.cmake files but only with header")
# Create the target to create the find cmake file
# projectName : name of the project to be used
# libraryTargetName : name of the library to be searched
# headerFile : header to be searched
# extraIncludeFile : extra include file to be used
function(phoenix_create_find projectName libraryTargetName headerFile extraIncludeFile)
set(findFileName "Find${projectName}.cmake")
string(TOUPPER ${projectName} PROJECT_NAME_UPPER)
set(fullDependModule "")
set(EXTRA_DEPENDENCIES_LIB "")
foreach(dependencyModule ${ARGN})
string(APPEND fullDependModule "find_package(${dependencyModule} REQUIRED)\n")
string(TOUPPER ${dependencyModule} DEPENDENCY_MODULE_UPPER)
string(APPEND EXTRA_DEPENDENCIES_LIB " \${${DEPENDENCY_MODULE_UPPER}}")
endforeach(dependencyModule)
set(PHOENIX_PACKAGE_PEDENDENCIES "${fullDependModule}")
if(extraIncludeFile STREQUAL "")
set(EXTRA_INCLUDE_CMAKE "")
else()
set(EXTRA_INCLUDE_CMAKE "include(${CMAKE_MODULE_PATH}/${extraIncludeFile})")
endif()
configure_file(${FIND_PROJECT_TEMPLATE_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${findFileName} @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${findFileName} DESTINATION share/cmake)
endfunction(phoenix_create_find)
# Create the target to create the find cmake file
# projectName : name of the project to be used
# libraryTargetName : name of the library to be searched
# headerFile : header to be searched
# extraIncludeFile : extra include file to be used
function(phoenix_create_find_header projectName headerFile extraIncludeFile)
set(findFileName "Find${projectName}.cmake")
string(TOUPPER ${projectName} PROJECT_NAME_UPPER)
set(fullDependModule "")
set(EXTRA_DEPENDENCIES_LIB "")
foreach(dependencyModule ${ARGN})
string(APPEND fullDependModule "find_package(${dependencyModule} REQUIRED)\n")
string(TOUPPER ${dependencyModule} DEPENDENCY_MODULE_UPPER)
string(APPEND EXTRA_DEPENDENCIES_LIB " \${${DEPENDENCY_MODULE_UPPER}}")
endforeach(dependencyModule)
set(PHOENIX_PACKAGE_PEDENDENCIES "${fullDependModule}")
if(extraIncludeFile STREQUAL "")
set(EXTRA_INCLUDE_CMAKE "")
else()
set(EXTRA_INCLUDE_CMAKE "include(${CMAKE_MODULE_PATH}/${extraIncludeFile})")
endif()
configure_file(${FIND_HEADER_PROJECT_TEMPLATE_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${findFileName} @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${findFileName} DESTINATION share/cmake)
endfunction(phoenix_create_find_header)
# Define the base of a Phoenix project
# programName : name of the program/library
# programVersion : version of the program/library
# programDescritpion : description of the program/library
# programHomePage : home page of the program/library
function(phoenix_base_project programName programVersion programDescritpion programHomePage)
if(NOT MODULE_MODE)
set(PROGRAM_NAME "${programName}" CACHE STRING "name of the current project" FORCE)
set(PROGRAM_VERSION "${programVersion}" CACHE STRING "version of the current project" FORCE)
set(PROGRAM_DESCRIPTION_NO_QUOTE "${programDescritpion}" CACHE STRING "description of the current project" FORCE)
set(PROGRAM_DESCRIPTION "\"${PROGRAM_DESCRIPTION_NO_QUOTE}\"" CACHE STRING "description with double quotes of the current project" FORCE)
set(PROGRAM_HOMEPAGE "${programHomePage}" CACHE STRING "home page of the current project" FORCE)
set(LIBRARY_DIRECTORY "lib" CACHE STRING "define the library directory (especially for Fedora with the wtf lib64)" FORCE)
set(DOC_MODE no CACHE BOOL "Doc mode")
set(SELF_TESTS_MODE yes CACHE BOOL "Self test mode")
message(STATUS "SELF_TESTS_MODE = ${SELF_TESTS_MODE}")
set(PHOENIX_INSTALL_PREFIX "$ENV{HOME}/usr" CACHE STRING "Install prefix")
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${PHOENIX_INSTALL_PREFIX}" CACHE PATH "cmake install prefix" FORCE)
endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_MODULE_PATH ${CMAKE_INSTALL_PREFIX}/share/cmake CACHE STRING "cmake module path")
set(PHOENIX_FORCE_PULL_MODULE no CACHE BOOL "Say if the submodule have to be pulled every time or not")
if(CMAKE_BUILD_TYPE STREQUAL "Coverage")
message(STATUS "Build for tests COVERAGE")
set(CTEST_COVERAGE_COMMAND "gcov")
set(SELF_TESTS_MODE yes)
set(CMAKE_CXX_FLAGS "--std=c++11 -Wall -Werror -g -O0 -fprofile-arcs -ftest-coverage" PARENT_SCOPE)
else()
set(CMAKE_CXX_FLAGS "--std=c++11 -Wall -Werror -g -O2" PARENT_SCOPE)
endif()
add_definitions(-D__PROGRAM_VERSION__="${PROGRAM_VERSION}")
if(DOC_MODE)
add_subdirectory(doc)
endif()
createLinuxPackages()
endif()
endfunction(phoenix_base_project)
if(APPLE)
set(CMAKE_MACOSX_RPATH ${CMAKE_INSTALL_PREFIX}/lib)
# use, i.e. don't skip the full RPATH for the build tree
set(CMAKE_SKIP_BUILD_RPATH FALSE)
# when building, don't use the install RPATH already
# (but later on when installing)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
endif()
if(CREATE_RPM)
set(LIBRARY_DIRECTORY "lib64")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" "${CMAKE_INSTALL_PREFIX}/lib64")
endif()
message(STATUS "LIBRARY_DIRECTORY = '${LIBRARY_DIRECTORY}'")
if(CREATE_RPM OR CREATE_DEB)
set(PACKAGE_CREATION_MODE yes CACHE BOOL "Say if we are in the package creation mode or not at the install")
# message(STATUS "Now install cmake modules in '${CMAKE_MODULE_PATH}'")
# set(PLIBS_INSTALL_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} CACHE STRING "Install path of the cmake module when creating binary package")
endif()
##########################################################################
# #
# test de présence des headers de la @PROJECT_NAME_UPPER@ #
# #
##########################################################################
@PHOENIX_PACKAGE_PEDENDENCIES@
find_path(@PROJECT_NAME_UPPER@_INCLUDE_DIR
NAMES @headerFile@
PATHS "${@PROJECT_NAME_UPPER@_PREFIX}/include/@projectName@" ${CMAKE_INSTALL_PREFIX}/include/@projectName@
$ENV{HOME}/usr/include/@projectName@ ${CMAKE_INCLUDE_PATH}/@projectName@ /usr/include/@projectName@ /usr/local/include/@projectName@
)
if(@PROJECT_NAME_UPPER@_INCLUDE_DIR)
message(STATUS "Found @PROJECT_NAME_UPPER@ headers : ${@PROJECT_NAME_UPPER@_INCLUDE_DIR}")
else(@PROJECT_NAME_UPPER@_INCLUDE_DIR)
message(FATAL_ERROR "@PROJECT_NAME_UPPER@ headers not found")
endif(@PROJECT_NAME_UPPER@_INCLUDE_DIR)
include_directories(${@PROJECT_NAME_UPPER@_INCLUDE_DIR})
set(@PROJECT_NAME_UPPER@_PREFIX "${@PROJECT_NAME_UPPER@_INCLUDE_DIR}/..")
set(@PROJECT_NAME_UPPER@ @libraryTargetName@ @EXTRA_DEPENDENCIES_LIB@)
set(@PROJECT_NAME_UPPER@_FOUND "YES" CACHE BOOL "@PROJECT_NAME_UPPER@ program found")
include_directories(${@PROJECT_NAME_UPPER@_INCLUDE_DIR} ${@PROJECT_NAME_UPPER@_INCLUDE_DIR}/../)
@EXTRA_INCLUDE_CMAKE@
##########################################################################
# #
# test de présence des headers de la @PROJECT_NAME_UPPER@ #
# #
##########################################################################
@PHOENIX_PACKAGE_PEDENDENCIES@
find_path(@PROJECT_NAME_UPPER@_INCLUDE_DIR
NAMES @headerFile@
PATHS "${@PROJECT_NAME_UPPER@_PREFIX}/include/@projectName@" ${CMAKE_INSTALL_PREFIX}/include/@projectName@
$ENV{HOME}/usr/include/@projectName@ ${CMAKE_INCLUDE_PATH}/@projectName@ /usr/include/@projectName@ /usr/local/include/@projectName@
)
if(@PROJECT_NAME_UPPER@_INCLUDE_DIR)
message(STATUS "Found @PROJECT_NAME_UPPER@ headers : ${@PROJECT_NAME_UPPER@_INCLUDE_DIR}")
else(@PROJECT_NAME_UPPER@_INCLUDE_DIR)
message(FATAL_ERROR "@PROJECT_NAME_UPPER@ headers not found")
endif(@PROJECT_NAME_UPPER@_INCLUDE_DIR)
include_directories(${@PROJECT_NAME_UPPER@_INCLUDE_DIR})
##########################################################################
# #
# test de présence de la @PROJECT_NAME_UPPER@ #
# #
##########################################################################
set(LIBRARY_NAME "lib@libraryTargetName@.so")
if(APPLE)
set(LIBRARY_NAME "lib@libraryTargetName@.dylib")
endif()
find_path(@PROJECT_NAME_UPPER@_LIBRARY_DIR
NAMES ${LIBRARY_NAME}
PATHS "${@PROJECT_NAME_UPPER@_PREFIX}/lib" ${CMAKE_INSTALL_PREFIX}/lib $ENV{HOME}/usr/lib ${CMAKE_INCLUDE_PATH}/lib /usr/lib /usr/local/lib /lib
)
if(@PROJECT_NAME_UPPER@_LIBRARY_DIR)
message(STATUS "Found lib @PROJECT_NAME_UPPER@ : ${@PROJECT_NAME_UPPER@_LIBRARY_DIR}")
else(@PROJECT_NAME_UPPER@_LIBRARY_DIR)
message(FATAL_ERROR "lib @PROJECT_NAME_UPPER@ not found")
endif(@PROJECT_NAME_UPPER@_LIBRARY_DIR)
set(@PROJECT_NAME_UPPER@_PREFIX "${@PROJECT_NAME_UPPER@_LIBRARY_DIR}/..")
set(@PROJECT_NAME_UPPER@ @libraryTargetName@ @EXTRA_DEPENDENCIES_LIB@)
set(@PROJECT_NAME_UPPER@_FOUND "YES" CACHE BOOL "@PROJECT_NAME_UPPER@ program found")
link_directories(${@PROJECT_NAME_UPPER@_LIBRARY_DIR})
include_directories(${@PROJECT_NAME_UPPER@_INCLUDE_DIR} ${@PROJECT_NAME_UPPER@_INCLUDE_DIR}/../)
@EXTRA_INCLUDE_CMAKE@
project(Phoenix)
cmake_minimum_required(VERSION 2.8)
phoenix_create_doc(PhoenixNotify Doxyfile.cmake)
This diff is collapsed.
This diff is collapsed.
/** @mainpage Library to ease the use of os notifications
*
* <a href="coverage/cov_report.html">See test coverage detail from gcovr</a><br />
<a href="coverage/Coverage.xml">See test coverage report</a>
*/
#!/bin/bash
if [[ "$OSTYPE" == "darwin"* ]]; then
export nbproc=`sysctl -n hw.physicalcpu`
else
export nbproc=`nproc`
fi
INSTALL_PREFIX="$1"
if [ -z "$1" ]
then
INSTALL_PREFIX=$HOME/usr
fi
export PATH=$INSTALL_PREFIX/bin:$PATH
export LD_LIBRARY_PATH=$INSTALL_PREFIX/lib:$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=$INSTALL_PREFIX/lib:$DYLD_LIBRARY_PATH
if [ -d build ]
then
echo "Remove existing directory build"
rm -fr build
fi
mkdir -p build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX
if [ $? != 0 ]
then
echo "Error on cmake : exit -1"
exit -1
fi
make -j $nbproc
if [ $? != 0 ]
then
echo "Error on make : exit -1"
exit -1
fi
make install -j $nbproc
if [ $? != 0 ]
then
echo "Error on install : exit -1"
exit -1
fi
if [ -f $HOME/.bashrc ]; then
source $HOME/.bashrc
fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment