Skip to main content

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.

        

History

Information Version
Mon 20 of Mar, 2017 22:06 GMT-0000 clemix 12
Mon 14 of Nov, 2016 14:04 GMT-0000 dark_sylinc 11
Mon 14 of Nov, 2016 14:03 GMT-0000 dark_sylinc 10
Mon 05 of May, 2014 08:30 GMT-0000 c6burns removed file link so it doesnt have to be maintained manually 9
Sat 30 of Apr, 2011 12:36 GMT-0000 montaropdf Adding an explanation on how to add optional OGRE libraries in the building process, add a comment in the 'Possible Improvements' section and add details in section 'Ogre Wiki Tutorial Framework' 8
Sun 02 of Jan, 2011 01:12 GMT-0000 jacmoe 7
Sat 01 of Jan, 2011 21:37 GMT-0000 jacmoe 6
Sat 01 of Jan, 2011 21:36 GMT-0000 jacmoe 5
Sat 01 of Jan, 2011 21:31 GMT-0000 jacmoe 4
Sat 01 of Jan, 2011 21:25 GMT-0000 jacmoe 3
Sat 01 of Jan, 2011 21:14 GMT-0000 jacmoe 2
Sat 01 of Jan, 2011 16:26 GMT-0000 jacmoe 1