This is a tutorial on how to split a glademm project into
subdirectories. You might want to do this if your project
is going to be at all big. Maybe you have a dialog with a
lot of handwritten code inside it, and you have decided to
split it into multiple source files (maybe one for each class
method), or maybe you have a lot of supporting classes,
etc.
We will start with a simple step by step example. This
tutorial assumes that you know how to use glade-2 already and
already understand the files glademm creates. We are
going to create a window and a dialog and put the dialog files
in their own directory.
-
Start glade-2
-
Start a new gtk+ project
-
In the project options, rename it to splitProject
(if you do it in the project directory entry area, glade
will change the rest of the fields for you), and set
the language to c++
-
Add a toplevel window, and a top level dialog
-
Inside each of those, place a button or label
-
Save the project
-
Build the project
-
From this point forward you will be working from the
command line and your favorite editor, so you can exit
glade
-
cd ~/Projects/splitProject/src
-
mkdir dialog
-
mv dialog* dialog/.
-
cp Makefile.am dialog/.
-
Edit ~/Projects/splitProject/src/Makefile.am:
- Add the line: SUBDIRS = dialog above the
bin_PROGRAMS line
- Remove all references to the dialog source files from
splitproject_SOURCES, and be sure the last source file now
listed does not have a \ after it
- Remove all references to the dialog source files from
noinst_HEADERS, and be sure the last source file now listed
does not have a \ after it
- Add dialog/libdialog.a to the end of the
splitproject_LDADD line
- Add the line: INCLUDES = -Idialog to the end of
the file
- Save and exit
-
cd dialog
-
Edit
~/Projects/splitProject/src/dialog/Makefile.am:
- Remove the bin_PROGRAMS line, replace it with the
line: noinst_LIBRARIES=libdialog.a
- Remove all references to the window and main program
source files from splitproject_SOURCES, and be sure the
last source file now listed does not have a \ after it
- Remove all references to the window and main
program files from noinst_HEADERS, and be sure the last
source file now listed does not have a \ after it
- Change splitproject_SOURCES to
libdialog_a_SOURCES
- Remove the splitproject_LDADD line
- Save and exit
-
cd ../..
-
you are now in the top directory of the project, edit
~/Projects/splitProject/configure.in:
- Modify the AC_OUTPUT line, by adding src/dialog/Makefile
to it. It should resemble:
AC_OUTPUT(Makefile src/Makefile src/dialog/Makefile
)
-
./autogen.sh
-
make
-
./src/splitproject
You are now done.
author: Mark Jones
no spam e-mail: markDOT.jones106AT@verizonDOT.net
writen: Monday December 23, 2002
packages at time of writing: gtkmm-2.0.2, glade 1.1.3
(glade-2), glademm V1.1.3e_cvs, automake-1.4, autoconf-2.54