Linux Build Files

Game_Ender

12-01-2007 23:54:39

Here are working scons files, they will almost work on Window, but they work on Linux. Can these be committed to OgreNewt CVS? Should I submit more patches? I have noticed there is unsafe cast, a standard C one at that which treats Ogre::Vector3 as an array of floats. Which of course will fail if either OgreNewt or Ogre are complied with double precision instead of single.

SConstruct (goes in project root)
import os

EnsureSConsVersion(0, 96, 93)

# Options either come from command line of config file
opts = Options('configure.py')
opts.Add('prefix', 'The installation root directory', '/usr/local')

# Setup the build environment
env = Environment(ENV=os.environ, options = opts)
Help(opts.GenerateHelpText(env))
Export('env')

# Our build subdirectory
buildDir = 'build'

# Allow SConscripts access to the directores
env['OgreNewt_Main'] = os.path.abspath('OgreNewt_Main')

# Build seperate directories (this calls our file in the sub directory)
env.SConscript('OgreNewt_Main/SConscript',
build_dir = os.path.join(buildDir, 'OgreNewt_Main'),
duplicate = 0)

# Handle the install
header_dir = 'OgreNewt_Main/inc'
headers = [os.path.join(header_dir,f) for f in os.listdir(header_dir)
if f.endswith('.h')]
library = os.path.join(buildDir, 'OgreNewt_Main', 'libOgreNewt.so')

# This creats a 'install' target which copies in the files
header_dir = os.path.join(env['prefix'], 'include')
lib_dir = os.path.join(env['prefix'], 'lib')


env.Alias('install', env.Install(dir = header_dir,
source = headers))
env.Alias('install', env.Install(dir = lib_dir,
source = library))



SConscript in <OgreNewt_Root>/OgreNewt_Main

Import('env')

import os
from subprocess import Popen, PIPE

base_dir = env['OgreNewt_Main']
src_dir = os.path.join(base_dir, 'src')

# All cpp files in the source directory
sources = [os.path.join('src',f) for f in os.listdir(src_dir)
if f.endswith('.cpp')]
sources = [src for src in sources
if src != 'src/OgreNewt_BasicFrameListener.cpp']

# Use PKG Config to grab ogre information
OGRE_CFLAGS = Popen(["pkg-config", "OGRE","--cflags"],
stdout=PIPE).communicate()[0]
OGRE_LDFLAGS = Popen(["pkg-config", "OGRE","--libs"],
stdout=PIPE).communicate()[0]

env.SharedLibrary(target = 'OgreNewt', source = sources,
CPPPATH = ['inc'],
CPPFLAGS = Split(OGRE_CFLAGS),
LINKFLAGS = Split(OGRE_LDFLAGS))

pratty70

15-01-2007 16:26:57

Thanks Game_Ender, got it built with scons last week but will also try out these scons scripts too.

Many thanks..