-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·36 lines (27 loc) · 812 Bytes
/
build.sh
File metadata and controls
executable file
·36 lines (27 loc) · 812 Bytes
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
#!/usr/bin/env bash
# Resource: https://stackoverflow.com/questions/145270/calling-c-c-from-python
# ... I was using osx and had to replace -soname with -install_name to compile
if [ -d "lib" ]; then
cd lib # move into library
else
mkdir lib
cd lib
fi
if [ -d "bin" ]; then
cd bin
else
mkdir bin
cd bin
fi
if [ -d "$OSTYPE" ]; then
rm -r $OSTYPE
fi
mkdir $OSTYPE
cd $OSTYPE
if [[ "$OSTYPE" == "linux-gnu" ]]; then
# I only have an nVIDIA GPU on my linux machine, so it compiles CUDA for this
nvcc --shared -o injection.so ../../src/checkInjective.cu --compiler-options '-fPIC'
elif [[ "$OSTYPE" == "darwin17" ]]; then
g++ -std=c++17 -c -fPIC ../../src/checkInjective.cpp -o injection.o
g++ -shared -Wl,-install_name,injection.so -o injection.so injection.o
fi