Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scripts: build rocksdb support ccache; fix run.sh; fix CMakeLists.txt #85

Merged
merged 3 commits into from
Jun 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ function run_build()
exit 1
fi

# reset DSN_ROOT env because "$ROOT/DSN_ROOT" is not generated now.
export DSN_ROOT=$ROOT/rdsn/builder/output
if [ ! -e $ROOT/DSN_ROOT ]; then
ln -sf $DSN_ROOT $ROOT/DSN_ROOT
Expand All @@ -173,6 +174,15 @@ function run_build()
if [ "$CLEAR_THIRDPARTY" == "YES" ]; then
OPT="$OPT --clear_thirdparty"
fi
if [ "$WARNING_ALL" == "YES" ]; then
OPT="$OPT -w"
fi
if [ "$RUN_VERBOSE" == "YES" ]; then
OPT="$OPT -v"
fi
if [ "$ENABLE_GCOV" == "YES" ]; then
OPT="$OPT --enable_gcov"
fi
./run.sh build $OPT
if [ $? -ne 0 ]; then
echo "ERROR: build rdsn failed"
Expand Down
5 changes: 4 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ set(DSN_THIRDPARTY_ROOT "$ENV{DSN_THIRDPARTY_ROOT}")
if((DSN_ROOT STREQUAL "") OR (NOT EXISTS "${DSN_ROOT}/"))
message(FATAL_ERROR "Please make sure that DSN_ROOT is defined and does exists.")
endif()
if((DSN_THIRDPARTY_ROOT STREQUAL "") OR (NOT EXISTS "${DSN_THIRDPARTY_ROOT}/"))
message(FATAL_ERROR "Please make sure that DSN_THIRDPARTY_ROOT is defined and does exists.")
endif()

include("${DSN_ROOT}/bin/dsn.cmake")

Expand All @@ -14,7 +17,7 @@ dsn_common_setup()

include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
include_directories("../rocksdb/include")
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../rocksdb/include)

add_subdirectory(base)
add_subdirectory(client_lib)
Expand Down
15 changes: 14 additions & 1 deletion src/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
ROOT=`pwd`
BUILD_DIR="$ROOT/builder"

echo "DSN_ROOT=$DSN_ROOT"
echo "DSN_THIRDPARTY_ROOT=$DSN_THIRDPARTY_ROOT"
echo "C_COMPILER=$C_COMPILER"
echo "CXX_COMPILER=$CXX_COMPILER"
CMAKE_OPTIONS="$CMAKE_OPTIONS -DCMAKE_C_COMPILER=$C_COMPILER -DCMAKE_CXX_COMPILER=$CXX_COMPILER"
Expand Down Expand Up @@ -126,7 +128,18 @@ then
rm -f ../rocksdb/pegasus_bench
fi

make -C ../rocksdb static_lib_$BUILD_TYPE $MAKE_OPTIONS
# use ccache if possible
if [ `command -v ccache` ]
then
ROCKSDB_CC="ccache $C_COMPILER"
ROCKSDB_CXX="ccache $CXX_COMPILER"
else
ROCKSDB_CC="$C_COMPILER"
ROCKSDB_CXX="$CXX_COMPILER"
fi

echo "ROCKDB_CC=$ROCKSDB_CC, ROCKSDB_CXX=$ROCKSDB_CXX"
CC=$ROCKSDB_CC CXX=$ROCKSDB_CXX make -C ../rocksdb static_lib_$BUILD_TYPE $MAKE_OPTIONS
if [ $? -ne 0 ]
then
echo "ERROR: build librocksdb.a failed"
Expand Down
4 changes: 2 additions & 2 deletions src/server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set(MY_PROJ_SRC "")
# "GLOB" for non-recursive search
set(MY_SRC_SEARCH_MODE "GLOB")

set(MY_PROJ_INC_PATH "${DSN_ROOT}/include/ext")
set(MY_PROJ_INC_PATH "")

set(MY_PROJ_LIBS
dsn_replica_server
Expand Down Expand Up @@ -40,7 +40,7 @@ else()
set(MY_PROJ_LIBS rocksdblib ${MY_PROJ_LIBS} rpcrt4)
endif()

set(MY_PROJ_LIB_PATH "../../rocksdb" "../ext/libevent/lib" ${LIBFDS_LIB_DIR} ${POCO_LIB_DIR})
set(MY_PROJ_LIB_PATH "../../rocksdb")

set(MY_BOOST_PACKAGES system filesystem)

Expand Down
2 changes: 1 addition & 1 deletion src/server/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ set(MY_PROJ_SRC "../pegasus_server_impl.cpp"

set(MY_SRC_SEARCH_MODE "GLOB")

set(MY_PROJ_LIB_PATH "../../../rocksdb" ${LIBFDS_LIB_DIR} ${POCO_LIB_DIR})
set(MY_PROJ_LIB_PATH "../../../rocksdb")

set(MY_PROJ_LIBS
dsn_replica_server
Expand Down
5 changes: 2 additions & 3 deletions src/shell/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ set(MY_PROJ_SRC "")
# "GLOB" for non-recursive search
set(MY_SRC_SEARCH_MODE "GLOB")

set(MY_PROJ_INC_PATH "../include"
"../base")
set(MY_PROJ_INC_PATH "../include" "../base")

set(MY_PROJ_LIBS
dsn.replication.tool
Expand Down Expand Up @@ -39,7 +38,7 @@ else()
set(MY_PROJ_LIBS rocksdblib ${MY_PROJ_LIBS} rpcrt4)
endif()

set(MY_PROJ_LIB_PATH "../../rocksdb" ${LIBFDS_LIB_DIR} ${POCO_LIB_DIR})
set(MY_PROJ_LIB_PATH "../../rocksdb")

set(MY_BINPLACES "${CMAKE_CURRENT_SOURCE_DIR}/config.ini")

Expand Down