-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild-LsCs-local.sh
More file actions
executable file
·65 lines (54 loc) · 1.54 KB
/
build-LsCs-local.sh
File metadata and controls
executable file
·65 lines (54 loc) · 1.54 KB
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
59
60
61
62
63
64
65
#!/bin/bash
#
echo "MUST BE RUN FROM ROOT OF PROJECT DIRECTORY TREE"
echo " "
echo "This will delete existing local build or release "
echo "directories and create new ones. It will then prep "
echo "the build directory for a ninja build. Finally it "
echo "will perform the actual build."
# Step 1 : Establish fresh clean directories
#
echo "*** Establishing fresh directories"
SCRIPT_DIR="$PWD"
BUILD_DIR="$SCRIPT_DIR/../LsCs_local_build"
RELEASE_DIR="$SCRIPT_DIR/../LsCs_local_release"
#
# Placed here so it can be hacked for those unfortunate distros that default to lib
# containing 32-bit libraries and lib64 for 64-bit even though they are 64-bit platforms
# themselves.
#
LIB_DIR="lib"
echo "SCRIPT_DIR $SCRIPT_DIR"
echo "BUILD_DIR $BUILD_DIR"
echo "RELEASE_DIR $RELEASE_DIR"
echo "LIB_DIR $LIB_DIR"
# Step 2 : Fresh directories
#
if [ -d "$BUILD_DIR" ]; then
rm -rf "$BUILD_DIR"
fi
if [ -d "$RELEASE_DIR" ]; then
rm -rf "$RELEASE_DIR"
fi
# create the directories we will use so they are fresh and clean
#
mkdir -p "$BUILD_DIR"
mkdir -p "$RELEASE_DIR"
# Step 3 : Prepare Build Directory
#
echo "*** Prepping build directory"
cd "$BUILD_DIR"
# Release
cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX="$RELEASE_DIR" \
-DBUILDING_LOCAL=ON \
"$SCRIPT_DIR"
# Step 4 : Actually build the library
#
echo "*** Building LSCS"
CORES=$(lscpu -b -p=Core,Socket | grep -v '^#' | sort -u | wc -l)
JOBS=$((CORES-1))
echo "Found $CORES cores so setting job count to $JOBS"
export NINJAJOBS=$JOBS
ninja -j $JOBS install
exit