Debian Codegraph @

configure

raw symbols SCIP
1 #!/bin/sh
2 # Convenience wrapper for easily viewing/setting options that
3 # the project's CMake scripts will recognize
4 set -e
5 command="$0 $*"
6
7 # check for `cmake` command
8 type cmake > /dev/null 2>&1 || {
9 echo "\
10 This package requires CMake, please install it first, then you may
11 use this configure script to access CMake equivalent functionality.\
12 " >&2;
13 exit 1;
14 }
15
16 # check for `python3` command
17 type python3 > /dev/null 2>&1 || {
18 echo "This package requires Python 3, please install it first." >&2;
19 }
20
21 site_packages=`python3 -c "from distutils.sysconfig import get_python_lib;\
22 print(get_python_lib(True))"`
23 pyver=`python3 -c "import sys; print(\"%s.%s\" % (sys.version_info[0], sys.version_info[1]))"`
24
25 usage="\
26 Usage: $0 [OPTION]... [VAR=VALUE]...
27
28 Build Directory:
29 --builddir=DIR place build files in directory [build]
30
31 Installation Directories:
32 --prefix=PREFIX installs to [PREFIX/lib/python${pyver}/site-packages]
33 --home=PATH installs to [PATH/lib/python]
34
35 Optional Features:
36 --enable-debug compile in debugging mode
37
38 Required Packages in Non-Standard Locations:
39 --with-python=PATH path to Python interpreter
40 --with-python-lib=PATH path to libpython
41 --with-python-inc=PATH path to Python headers
42 --with-swig=PATH path to SWIG executable
43
44 Influential Environment Variables (only on first invocation
45 per build directory):
46 CC C compiler command
47 CFLAGS C compiler flags
48 CXX C++ compiler command
49 CXXFLAGS C++ compiler flags
50 "
51
52 sourcedir="$( cd "$( dirname "$0" )" && pwd )"
53
54 # Function to append a CMake cache entry definition to the
55 # CMakeCacheEntries variable
56 # $1 is the cache entry variable name
57 # $2 is the cache entry variable type
58 # $3 is the cache entry variable value
59 append_cache_entry () {
60 CMakeCacheEntries="$CMakeCacheEntries -D $1:$2=$3"
61 }
62
63 # set defaults
64 builddir=build
65 CMakeCacheEntries=""
66 append_cache_entry PY_MOD_INSTALL_DIR PATH $site_packages
67 append_cache_entry ENABLE_DEBUG BOOL false
68
69 # parse arguments
70 while [ $# -ne 0 ]; do
71 case "$1" in
72 -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
73 *) optarg= ;;
74 esac
75
76 case "$1" in
77 --help|-h)
78 echo "${usage}" 1>&2
79 exit 1
80 ;;
81 --builddir=*)
82 builddir=$optarg
83 ;;
84 --prefix=*)
85 append_cache_entry PY_MOD_INSTALL_DIR PATH $optarg/lib/python${pyver}/site-packages
86 ;;
87 --home=*)
88 append_cache_entry PY_MOD_INSTALL_DIR PATH $optarg/lib/python
89 ;;
90 --enable-debug)
91 append_cache_entry ENABLE_DEBUG BOOL true
92 ;;
93 --with-python=*)
94 append_cache_entry Python_EXECUTABLE PATH $optarg
95 ;;
96 --with-python-inc=*)
97 append_cache_entry Python_INCLUDE_DIRS PATH $optarg
98 ;;
99 --with-swig=*)
100 append_cache_entry SWIG_EXECUTABLE PATH $optarg
101 ;;
102 *)
103 echo "Invalid option '$1'. Try $0 --help to see available options."
104 exit 1
105 ;;
106 esac
107 shift
108 done
109
110 if [ -d $builddir ]; then
111 # If build directory exists, check if it has a CMake cache
112 if [ -f $builddir/CMakeCache.txt ]; then
113 # If the CMake cache exists, delete it so that this configuration
114 # is not tainted by a previous one
115 rm -f $builddir/CMakeCache.txt
116 fi
117 else
118 # Create build directory
119 mkdir -p $builddir
120 fi
121
122 echo "Build Directory : $builddir"
123 echo "Source Directory: $sourcedir"
124 cd $builddir
125 cmake $CMakeCacheEntries $sourcedir
126
127 echo "# This is the command used to configure this build" > config.status
128 echo $command >> config.status
129 chmod u+x config.status