Skip to content

Commit

Permalink
Merge pull request he4rt#104 from he4rt/feat/better-compilation-scripts
Browse files Browse the repository at this point in the history
feature(scripts): compilation scripts for libuv and cpp drivers
  • Loading branch information
CodeLieutenant authored Aug 13, 2024
2 parents f30ffae + 2c25f93 commit 3724bdd
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 14 deletions.
44 changes: 44 additions & 0 deletions scripts/compile-cpp-driver.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
SCYLLA_OR_CASSANDRA=$1
CURRENT_DIR="$(pwd)"

if [ -z "$SCYLLA_OR_CASSANDRA" ]; then
SCYLLA_OR_CASSANDRA="scylladb"
fi

if [ "$SCYLLA_OR_CASSANDRA" = "scylladb" ]; then
GIT_REPO="https://github.com/scylladb/cpp-driver.git"
GIT_OUTPUT="/opt/scylladb-driver"
else
GIT_REPO="https://github.com/datastax/cpp-driver.git"
GIT_OUTPUT="/opt/cassandra-driver"
fi

git clone --depth 1 "$GIT_REPO" "$GIT_OUTPUT"

cd "$GIT_OUTPUT" || exit 1

mkdir build || exit 1

cd build || exit 1

CFLAGS="-fPIC" CXXFLAGS="-fPIC -Wno-error=redundant-move" LDFLAGS="-flto" cmake -G Ninja \
-DCASS_CPP_STANDARD=17 \
-DCASS_BUILD_STATIC=ON \
-DCASS_BUILD_SHARED=ON \
-DCASS_USE_STD_ATOMIC=ON \
-DCASS_USE_STATIC_LIBS=ON \
-DCASS_USE_TIMERFD=ON \
-DCASS_USE_LIBSSH2=ON \
-DCASS_USE_ZLIB=ON \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_EXPORT_COMPILE_COMMANDS="OFF" \
-DCMAKE_BUILD_TYPE="RelWithInfo" \
..

CFLAGS="-fPIC" CXXFLAGS="-fPIC -Wno-error=redundant-move" LDFLAGS="-flto" ninja install

cd .. || exit

rm -rf build

cd "$CURRENT_DIR" || exit 1
30 changes: 30 additions & 0 deletions scripts/compile-libuv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
LIBUV_VERSION="v1.48.0"
LIBUV_REPO="https://github.com/libuv/libuv.git"
CURRENT_DIR="$(pwd)"

git clone --depth=1 "$LIBUV_REPO" /opt/libuv

cd /opt/libuv || exit 1

git fetch --tags

git checkout -b $LIBUV_VERSION tags/$LIBUV_VERSION

mkdir build || exit 1

cd build || exit 1

LDFLAGS="-flto" CFLAGS="-fPIC" cmake -G Ninja \
-DBUILD_TESTING=OFF \
-DBUILD_BENCHMARKS=OFF \
-DLIBUV_BUILD_SHARED=ON \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_BUILD_TYPE="RelWithInfo" ..

LDFLAGS="-flto" CFLAGS="-fPIC" ninja install

cd .. || exit

rm -rf build

cd "$CURRENT_DIR" || exit 1
14 changes: 0 additions & 14 deletions scripts/compile-scylladb.sh

This file was deleted.

0 comments on commit 3724bdd

Please sign in to comment.