| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
# We build where we are |
| 4 |
SDK_BUILD_BASE=$(pwd -P)/output |
| 5 |
|
| 6 |
if [ -z "$SDK_SRC_BASE" ] |
| 7 |
then |
| 8 |
echo Script variable SDK_SRC_BASE must be set in the calling \'configure\' script, |
| 9 |
echo to the root location of the sources, typically with such a pattern: |
| 10 |
echo 'SDK_SRC_BASE="$(cd "$(dirname "$0")"; pwd -P)"' |
| 11 |
echo "(see 'configure.template' from the argeo-build/cmake directory)" |
| 12 |
exit 1 |
| 13 |
fi |
| 14 |
|
| 15 |
SDK_MK=$SDK_SRC_BASE/sdk.mk |
| 16 |
|
| 17 |
if [ -f "$SDK_MK" ]; |
| 18 |
then |
| 19 |
echo "File $SDK_MK already exists. Remove it in order to configure a new build location:" |
| 20 |
echo "rm $SDK_MK" |
| 21 |
exit 1 |
| 22 |
|
| 23 |
else |
| 24 |
|
| 25 |
if [ -z "$JAVA_HOME" ] |
| 26 |
then |
| 27 |
JAVA_HOME=$(dirname $(dirname $(readlink -f $(which java)))) |
| 28 |
echo "Environment variable JAVA_HOME not set, using $JAVA_HOME of $(which java)" |
| 29 |
fi |
| 30 |
|
| 31 |
# Create build directory, so that it can be used right away |
| 32 |
# and we check whether we have the rights |
| 33 |
mkdir -p $SDK_BUILD_BASE |
| 34 |
if [ ! -d "$SDK_BUILD_BASE" ]; |
| 35 |
then |
| 36 |
echo "Cannot create $SDK_BUILD_BASE, SDK configuration has failed." |
| 37 |
exit 2 |
| 38 |
fi |
| 39 |
|
| 40 |
if [ -z "$CMAKE_BUILD_TYPE" ] |
| 41 |
then |
| 42 |
CMAKE_BUILD_TYPE=Release |
| 43 |
fi |
| 44 |
|
| 45 |
(cd $SDK_SRC_BASE && \ |
| 46 |
cmake -B $SDK_BUILD_BASE/$(basename $SDK_SRC_BASE) \ |
| 47 |
-DA2_INSTALL_MODE=a2 \ |
| 48 |
-DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \ |
| 49 |
-DJAVA_HOME=$JAVA_HOME |
| 50 |
) |
| 51 |
|
| 52 |
echo SDK was configured with CMake. |
| 53 |
echo "JAVA_HOME : $JAVA_HOME" |
| 54 |
echo "Base for sources : $SDK_SRC_BASE" |
| 55 |
echo "Base for builds : $SDK_BUILD_BASE" |
| 56 |
fi |