27 #include "../../../../common/Version.h" 34 #define CMAKE_FILE_NAME "CMakeLists.txt" 35 #define PLUGIN_INFO_XML_FILE_NAME "plugin_info.xml.in" 46 std::string fileName = buildPath;
50 file.open(fileName.c_str());
56 file <<
"cmake_minimum_required(VERSION 2.8)\n";
60 file <<
"# Controls for the source and build tree locations\n";
61 file <<
"set(SRCDIR " + sourcePath +
")\n";
62 file <<
"set(INCLDIR ${SRCDIR}) \n";
66 file <<
"# Set the project name\n";
67 file <<
"set(PROJ_NAME \"" + projName +
"\")\n";
68 file <<
"project(${PROJ_NAME})\n";
69 file <<
"set(LIB_NAME ${PROJ_NAME})\n";
73 file <<
"# If this plugin has dependencies with any package\n";
74 file <<
"# you should set it here\n";
82 file <<
"# If this plugin has UI files\n";
83 file <<
"# you should set it here\n";
84 file <<
"# qt4_wrap_ui...\n\n";
88 file <<
"# Add files\n";
89 file <<
"file(GLOB SRCS ${SRCDIR}/*.cpp)\n";
90 file <<
"file(GLOB HDRS ${INCLDIR}/*.h)\n";
94 file <<
"# WIN32 Definitions\n";
95 file <<
"if(WIN32)\n";
96 file <<
" add_definitions(-D_CRT_SECURE_NO_WARNINGS)\n";
97 file <<
"endif(WIN32)\n";
101 file <<
"# General Definitions\n";
102 file <<
"add_definitions(-D" + exportMacro +
")\n";
106 file <<
"# Append extra files (used in case project has UI forms)\n";
107 file <<
"#source_group(\"Form Files\" FILES ${FORMS})\n";
108 file <<
"#source_group(\"Generated Files\" FILES ${MOC} ${UI})\n";
112 file <<
"# Configure file\n";
113 file <<
"configure_file(\"${CMAKE_CURRENT_SOURCE_DIR}/plugin_info.xml.in\" ";
114 file <<
"\"${CMAKE_CURRENT_BINARY_DIR}/" + projName +
".xml\")\n";
118 file <<
"# Lib properties\n";
119 file <<
"include_directories( ${DEP_INCLUDES} )\n";
120 file <<
"add_library (${PROJ_NAME} SHARED ${HDRS} ${SRCS}) # ${UI} ${MOC}\n";
121 file <<
"set_target_properties(${PROJ_NAME} PROPERTIES DEBUG_POSTFIX _d)\n";
122 file <<
"target_link_libraries(${PROJ_NAME} ${DEP_LIBS})\n";
216 time_t now = time(
nullptr);
217 char*
dt = ctime(&now);
218 std::string currentTime =
dt;
222 std::string defaultHeader;
224 defaultHeader +=
"#######################################################################\n";
225 defaultHeader +=
"## This file was automatically generated by TerraView - Plugin Builder\n";
226 defaultHeader +=
"## TerraLib Version: " + teVersion +
" \n";
227 defaultHeader +=
"## File: " + fileName +
"\n";
228 defaultHeader +=
"## Date: " + currentTime;
229 defaultHeader +=
"#######################################################################\n";
231 stream << defaultHeader.c_str();
237 time_t now = time(
nullptr);
238 char*
dt = ctime(&now);
239 std::string currentTime =
dt;
243 std::string defaultHeader;
245 defaultHeader +=
"<!--###################################################################\n";
246 defaultHeader +=
"## This file was automatically generated by TerraView - Plugin Builder\n";
247 defaultHeader +=
"## TerraLib Version: " + teVersion +
"\n";
248 defaultHeader +=
"## File: " + fileName +
"\n";
249 defaultHeader +=
"## Date: " + currentTime;
250 defaultHeader +=
"####################################################################-->\n";
252 stream << defaultHeader.c_str();
257 std::string componentList;
264 componentList += componentName +
" ";
267 stream <<
"list (APPEND CMAKE_PREFIX_PATH \"" + teCmakePath +
"\")\n";
268 stream <<
"list (APPEND CMAKE_FIND_ROOT_PATH \"" + teCmakePath +
"\")\n";
270 stream <<
"find_package(terralib 5 REQUIRED COMPONENTS " + componentList +
")\n";
271 stream <<
"if(terralib_FOUND)\n";
272 stream <<
" list (APPEND DEP_INCLUDES ${TE_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR})\n";
273 stream <<
" list (APPEND DEP_LIBS ${TE_LIBRARIES})\n";
274 stream <<
"endif()\n";
279 stream <<
"find_package(Boost ${_Boost_VERSION} REQUIRED COMPONENTS system filesystem)\n";
280 stream <<
"if(Boost_FOUND)\n";
281 stream <<
" list (APPEND DEP_INCLUDES ${Boost_INCLUDE_DIRS})\n";
282 stream <<
"endif()\n";
static std::string asString()
Basic information about a plugin.
This class is used to create the cmake file for the new plugin builded.
static te::dt::TimeDuration dt(20, 30, 50, 11)
std::vector< std::string > linked_libraries
The list of linked libraries.
file(WRITE ${CMAKE_BINARY_DIR}/config_qhelp.cmake"configure_file (${TERRALIB_ABSOLUTE_ROOT_DIR}/doc/qhelp/help.qhcp.in ${CMAKE_BINARY_DIR}/share/terraview/help/help.qhcp @ONLY)") add_custom_command(OUTPUT del_dir COMMAND $