ede/tools/create-project

87 lines
1.3 KiB
Plaintext
Raw Permalink Normal View History

2011-10-20 13:11:05 +04:00
#!/bin/sh
# create ede project with starting boilerplate code
program_name="$0"
die() {
echo "*** $@"
exit 1
}
help() {
cat <<EOF
Usage: $program_name [PROJECT] [CLASS]
Create project boilerplate code in [PROJECT] directory.
Options:
--help this help
Example:
$program_name ede-sample-application
EOF
exit 1
}
create_boilerplate() {
name="$1"
[ -d $name ] && die "Project folder with this name already exists. Aborting..."
mkdir $name
# create Jamfile
cat > $name/Jamfile <<EOF
#
# \$Id:\$
#
SubDir TOP $name ;
SOURCE = $name.cpp ;
2011-10-20 18:18:11 +04:00
EdeProgram $name : \$(SOURCE) ;
2011-10-20 13:11:05 +04:00
TranslationStrings locale : \$(SOURCE) ;
EOF
# create sources
cat > $name/$name.cpp <<EOF
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <edelib/Window.h>
2011-10-20 13:17:08 +04:00
#include <edelib/Nls.h>
#include <edelib/Ede.h>
2011-10-20 13:11:05 +04:00
#include <FL/Fl.H>
#include <FL/Fl_Box.H>
EDELIB_NS_USING_AS(Window, EdeWindow)
int main(int argc, char** argv) {
EDE_APPLICATION("$name");
EdeWindow *win = new EdeWindow(300, 100);
win->label("$name sample");
2011-10-20 13:17:08 +04:00
new Fl_Box(1, 1, 299, 99, _("Hola from $name"));
2011-10-20 13:11:05 +04:00
win->end();
win->show(argc, argv);
return Fl::run();
}
EOF
}
if [ $# -eq 0 ] || [ "$1" = "--help" ]; then
help
fi
create_boilerplate "$1"
cat <<EOF
Project created. Now add:
SubInclude TOP $name ;
to toplevel Jamfile.
EOF