CMake: pass installation prefix to programs

The file libowlps/owlps-config.h.in was added to allow CMake to pass the
installation prefix variable to the programs. That allows the programs
to look for their configuration file at the right position (i.e. in the
etc/owlps directory under the installation prefix).
This commit is contained in:
Matteo Cypriani 2013-06-04 11:57:59 -04:00
parent 4bd104d633
commit d32813376b
6 changed files with 40 additions and 10 deletions

View File

@ -52,11 +52,6 @@ Work to do in OwlPS
- Add option dump-configuration (displays the config & exits).
- CMake:
- handle logo/
- use the installation prefix as search prefix for configuration files
in Listener, Aggregator and Positioner
- Support string-based positioning requests
Along with the binary requests, implement a string-based request

View File

@ -9,6 +9,10 @@
# distributed along with this file, either separately or by replacing
# this notice by the COPYRIGHT.t2t file's contents.
# Generate configuration header
configure_file(owlps-config.h.in
"${GENERATED_INCLUDE}/owlps-config.h")
# On Linux and other GNU systems (e.g. GNU/kFreeBSD), we need -lrt for
# clock_gettime()
string(REGEX MATCH "^GNU" GNU_SYSTEM ${CMAKE_SYSTEM_NAME})

View File

@ -0,0 +1,27 @@
/*
* This file is part of the Owl Positioning System (OwlPS) project.
* It is subject to the copyright notice and license terms in the
* COPYRIGHT.t2t file found in the top-level directory of this
* distribution and at
* http://code.lm7.fr/p/owlps/source/tree/master/COPYRIGHT.t2t
* No part of the OwlPS Project, including this file, may be copied,
* modified, propagated, or distributed except according to the terms
* contained in the COPYRIGHT.t2t file; the COPYRIGHT.t2t file must be
* distributed along with this file, either separately or by replacing
* this notice by the COPYRIGHT.t2t file's contents.
*
***********************************************************************
*
* This is the configuration header file for OwlPS. It is not strictly
* related with libowlps, but it sits in the same directory because
* libowlps is used by all the C/C++ programs in OwlPS.
*/
#ifndef _OWLPS_CONFIG_H_
#define _OWLPS_CONFIG_H_
// Directory in which are located the configuration files
#define OWL_CONFIG_PREFIX "${CMAKE_INSTALL_PREFIX}/etc/owlps"
#endif // _OWLPS_CONFIG_H_

View File

@ -19,12 +19,14 @@
#ifndef _OWLPS_AGGREGATOR_H_
#define _OWLPS_AGGREGATOR_H_
#include <owlps-config.h>
#include <owlps.h>
/* Arguments & program configuration */
#define OPTIONS "Ac:C:Df:hH:i:k:K:l:o:O:p:qt:vV" // getopt string
#define DEFAULT_CONFIG_FILE "/usr/local/etc/owlps/owlps-aggregator.conf"
#define DEFAULT_CONFIG_FILE OWL_CONFIG_PREFIX "/owlps-aggregator.conf"
#define DEFAULT_AGGREGATE_TIMEOUT 600 // milliseconds
#define DEFAULT_KEEP_TIMEOUT 3000 // milliseconds
#define DEFAULT_CHECK_INTERVAL 300 // milliseconds

View File

@ -19,6 +19,7 @@
#ifndef _OWLPS_LISTENER_H_
#define _OWLPS_LISTENER_H_
#include <owlps-config.h>
#include <owlps-listener-config.h>
#ifdef OWLPS_LISTENER_KEEPS_MONITOR
@ -70,7 +71,7 @@
/* Arguments & program configuration */
#define OPTIONS "ADf:hH:i:I:Kl:m:n:O:p:P:qr:R:t:T:vVw:" // getopt string
#define DEFAULT_CONFIG_FILE "/usr/local/etc/owlps/owlps-listener.conf"
#define DEFAULT_CONFIG_FILE OWL_CONFIG_PREFIX "/owlps-listener.conf"
enum {MODE_ACTIVE = 'a', MODE_PASSIVE = 'p', MODE_MIXED = 'm'} ;
#define DEFAULT_AUTOCALIBRATION_HELLO_DELAY 15 // seconds
#define DEFAULT_AUTOCALIBRATION_DELAY 25 // milliseconds

View File

@ -15,6 +15,8 @@
#include "userinterface.hh"
#include "configuration.hh"
#include <owlps-config.h>
#include <owlps.h>
#include <iostream>
@ -29,8 +31,7 @@ namespace po = boost::program_options ;
/* *** Default value definitions *** */
/* General options */
#define DEFAULT_CONFIG_FILE_NAME \
"/usr/local/etc/owlps/owlps-positioner.conf"
#define DEFAULT_CONFIG_FILE OWL_CONFIG_PREFIX "/owlps-positioner.conf"
/* Positioning options */
#define DEFAULT_SS_SIMILARITY "mean"
@ -103,7 +104,7 @@ void UserInterface::fill_cli_options()
("version,V",
"Print version information.")
("config-file,f",
po::value<string>()->default_value(DEFAULT_CONFIG_FILE_NAME),
po::value<string>()->default_value(DEFAULT_CONFIG_FILE),
"Alternative configuration file.")
("verbose,v",
"Verbose mode.")