-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.sh
executable file
·46 lines (35 loc) · 1.36 KB
/
build.sh
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
#!/bin/bash
mode=$1;
if [ -n "$mode" ] && [ -n "$(echo $mode | grep -i '^debug$')" ];
then
CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=$mode -DCMAKE_DEBUG_POSTFIX=d";
elif [ -n "$mode" ] && [ -n "$(echo $mode | grep -i '^release$')" ];
then
CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=$mode";
else
printf 'ERROR! Usage: ./build.sh [debug|release]\n\n';
exit;
fi
export BUILD_DIR=$(pwd)/build;
{ ls $BUILD_DIR/lib || mkdir -p $BUILD_DIR/lib; } &> /dev/null;
{ ls $BUILD_DIR/bin || mkdir -p $BUILD_DIR/bin; } &> /dev/null;
cmake $CMAKE_OPTIONS -DCMAKE_EXPORT_COMPILE_COMMANDS=1;
numCpuCores=$(grep -c ^processor /proc/cpuinfo);
make -j $numCpuCores && make install;
{ ls $BUILD_DIR/include/btree || mkdir -p $BUILD_DIR/include/btree; } &> /dev/null;
cp -rf btree $BUILD_DIR/include/btree/;
function copyHeaders()
{
local moduleRelativePath=$1;
{ ls $BUILD_DIR/include/$moduleRelativePath || mkdir -p $BUILD_DIR/include/$moduleRelativePath; } &> /dev/null;
find $moduleRelativePath -maxdepth 1 -type f | grep '\.h$' | grep -v "_impl\|_winrt\|pch.h\|targetver.h" | xargs -I{} cp {} build/include/$moduleRelativePath;
}
copyHeaders 3fd/core;
copyHeaders 3fd/utils;
copyHeaders 3fd/sqlite;
copyHeaders 3fd/broker;
copyHeaders 3fd/opencl;
copyHeaders 3fd/opencl/CL;
cp Acknowledgements.txt $BUILD_DIR/;
cp LICENSE $BUILD_DIR/;
cp README $BUILD_DIR/;