diff --git a/CMakeLists.txt b/CMakeLists.txt index 82e3150112..cfe9b17039 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.8) +cmake_minimum_required(VERSION 3.5.2) project(dsn C CXX) diff --git a/bin/dsn.cmake b/bin/dsn.cmake index 1dd94b6bc7..ba1f576211 100644 --- a/bin/dsn.cmake +++ b/bin/dsn.cmake @@ -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.") @@ -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) @@ -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) @@ -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) diff --git a/scripts/linux/build.sh b/scripts/linux/build.sh index 8d32308825..d70ad48417 100755 --- a/scripts/linux/build.sh +++ b/scripts/linux/build.sh @@ -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 diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index fe94573708..01686fff05 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -1,5 +1,3 @@ -add_definitions(-DDSN_IN_CORE) -set(DSN_IN_CORE "TRUE") add_subdirectory(core) add_subdirectory(perf_counter) add_subdirectory(tools) diff --git a/src/core/tests/CMakeLists.txt b/src/core/tests/CMakeLists.txt index d4234f3e9e..f0a9d40959 100644 --- a/src/core/tests/CMakeLists.txt +++ b/src/core/tests/CMakeLists.txt @@ -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 diff --git a/src/dist/cli/shell/CMakeLists.txt b/src/dist/cli/shell/CMakeLists.txt index 8190ec2988..593132619b 100644 --- a/src/dist/cli/shell/CMakeLists.txt +++ b/src/dist/cli/shell/CMakeLists.txt @@ -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") diff --git a/src/dist/http/test/CMakeLists.txt b/src/dist/http/test/CMakeLists.txt index 7edbb678a8..e42e35afee 100644 --- a/src/dist/http/test/CMakeLists.txt +++ b/src/dist/http/test/CMakeLists.txt @@ -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" diff --git a/src/dist/nfs/test/CMakeLists.txt b/src/dist/nfs/test/CMakeLists.txt index 84bf0cef25..6f0ed5e2ed 100644 --- a/src/dist/nfs/test/CMakeLists.txt +++ b/src/dist/nfs/test/CMakeLists.txt @@ -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 diff --git a/src/dist/replication/common/test/CMakeLists.txt b/src/dist/replication/common/test/CMakeLists.txt index d7b5a52585..8518ed8669 100644 --- a/src/dist/replication/common/test/CMakeLists.txt +++ b/src/dist/replication/common/test/CMakeLists.txt @@ -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 diff --git a/src/dist/replication/meta_server/CMakeLists.txt b/src/dist/replication/meta_server/CMakeLists.txt index c82be19b3e..521d1bb11e 100644 --- a/src/dist/replication/meta_server/CMakeLists.txt +++ b/src/dist/replication/meta_server/CMakeLists.txt @@ -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 diff --git a/src/dist/replication/storage_engine/simple_kv/CMakeLists.txt b/src/dist/replication/storage_engine/simple_kv/CMakeLists.txt index 428fa1eb4f..5f8f985c41 100644 --- a/src/dist/replication/storage_engine/simple_kv/CMakeLists.txt +++ b/src/dist/replication/storage_engine/simple_kv/CMakeLists.txt @@ -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 "") diff --git a/src/dist/replication/test/meta_test/balancer_simulator/CMakeLists.txt b/src/dist/replication/test/meta_test/balancer_simulator/CMakeLists.txt index 272f78b2d0..8388726e45 100644 --- a/src/dist/replication/test/meta_test/balancer_simulator/CMakeLists.txt +++ b/src/dist/replication/test/meta_test/balancer_simulator/CMakeLists.txt @@ -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 "") diff --git a/src/dist/replication/test/meta_test/unit_test/CMakeLists.txt b/src/dist/replication/test/meta_test/unit_test/CMakeLists.txt index 59f88ce62c..3f483109d9 100644 --- a/src/dist/replication/test/meta_test/unit_test/CMakeLists.txt +++ b/src/dist/replication/test/meta_test/unit_test/CMakeLists.txt @@ -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) diff --git a/src/dist/replication/test/replica_test/unit_test/CMakeLists.txt b/src/dist/replication/test/replica_test/unit_test/CMakeLists.txt index 0ceea7826d..4abe8b02b0 100644 --- a/src/dist/replication/test/replica_test/unit_test/CMakeLists.txt +++ b/src/dist/replication/test/replica_test/unit_test/CMakeLists.txt @@ -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 @@ -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) diff --git a/src/dist/replication/test/simple_kv/CMakeLists.txt b/src/dist/replication/test/simple_kv/CMakeLists.txt index b4cbe4f8ff..4deb0bf268 100644 --- a/src/dist/replication/test/simple_kv/CMakeLists.txt +++ b/src/dist/replication/test/simple_kv/CMakeLists.txt @@ -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 @@ -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 @@ -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 @@ -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} diff --git a/src/tests/dsn/CMakeLists.txt b/src/tests/dsn/CMakeLists.txt index a10fe10607..b8b1fce838 100644 --- a/src/tests/dsn/CMakeLists.txt +++ b/src/tests/dsn/CMakeLists.txt @@ -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 @@ -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 "") diff --git a/thirdparty/fix_s2_for_pegasus.patch b/thirdparty/fix_s2_for_pegasus.patch index afea915e82..626849047e 100644 --- a/thirdparty/fix_s2_for_pegasus.patch +++ b/thirdparty/fix_s2_for_pegasus.patch @@ -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.")