📣 An issue occured with the embedded container registry on October 25 2021, between 10:30 and 12:10 (UTC+2). Any persisting issues should be reported to CC-IN2P3 Support. 🐛

Commit 4db721ba authored by Pierre Aubert's avatar Pierre Aubert
Browse files

Initial commit

parents
build
build2
.kdev4/
.tmp_project/
*.kdev4
image: gitlab-registry.in2p3.fr/cta-lapp/phoenix_libs/phoenixhdf5/hdf5:0.2
stages:
- BuildTestinstall
- deploy
#- build
#- test
#- deploy
dailyBuildMasterAll:
variables:
CONDA_ENV_DIR: /opt/conda/envs/ctadev
#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:
pages:
variables:
CONDA_ENV_DIR: /opt/conda/envs/ctadev
stage: deploy
script:
- export LD_LIBRARY_PATH=/usr/lib
- env
#- git clone https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS/PhoenixTex2Html.git
#- cd PhoenixTex2Html
#- ./install.sh /usr
#- cd ..
#- rm -fr PhoenixTex2Html
- rm -fr build public
- mkdir -p build
- mkdir -p public/html
- cd build
- >
cmake ..
-DCMAKE_INSTALL_PREFIX=/usr
-DRELEASE_MODE=yes
-DDOC_MODE=yes
-DSELF_TESTS_MODE=no
- make all
- make doc
#- scp -r doc/platex/* ../public
#- scp -r doc/html/* ../public/html
- scp -r doc/html/* ../public/
artifacts:
paths:
- public
expire_in: 1d
only:
- branches
- tags
tags:
project(Phoenix)
cmake_minimum_required(VERSION 2.8)
add_subdirectory(cmake)
phoenix_base_project("PhoenixZmq" "1.4.1"
"Library which integrates zeromq use in Phoenix"
"https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS/PhoenixZmq")
pull_extra_module("DataStream" "https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS/DataStream.git")
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
add_subdirectory(src)
phoenix_create_find(PhoenixZmq phoenix_zmq phoenix_zmq.h "")
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/PhoenixZmq
# Documentation
https://cta-lapp.pages.in2p3.fr//PHOENIX_LIBS/PhoenixZmq/
# Requirements
- c++ compiler >=5.3.1
- cmake > 3
- make
- zmq >= 5
# Installation for Users
$ git clone https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS/PhoenixZmq.git
$ cd PhoenixZmq
$ ./install.sh
project(Phoenix)
cmake_minimum_required(VERSION 2.8)
add_subdirectory(TEST_ZMQ_PUSH_PULL)
project(Phoenix)
cmake_minimum_required(VERSION 2.8)
add_executable(test_pzmq_push_pull main.cpp)
target_link_libraries(test_pzmq_push_pull phoenix_zmq ${ZMQ_LIBRARY} pthread)
add_test(NAME TestPZMQPushPull
COMMAND ${CHECK_OUTPUT_FILE} ${CMAKE_CURRENT_BINARY_DIR}/test_pzmq_push_pull
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
/***************************************
Auteur : Pierre Aubert
Mail : aubertp7@gmail.com
Licence : CeCILL-C
****************************************/
#include <unistd.h>
#include <fstream>
#include <iostream>
#include <thread>
#include "phoenix_zmq.h"
#define CONNECTION_PORT 3390
using namespace std;
///Send messages on socket
/** @param nbMessage : number of message to be sent
*/
void threadSendMessage(size_t nbMessage){
cout << "threadSendMessage : send message" << endl;
//Init the connection with host
zmq::context_t context(1);
zmq::socket_t* emiter = pzmq_createServerSocket(context, ZMQ_PUSH, CONNECTION_PORT);
std::ofstream fs;
fs.open("threadSendMessage.txt");
for(size_t i(0lu); i < nbMessage; ++i){
zmq::message_t message(sizeof(size_t));
memcpy(message.data(), &i, sizeof(size_t));
cout << "message n°"<<i<<", Send value " << i << ", message size = " << message.size() << endl;
fs << i << endl;
zmq::send_result_t isSent = emiter->send(message, zmq::send_flags::none); //ZMQ_DONTWAIT
if(!isSent){
std::cerr << "threadSendMessage : cannot send message" << std::endl;
return;
}
usleep(500000);
}
fs.close();
cout << "threadSendMessage : stop" << endl;
pzmq_closeServerSocket(emiter);
}
///Recieved messages on socket
/** @param address : address of the socket
* @param threadId : id of the thread
* @param nbMessage : number of message to be read
*/
void threadRecievedMessage(const std::string & address, size_t threadId, size_t nbMessage){
cout << "threadRecievedMessage "<<threadId<<" : read message to '"<<address<<"'" << endl;
//Init the connection with host
zmq::context_t context(1);
zmq::socket_t* reciever = pzmq_createClientSocket(context, ZMQ_PULL, address, CONNECTION_PORT);
std::stringstream outFile;
outFile << "threadRecievedMessage_" << threadId << ".txt";
std::ofstream fs;
fs.open(outFile.str());
size_t i(0lu);
while(i < nbMessage){
usleep(100000);
cout << "threadRecievedMessage : wait for message" << endl;
zmq::message_t message(sizeof(size_t));
zmq::recv_result_t isRecieved = reciever->recv(message, zmq::recv_flags::dontwait); //ZMQ_DONTWAIT
if(!isRecieved){continue;}
size_t value(0lu);
memcpy(&value, message.data(), sizeof(size_t));
cout << "Recv("<<threadId<<") message n°"<<i<<", value = " << value << ", message size = " << message.size() << endl;
fs << value << endl;
++i;
}
fs.close();
cout << "threadRecievedMessage : stop" << endl;
pzmq_closeServerSocket(reciever);
}
///Launch the process
/** @return 0 on success, -1 otherwise
*/
int launchProcess(){
size_t nbMessage(10lu);
std::string hostName("localhost");
std::thread thrSend(threadSendMessage, nbMessage);
std::thread thrRecv0(threadRecievedMessage, hostName, 0lu, nbMessage);
// std::thread thrRecv1(threadRecievedMessage, hostName, 1lu, nbMessage);
thrRecv0.join();
thrSend.join();
// thrRecv1.join();
return 0;
}
int main(int argc, char **argv){
return launchProcess();
}
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(pull_extra_module.cmake)
include(create_doc.cmake)
include(create_find_project.cmake)
include(FindZMQ.cmake)
endif()
set(ZMQ_FOUND yes CACHE BOOL "true if the zmq library has been found")
message(STATUS "CONDA_PREFIX = '$ENV{CONDA_PREFIX}'")
message(STATUS "CONDA_ENV_PATH = '$ENV{CONDA_ENV_PATH}'")
find_path(ZMQ_INCLUDE_DIR NAMES zmq.hpp
PATHS $ENV{CONDA_PREFIX}/include $ENV{CONDA_ENV_PATH}/include /usr/include /usr/local/include $ENV{HOME}/usr/include)
if(ZMQ_INCLUDE_DIR)
message(STATUS "Find zmq include at ${ZMQ_INCLUDE_DIR}")
else()
message(FATAL_ERROR "Cannot find zmq include")
set(ZMQ_FOUND no)
return()
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${ZMQ_INCLUDE_DIR}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${ZMQ_INCLUDE_DIR}")
set(LIB_NAME "libzmq.so")
if(APPLE)
set(LIB_NAME "libzmq.dylib")
endif()
find_path(ZMQ_LIBRARY_DIR NAMES ${LIB_NAME}
PATHS $ENV{CONDA_PREFIX}/lib $ENV{CONDA_ENV_PATH}/lib /usr/lib /usr/lib64 /usr/local/lib /usr/lib/x86_64-linux-gnu/ /usr/local/lib/x86_64-linux-gnu/ $ENV{HOME}/usr/lib)
if(ZMQ_LIBRARY_DIR)
message(STATUS "Find zmq library at ${ZMQ_LIBRARY_DIR}")
else()
message(FATAL_ERROR "Cannot find zmq library")
set(ZMQ_FOUND no)
endif()
#link_directories(${ZMQ_LIBRARY_DIR})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -L${ZMQ_LIBRARY_DIR}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -L${ZMQ_LIBRARY_DIR}")
set(ZMQ_LIBRARY "zmq" CACHE STRING "name of the zmq library")
# 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")
add_definitions(--std=c++11 -Wall -Werror -g -O2 -D__PROGRAM_VERSION__="${PROGRAM_VERSION}")
if(DOC_MODE)
pull_extra_module("PhoenixTex2Html" "https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS/PhoenixTex2Html.git")
add_subdirectory(doc)
endif()
createLinuxPackages()
endif()
endfunction(phoenix_base_project)
set(SCRIPT_CLONE_MODULE "${CMAKE_CURRENT_SOURCE_DIR}/scriptCloneModule.sh" CACHE STRING "Script to be used to clone project used as module")
set(SCRIPT_PULL_MODULE "${CMAKE_CURRENT_SOURCE_DIR}/scriptPull.sh" CACHE STRING "Script to be used to clone project used as module")
set(SCRIPT_CLONE_PACKAGE "${CMAKE_CURRENT_SOURCE_DIR}/scriptClonePackage.sh" CACHE STRING "Script to be used to clone package used as module")
# Check if a project (used as module) is found, if it's not, it will be fetch with its url
# When the project is found, this function does a classic add_subdirectory
# Parameter :
# packageName : name of the package to be found (classic parameter of find_package)
# urlGitToPackage : url of the git repository to be used to fetch it if it is not found
function(get_extra_module packageName urlGitToPackage)
set(PHOENIX_TARGET_NAME "phoenix_${packageName}_found")
if(TARGET ${PHOENIX_TARGET_NAME})
message(STATUS "Project ${packageName} already found, target ${PHOENIX_TARGET_NAME} exits")
else()
add_custom_target(${PHOENIX_TARGET_NAME})
set(SUB_MODULE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/.tmp_project)
file(MAKE_DIRECTORY ${SUB_MODULE_DIRECTORY})
set(MODULE_MODE yes)
set(MODULE_PROJECT_DIR ${SUB_MODULE_DIRECTORY}/${packageName})
if(EXISTS ${MODULE_PROJECT_DIR})
message(STATUS "Find project ${packageName} in ${MODULE_PROJECT_DIR}")
execute_process(COMMAND ${SCRIPT_PULL_MODULE} ${MODULE_PROJECT_DIR}
WORKING_DIRECTORY ${SUB_MODULE_DIRECTORY}/
ERROR_QUIET
OUTPUT_QUIET
)
add_subdirectory(${MODULE_PROJECT_DIR})
include_directories(${MODULE_PROJECT_DIR}/src)
include_directories(${PHOENIX_INCLUDE_DIRS})
else()
message(STATUS "Project ${packageName} not found")
if(urlGitToPackage)
get_filename_component(basePackageDirName ${urlGitToPackage} NAME_WE)
message(STATUS "Get project ${packageName} with url '${urlGitToPackage}'")
execute_process(COMMAND ${SCRIPT_CLONE_MODULE} ${urlGitToPackage}
WORKING_DIRECTORY ${SUB_MODULE_DIRECTORY}/)
if(EXISTS ${MODULE_PROJECT_DIR})
message(STATUS "Find project ${packageName} in ${MODULE_PROJECT_DIR}")
add_subdirectory(${MODULE_PROJECT_DIR})
include_directories(${MODULE_PROJECT_DIR}/src)
include_directories(${PHOENIX_INCLUDE_DIRS})
else()
message(FATAL_ERROR "Project ${packageName} not found even after cloning repository ${urlGitToPackage}")
endif()
else(urlGitToPackage)
message(FATAL_ERROR "Package ${packageName} not found and no url to fetch it")
endif(urlGitToPackage)
endif()
endif()
endfunction(get_extra_module)
# Check if a project (used as module) is found, if it's not, it will be fetch with its url
# When the project is found, this function does a classic add_subdirectory
# Parameter :
# packageName : name of the package to be found (classic parameter of find_package)
# urlGitToPackage : url of the git repository to be used to fetch it if it is not found
function(pull_extra_module packageName urlGitToPackage)
# There is one global varialbe PHOENIX_FORCE_PULL_MODULE
# - if the PHOENIX_FORCE_PULL_MODULE == no
# - we look for the FindXXX.cmake and we use the classic find_package
# - if the package has been found nothing to do
# - but if the corresponding module is found, we remove it (to avoid extra clone and conflict)
# - if the package is not found, we get the existing module (by clone or pull)
# - if the module does not exsit, it is cloned (and then potentially installed)
# - if the module does exsit, it is pulled (and also potentially installed after)
# - if the PHOENIX_FORCE_PULL_MODULE == yes
# - if the module is not found, we clone it even if the package does exist (we recompile it and reinstall it)
# - if the module is found, we pull it even if the package does exist (we recompile it and reinstall it)
if(PHOENIX_FORCE_PULL_MODULE)
# We always pull the module
get_extra_module(${packageName} ${urlGitToPackage})
else()
# Try to find the package
find_package(${packageName})
string(TOUPPER ${packageName} UPPER_PACKAGE_NAME)
if(${${UPPER_PACKAGE_NAME}_FOUND})