Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

*: remove DSN_IN_CORE, improve BOOST linking, fix build.sh #283

Merged
merged 6 commits into from
Jul 29, 2019
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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.8)
cmake_minimum_required(VERSION 3.5.2)

project(dsn C CXX)

Expand Down
51 changes: 12 additions & 39 deletions bin/dsn.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ endfunction(ms_add_project)
# - MY_PROJ_LIBS
# - MY_BINPLACES
# Extra files that will be installed
# - MY_BOOST_PACKAGES
# - MY_BOOST_LIBS
function(dsn_add_project)
if((NOT DEFINED MY_PROJ_TYPE) OR (MY_PROJ_TYPE STREQUAL ""))
message(FATAL_ERROR "MY_PROJ_TYPE is empty.")
Expand Down Expand Up @@ -135,24 +135,14 @@ function(dsn_add_project)
if(NOT DEFINED MY_BINPLACES)
set(MY_BINPLACES "")
endif()
if(NOT DEFINED MY_BOOST_PACKAGES)
set(MY_BOOST_PACKAGES "")
endif()

set(MY_BOOST_LIBS "")
if(NOT (MY_BOOST_PACKAGES STREQUAL ""))
ms_setup_boost(TRUE "${MY_BOOST_PACKAGES}" MY_BOOST_LIBS)
if(NOT DEFINED MY_BOOST_LIBS)
set(MY_BOOST_LIBS "")
endif()

if((MY_PROJ_TYPE STREQUAL "SHARED") OR (MY_PROJ_TYPE STREQUAL "EXECUTABLE"))
if(DSN_BUILD_RUNTIME AND(DEFINED DSN_IN_CORE) AND DSN_IN_CORE)
set(TEMP_LIBS "")
else()
set(TEMP_LIBS dsn_runtime)
endif()
set(MY_PROJ_LIBS ${MY_PROJ_LIBS} ${TEMP_LIBS} ${MY_BOOST_LIBS} ${DSN_SYSTEM_LIBS})
endif()

ms_add_project("${MY_PROJ_TYPE}" "${MY_PROJ_NAME}" "${MY_PROJ_SRC}" "${MY_PROJ_INC_PATH}" "${MY_PROJ_LIBS}" "${MY_PROJ_LIB_PATH}" "${MY_BINPLACES}")
endfunction(dsn_add_project)

Expand Down Expand Up @@ -250,25 +240,6 @@ function(dsn_setup_compiler_flags)
FORCE)
endfunction(dsn_setup_compiler_flags)

macro(ms_setup_boost STATIC_LINK PACKAGES BOOST_LIBS)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_STATIC_RUNTIME OFF)

find_package(Boost COMPONENTS ${PACKAGES} REQUIRED)

if(NOT Boost_FOUND)
message(FATAL_ERROR "Cannot find library boost")
endif()

set(TEMP_LIBS "")
foreach(PACKAGE ${PACKAGES})
string(TOUPPER ${PACKAGE} PACKAGE)
set(TEMP_LIBS ${TEMP_LIBS} ${Boost_${PACKAGE}_LIBRARY})
endforeach()
set(${BOOST_LIBS} ${TEMP_LIBS})
endmacro(ms_setup_boost)

# find necessary system libs
function(dsn_setup_system_libs)
find_package(Threads REQUIRED)
Expand Down Expand Up @@ -306,16 +277,18 @@ function(dsn_setup_system_libs)
)
endfunction(dsn_setup_system_libs)

function(dsn_setup_include_path)
if(DEFINED BOOST_ROOT)
include_directories(${BOOST_ROOT}/include)
endif()
include_directories(${BOOST_INCLUDEDIR})
function(dsn_setup_include_path)#TODO: remove this
include_directories(${DSN_THIRDPARTY_ROOT}/include)
endfunction(dsn_setup_include_path)

function(dsn_setup_link_path)
link_directories(${BOOST_LIBRARYDIR})
function(dsn_setup_link_path)#TODO: dsn_setup_thirdparty_libs()
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_STATIC_RUNTIME OFF)

find_package(Boost COMPONENTS system filesystem regex REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})

link_directories(${DSN_THIRDPARTY_ROOT}/lib)
endfunction(dsn_setup_link_path)

Expand Down
7 changes: 7 additions & 0 deletions scripts/linux/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,13 @@ fi

cd $ROOT
DSN_GIT_COMMIT=`git log | head -n 1 | awk '{print $2}'`
if [ $? -ne 0 ] || [ -z "$DSN_GIT_COMMIT" ]
then
echo "ERROR: get DSN_GIT_COMMIT failed"
echo "HINT: check if rdsn is a git repo"
echo " or check gitdir in .git (edit it or use \"git --git-dir='../.git/modules/rdsn' log\" to get commit)"
exit 1
fi
GIT_COMMIT_FILE=include/dsn/git_commit.h
if [ ! -f $GIT_COMMIT_FILE ] || ! grep $DSN_GIT_COMMIT $GIT_COMMIT_FILE
then
Expand Down
2 changes: 0 additions & 2 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
add_definitions(-DDSN_IN_CORE)
set(DSN_IN_CORE "TRUE")
add_subdirectory(core)
add_subdirectory(perf_counter)
add_subdirectory(tools)
Expand Down
4 changes: 2 additions & 2 deletions src/core/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ set(MY_PROJ_INC_PATH
${GTEST_INCLUDE_DIR}
../core ../tools/common ../tools/simulator ../tools/hpc ../tools/nfs
)

set(MY_BOOST_PACKAGES system filesystem regex)

set(MY_PROJ_LIBS gtest
dsn_runtime
)

set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)

set(MY_PROJ_LIB_PATH "${GTEST_LIB_DIR}")

# Extra files that will be installed
Expand Down
6 changes: 4 additions & 2 deletions src/dist/cli/shell/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ else()
set(MY_PROJ_LIBS dsn_cli)
endif()

set(MY_PROJ_LIB_PATH "")
list(APPEND MY_PROJ_LIBS dsn_runtime)

set(MY_BOOST_LIBS Boost::system Boost::filesystem)

set(MY_BOOST_PACKAGES system filesystem)
set(MY_PROJ_LIB_PATH "")

# Extra files that will be installed
set(MY_BINPLACES "${CMAKE_CURRENT_SOURCE_DIR}/config.ini")
Expand Down
3 changes: 2 additions & 1 deletion src/dist/http/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ set(MY_SRC_SEARCH_MODE "GLOB")

set(MY_PROJ_LIBS
dsn_http
dsn_runtime
gtest
gtest_main
)

set(MY_BOOST_PACKAGES system filesystem)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

set(MY_BINPLACES
"${CMAKE_CURRENT_SOURCE_DIR}/run.sh"
Expand Down
6 changes: 3 additions & 3 deletions src/dist/nfs/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ set(MY_SRC_SEARCH_MODE "GLOB")

set(MY_PROJ_INC_PATH "")

set(MY_PROJ_LIBS "dsn_nfs" "gtest")
set(MY_PROJ_LIBS dsn_nfs dsn_runtime gtest)

set(MY_PROJ_LIB_PATH "")
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

set(MY_BOOST_PACKAGES system filesystem)
set(MY_PROJ_LIB_PATH "")

# Extra files that will be installed
set(MY_BINPLACES
Expand Down
5 changes: 3 additions & 2 deletions src/dist/replication/common/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ set(MY_PROJ_NAME dsn_replication_common_test)

set(MY_SRC_SEARCH_MODE "GLOB")

set(MY_BOOST_PACKAGES system filesystem)

set(MY_PROJ_LIBS
dsn_replication_common
dsn_runtime
gtest
fmt
)

set(MY_BOOST_LIBS Boost::system Boost::filesystem)

set(MY_BINPLACES
config-test.ini
run.sh
Expand Down
1 change: 1 addition & 0 deletions src/dist/replication/meta_server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ set(MY_PROJ_LIBS
dsn.replication.zookeeper_provider
dsn_cli
dsn_http
dsn_runtime
zookeeper_mt
galaxy-fds-sdk-cpp
PocoNet
Expand Down
4 changes: 2 additions & 2 deletions src/dist/replication/storage_engine/simple_kv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ set(MY_SRC_SEARCH_MODE "GLOB")

set(MY_PROJ_INC_PATH "")

set(MY_BOOST_PACKAGES system filesystem)
set(MY_PROJ_LIBS dsn_replica_server dsn_meta_server dsn_replication_client dsn_runtime fmt)

set(MY_PROJ_LIBS dsn_replica_server dsn_meta_server dsn_replication_client fmt)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

set(MY_PROJ_LIB_PATH "")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@ set(MY_SRC_SEARCH_MODE "GLOB")

set(MY_PROJ_INC_PATH)

set(MY_PROJ_LIBS dsn_meta_server
dsn_replication_common
dsn.block_service.local
dsn.block_service.fds
fmt
gtest)
set(MY_PROJ_LIBS
dsn_meta_server
dsn_replication_common
dsn.block_service.local
dsn.block_service.fds
dsn_runtime
fmt
gtest)

set(MY_PROJ_LIB_PATH "")
set(MY_BOOST_LIBS Boost::system Boost::filesystem Boost::regex)

set(MY_BOOST_PACKAGES system filesystem)
set(MY_PROJ_LIB_PATH "")

# Extra files that will be installed
set(MY_BINPLACES "")
Expand Down
38 changes: 20 additions & 18 deletions src/dist/replication/test/meta_test/unit_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,29 @@ set(MY_SRC_SEARCH_MODE "GLOB")

set(MY_PROJ_INC_PATH "")

set(MY_PROJ_LIBS dsn.replication.zookeeper_provider
dsn_replication_common
dsn.block_service.local
dsn.block_service.fds
dsn.failure_detector
dsn_cli
dsn_http
zookeeper_mt
galaxy-fds-sdk-cpp
PocoNet
PocoFoundation
PocoNetSSL
PocoJSON
crypto
fmt
gtest)
set(MY_PROJ_LIBS
dsn.replication.zookeeper_provider
dsn_replication_common
dsn.block_service.local
dsn.block_service.fds
dsn.failure_detector
dsn_cli
dsn_http
dsn_runtime
zookeeper_mt
galaxy-fds-sdk-cpp
PocoNet
PocoFoundation
PocoNetSSL
PocoJSON
crypto
fmt
gtest)

set(MY_BOOST_LIBS Boost::system Boost::filesystem)

set(MY_PROJ_LIB_PATH "")

set(MY_BOOST_PACKAGES system filesystem)

# Extra files that will be installed
set(MY_BINPLACES clear.sh run.sh config-ddl-test.ini config-test.ini suite1 suite2)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ set(MY_PROJ_LIBS dsn_meta_server
dsn.block_service.fds
dsn.failure_detector
dsn_http
dsn_runtime
zookeeper_mt
galaxy-fds-sdk-cpp
PocoNet
Expand All @@ -29,7 +30,7 @@ set(MY_PROJ_LIBS dsn_meta_server
fmt
gtest)

set(MY_BOOST_PACKAGES system filesystem)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

#Extra files that will be installed
set(MY_BINPLACES clear.sh run.sh config-test.ini)
Expand Down
12 changes: 5 additions & 7 deletions src/dist/replication/test/simple_kv/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
set(MY_PROJ_NAME dsn.rep_tests.simple_kv)
add_definitions(-DDSN_IN_CORE)
set(DSN_IN_CORE "TRUE")

# Search mode for source files under CURRENT project directory?
# "GLOB_RECURSE" for recursive search
Expand All @@ -10,11 +8,7 @@ set(MY_PROJ_SRC ${MY_PROJ_SRC} ../../storage_engine/simple_kv/simple_kv_types.cp

set(MY_PROJ_INC_PATH)

set(MY_BOOST_PACKAGES system filesystem)

set(MY_PROJ_LIBS gtest
dsn_runtime
dsn_replica_server
set(MY_PROJ_LIBS dsn_replica_server
dsn_meta_server
dsn_replication_common
dsn_replication_client
Expand All @@ -23,6 +17,7 @@ set(MY_PROJ_LIBS gtest
dsn.failure_detector.multimaster
dsn.failure_detector
dsn.replication.zookeeper_provider
dsn_runtime
zookeeper_mt
galaxy-fds-sdk-cpp
PocoNet
Expand All @@ -31,8 +26,11 @@ set(MY_PROJ_LIBS gtest
PocoJSON
crypto
fmt
gtest
)

set(MY_BOOST_LIBS Boost::system Boost::filesystem)

set(MY_PROJ_LIB_PATH
${GTEST_LIB_DIR}
${ZOOKEEPER_LIB_DIR}
Expand Down
3 changes: 2 additions & 1 deletion src/tests/dsn/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ set(MY_PROJ_LIBS
dsn.failure_detector.multimaster
dsn.failure_detector
dsn.replication.zookeeper_provider
dsn_runtime
zookeeper_mt
galaxy-fds-sdk-cpp
PocoNet
Expand All @@ -35,7 +36,7 @@ set(MY_PROJ_LIBS
${MY_PROJ_LIBS}
)

set(MY_BOOST_PACKAGES system filesystem)
set(MY_BOOST_LIBS Boost::system Boost::filesystem)

set(MY_PROJ_LIB_PATH "")

Expand Down
6 changes: 0 additions & 6 deletions thirdparty/fix_s2_for_pegasus.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt
index c6b40ee..cd20718 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 2.8.12)
project(s2-geometry)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include(CMakeDependentOption)
@@ -17,11 +17,12 @@ cmake_dependent_option(WITH_GLOG "Use glog for logging." ON
"WITH_GFLAGS" OFF)
add_feature_info(GLOG WITH_GLOG "provides logging configurability.")
Expand Down