forked from Iainmon/ChAI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathembed_libtorch.sh
More file actions
executable file
·37 lines (27 loc) · 1.42 KB
/
embed_libtorch.sh
File metadata and controls
executable file
·37 lines (27 loc) · 1.42 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
#!/usr/bin/env sh
#
# This script prints the flags required by the Chapel compiler to embed Python
# code in a Chapel program. It is intended to be used by consumers of the
# 'Python' module. See https://chapel-lang.org/docs/modules/packages/Python.html
#
# get the chpl home directory
# chpl_home=$(cd $(dirname $0) ; cd ..; cd ..; pwd)
# chpl_python=$("$chpl_home/util/config/find-python.sh")
cd "$(dirname "$0")"
mkdir -p build
cd build
cmake .. > /dev/null
make -j4 > /dev/null
cd ..
SOURCE_DIR=$(pwd)
BRIDGE_LIB=$SOURCE_DIR/build/CMakeFiles/bridge.dir/bridge/lib/bridge.cpp.o
LIBTORCH_DIR=$SOURCE_DIR/libtorch
echo "-M $SOURCE_DIR/lib $SOURCE_DIR/bridge/include/bridge.h $BRIDGE_LIB -I $SOURCE_DIR/bridge/include -L $LIBTORCH_DIR/lib --ldflags -Wl,-rpath,$SOURCE_DIR/libtorch/lib"
# PYTHON_INCLUDE_DIR=$($chpl_python -c "import sysconfig; print(sysconfig.get_paths()['include'])")
# PYTHON_LIB_DIR=$($chpl_python -c "import sysconfig; print(sysconfig.get_config_var('LIBDIR'))")
# PYTHON_LDVERSION=$($chpl_python -c "import sysconfig; print(sysconfig.get_config_var('LDVERSION'))")
# DISABLE_WARNINGS=""
# # some older python's don't use `#ifndef` when they should
# # so we disable redefinition warnings for clean testing
# DISABLE_WARNINGS="$DISABLE_WARNINGS --ccflags -Wno-macro-redefined"
# echo "--ccflags -isystem$PYTHON_INCLUDE_DIR -L$PYTHON_LIB_DIR --ldflags -Wl,-rpath,$PYTHON_LIB_DIR -lpython$PYTHON_LDVERSION $DISABLE_WARNINGS"