#!/bin/bash

OPTION="$1"

function usage(){
	echo "Phoenix Config provides a script to get installation path of current project. Thus, it can be used with other build system."
	echo "Usage :"
	echo -e "\tphoenixzmq-config --version"
	echo -e "\tphoenixzmq-config --longversion"
	echo -e "\tphoenixzmq-config --prefix"
	echo -e "\tphoenixzmq-config --bin"
	echo -e "\tphoenixzmq-config --lib"
	echo -e "\tphoenixzmq-config --include"
	echo -e "\tphoenixzmq-config --share"
	echo -e "\tphoenixzmq-config --modulepath"
	echo -e "\tphoenixzmq-config --cmake"
	echo "Options :"
	echo -e "\t--version : version of the current project"
	echo -e "\t--prefix : installation prefix of the current project"
	echo -e "\t--bin : binary directory"
	echo -e "\t--lib : library directory"
	echo -e "\t--include : include directory"
	echo -e "\t--share : share directory"
	echo -e "\t--modulepath : CMAKE_MODULE_PATH directory"
	echo -e "\t--cmake : CMake arguments to compile with the same prefix as the current program"
}

PROGRAM_VERSION="9.0.1"
PROGRAM_VERSION_LONG="9.0.1"
PROGRAM_PREFIX="/builds/CTA-LAPP/PHOENIX_LIBS2/network/PhoenixZMQ/.pixi/bld/phoenixzmq/H3PqHCMjqWU/host_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho"
PROGRAM_BIN="${PROGRAM_PREFIX}/bin"
PROGRAM_LIB="${PROGRAM_PREFIX}/lib"
PROGRAM_INCLUDE="${PROGRAM_PREFIX}/include/PhoenixZMQ"
PROGRAM_SHARE="${PROGRAM_PREFIX}/share/PhoenixZMQ"
PROGRAM_MODULE_PATH="${PROGRAM_PREFIX}/share/cmake/Modules/"
PROGRAM_CMAKE="-DCMAKE_INSTALL_PREFIX=${PROGRAM_PREFIX} -DCMAKE_MODULE_PATH=${PROGRAM_MODULE_PATH}"

if [[ "${OPTION}" == "-h"* ]]
then
	usage
	exit 0
fi

if [[ "${OPTION}" == "--help"* ]]
then
	usage
	exit 0
fi

function printValue(){
	OPTION_NAME="$1"
	PATH_VALUE="$2"
	if [[ "${OPTION}" == "${OPTION_NAME}" ]]
	then
		echo ${PATH_VALUE}
		exit 0
	fi
}

printValue "--version" "${PROGRAM_VERSION}"
printValue "--longversion" "${PROGRAM_VERSION_LONG}"
printValue "--prefix" "${PROGRAM_PREFIX}"
printValue "--bin" "${PROGRAM_BIN}"
printValue "--lib" "${PROGRAM_LIB}"
printValue "--include" "${PROGRAM_INCLUDE}"
printValue "--share" "${PROGRAM_SHARE}"
printValue "--modulepath" "${PROGRAM_MODULE_PATH}"
printValue "--cmake" "${PROGRAM_CMAKE}"

