Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Signed-off-by: tangruilin <[email protected]>
  • Loading branch information
Tangruilin authored Apr 4, 2023
1 parent fb76752 commit 1eec9d5
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 53 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/pika.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,4 @@ jobs:
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
# run: ctest -C ${{env.BUILD_TYPE}}
run: bash ../utils/Run_tests.sh all
run: ctest -C ${{env.BUILD_TYPE}}
85 changes: 46 additions & 39 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
cmake_minimum_required(VERSION 3.10)

# Avoid warning about DOWNLOAD_EXTRACT_TIMESTAMP in CMake 3.24:
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
cmake_policy(SET CMP0135 NEW)
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
cmake_policy(SET CMP0135 NEW)
endif()

set(CMAKE_CXX_STANDARD 17)
project(pika)
set(CMAKE_CXX_FLAGS "-pthread -Wl,--no-as-needed -ldl")
set(CMAKE_CXX_FLAGS "-pthread -Wl,--no-as-needed -ldl")
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
enable_testing()

if (NOT CMAKE_BUILD_TYPE)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RElEASE)
endif ()
endif()

string(TOUPPER ${CMAKE_BUILD_TYPE} BUILD_TYPE)

if (${BUILD_TYPE} STREQUAL DEBUG)
if(${BUILD_TYPE} STREQUAL DEBUG)
set(LIB_BUILD_TYPE DEBUG)
elseif (${BUILD_TYPE} STREQUAL MINSIZEREL)
elseif(${BUILD_TYPE} STREQUAL MINSIZEREL)
set(LIB_BUILD_TYPE MINSIZEREL)
elseif (${BUILD_TYPE} STREQUAL RELWITHDEBINFO)
elseif(${BUILD_TYPE} STREQUAL RELWITHDEBINFO)
set(LIB_BUILD_TYPE RELWITHDEBINFO)
else ()
else()
set(LIB_BUILD_TYPE RElEASE)
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
endif ()
endif()

set(EP_BASE_SUFFIX "buildtrees")
set_property(DIRECTORY PROPERTY EP_BASE ${CMAKE_CURRENT_SOURCE_DIR}/${EP_BASE_SUFFIX})
Expand All @@ -39,7 +40,7 @@ set(INSTALL_LIBDIR_64 ${STAGED_INSTALL_PREFIX}/lib64)
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${STAGED_INSTALL_PREFIX})

execute_process(COMMAND sh ${CMAKE_UTILS_DIR}/Get_OS_Version.sh
OUTPUT_VARIABLE OS_VERSION)
OUTPUT_VARIABLE OS_VERSION)

message(STATUS "${PROJECT_NAME} staged install: ${STAGED_INSTALL_PREFIX}")
message(STATUS "Current platform: ${OS_VERSION} ")
Expand Down Expand Up @@ -72,11 +73,13 @@ ExternalProject_Add(gtest
BUILD_COMMAND
make -j${CPU_CORE}
)
if (${OS_VERSION} MATCHES "CentOS")

if(${OS_VERSION} MATCHES "CentOS")
set(GTEST_LIBRARY ${INSTALL_LIBDIR_64}/libgtest.a)
else ()
else()
set(GTEST_LIBRARY ${INSTALL_LIBDIR}/libgtest.a)
endif ()
endif()

set(GTEST_INCLUDE_DIR ${INSTALL_INCLUDEDIR})

ExternalProject_Add(gflags
Expand Down Expand Up @@ -106,11 +109,11 @@ ExternalProject_Add(gflags
make -j${CPU_CORE}
)

if (${LIB_BUILD_TYPE} STREQUAL DEBUG)
if(${LIB_BUILD_TYPE} STREQUAL DEBUG)
set(LIB_GFLAGS libgflags_debug.a)
else ()
else()
set(LIB_GFLAGS libgflags.a)
endif ()
endif()

set(GFLAGS_LIBRARY ${INSTALL_LIBDIR}/LIB_GFLAGS)
set(GFLAGS_INCLUDE_DIR ${INSTALL_INCLUDEDIR})
Expand Down Expand Up @@ -176,11 +179,11 @@ ExternalProject_Add(glog
make -j${CPU_CORE}
)

if (${LIB_BUILD_TYPE} STREQUAL DEBUG)
if(${LIB_BUILD_TYPE} STREQUAL DEBUG)
set(LIB_GLOG libglogd.a)
else ()
else()
set(LIB_GLOG libglog.a)
endif ()
endif()

set(GLOG_LIBRARY ${INSTALL_LIBDIR}/${LIB_GLOG})
set(GLOG_INCLUDE_DIR ${INSTALL_INCLUDEDIR})
Expand Down Expand Up @@ -213,11 +216,12 @@ ExternalProject_Add(snappy
make -j${CPU_CORE}
)

if (${OS_VERSION} MATCHES "CentOS")
if(${OS_VERSION} MATCHES "CentOS")
set(SNAPPY_LIBRARY ${INSTALL_LIBDIR_64}/libsnappy.a)
else ()
else()
set(SNAPPY_LIBRARY ${INSTALL_LIBDIR}/libsnappy.a)
endif ()
endif()

set(SNAPPY_INCLUDE_DIR ${INSTALL_INCLUDEDIR})

ExternalProject_Add(zstd
Expand Down Expand Up @@ -250,11 +254,12 @@ ExternalProject_Add(zstd
make -j${CPU_CORE}
)

if (${OS_VERSION} MATCHES "CentOS")
if(${OS_VERSION} MATCHES "CentOS")
set(ZSTD_LIBRARY ${INSTALL_LIBDIR_64}/libzstd.a)
else ()
else()
set(ZSTD_LIBRARY ${INSTALL_LIBDIR}/libzstd.a)
endif ()
endif()

set(ZSTD_INCLUDE_DIR ${INSTALL_INCLUDEDIR})

ExternalProject_Add(lz4
Expand Down Expand Up @@ -287,11 +292,12 @@ ExternalProject_Add(lz4
make -j${CPU_CORE}
)

if (${OS_VERSION} MATCHES "CentOS")
if(${OS_VERSION} MATCHES "CentOS")
set(LZ4_LIBRARY ${INSTALL_LIBDIR_64}/liblz4.a)
else ()
else()
set(LZ4_LIBRARY ${INSTALL_LIBDIR}/liblz4.a)
endif ()
endif()

set(LZ4_INCLUDE_DIR ${INSTALL_INCLUDEDIR})

ExternalProject_Add(zlib
Expand Down Expand Up @@ -348,11 +354,12 @@ ExternalProject_Add(gperftools
make -j${CPU_CORE}
)

if (${OS_VERSION} MATCHES "CentOS")
if(${OS_VERSION} MATCHES "CentOS")
set(TCMALLOC_LIBRARY ${INSTALL_LIBDIR_64}/liblibtcmalloclz4.a)
else ()
else()
set(TCMALLOC_LIBRARY ${INSTALL_LIBDIR}/libtcmalloc.a)
endif ()
endif()

set(TCMALLOC_INCLUDE_DIR ${INSTALL_INCLUDEDIR})

ExternalProject_Add(jemalloc
Expand Down Expand Up @@ -418,11 +425,12 @@ ExternalProject_Add(protobuf
make -j${CPU_CORE}
)

if (${LIB_BUILD_TYPE} STREQUAL DEBUG)
if(${LIB_BUILD_TYPE} STREQUAL DEBUG)
set(LIB_PROTOBUF libprotobufd.a)
else ()
else()
set(LIB_PROTOBUF libprotobuf.a)
endif ()
endif()

set(PROTOBUF_INCLUDE_DIR ${INSTALL_INCLUDEDIR})
set(PROTOBUF_LIBRARY ${INSTALL_LIBDIR}/LIB_PROTOBUF)
set(PROTOBUF_PROTOC ${STAGED_INSTALL_PREFIX}/bin/protoc)
Expand Down Expand Up @@ -476,11 +484,11 @@ ExternalProject_Add(rocksdb
make -j${CPU_CORE}
)

if (${OS_VERSION} MATCHES "CentOS")
if(${OS_VERSION} MATCHES "CentOS")
set(ROCKSDB_LIBRARY ${INSTALL_LIBDIR_64}/librocksdb.a)
else ()
else()
set(ROCKSDB_LIBRARY ${INSTALL_LIBDIR}/librocksdb.a)
endif ()
endif()

set(ROCKSDB_INCLUDE_DIR ${INSTALL_INCLUDEDIR})
set(ROCKSDB_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${EP_BASE_SUFFIX}/Source/rocksdb)
Expand Down Expand Up @@ -574,4 +582,3 @@ target_link_libraries(${PROJECT_NAME}
libz.a
libunwind.a
libjemalloc.a)

26 changes: 14 additions & 12 deletions src/storage/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ include(GoogleTest)
file(GLOB_RECURSE BLACKWINDOW_TEST_SOURCE "${PROJECT_SOURCE_DIR}/tests/*.cc")

aux_source_directory(../stc TEST_SRCS)
enable_testing()

# set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/build)
foreach(blackwindow_test_source ${BLACKWINDOW_TEST_SOURCE})
get_filename_component(storage_test_filename ${blackwindow_test_source} NAME)
message(${storage_test_filename})
Expand All @@ -15,17 +15,19 @@ foreach(blackwindow_test_source ${BLACKWINDOW_TEST_SOURCE})
# Add the test target
add_executable(${blackwindow_test_name} ${blackwindow_test_source})
target_include_directories(${blackwindow_test_name}
PUBLIC ${PROJECT_SOURCE_DIR}/include
PUBLIC ${PROJECT_SOURCE_DIR}/..
${ROCKSDB_INCLUDE_DIR}
${ROCKSDB_SOURCE_DIR}
)
PUBLIC ${PROJECT_SOURCE_DIR}/include
PUBLIC ${PROJECT_SOURCE_DIR}/..
${ROCKSDB_INCLUDE_DIR}
${ROCKSDB_SOURCE_DIR}
)
add_dependencies(${blackwindow_test_name} gtest)
target_link_libraries(${blackwindow_test_name}
PUBLIC ${GTEST_LIBRARY}
PUBLIC pstd
PUBLIC ${ROCKSDB_LIBRARY}
PUBLIC storage
)
add_test(NAME ${blackwindow_test_name} COMMAND ${blackwindow_test_name})
PUBLIC ${GTEST_LIBRARY}
PUBLIC pstd
PUBLIC ${ROCKSDB_LIBRARY}
PUBLIC storage
)
add_test(NAME ${blackwindow_test_name}
COMMAND ${blackwindow_test_name}
WORKING_DIRECTORY .)
endforeach(blackwindow_test_source ${BLACKWINDOW_TEST_SOURCE})

0 comments on commit 1eec9d5

Please sign in to comment.