diff --git a/CMake/generate-config-properties.cpp b/CMake/GenerateConfigProperties.cpp similarity index 94% rename from CMake/generate-config-properties.cpp rename to CMake/GenerateConfigProperties.cpp index f22e15dc549cc0d8a06c2c7367ef9b4c0ca367e8..a9aba0dd6cb8dcfe513ba28897645b3cc029a191 100644 --- a/CMake/generate-config-properties.cpp +++ b/CMake/GenerateConfigProperties.cpp @@ -24,11 +24,11 @@ PURPOSE. See the above copyright notices for more information. #include <iostream> /** - * @brief main application for generating the otb_config.inp file. - * - * @param argv[1] Path to OTB_BINARY_DIR/otb_config.inp + * @brief main application for generating the otb.conf file. * - * @param argv[2] language parameter + * @param argv[1] Path to OTB_BINARY_DIR/otb.conf + * + * @param argv[2] language parameter */ int main(int argc, char* argv[]) { @@ -52,7 +52,7 @@ int main(int argc, char* argv[]) std::string releaseVersion = "0"; std::string::size_type pos1 = std::string::npos; std::string::size_type pos2 = std::string::npos; - + pos1 = versionNumber.find(".", 0); if(pos1 != std::string::npos) { @@ -104,17 +104,17 @@ int main(int argc, char* argv[]) << std::endl; */ std::string language(argv[2]); - - + + os << "#Auto generated by config-properties \n" << "#Language \n" << "OTB_LANG=" << language << "\n" << "# end of config file properties generation" - << std::endl; + << std::endl; os.close(); - + std::cout << "wrote file: " << argv[1] << std::endl; exit(0); diff --git a/CMakeLists.txt b/CMakeLists.txt index 18dba8ca0f966c7ea6a4c4ea4f843679a9fa5967..e5d371b9150a8cf6103cc54a06d8f1c5ff18d001 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1127,14 +1127,14 @@ INCLUDE(CPack) ENDIF(OTB_USE_CPACK) -FILE(GLOB otbconfigfileCreation_SRCS "${OTB_SOURCE_DIR}/CMake/generate-config-properties.cpp") -SET(otbconfigfile_DEFAULT "${OTB_BINARY_DIR}/otb_config.inp") +FILE(GLOB otbconfigfileCreation_SRCS "${OTB_SOURCE_DIR}/CMake/GenerateConfigProperties.cpp") +SET(otbconfigfile_DEFAULT "${OTB_BINARY_DIR}/otb.conf") -ADD_EXECUTABLE(generate-config-properties ${otbconfigfileCreation_SRCS}) +ADD_EXECUTABLE(GenerateConfigProperties ${otbconfigfileCreation_SRCS}) ADD_CUSTOM_COMMAND( - TARGET generate-config-properties + TARGET GenerateConfigProperties POST_BUILD - COMMAND generate-config-properties + COMMAND GenerateConfigProperties ARGS "${otbconfigfile_DEFAULT}" "${OTB_LANG}" - COMMENT "Generating otb_config.inp" ) + COMMENT "Generating ${otbconfigfile_DEFAULT}" ) diff --git a/Code/Common/otbConfigurationFile.h b/Code/Common/otbConfigurationFile.h index ae5cf7c50f141e91c78b50d99d935608ff9296cb..45ecdaed66a32889c86c3de37d9bd2bab3cc2d28 100644 --- a/Code/Common/otbConfigurationFile.h +++ b/Code/Common/otbConfigurationFile.h @@ -30,24 +30,24 @@ namespace otb /** \class ConfigurationFile * \brief Manage OTB ConfigurationFile file */ - + class ConfigurationFile : public itk::Object { public: /** Standard class typedef */ - + typedef ConfigurationFile Self; typedef itk::Object Superclass; typedef itk::SmartPointer<Self> Pointer; typedef itk::SmartPointer<const Self> ConstPointer; - - + + /** Standard macro */ itkTypeMacro(ConfigurationFile,Object); /** This is protected for the singleton. Use GetInstance() instead. */ itkNewMacro(Self); - + /** Get the unique instanc1e of the model */ // static Pointer GetInstance() // { @@ -57,24 +57,25 @@ namespace otb // } // return Instance; // }; - + ConfigFile * GetOTBConfig() { return m_OTBConfig; }; - + std::string GetLanguage() { - return m_OTBConfig->read<std::string>( "LANG" ); + return m_OTBConfig->read<std::string>( "OTB_LANG" ); }; // std::string lib(OTB_CONFIG); - + protected: - + /** Constructor */ - ConfigurationFile(){ + ConfigurationFile() + { std::string OTBBinDir(OTB_CONFIG); - m_OTBConfig = new ConfigFile(OTBBinDir + "/otb_config.inp"); + m_OTBConfig = new ConfigFile(OTBBinDir + "/otb.conf"); } ; /** Destructor */