Welcome to mirror list, hosted at ThFree Co, Russian Federation.

build.sh « autobuild « tools - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 38ca4767bccca69092eebb9a383a8f7e5ff88f1a (plain)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
set -e -x -u

MY_PATH="`dirname \"$0\"`"              # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`"  # absolutized and normalized

source "$MY_PATH/detect_qmake.sh"

# Prints number of cores to stdout
GetCPUCores() {
  case "$OSTYPE" in
    # it's GitBash under Windows
    cygwin)    echo $NUMBER_OF_PROCESSORS
               ;;
    linux-gnu) grep -c ^processor /proc/cpuinfo 2>/dev/null
               ;;
    darwin*)   sysctl -n hw.ncpu
               ;;
    *)         echo "Unsupported platform in $0"
               exit 1
               ;;
  esac
  return 0
}


# Replaces "/cygwin/c" prefix with "c:" one on Windows platform.
# Does nothing under other OS.
# 1st param: path to be modified.
StripCygwinPrefix() {
  if [[ $(GetNdkHost) == "windows-x86_64" ]]; then
    echo "c:`(echo "$1" | cut -c 12-)`"
    return 0
  fi

  echo "$1"
  return 0
}

# 1st param: shadow directory path
# 2nd param: mkspec
# 3rd param: additional qmake parameters
BuildQt() {
  (
    SHADOW_DIR="$1"
    MKSPEC="$2"
    QMAKE_PARAMS="$3"

    mkdir -p "$SHADOW_DIR"
    cd "$SHADOW_DIR"
    echo "Launching qmake..."
    # This call is needed to correctly rebuild c++ sources after switching between branches with added or removed source files.
    # Otherwise we get build errors.
    "$QMAKE" -r CONFIG-=sdk "$QMAKE_PARAMS" -spec "$(StripCygwinPrefix $MKSPEC)" "$(StripCygwinPrefix $MY_PATH)/../../omim.pro"
#    make clean > /dev/null || true
    make -j $(GetCPUCores)
  )
}