aboutsummaryrefslogtreecommitdiffstats
path: root/src/SConscript
blob: 60e13b6629e8e8e5460ed7cd109eb87fd30341eb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/python
# -*- coding: utf-8 -*-

import sys
import os.path

env = Environment()

# Include directories to look for 'Python.h' in
python_inc_path = os.path.join(sys.prefix, 'include', 'python' + sys.version[:3])
env.Append(CPPPATH=[python_inc_path])

# Libraries to link against
libs = ['boost_python', 'exiv2']
env.Append(LIBS=libs)

# Build shared library libpyexiv2
cpp_sources = ['exiv2wrapper.cpp', 'exiv2wrapper_python.cpp']
libpyexiv2 = env.SharedLibrary('exiv2python', cpp_sources)

# Install the shared library and the Python module, invoked using
# 'scons install'. If DESTDIR is specified on the command line when invoking
# scons, it will be prepended to each installed target file. See
# http://www.gnu.org/prep/standards/html_node/DESTDIR.html for reference.
python_lib_path = os.path.join(sys.prefix, 'lib', 'python' + sys.version[:3], 'site-packages')
dest_dir = ARGUMENTS.get('DESTDIR')
if (dest_dir is None) or (not os.path.isabs(dest_dir)):
    install_dir = python_lib_path
else:
    install_dir = os.path.join(dest_dir, python_lib_path[1:])
env.Install(install_dir, [libpyexiv2, 'pyexiv2.py'])
env.Alias('install', install_dir)