Skip to content

Commit

Permalink
configure: --env and additional --with-* options
Browse files Browse the repository at this point in the history
Added --with-libpeyton, --with-cuda, --devemu and --env options.
  • Loading branch information
mjuric committed May 25, 2010
1 parent 5772288 commit ddcb5b4
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ tee -a $CONFIGLOG <<-EOF
--prefix=<prefix> # will install the code into <prefix>
--optimized # configure the 'Release' build
--debug # configure the 'Debug' build
--env=<VAR=VALUE> # set VAR=VALUE environment variable
# before running CMAKE
--with-cuda=<cuda_root> # use CUDA toolkit from <cuda_root>
--with-boost=<boost_root> # use boost from <boost_root> directory
--with-libpeyton=<lp_root> # use libpeyton from <lp_root> directory
--devemu # target CUDA code for device emulation
If ran from the top level source directory, it will configure the build
directory in build/optimized/debug (depending on whether --optimized or
Expand Down Expand Up @@ -78,6 +83,7 @@ configlog "$@"

# Quick check for CMake
CMAKE=${CMAKE:-cmake}
ENV=${ENV:-env}
which $CMAKE 2>&1 > /dev/null || {
CML=`dirname $0`"/CMakeLists.txt"
xecho "No usable CMake found (tried looking for executable \`$CMAKE')"
Expand All @@ -97,14 +103,22 @@ BUILDDIR='build'
#
# Project-specific command-line argument parsing
#
TEMP=`getopt -o hp: -l help,prefix:,debug,optimized,with-boost: -- "$@"` || { xecho "Try $0 --help"; exit $?; }
TEMP=`getopt -o hp: -l help,prefix:,debug,optimized,devemu,env:,with-cuda:,with-boost:,with-libpeyton: -- "$@"` || { xecho "Try $0 --help"; exit $?; }
eval set -- "$TEMP"
while true ; do
case "$1" in
-p|--prefix)
xecho "=== configure: Setting install path to '$2'"
CMAKE="$CMAKE -DCMAKE_INSTALL_PREFIX='$2'"
shift 2 ;;
--env)
xecho "=== configure: Setting environment variable '$2'"
ENV="$ENV '$2'"
shift 2 ;;
--devemu)
xecho "=== configure: Targeting CUDA code for device emulation"
CMAKE="$CMAKE -DCUDA_BUILD_EMULATION=ON"
shift 1 ;;
--debug)
xecho "=== configure: Setting build type to 'Debug'"
BUILDDIR='debug'
Expand All @@ -119,6 +133,14 @@ while true ; do
xecho "=== configure: Using Boost from '$2'"
CMAKE="$CMAKE -DBOOST_ROOT='$2'"
shift 2 ;;
--with-cuda)
xecho "=== configure: Using CUDA Toolkit from '$2'"
CMAKE="$CMAKE -DCUDA_TOOLKIT_ROOT_DIR='$2'"
shift 2 ;;
--with-libpeyton)
xecho "=== configure: Using libpeyton from '$2'"
CMAKE="$CMAKE -Dlibpeyton_ROOT='$2'"
shift 2 ;;
-h|--help)
usage;
exit 0 ;;
Expand Down Expand Up @@ -154,7 +176,7 @@ test -f CMakeCache.txt && rm -f CMakeCache.txt

# Run cmake
xecho "=== Invoking CMake to configure the source"
eval $CMAKE | tee -a $CONFIGLOG;
eval $ENV $CMAKE | tee -a $CONFIGLOG;
test "x${PIPESTATUS[0]}" == "x0" && {
if [ "$BDSET" == "1" ]; then
# Generate a stub makefile that will hand-off compilation to the real makefile
Expand Down

0 comments on commit ddcb5b4

Please sign in to comment.