Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new explicit options with build_prefix. #9

Merged
merged 1 commit into from
Sep 5, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 44 additions & 27 deletions src/sconsx/tools/builddir.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,59 +4,77 @@
# OpenAlea.SConsX: SCons extension package for building platform
# independant packages.
#
# Copyright 2006-2009 INRIA - CIRAD - INRA
# Copyright 2006-2016 CIRAD - INRIA - INRA
#
# File author(s): Christophe Pradal <christophe.prada@cirad.fr>
#
# Distributed under the Cecill-C License.
# See accompanying file LICENSE.txt or copy at
# http://www.cecill.info/licences/Licence_CeCILL-C_V1-en.html
#
#
# OpenAlea WebSite : http://openalea.gforge.inria.fr
#
#--------------------------------------------------------------------------------
""" Build directory configure environment. """

__license__ = "Cecill-C"
__revision__ = "$Id$"

import os, sys
import os
from openalea.sconsx.config import *


class BuildDir:
"""Define Variant Dir options for putting build files outside the source tree."""

def __init__(self, config):
"""Pluggin definition."""
self.name = 'build_dir'
self.config = config
self._default = {}


def default(self):
#self._default['build_prefix']= pj(self.config.dir[0], "build-" + platform.name)
self._default['build_prefix'] = pj(self.config.dir[0], "build-scons")

def option( self, opts):

"""Set the default directory values for build_prefix."""
# self._default['build_prefix']= pj(self.config.dir[0], "build-" + platform.name)
prefix = self._default['build_prefix'] = pj(self.config.dir[0], "build-scons")
self._default['build_bindir'] = pj(prefix, "bin")
self._default['build_libdir'] = pj(prefix, "lib")
self._default['build_includedir'] = pj(prefix, "include")

def option(self, opts):
"""Define user options to redefine the default values."""
self.default()
opts.Add( BoolVariable('with_build_dir', 'build files in a separate directory?', True))
opts.Add(BoolVariable('with_build_dir', 'build files in a separate directory?', True))
opts.Add('build_prefix',
'local preinstall directory',
self._default['build_prefix'])

'local preinstall directory',
self._default['build_prefix'])
opts.Add('build_bindir',
'local preinstall directory for binaries',
self._default['build_bindir'])
opts.Add('build_libdir',
'local preinstall directory for libraries',
self._default['build_libdir'])
opts.Add('build_includedir',
'local preinstall directory for headers',
self._default['build_includedir'])

def update(self, env):
""" Update the environment with specific flags """

"""Update the environment with specific flags."""
if env['with_build_dir']:
prefix = env['build_prefix']
bin_prefix = env['build_bindir']
lib_prefix = env['build_libdir']
inc_prefix = env['build_includedir']
else:
prefix = self.config.dir[0]

build = {
'build_prefix': prefix,
'build_bindir': pj(prefix, 'bin'),
'build_libdir' : pj(prefix, 'lib'),
'build_includedir' : pj(prefix, 'include') }
bin_prefix = pj(prefix, 'bin')
lib_prefix = pj(prefix, 'lib')
inc_prefix = pj(prefix, 'include')

build = {
'build_prefix': prefix,
'build_bindir': bin_prefix,
'build_libdir': lib_prefix,
'build_includedir': inc_prefix}

if env['with_build_dir']:
build['build_dir'] = pj(prefix, 'src')
Expand All @@ -71,14 +89,13 @@ def update(self, env):
if not env['with_build_dir']:
env['build_dir'] = pj(env['build_prefix'], 'src')



def configure(self, config):
"""Configure code needs to go here."""
pass


def create(config):
" Create builddir tool "
"""Create builddir tool."""
builddir = BuildDir(config)

return builddir