Skip to content
Snippets Groups Projects
Commit c7df41bd authored by Manuel Grizonnet's avatar Manuel Grizonnet
Browse files

ENH:config file with install command in cmake

parent b9120800
Branches
Tags
No related merge requests found
......@@ -15,8 +15,10 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __otbConfiguration_h
#define __otbConfiguration_h
#ifndef __otbConfigurationFile_h
#define __otbConfigurationFile_h
#include "otbConfigure.h"
#include "itkObject.h"
#include "itkObjectFactory.h"
......@@ -25,24 +27,24 @@ PURPOSE. See the above copyright notices for more information.
namespace otb
{
/** \class Configuration
* \brief Manage OTB configuration file
/** \class ConfigurationFile
* \brief Manage OTB ConfigurationFile file
*/
class Configuration
class ConfigurationFile
: public itk::Object
{
public:
/** Standard class typedef */
typedef Configuration Self;
typedef ConfigurationFile Self;
typedef itk::Object Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Standard macro */
itkTypeMacro(Configuration,Object);
itkTypeMacro(ConfigurationFile,Object);
/** This is protected for the singleton. Use GetInstance() instead. */
itkNewMacro(Self);
......@@ -70,13 +72,13 @@ namespace otb
protected:
/** Constructor */
Configuration(){
ConfigurationFile(){
std::string OTBBinDir(OTB_CONFIG);
m_OTBConfig = new ConfigFile(OTBBinDir + "/otb_config.inp");
}
;
/** Destructor */
~Configuration(){};
~ConfigurationFile(){};
/** PrintSelf method */
void PrintSelf(std::ostream& os, itk::Indent indent) const {};
private:
......
......@@ -18,12 +18,12 @@
#include "itkExceptionObject.h"
#include "otbMacro.h"
#include <fstream>
#include "otbConfiguration.h"
#include "otbConfigurationFile.h"
int otbConfigurationTest(int argc, char * argv[])
{
std::cout << "begin config test" << std::endl;
typedef otb::Configuration ConfigurationType;
// std::cout << "begin config test" << std::endl;
typedef otb::ConfigurationFile ConfigurationType;
//Instantiation
// ConfigurationType::Pointer conf = ConfigurationType::GetInstance();
......@@ -32,10 +32,10 @@ int otbConfigurationTest(int argc, char * argv[])
std::string lang = conf->GetLanguage();
std::cout << "config language " << lang << std::endl;
if (lang != "fr")
return EXIT_FAILURE;
std::cout << "config language " << lang << std::endl;
return EXIT_SUCCESS;
}
......@@ -2,13 +2,14 @@ PROJECT(otbConfigFilelib)
FILE(GLOB otbConfigFilelib_SRCS "*.cpp")
FILE(GLOB otbConfigFilelib_HDRS "*.h")
ADD_LIBRARY(otbConfigFile ${otbConfigFilelib_SRCS})
SET(otbConfigFile_DEFAULT otb_config.inp)
ADD_LIBRARY(otbConfigFile ${otbConfigFilelib_SRCS} ${otbConfigFile_DEFAULT})
TARGET_LINK_LIBRARIES(otbConfigFile)
IF(OTB_LIBRARY_PROPERTIES)
SET_TARGET_PROPERTIES(otbConfigFile PROPERTIES ${OTB_LIBRARY_PROPERTIES})
ENDIF(OTB_LIBRARY_PROPERTIES)
INCLUDE_DIRECTORIES("${OTB_SOURCE_DIR}/Utilities/otbconfigfile")
# INCLUDE_DIRECTORIES("${OTB_SOURCE_DIR}/Utilities/otbconfigfile")
IF(NOT OTB_INSTALL_NO_LIBRARIES)
INSTALL(TARGETS otbConfigFile
......@@ -22,3 +23,6 @@ IF(NOT OTB_INSTALL_NO_DEVELOPMENT)
DESTINATION ${OTB_INSTALL_INCLUDE_DIR_CM24}/Utilities/otbConfigFilelib
COMPONENT Development)
ENDIF(NOT OTB_INSTALL_NO_DEVELOPMENT)
#copy the configuration file in the binary directory
INSTALL(FILES ${otbConfigFile_DEFAULT} DESTINATION ${CMAKE_INSTALL_PREFIX})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment