21 std::cerr <<
"project_generator : cannot parse config file '"<<descriptionFile<<
"'" << std::endl;
25 if(mapProject == NULL){
26 std::cerr <<
"project_generator_loadConfig : Missing [project] in config file '"<<descriptionFile<<
"'" << std::endl;
49 body +=
"file(GLOB "+libName+
"_SRC \"${CMAKE_CURRENT_SOURCE_DIR}/*.cpp\")\n";
50 body +=
"phoenix_add_library("+libName+
" ${"+libName+
"_SRC})\n";
51 body +=
"target_link_libraries("+libName+
" phoenix_type_stream phoenix_data_stream)\n";
53 body +=
"install(TARGETS "+libName+
" LIBRARY DESTINATION ${LIBRARY_DIRECTORY} ARCHIVE DESTINATION ${LIBRARY_DIRECTORY})\n";
55 body +=
"file(GLOB headers \"${CMAKE_CURRENT_SOURCE_DIR}/*.h\")\n";
57 body +=
"install(FILES ${headers} DESTINATION include/"+projectName+
")\n";
71 body +=
"add_subdirectory(TEST_"+baseConfigClassName.
toUpper()+
")\n\n";
86 body +=
"cmake_minimum_required(VERSION 3.10)\n";
87 body +=
"project("+projectConfig.
name+
")\n";
89 body +=
"\nfind_package(PhoenixCMake REQUIRED)\n\n";
91 body +=
"phoenix_base_project(\""+projectConfig.
name+
"\" \""+projectConfig.
version+
"\"\n";
93 body +=
"\t\t\""+projectConfig.
url+
"\")\n\n";
95 body +=
"pull_extra_module(\"PhoenixDataStream\" \"https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS2/PhoenixDataStream.git\")\n";
96 body +=
"pull_extra_module(\"PhoenixTypeStream\" \"https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS2/PhoenixTypeStream.git\")\n\n";
98 body +=
"phoenix_include_directories(\n";
99 body +=
"\t${CMAKE_CURRENT_SOURCE_DIR}\n";
100 body +=
"\t${CMAKE_CURRENT_BINARY_DIR}\n";
101 body +=
"\t${CMAKE_CURRENT_SOURCE_DIR}/src\n";
103 body +=
"phoenix_create_find("+projectConfig.
name+
" "+projectConfig.
name.
toLower()+
" "+baseConfigClassName+
".h "" PhoenixDataStream PhoenixTypeStream)\n\n";
104 body +=
"add_subdirectory(src)\n\n";
105 body +=
"phoenix_tests()\n";
117 body +=
"\n\n";
120 body +=
"[]("+projectConfig.
url+
"/-/commits/"+mainBranch+
")\n";
121 body +=
"[]("+projectConfig.
url+
"/-/commits/"+mainBranch+
")\n\n";
123 body +=
"# Remarks\n\n";
124 body +=
"This project was generated automatically by [phoenix_filegenerator](https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS2/PhoenixFileGenerator)\n";
125 body +=
"using [phoenix_generator](https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS2/PhoenixGenerator) library\n\n";
127 body +=
"# Code\n\n";
128 body +=
"Version : " + projectConfig.
version +
"\n\n";
129 body += projectConfig.
url +
"\n\n";
130 body +=
"# Description\n\n";
134 if(docPagesUrl !=
""){
135 body +=
"# Documentation\n\n";
136 body +=
"[See the pages documentation](" + docPagesUrl +
")\n\n";
138 body +=
"# Requirements\n\n";
139 body +=
"- c++ compiler (tested with g++ 11,12 and clang 14)\n";
140 body +=
"- [PhoenixCMake](https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS2/PhoenixCMake)\n";
141 body +=
"- cmake > 3\n";
142 body +=
"- make\n\n";
144 body +=
"# Installation for Users\n\n";
147 body +=
"git clone "+projectConfig.
url+
".git\n";
148 body +=
"cd "+projectConfig.
name+
"\n";
149 body +=
"./install.sh\n";
165 body +=
".tmp_project/\n";
166 body +=
"tmp_project/\n\n";
178 specificRunnerTag +=
" tags:\n";
179 specificRunnerTag +=
" - "+projectConfig.
runnerTag+
"\n";
185 body +=
"\nstages:\n";
186 body +=
"- BuildTestinstall\n";
187 body +=
"- DocCoverage\n";
188 body +=
"- deploy\n\n";
190 body +=
"dailyBuildMasterAll:\n";
191 body +=
" image: gitlab-registry.in2p3.fr/cta-lapp/phoenix_libs2/phoenixcmake/phoenix_cmake_ubuntu_2204:latest\n";
192 body +=
" stage: BuildTestinstall\n";
193 body +=
" script:\n";
194 body +=
" - export LD_LIBRARY_PATH=/usr/lib\n";
196 body +=
" - mkdir -p build\n";
197 body +=
" - cd build\n";
199 body +=
" cmake ..\n";
200 body +=
" -DCMAKE_INSTALL_PREFIX=/usr\n";
201 body +=
" -DSELF_TESTS_MODE=yes\n";
202 body +=
" -DCMAKE_MODULE_PATH=/usr/share/cmake/Modules\n";
203 body +=
" - make all\n";
204 body +=
" - make install\n";
205 body +=
" - make test\n";
207 body +=
" - branches\n";
209 body += specificRunnerTag;
212 body +=
"TestCoverage:\n";
213 body +=
" image: gitlab-registry.in2p3.fr/cta-lapp/phoenix_libs2/phoenixcmake/phoenix_cmake_ubuntu_2204:latest\n";
214 body +=
" stage: DocCoverage\n";
215 body +=
" script:\n";
216 body +=
" - export LD_LIBRARY_PATH=/usr/lib\n";
218 body +=
" - mkdir -p build coverage\n";
219 body +=
" - cd build\n";
221 body +=
" cmake ..\n";
222 body +=
" -DCMAKE_INSTALL_PREFIX=/usr\n";
223 body +=
" -DSELF_TESTS_MODE=yes\n";
224 body +=
" -DCMAKE_BUILD_TYPE=Coverage\n";
225 body +=
" -DCMAKE_MODULE_PATH=/usr/share/cmake/Modules\n";
226 body +=
" - make all\n";
227 body +=
" - make install\n";
228 body +=
" - make test\n";
229 body +=
" - ./uninstall_"+projectConfig.
name.
toLower()+
"\n";
230 body +=
" - cd ../coverage\n";
231 body +=
" - gcovr -r ../ --exclude-throw-branches --html cov_report.html --html-details\n";
232 body +=
" - gcovr -r ../ --exclude-throw-branches --xml Coverage.xml\n";
233 body +=
" - gcovr -r ../ --exclude-throw-branches\n";
234 body +=
" coverage: '/TOTAL.*\\s+(\\d+\\%)$/'\n";
235 body +=
" artifacts:\n";
237 body +=
" - coverage\n";
238 body +=
" expire_in: 8d\n";
240 body +=
" - branches\n";
242 body += specificRunnerTag;
245 body +=
" image: gitlab-registry.in2p3.fr/cta-lapp/phoenix_libs2/phoenixcmake/phoenix_cmake_ubuntu_2204:latest\n";
246 body +=
" stage: DocCoverage\n";
247 body +=
" script:\n";
248 body +=
" - export LD_LIBRARY_PATH=/usr/lib\n";
250 body +=
" - rm -fr build public\n";
251 body +=
" - mkdir -p build\n";
252 body +=
" - mkdir -p public\n";
253 body +=
" - cd build\n";
255 body +=
" cmake ..\n";
256 body +=
" -DCMAKE_INSTALL_PREFIX=/usr\n";
257 body +=
" -DDOC_MODE=yes\n";
258 body +=
" -DCMAKE_MODULE_PATH=/usr/share/cmake/Modules\n";
259 body +=
" - make all\n";
260 body +=
" - make doc\n";
261 body +=
" - scp -r doc/html/* ../public\n";
262 body +=
" artifacts:\n";
264 body +=
" - public\n";
265 body +=
" expire_in: 8d\n";
267 body +=
" - branches\n";
269 body += specificRunnerTag;
272 body +=
" stage: deploy\n";
273 body +=
" image: gitlab-registry.in2p3.fr/cta-lapp/phoenix_libs2/phoenixcmake/phoenix_cmake_ubuntu_2204:latest\n";
274 body +=
" script:\n";
275 body +=
" - mv coverage public/\n";
276 body +=
" artifacts:\n";
278 body +=
" - public\n";
279 body +=
" expire_in: 8d\n";
280 body += specificRunnerTag;
296 std::cerr <<
"project_generator : cannot parse project description file '"<<descriptionFile<<
"'" << std::endl;
300 PPath mainProjectDir(projectConfig.
name);
302 std::cerr <<
"project_generator : cannot create main directory of project '"<<mainProjectDir<<
"'" << std::endl;
306 PPath mainProjectSrc(mainProjectDir /
PPath(
"src"));
308 std::cerr <<
"project_generator : cannot create source directory of project '"<<mainProjectSrc<<
"'" << std::endl;
314 std::cerr <<
"project_generator : can't save file '"<<className<<
"'[.h or .cpp]" << std::endl;
318 PPath cmakeListsSrc(mainProjectSrc /
PPath(
"CMakeLists.txt"));
321 PPath cmakeListsMain(mainProjectDir /
PPath(
"CMakeLists.txt"));
324 PPath cmakeListsTest(mainProjectDir /
PPath(
"TESTS/CMakeLists.txt"));
327 PPath readmeFile(mainProjectDir /
PPath(
"README.md"));
330 PPath gitignoreFile(mainProjectDir /
PPath(
".gitignore"));
333 PPath gitlabciFile(mainProjectDir /
PPath(
".gitlab-ci.yml"));
const DicoValue * getMap(const PString &key) const
Get a DicoValue in the map of the current one.
Path of a directory or a file.
bool saveFileContent(const PString &content) const
Save a PString in a file.
PPath & eraseExtension()
Erase the extension of the PPath.
bool createDirectory(mode_t mode=0755) const
Create the current directory.
PPath getFileName() const
Get the name of the file, from last char to /.
PString toLower() const
Convert PString in lower case.
PString toUpper() const
Convert std::string in upper case.
PString getCMakeListsHeader()
Get the CMakeLists.txt header.
PString getGitlabDocUrl(const PString &projectUrl)
Get the documentation url of the given project url if possible.
bool saveParserClassConfig(const PPath &baseFileNameOutput, const PPath &fileName, bool enableDataStream, bool enableTypeStream, bool enableUnitTest, const PPath &testParentDir, const PString &libName)
Parser list class config.
bool parser_toml(DicoValue &dico, const PPath &fileName)
PString phoenix_get_string(const DicoValue &dico, const PString &varName, const PString &defaultValue)
Get the string from a dictionnary.
bool project_generator_cmakeListsMain(const PPath &fileName, const ProjectConfig &projectConfig, const PString &baseConfigClassName)
Create the main CMakeLists.txt of the project directory.
bool project_generator_cmakeListsSrc(const PPath &fileName, const PString &projectName, const PString &libName)
Create the CMakeLists.txt of the src directory.
bool project_generator_gitlabci(const PPath &fileName, const ProjectConfig &projectConfig)
Create the .gitlab-ci.yml of the project.
bool project_generator_gitignore(const PPath &fileName)
Create the .gitignore of the project.
bool project_generator(const PPath &descriptionFile, const PPath &configFile, bool isPythonWrapper)
Generate a full project with PhoenixDataStream and PhoenixTypeStream.
bool project_generator_readme(const PPath &fileName, const ProjectConfig &projectConfig)
Create the readme of the project directory.
bool project_generator_cmakeListsTest(const PPath &fileName, const PString &baseConfigClassName)
Create the main CMakeLists.txt of the project directory.
bool project_generator_loadConfig(ProjectConfig &config, const PPath &descriptionFile)
Load the project configuration.
Configuration of the project.
PString description
Description of the project.
PString name
Name of the project.
PString runnerTag
Specific runner tag if needed (could be MUST_big_runner)
PString mainBranch
Main branch of hte project.
PString version
Project version.
bool project_wrapper_generator(const ProjectConfig &projectConfig, const PPath &configFile)
Generate a full python wrapper project with PhoenixDataStream and PhoenixTypeStream.