Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Etienne Schmitt
CGoGN
Commits
d758f4b9
Commit
d758f4b9
authored
Dec 20, 2011
by
Sylvain Thery
Browse files
add script for app duplication
update scripts
parent
6a7e5cc3
Changes
4
Hide whitespace changes
Inline
Side-by-side
scripts/README.TXT
View file @
d758f4b9
...
...
@@ -12,4 +12,11 @@ This must be done in a CGoGN_Apps directory. It create an empty debug applicatio
with only one source (no header, no ui, no Debug/Release)
duplicate_apps.sh:
Usage duplicate_apps src_dir dest_dir
Duplicate an application:
- files that have the name of directory src are changed to dst
- includes are modified to follow these changes
- Classes and vars in .h & .cpp file that have the name (with first
letter in uppercase) are changed with dst name
scripts/duplicate_apps.sh
0 → 100755
View file @
d758f4b9
#!/bin/bash
if
test
$#
-lt
2
;
then
echo
$0
application_directory_source application_directory_destination
exit
2
fi
if
test
-d
$2
;
then
echo
Directory
$2
already exist
exit
3
fi
if
test
!
-d
$1
;
then
echo
Directory
$1
does not exist
exit
4
fi
echo
"copying ..."
cp
-r
$1
$2
echo
"cleanin ..."
cd
$2
find
.
-name
"CMakeFiles"
-exec
rm
-rf
{}
\;
2> /dev/null
find
.
-name
"cmake_install.cmake"
-exec
rm
-f
{}
\;
2> /dev/null
find
.
-name
"CMakeCache.txt"
-exec
rm
-f
{}
\;
2> /dev/null
find
.
-name
"Makefile"
-exec
rm
-f
{}
\;
2> /dev/null
cd
bin
rm
-rf
*
cd
..
app1
=
`
basename
$1
`
app2
=
`
basename
$2
`
echo
remplace
$app1
by
$app2
in
CMakeLists.txt ...
find
.
-name
"CMakeLists.txt"
-exec
sed
-i
s/
$app1
/
$app2
/g
{}
\;
echo
"renaming files:"
list_of_files
=
`
find
.
-name
$app1
\*
`
for
f
in
$list_of_files
;
do
nf
=
`
echo
$f
|
sed
s/
$app1
/
$app2
/
`
echo
" "
$f
-
\>
$nf
mv
$f
$nf
# search into files for inclusion
bf
=
`
basename
$f
`
bnf
=
`
basename
$nf
`
list2
=
`
fgrep
-wl
$bf
*
`
# if test -n """$list2"""; then
# echo " files to modify (includes)" $list2
for
xx
in
$list2
;
do
sed
-i
s/
$bf
/
$bnf
/g
$xx
done
# fi
done
echo
Modify contents ...
find
.
-name
"*.cpp"
-o
-name
"*.hpp"
-o
-name
"*.h"
-exec
sed
-i
s/
${
app1
^
}
/
${
app2
^
}
/g
{}
\;
find
.
-name
"*.cpp"
-exec
sed
-i
s/
${
app1
^
}
/
${
app2
^
}
/g
{}
\;
find
.
-name
"*.h"
-exec
sed
-i
s/
${
app1
^
}
/
${
app2
^
}
/g
{}
\;
echo
finished
scripts/skeleton_apps.sh
View file @
d758f4b9
#!/bin/bash
if
test
$#
-lt
1
;
then
echo
$0
application_
reper
tory
[
src_files]
echo
$0
application_
direc
tory
[
src_files]
exit
2
fi
if
test
-d
$PWD
/
$1
;
then
echo
Reper
tory
$1
already exist
echo
Direc
tory
$1
already exist
exit
3
fi
...
...
@@ -64,7 +64,7 @@ echo link_directories\( \$\{CGoGN_ROOT_DIR\}/lib/Debug/ \$\{CGoGN_ROOT_DIR\}/lib
echo
""
>>
CMakeLists.txt
echo
QT4_WRAP_UI
\(
${
apps
}
_ui
\$\{
CMAKE_SOURCE_DIR
\}
/
${
apps
}
.ui
\)
>>
CMakeLists.txt
echo
QT4_WRAP_CPP
\(
${
apps
}
_moc
\$\{
CMAKE_SOURCE_DIR
\}
/
${
apps
}
.h
\)
>>
CMakeLists.txt
echo
""
>>
CMakeLists.tx
echo
""
>>
CMakeLists.tx
t
echo
add_executable
\(
${
apps
}
D
$sources
>>
CMakeLists.txt
echo
" "
\$\{
${
apps
}
_moc
\}
>>
CMakeLists.txt
echo
" "
\$\{
${
apps
}
_ui
\}
\)
>>
CMakeLists.txt
...
...
@@ -88,7 +88,7 @@ echo link_directories\( \$\{CGoGN_ROOT_DIR\}/lib/Release \$\{Boost_LIBRARY_DIRS\
echo
""
>>
CMakeLists.txt
echo
QT4_WRAP_UI
\(
${
apps
}
_ui
\$\{
CMAKE_SOURCE_DIR
\}
/
${
apps
}
.ui
\)
>>
CMakeLists.txt
echo
QT4_WRAP_CPP
\(
${
apps
}
_moc
\$\{
CMAKE_SOURCE_DIR
\}
/
${
apps
}
.h
\)
>>
CMakeLists.txt
echo
""
>>
CMakeLists.tx
echo
""
>>
CMakeLists.tx
t
echo
add_executable
\(
${
apps
}
$sources
>>
CMakeLists.txt
echo
" "
\$\{
${
apps
}
_moc
\}
>>
CMakeLists.txt
echo
" "
\$\{
${
apps
}
_ui
\}
\)
>>
CMakeLists.txt
...
...
@@ -128,12 +128,14 @@ echo \#include \"Utils/Qt/qtui.h\" >> ${apps}.h
echo
""
>>
${
apps
}
.h
echo
"using namespace CGoGN;"
>>
${
apps
}
.h
echo
""
>>
${
apps
}
.h
echo
"class
${
apps
}
: public Utils::QT::SimpleQT"
>>
${
apps
}
.h
echo
"class
${
apps
^
}
: public Utils::QT::SimpleQT"
>>
${
apps
}
.h
echo
"{"
>>
${
apps
}
.h
echo
" Q_OBJECT"
>>
${
apps
}
.h
echo
"public:"
>>
${
apps
}
.h
echo
""
>>
${
apps
}
.h
echo
"
${
apps
}
() {}"
>>
${
apps
}
.h
echo
"
${
apps
^
}
() {}"
>>
${
apps
}
.h
echo
""
>>
${
apps
}
.h
echo
" ~
${
apps
^
}
() {}"
>>
${
apps
}
.h
echo
""
>>
${
apps
}
.h
echo
" void cb_redraw();"
>>
${
apps
}
.h
echo
""
>>
${
apps
}
.h
...
...
@@ -186,10 +188,10 @@ echo "**************************************************************************
echo
""
>>
${
apps
}
.cpp
echo
\#
include
\"
${
apps
}
.h
\"
>>
${
apps
}
.cpp
echo
""
>>
${
apps
}
.cpp
echo
"void
Interface
::cb_initGL()"
>>
${
apps
}
.cpp
echo
"void
${
apps
^
}
::cb_initGL()"
>>
${
apps
}
.cpp
echo
"{}"
>>
${
apps
}
.cpp
echo
""
>>
${
apps
}
.cpp
echo
"void
Interface
::cb_redraw()"
>>
${
apps
}
.cpp
echo
"void
${
apps
^
}
::cb_redraw()"
>>
${
apps
}
.cpp
echo
"{}"
>>
${
apps
}
.cpp
echo
""
>>
${
apps
}
.cpp
...
...
@@ -197,7 +199,8 @@ echo "int main(int argc, char **argv)" >> ${apps}.cpp
echo
"{"
>>
${
apps
}
.cpp
echo
""
>>
${
apps
}
.cpp
echo
" QApplication app(argc, argv);"
>>
${
apps
}
.cpp
echo
"
${
apps
}
sqt;"
>>
${
apps
}
.cpp
echo
"
${
apps
^
}
sqt;"
>>
${
apps
}
.cpp
echo
" "
sqt.setWindowTitle
\(\"
${
apps
^
}
\"\)\;
>>
${
apps
}
.cpp
echo
""
>>
${
apps
}
.cpp
echo
" Utils::QT::uiDockInterface dock;"
>>
${
apps
}
.cpp
echo
" sqt.setDock(&dock);"
>>
${
apps
}
.cpp
...
...
@@ -238,7 +241,7 @@ echo " <property name=\"features\">" >> ${apps}.ui
echo
" <set>QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable</set>"
>>
${
apps
}
.ui
echo
" </property>"
>>
${
apps
}
.ui
echo
" <property name=
\"
allowedAreas
\"
>"
>>
${
apps
}
.ui
echo
" <set>Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea</set>"
>>
${
apps
}
.ui
t
echo
" <set>Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea</set>"
>>
${
apps
}
.ui
echo
" </property>"
>>
${
apps
}
.ui
echo
" <property name=
\"
windowTitle
\"
>"
>>
${
apps
}
.ui
echo
" <string>Control</string>"
>>
${
apps
}
.ui
...
...
scripts/skeleton_test.sh
View file @
d758f4b9
#!/bin/bash
if
test
$#
-lt
1
;
then
echo
$0
application_
reper
tory
echo
$0
application_
direc
tory
exit
2
fi
echo
"Warning do not forget to check the CGoGN_ROOT_DIR variable (ccmake)"
if
test
-d
$PWD
/
$1
;
then
echo
Reper
tory
$1
already exist
echo
Direc
tory
$1
already exist
exit
3
fi
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment