27 #include "../../../../common/Version.h" 
   34 #define CMAKE_FILE_NAME           "CMakeLists.txt" 
   35 #define PLUGIN_INFO_XML_FILE_NAME "plugin_info.xml.in" 
   50   std::string fileName = buildPath;
 
   54   file.open(fileName.c_str());
 
   57   insertDefaultHeader(file);
 
   60   file << 
"cmake_minimum_required(VERSION 2.8)\n"; 
 
   64   file << 
"# Controls for the source and build tree locations\n"; 
 
   65   file << 
"set(SRCDIR " + sourcePath + 
")\n";
 
   66   file << 
"set(INCLDIR ${SRCDIR}) \n";
 
   70   file << 
"# Set the project name\n"; 
 
   71   file << 
"set(PROJ_NAME \"" + projName + 
"\")\n";
 
   72   file << 
"project(${PROJ_NAME})\n";
 
   73   file << 
"set(LIB_NAME ${PROJ_NAME})\n";
 
   77   file << 
"# If this plugin has dependencies with any package\n";
 
   78   file << 
"# you should set it here\n";
 
   80   findTerralib(file, cmakePath, pi);
 
   86   file << 
"# If this plugin has UI files\n";
 
   87   file << 
"# you should set it here\n"; 
 
   88   file << 
"# qt4_wrap_ui...\n\n";
 
   92   file << 
"# Add files\n"; 
 
   93   file << 
"file(GLOB SRCS ${SRCDIR}/*.cpp)\n";
 
   94   file << 
"file(GLOB HDRS ${INCLDIR}/*.h)\n";
 
   98   file << 
"# WIN32 Definitions\n"; 
 
   99   file << 
"if(WIN32)\n";
 
  100   file << 
"  add_definitions(-D_CRT_SECURE_NO_WARNINGS)\n";
 
  101   file << 
"endif(WIN32)\n";
 
  105   file << 
"# General Definitions\n";
 
  106   file << 
"add_definitions(-D" + exportMacro + 
")\n";
 
  110   file << 
"# Append extra files (used in case project has UI forms)\n";
 
  111   file << 
"#source_group(\"Form Files\" FILES ${FORMS})\n";
 
  112   file << 
"#source_group(\"Generated Files\" FILES ${MOC} ${UI})\n";
 
  116   file << 
"# Configure file\n";
 
  117   file << 
"configure_file(\"${CMAKE_CURRENT_SOURCE_DIR}/plugin_info.xml.in\" ";
 
  118   file << 
"\"${CMAKE_CURRENT_BINARY_DIR}/" + projName + 
".xml\")\n";
 
  122   file << 
"# Lib properties\n";
 
  123   file << 
"include_directories( ${DEP_INCLUDES} )\n";
 
  124   file << 
"add_library (${PROJ_NAME} SHARED ${HDRS} ${SRCS}) # ${UI} ${MOC}\n";
 
  125   file << 
"set_target_properties(${PROJ_NAME} PROPERTIES DEBUG_POSTFIX _d)\n";
 
  126   file << 
"target_link_libraries(${PROJ_NAME} ${DEP_LIBS})\n";
 
  135   std::string fileName = buildPath;
 
  139   file.open(fileName.c_str());
 
  145   file << 
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n";
 
  146   file << 
"<PluginInfo xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n";
 
  147   file << 
"            xmlns:xsd=\"http://www.w3.org/2001/XMLSchema-instance\"\n";
 
  148   file << 
"            xmlns=\"http://www.terralib.org/schemas/plugin\"\n";
 
  149   file << 
"            xsd:schemaLocation=\"http://www.terralib.org/schemas/plugin ${TERRALIB_SCHEMA_LOCATION}/plugin/plugin_info.xsd\"\n";
 
  150   file << 
"            version=\"" + pi.
m_version + 
"\"\n";
 
  151   file << 
"            release=\"" + pi.
m_release + 
"\"\n";
 
  152   file << 
"            engine=\"" + pi.
m_engine + 
"\">\n";
 
  153   file << 
"  <Name>" + pi.
m_name + 
"</Name>\n";
 
  154   file << 
"  <DisplayName>" + pi.
m_displayName + 
"</DisplayName>\n";
 
  155   file << 
"  <Description>" + pi.
m_description + 
"</Description>\n";
 
  158   file << 
"  <Category>" + pi.
m_category + 
"</Category>\n";
 
  159   file << 
"  <Site xlink:href=\"" + pi.
m_site + 
"\"/>\n";
 
  160   file << 
"  <Provider>\n";
 
  161   file << 
"    <Name>" + p.
m_name + 
"</Name>\n";
 
  162   file << 
"    <Site xlink:href=\"" + p.
m_site + 
"\"/>\n";
 
  163   file << 
"    <Email>" + p.
m_email + 
"</Email>\n";
 
  164   file << 
"  </Provider>\n";
 
  168     file << 
"  <RequiredPlugins>\n";
 
  173     file << 
"  </RequiredPlugins>\n";
 
  178     file << 
"  <RequiredModules>\n";
 
  183     file << 
"  </RequiredModules>\n";
 
  189     file << 
"  <Resources>\n";
 
  192       file << 
"    <Resource name=\"" + pi.
m_resources[t].first + 
"\" xlink:href=\"" + pi.
m_resources[t].second + 
"\"/>\n";
 
  194     file << 
"  </Resources>\n";
 
  200     file << 
"  <Parameters>\n";
 
  203       file << 
"    <Parameter>\n";
 
  204       file << 
"      <Name>" + pi.
m_parameters[t].first + 
"</Name>\n";
 
  205       file << 
"      <Value>" + pi.
m_parameters[t].second + 
"</Value>\n";
 
  206       file << 
"    </Parameter>\n";
 
  208     file << 
"  </Parameters>\n";
 
  212   file << 
"</PluginInfo>\n";
 
  219   time_t now = time(0);
 
  220   char* dt = ctime(&now);
 
  221   std::string currentTime = dt;
 
  225   std::string defaultHeader = 
"";
 
  227   defaultHeader += 
"#######################################################################\n";
 
  228   defaultHeader += 
"## This file was automatically generated by TerraView - Plugin Builder\n";
 
  229   defaultHeader += 
"## TerraLib Version: " + teVersion + 
" \n";
 
  230   defaultHeader += 
"## File: " + fileName + 
"\n";
 
  231   defaultHeader += 
"## Date: " + currentTime;
 
  232   defaultHeader += 
"#######################################################################\n";
 
  234   stream << defaultHeader.c_str();
 
  240   time_t now = time(0);
 
  241   char* dt = ctime(&now);
 
  242   std::string currentTime = dt;
 
  246   std::string defaultHeader = 
"";
 
  248   defaultHeader += 
"<!--###################################################################\n";
 
  249   defaultHeader += 
"##  This file was automatically generated by TerraView - Plugin Builder\n";
 
  250   defaultHeader += 
"##  TerraLib Version: " + teVersion + 
"\n";
 
  251   defaultHeader += 
"##  File: " + fileName + 
"\n";
 
  252   defaultHeader += 
"##  Date: " + currentTime;
 
  253   defaultHeader += 
"####################################################################-->\n";
 
  255   stream << defaultHeader.c_str();
 
  260   std::string componentList = 
"";
 
  267     componentList += componentName + 
" ";
 
  270   stream << 
"list (APPEND CMAKE_PREFIX_PATH \"" + teCmakePath + 
"\")\n";
 
  271   stream << 
"list (APPEND CMAKE_FIND_ROOT_PATH \"" + teCmakePath + 
"\")\n";
 
  273   stream << 
"find_package(terralib 5 REQUIRED COMPONENTS " + componentList + 
")\n";
 
  274   stream << 
"if(terralib_FOUND)\n";
 
  275   stream << 
"  list (APPEND DEP_INCLUDES ${TE_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR})\n";
 
  276   stream << 
"  list (APPEND DEP_LIBS ${TE_LIBRARIES})\n";
 
  277   stream << 
"endif()\n";
 
  282   stream << 
"find_package(Boost ${_Boost_VERSION} REQUIRED COMPONENTS system filesystem)\n";
 
  283   stream << 
"if(Boost_FOUND)\n";
 
  284   stream << 
"  list (APPEND DEP_INCLUDES ${Boost_INCLUDE_DIRS})\n";
 
  285   stream << 
"endif()\n";
 
The basic information about a plugin. 
 
std::string m_site
The provider home page. 
 
std::vector< Resource > m_resources
The list of resources used by plugin. 
 
std::vector< std::string > m_requiredPlugins
The list of required plugins in order to lunch the plugin. 
 
std::string m_name
Provider name: may be a person or a company. 
 
void createCmakeFile(const std::string &buildPath, const std::string &sourcePath, const std::string &projName, const std::string exportMacro, const std::string &cmakePath, const te::plugin::PluginInfo &pi)
 
void findBoost(std::ofstream &stream)
 
std::vector< Parameter > m_parameters
Any configuration parameter that can be informed to plugin (map: parameter-name -> parameter-value)...
 
void findTerralib(std::ofstream &stream, const std::string &teCmakePath, const te::plugin::PluginInfo &pi)
 
void createPluginInfoFile(const std::string &buildPath, const te::plugin::PluginInfo &pi, const te::plugin::Provider &p)
 
This struct can be used to describe a given plugin provider. 
 
std::string m_licenseDescription
A brief description about the plugin license. 
 
std::string m_licenseURL
An URL where someone can find more information on the license. 
 
std::string m_description
A brief explanation about the plugin. 
 
std::string m_site
An URL pointing to the plugin site. 
 
std::string m_version
The plugin version. 
 
static std::string asString()
 
std::string m_terralibVersion
The TerraLib version this plugin depends on. 
 
void insertDefaultXMLHeader(std::ofstream &stream)
 
std::string m_engine
The type of plugin execution engine: C++, JAVA. 
 
std::string m_release
The release date of the plugin. This may be used to identify new versions of a given plugin...
 
std::string m_email
The provider contact e-mail. 
 
std::string m_name
The plugin name: an internal value used to identify the plugin in the system. Must be a unique value...
 
std::vector< std::string > m_requiredModules
The list of required category of plugins in order to lunch the plugin. 
 
#define PLUGIN_INFO_XML_FILE_NAME
 
void insertDefaultHeader(std::ofstream &stream)
 
This class is used to create the cmake file for the new plugin builded. 
 
std::string m_category
The plugin category. 
 
std::string m_displayName
The plugin name to be displayed in a graphical interface.