-
Notifications
You must be signed in to change notification settings - Fork 84
Expand file tree
/
Copy pathbuild_manylinux.sh
More file actions
executable file
·74 lines (58 loc) · 2.97 KB
/
Copy pathbuild_manylinux.sh
File metadata and controls
executable file
·74 lines (58 loc) · 2.97 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
66
67
68
69
70
71
72
73
74
#!/bin/sh
export SSCDIR=/io/ssc
export SAMNTDIR=/io/sam
export PYSAMDIR=/io/pysam
ARCH=$(uname -m)
if [ $ARCH = "aarch64" ]; then
ORTOOLS=or-tools_aarch64_AlmaLinux-8.10_cpp_v9.14.6206
else
ORTOOLS=or-tools_x86_64_AlmaLinux-8.10_cpp_v9.14.6206
export CC=gcc
export CXX=g++
fi
export ORTOOLSDIR=/io/${ORTOOLS}
echo "ortools, $ORTOOLSDIR"
mkdir ${ORTOOLSDIR}
curl -L https://github.com/google/or-tools/releases/download/v9.14/${ORTOOLS}.tar.gz -o ${ORTOOLS}.tar.gz
tar xvzf ${ORTOOLS}.tar.gz -C ${ORTOOLSDIR} --strip-components=1
mkdir -p /io/build_linux_ssc
cd /io/build_linux_ssc
rm -rf *
cmake ${SSCDIR} -DCMAKE_BUILD_TYPE=Release -DSAM_SKIP_TOOLS=1 -DSAMAPI_EXPORT=1 -DSAM_SKIP_TESTS=1 -DUSE_XPRESS=0 -DUSE_COINOR=1 -DCMAKE_SYSTEM_PREFIX_PATH="$ORTOOLSDIR" -Dabsl_DIR="$ORTOOLSDIR\lib\cmake\absl" -Dutf8_range_DIR="$ORTOOLSDIR\lib\cmake\utf8_range" -Dortools_DIR="$ORTOOLSDIR\lib\cmake\ortools" ../ssc || exit
#cmake ${SSCDIR} -DCMAKE_BUILD_TYPE=Release \
# -DSAMAPI_EXPORT=1 -DSAM_SKIP_TOOLS=1 -DSAM_SKIP_TESTS=1 \
# -DUSE_XPRESS=0 -DUSE_COINOR=1 -DCMAKE_SYSTEM_PREFIX_PATH="$ORTOOLSDIR" \
# -Dabsl_DIR="$ORTOOLSDIR/lib/cmake/absl" -Dutf8_range_DIR="$ORTOOLSDIR/lib/cmake/utf8_range" \
# -Dortools_DIR="$ORTOOLSDIR/lib/cmake/ortools" -DCMAKE_PREFIX_PATH="$ORTOOLSDIR" -DCMAKE_LIBRARY_PATH="$ORTOOLSDIR" ../ssc || exit
cmake --build . --target shared -j 8 || exit
cmake --build . --target ssc -j 8 || exit
mkdir -p /io/build_linux_sam
cd /io/build_linux_sam
rm -rf *
cmake ${SAMNTDIR}/api -DCMAKE_BUILD_TYPE=Release -DSAMAPI_EXPORT=1 -DSAM_SKIP_AUTOGEN=1 -DUSE_XPRESS=0 -DUSE_COINOR=1 -DCMAKE_SYSTEM_PREFIX_PATH="$ORTOOLSDIR" -Dabsl_DIR="$ORTOOLSDIR\lib\cmake\absl" -Dutf8_range_DIR="$ORTOOLSDIR\lib\cmake\utf8_range" -Dortools_DIR="$ORTOOLSDIR\lib\cmake\ortools" ../sam/api || exit
make -j 8 || exit
cd $PYSAMDIR
# Stage external files (libs, defaults) into PySAM/
/opt/python/cp312-cp312/bin/python prepare_build.py || exit
for PYTHONENV in cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312 cp313-cp313 cp314-cp314
do
yes | /opt/python/$PYTHONENV/bin/python -m pip install --upgrade pip
yes | /opt/python/$PYTHONENV/bin/pip install -r tests/requirements.txt
yes | /opt/python/$PYTHONENV/bin/pip install repairwheel
yes | /opt/python/$PYTHONENV/bin/pip install build
yes | /opt/python/$PYTHONENV/bin/pip uninstall NREL-PySAM
yes | /opt/python/$PYTHONENV/bin/pip uninstall NLR-PySAM
/opt/python/$PYTHONENV/bin/python -m build --wheel || exit
WHEEL=$(ls dist/nlr_pysam-*-$PYTHONENV-*linux*$ARCH.whl)
/opt/python/$PYTHONENV/bin/python -m repairwheel "$WHEEL" -l "$ORTOOLSDIR/lib64" -o dist/wheelhouse/
REPAIRED_WHEEL=$(ls dist/wheelhouse/nlr_pysam-*-$PYTHONENV-*linux*$ARCH.whl)
yes | /opt/python/$PYTHONENV/bin/pip install "$REPAIRED_WHEEL"
# /opt/python/$PYTHONENV/bin/pytest -s tests
retVal=$?
if [ $retVal -ne 0 ]; then
echo "Error in Tests"
exit 1
fi
done
# Clean up staged files
/opt/python/cp312-cp312/bin/python prepare_build.py --clean