Skip to content

Commit f8f45f8

Browse files
committed
Merge branch 'feature/QPR-13726_eric_wheels_00' into 'master'
QPR-13726 Implement Gitlab CI Jobs to Build Wheels Closes QPR-13726 See merge request qs/oreplus!3099
2 parents 2176c1c + 46eba28 commit f8f45f8

6 files changed

Lines changed: 136 additions & 1 deletion

File tree

Docker/Dockerfile-ORE-Dependencies

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,23 @@ RUN apt-get update \
2323
swig \
2424
lld \
2525
python3-dev \
26+
python3-pip \
27+
python3-venv \
28+
curl \
2629
-o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" \
2730
&& apt-get clean \
2831
&& rm -rf /var/lib/apt/lists/* \
2932
&& mv /usr/bin/ld /usr/bin/ld.backup \
30-
&& ln -s /usr/bin/lld /usr/bin/ld
33+
&& ln -s /usr/bin/lld /usr/bin/ld
34+
35+
RUN \
36+
curl -sSL https://get.docker.com -o install-docker.sh && \
37+
sh install-docker.sh --version 28
38+
39+
RUN python3 -m venv /venv
40+
ENV PATH="/venv/bin:$PATH"
41+
42+
RUN \
43+
pip3 install cibuildwheel==3.2.1 && \
44+
rm -rf ~/.cache/pip
45+

Docker/Dockerfile-Wheels-Boost

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
ARG WHEEL_IMG
3+
FROM ${WHEEL_IMG}
4+
5+
RUN \
6+
curl -O -L https://archives.boost.io/release/1.83.0/source/boost_1_83_0.tar.gz && \
7+
tar xfz boost_1_83_0.tar.gz && \
8+
cd boost_1_83_0 && \
9+
./bootstrap.sh --with-libraries=date_time,filesystem,iostreams,log,regex,serialization,system,thread,timer && \
10+
./b2 install
11+

Docker/Dockerfile-Wheels-CIBW

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
FROM ${DOCKER_REPO}ore-build-dependencies:${ORE_BUILD_VERSION}
3+
4+
ARG WHEEL_ARCH
5+
ARG WHEEL_IMAGE
6+
7+
ENV PATH="/venv/bin:$PATH"
8+
9+
ENV CIBW_BUILD="cp310-manylinux_${WHEEL_ARCH} cp312-manylinux_${WHEEL_ARCH}"
10+
ENV CIBW_MANYLINUX_X86_64_IMAGE=${WHEEL_IMAGE}
11+
ENV CIBW_MANYLINUX_AARCH64_IMAGE=${WHEEL_IMAGE}
12+
ENV CIBW_BEFORE_BUILD="chmod +x ORE-SWIG/Wheels-gitlab/before_all_linux.sh && ORE-SWIG/Wheels-gitlab/before_all_linux.sh"
13+
14+
WORKDIR /builds/qs/oreplus/ore
15+
RUN cibuildwheel --output-dir wheelhouse ORE-SWIG
16+
17+
COPY wheelhouse /wheelhouse
18+

Docker/Dockerfile-Wheels-ORE

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
ARG WHEEL_IMG
3+
FROM ${WHEEL_IMG}
4+
5+
ARG CMAKE_BUILD_TYPE=Release
6+
ARG NUM_CORES=16
7+
8+
COPY CMakeLists.txt /ore/CMakeLists.txt
9+
COPY QuantLib /ore/QuantLib
10+
COPY QuantExt /ore/QuantExt
11+
COPY OREData /ore/OREData
12+
COPY OREAnalytics /ore/OREAnalytics
13+
COPY ThirdPartyLibs /ore/ThirdPartyLibs
14+
COPY cmake /ore/cmake
15+
16+
RUN \
17+
dnf -y install clang && \
18+
dnf -y install ccache && \
19+
dnf -y install ninja-build
20+
21+
ENV PATH="/usr/lib/ccache:$PATH"
22+
ENV CCACHE_DIR="/ccache"
23+
ENV CCACHE_MAXSIZE="10G"
24+
25+
WORKDIR /ore
26+
RUN \
27+
mkdir build && \
28+
cd build && \
29+
cmake .. -GNinja -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_CXX_FLAGS="-D BOOST_ENABLE_ASSERT_HANDLER $([ "$(uname -m)" = "x86_64" ] && echo "-mavx2")" -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DQL_BUILD_EXAMPLES=OFF -DQL_BUILD_TEST_SUITE=OFF -DQL_ENABLE_PARALLEL_UNIT_TEST_RUNNER=ON -DQL_ENABLE_SESSIONS=ON -DORE_BUILD_APP=OFF -DORE_BUILD_DOC=OFF -DORE_BUILD_EXAMPLES=OFF -DORE_BUILD_SWIG=OFF -DORE_BUILD_TESTS=OFF -DORE_ENABLE_OPENCL=OFF -DORE_ENABLE_PARALLEL_UNIT_TEST_RUNNER=ON -DORE_PYTHON_INTEGRATION=OFF
30+
31+
WORKDIR /ore/build
32+
RUN --mount=type=cache,target=/ccache/ ccache -z && \
33+
cmake --build . -- -j ${NUM_CORES} install && \
34+
ccache -s
35+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
pip3 install docker setuptools
4+
cd ORE-SWIG
5+
cp Wheels-gitlab/oreanalytics-config .
6+
chmod +x oreanalytics-config
7+
python3 setup.py wrap
8+
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/sh
2+
3+
# The dockerfile Dockerfile-Wheels-CIBW launches cibuildwheel like so:
4+
# WORKDIR /builds/qs/oreplus/ore
5+
# cibuildwheel --output-dir wheelhouse ORE-SWIG
6+
# This tells cibuildwheel to start in directory "ore" and run in directory "ORE-SWIG".
7+
# Then cibuildwheel runs docker, and copies its current directory ("ore")
8+
# into the container, into directory "/project":
9+
ORE="/project"
10+
11+
# On your system, the boost_thread lib may have a nonstandard name, e.g. boost_thread-mt.
12+
# If that is the case then set the BOOST_THREAD variable before calling this script, e.g:
13+
# export BOOST_THREAD=boost_thread-mt
14+
BOOST_THREAD="${BOOST_THREAD:=boost_thread}"
15+
16+
usage="\
17+
Usage: oreanalytics-config [--libs] [--cflags]"
18+
19+
if test $# -eq 0; then
20+
echo "${usage}" 1>&2
21+
exit 1
22+
fi
23+
24+
while test $# -gt 0; do
25+
case "$1" in
26+
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
27+
*) optarg= ;;
28+
esac
29+
30+
case $1 in
31+
--cflags)
32+
#echo -I${ORE}/build/QuantLib -I${ORE}/OREAnalytics -I${ORE}/OREData -I${ORE}/QuantExt -I${ORE}/QuantLib -I${BOOST_INC} -std=c++1z -DNDEBUG -Wno-free-nonheap-object -Wno-maybe-uninitialized -Wno-misleading-indentation
33+
# We must not specify any include directories, because we have already installed boost and ORE to system directories:
34+
echo -w
35+
;;
36+
--libs)
37+
#echo -L${ORE}/build/OREAnalytics/orea -lOREAnalytics -L${ORE}/build/OREData/ored -lOREData -L${ORE}/build/QuantExt/qle -lQuantExt -L${ORE}/build/QuantLib/ql -lQuantLib -L${BOOST_LIB} -l${BOOST_THREAD} -lboost_system -lboost_serialization -lboost_date_time -lboost_regex -lboost_filesystem -std=c++1z
38+
# We must not specify any library directories, because we have already installed boost and ORE to system directories:
39+
echo -lOREAnalytics -lOREData -lQuantExt -lQuantLib -l${BOOST_THREAD} -lboost_system -lboost_serialization -lboost_date_time -lboost_regex -lboost_filesystem
40+
;;
41+
*)
42+
echo "${usage}" 1>&2
43+
exit 1
44+
;;
45+
esac
46+
shift
47+
done
48+

0 commit comments

Comments
 (0)