History: Setting Up An Application - Autotools - Linux
Source of version: 7
Copy to clipboard
{DIV(class="Layout_box6")}{SPLIT(colsize=15%|85%)}{img fileId="1981"}---
{DIV(class="bigBold")}Setting Up An Application using GNU Autotools - Linux{DIV}{SPLIT}
{DIV}
%clear%
!Introduction
This set of instructions will walk you through setting up a C++ project from scratch using GNU Autotools.
When you have finished this tutorial you will be able to compile a working Ogre Application and you will be ready to start the ((Basic Tutorials)).
{maketoc}
!Prerequisites
You should have a working build environment set up ({MONO()}apt-get install build-essentials on Ubuntu{MONO})
Make sure that {MONO()}autoconf{MONO} + {MONO()}automake{MONO} + {MONO()}libtool{MONO} are installed.
!Ogre Wiki Tutorial Framework
Download the ((Ogre Wiki Tutorial Framework)) here:
{ATTACH(id="124", page="Ogre Wiki Tutorial Framework",icon="1")}{ATTACH}
!bootstrap
{CODE(wrap="1", colors="bash")}#!/bin/sh
rm -rf autom4te.cache
libtoolize --force --copy && aclocal && autoheader && automake --add-missing --force-missing --copy --foreign && autoconf{CODE}
Make this file (bootstrap) executable.
!configure.ac
{CODE(wrap="1", colors="make")}AC_INIT(configure.ac)
AM_INIT_AUTOMAKE(SampleApp, 0.1)
AM_CONFIG_HEADER(config.h)
AC_LANG_CPLUSPLUS
AC_PROG_CXX
AM_PROG_LIBTOOL
PKG_CHECK_MODULES(OGRE, [OGRE >= 1.2])
AC_SUBST(OGRE_CFLAGS)
AC_SUBST(OGRE_LIBS)
PKG_CHECK_MODULES(OIS, [OIS >= 1.0])
AC_SUBST(OIS_CFLAGS)
AC_SUBST(OIS_LIBS)
AC_CONFIG_FILES(Makefile)
AC_OUTPUT{CODE}
!Makefile.am
{CODE(wrap="1", colors="make")}
noinst_HEADERS= BaseApplication.h TutorialApplication.h
bin_PROGRAMS= OgreApp
OgreApp_CPPFLAGS= -I$(top_srcdir)
OgreApp_SOURCES= BaseApplication.cpp TutorialApplication.cpp
OgreApp_CXXFLAGS= $(OGRE_CFLAGS) $(OIS_CFLAGS)
OgreApp_LDADD= $(OGRE_LIBS) $(OIS_LIBS)
EXTRA_DIST = bootstrap
AUTOMAKE_OPTIONS = foreign{CODE}
!The Autotools Dance
Run this in a console:
{CODE(wrap="1", colors="bash")}./bootstrap && ./configure && make{CODE}
You should have successfully built your Ogre application. :)
!Possible Improvements
Make a new build target which either copies the executable to a '''dist''' directory - see ((dflkjf)) - or a target which copies the Ogre configuration files (plugins.cfg and resources.cfg) from /usr/local/share/OGRE.