forked from mottosso/cmdc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_linux.sh
79 lines (63 loc) · 1.81 KB
/
build_linux.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env bash
# requires python
# requires g++ (7.3.1)
# requires $DEVKIT_LOCATION
# Take version via command-line argument
MAYA_VERSION=2020
MAYA_VERSION=${1:-$MAYA_VERSION}
CMDC_VERSION="0.1.1"
if [[ $MAYA_VERSION == 2018* ]] ; then PYTHON_INCLUDE=python2.7 ; fi
if [[ $MAYA_VERSION == 2019* ]] ; then PYTHON_INCLUDE=python2.7 ; fi
if [[ $MAYA_VERSION == 2020* ]] ; then PYTHON_INCLUDE=Python ; fi
if [[ $MAYA_VERSION == 2022* ]] ; then PYTHON_INCLUDE=Python37/Python ; fi
t0=$(date +%s.%N)
echo "(1) Parsing.."
python ./scripts/mfn.py parse
if [ $? -ne 0 ]; then
exit 1
fi
t1=$(date +%s.%N)
parse_duration=$(echo "(($t1 - $t0) * 1000)/1" | bc)
echo "(1) Finished in $parse_duration ms"
echo "(1) ----------------------------"
echo "(2) Compiling.."
# Make build directory, unless one already exists
mkdir -p build
g++ src/main.cpp \
-I$DEVKIT_LOCATION/include \
-I$DEVKIT_LOCATION/include/$PYTHON_INCLUDE \
-L$DEVKIT_LOCATION/lib \
-L$(pwd)/lib \
-I$(pwd)/include \
-std=c++11 \
-o build/main.o \
-o build/cmdc.so \
-w \
-shared \
-fPIC \
-fexceptions \
-lstdc++ \
-lpython2.7 \
-lFoundation \
-lOpenMaya \
-lOpenMayaRender \
-lOpenMayaUI \
-lOpenMayaAnim \
-lOpenMayaFX \
-DNDEBUG \
-DVERSION_INFO=$CMDC_VERSION
if [ $? -ne 0 ]; then
exit 1
fi
t2=$(date +%s.%N)
compile_duration=$(echo "(($t2 - $t1) * 1000)/1" | bc)
echo "(2) Finished in $compile_duration ms"
echo "(2) ----------------------------"
echo "(3) Cleaning.."
python ./scripts/mfn.py clear
t3=$(date +%s.%N)
clean_duration=$(echo "(($t3 - $t2) * 1000)/1" | bc)
total_duration=$(echo "(($t3 - $t0) * 1000)/1" | bc)
echo "(3) Finished in $clean_duration ms"
echo "(3) ----------------------------"
echo "Successfully created ./build/cmdc.so in $total_duration ms"