[asterisk-scf-commits] asterisk-scf/release/cmake.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Wed Sep 15 14:32:38 CDT 2010


branch "master" has been updated
       via  4bf0cf87c656657eb4ad1667b17936b240733d4e (commit)
      from  364040aa2e2252eb07d896dc98eee1d2362f56e9 (commit)

Summary of changes:
 init-cmake.sh |   89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 87 insertions(+), 2 deletions(-)


- Log -----------------------------------------------------------------
commit 4bf0cf87c656657eb4ad1667b17936b240733d4e
Author: David M. Lee <dlee at digium.com>
Date:   Wed Sep 15 14:31:04 2010 -0500

    Made the init-cmake script more configurable.  Defaulted windows to VS9.

diff --git a/init-cmake.sh b/init-cmake.sh
index 8319c41..9b64072 100755
--- a/init-cmake.sh
+++ b/init-cmake.sh
@@ -1,9 +1,91 @@
-#!/bin/sh
+#!/bin/bash
 
 #
 # Helpful initialization script for cmake
 #
 
+function print_help()
+{
+   cat <<EOF
+Usage
+  $0 [script-opts] -- [cmake-opts]
+  $0 [cmake-opts]
+
+Script Options
+  --vs9       = Shorthand for -G "Visual Studio 9 2008"
+  --vs9-64    = Shorthand for -G "Visual Studio 9 2008 win64"
+  --vs10      = Shorthand for -G "Visual Studio 10"
+  --vs10-64   = Shorthand for -G "Visual Studio 10 win64"
+  --make      = Shorthand for -G "Unix Makefiles"
+  --nmake     = Shorthand for -G "NMake Makefiles"
+  --help      = Show this help text and exit
+
+Cmake Options
+  run cmake --help for full list
+EOF
+}
+
+cmake_args=()
+function add_cmake_args()
+{
+   cmake_args+=("$@")
+}
+
+case $(uname -s)-$(uname -m) in
+   Darwin-*)       platform=mac     ;;
+   Linux-x86_64)   platform=lin64   ;;
+   Linux-i[0-9]86) platform=lin32   ;;
+   MINGW32*-i686)  platform=win32   ;;
+   *)              platform=unknown ;;
+esac
+
+case $platform in
+   win*) # for windows, default to VS9
+      add_cmake_args -G "Visual Studio 9 2008"
+      ;;
+esac
+
+
+while test $# -gt 0; do
+   case $1 in
+      --vs9)
+         add_cmake_args -G "Visual Studio 9 2008"
+         shift
+         ;;
+      --vs9-64)
+         add_cmake_args -G "Visual Studio 9 2008 win64"
+         shift
+         ;;
+      --vs10)
+         add_cmake_args -G "Visual Studio 10"
+         shift
+         ;;
+      --vs10-64)
+         add_cmake_args -G "Visual Studio 10 win64"
+         shift
+         ;;
+      --make)
+         add_cmake_args -G "Unix Makefiles"
+         shift
+         ;;
+      --nmake)
+         add_cmake_args -G "Visual Studio 9 2008"
+         shift
+         ;;
+      --help)
+         print_help
+         exit 0
+         ;;
+      --) # rest of args are for cmake
+         shift
+         break
+         ;;
+      *)  # unrecognized arg; pass this and rest on to cmake
+         break
+         ;;
+   esac
+done
+
 if ! test -f CMakeLists.txt; then
    echo "CMakeLists.txt missing.  Must be run from a CMake build directory." >&2
    exit 1
@@ -12,5 +94,8 @@ fi
 mkdir -p build
 cd build
 
+# show what we're doing
+set -x
+
 # -Wdev: Enable developer warnings.
-cmake -Wdev .. "$@"
+cmake -Wdev .. "${cmake_args[@]}" "$@"

-----------------------------------------------------------------------


-- 
asterisk-scf/release/cmake.git



More information about the asterisk-scf-commits mailing list