diff --git a/ReadMe.md b/ReadMe.md index a4f7c309f421e0be765789042cf419950bde49de..2e6d24ea8fef26a8e434f05199c45ed9adf4ca9b 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -26,12 +26,14 @@ Execute the *new_project.sh* script with the following parameters: * *application*: generates the necessary structure to create a binary file. * **-p "the project description"**: this parameter is required. It provides a short description of the project. This parameter will appear in all the associated documentation. For multi-word values, use the double quote. * **-n project\_name**: this parameter is required. It specifies the name of the shared library or the binary file to be generate by the project. **This parameter must not have any whitespace characters**. -* **-d comma,separated,dependencies**: this parameter is optional. It specifies a set of dependencies of the library or application being generated. These depedencies will be automatically included inside the CMake structure. Only dependencies supported by the CMake framework are currently supported. +* **-d comma,separated,dependencies**: this parameter is optional. It specifies a set of dependencies of the library or application being generated. These depedencies will be automatically included inside the CMake structure. Only dependencies developed at IRI are currently supported. Other type of dependencies should better be added by hand. [//]: <> (Commented test option until it is operative again) [//]: <> (* **-g**: this parameters is optional. Is specifies whether the test strcture is to be included into the project or not. This includes the necessaty CMake files to download and locally build the google test software and a basic test file for the generated project.) -After executing the script, all the temporary and template files are removed, as well as the link to the remote GIT repository, so that the new project can be easily associated to another repository. +After executing the script, all the temporary and template files are removed, as well as the link to the remote GIT repository, so that the new project can be easily associated to another repository. + +Finally you can rename the main folder as your project_name. ## Disclaimer diff --git a/new_project.sh b/new_project.sh index 21d01887da8163761e6ad4fa20ed29fe32522f56..7f011a08e7a8187c7f066ead4c41b471ae0e2598 100755 --- a/new_project.sh +++ b/new_project.sh @@ -204,19 +204,22 @@ else rm temp1.txt fi -#Add to CMakeLists.txt line wit dependencies like SET(CPACK_DEBIAN_PACKAGE_DEPENDS "iri-dep1-dev (>= 1.0~${DISTRIB}), iri-dep2-dev (>= 1.0~${DISTRIB})") -cpack_depends="SET(CPACK_DEBIAN_PACKAGE_DEPENDS \"" -for x in $arr -do - dep_line="iri-$x-dev (>= 1.0~\${DISTRIB})" - cpack_depends="$cpack_depends$dep_line, " -done -cpack_depends=${cpack_depends%??} #remove last ', ' -cpack_depends="$cpack_depends\")" -line_to_add="\ \ $cpack_depends" -file=./CMakeLists.txt -comment="#Uncomment to add dependencies comma separated" -sed -i "/${comment}/ a ${line_to_add}" ${file} +#Add to CMakeLists.txt line with dependencies like SET(CPACK_DEBIAN_PACKAGE_DEPENDS "iri-dep1-dev (>= 1.0~${DISTRIB}), iri-dep2-dev (>= 1.0~${DISTRIB})") +if [ -n "$arr" ] +then + cpack_depends="SET(CPACK_DEBIAN_PACKAGE_DEPENDS \"" + for x in $arr + do + dep_line="iri-$x-dev (>= 1.0~\${DISTRIB})" + cpack_depends="$cpack_depends$dep_line, " + done + cpack_depends=${cpack_depends%??} #remove last ', ' + cpack_depends="$cpack_depends\")" + line_to_add="\ \ $cpack_depends" + file=./CMakeLists.txt + comment="#Uncomment to add dependencies comma separated" + sed -i "/${comment}/ a ${line_to_add}" ${file} +fi rm CMakeLists_test_template.txt rm CMakeLists_template.txt @@ -231,6 +234,7 @@ PROJECT_NAME_VAR="\${PROJECT_NAME}" if [ $TYPE = application ] then echo "# locate the necessary dependencies" >> CMakeLists.tmp + echo "# FIND_PACKAGE(my_example_library REQUIRED)" >> CMakeLists.tmp for x in $arr do echo "FIND_PACKAGE($x REQUIRED)" >> CMakeLists.tmp @@ -278,6 +282,8 @@ else echo "" >> CMakeLists.tmp echo "# locate the necessary dependencies" >> CMakeLists.tmp + echo "# FIND_PACKAGE(my_example_library REQUIRED)" >> CMakeLists.tmp + for x in $arr do echo "FIND_PACKAGE($x REQUIRED)" >> CMakeLists.tmp @@ -356,16 +362,19 @@ fi sed 's/library-name/'$NAME_WITH_DASHES'/g' <.gitlab-ci_template.yml >./.gitlab-ci.yml #Add to .gitlab-ci.yml apt install dependencies like - apt -y install iri-dep1-dev iri-dep2-dev -apt_deps="" -for x in $arr -do - dep_line="iri-$x-dev" - apt_deps="$apt_deps$dep_line " -done -line_to_add="\ \ \ \ \ \ - apt -y install $apt_deps" -file=./.gitlab-ci.yml -comment="##Install dependencies" -sed -i "/${comment}/ a ${line_to_add}" ${file} +if [ -n "$arr" ] +then + apt_deps="" + for x in $arr + do + dep_line="iri-$x-dev" + apt_deps="$apt_deps$dep_line " + done + line_to_add="\ \ \ \ \ \ - apt -y install $apt_deps" + file=./.gitlab-ci.yml + comment="##Install dependencies" + sed -i "/${comment}/ a ${line_to_add}" ${file} +fi if [ $TEST = 1 ] then