Skip to content
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
29 changes: 15 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,20 @@ if(PIXIE_BENCHMARKS)
)
FetchContent_MakeAvailable(pasta_bit_vector)

if(NOT WIN32)
# Disable sdsl-lite's own tests/examples/tutorials
set(SDSL_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(SDSL_BUILD_TUTORIAL OFF CACHE BOOL "" FORCE)
set(SDSL_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
FetchContent_Declare(
sdsl_lite
GIT_REPOSITORY https://github.com/xxsds/sdsl-lite.git
GIT_TAG v3.0.3
)
FetchContent_MakeAvailable(sdsl_lite)
endif()
# Disable sdsl-lite's own tests/examples/tutorials
set(SDSL_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(SDSL_BUILD_TUTORIAL OFF CACHE BOOL "" FORCE)
set(SDSL_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
FetchContent_Declare(
sdsl_lite
GIT_REPOSITORY https://github.com/xxsds/sdsl-lite.git
GIT_TAG v3.0.3
PATCH_COMMAND ${CMAKE_COMMAND}
-DROOT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}
-DSDSL_SOURCE_DIR=<SOURCE_DIR>
-P ${CMAKE_CURRENT_SOURCE_DIR}/third_party/sdsl-lite/patch.cmake
)
FetchContent_MakeAvailable(sdsl_lite)
endif()

if(PIXIE_TESTS)
Expand Down Expand Up @@ -145,8 +147,7 @@ if(PIXIE_BENCHMARKS)
PRIVATE ${sdsl_lite_SOURCE_DIR}/include)
target_link_libraries(bench_rmm_sdsl
PRIVATE
benchmark
sdsl-lite)
benchmark)

add_executable(louds_tree_benchmarks
src/benchmarks/louds_tree_benchmarks.cpp)
Expand Down
2 changes: 1 addition & 1 deletion src/tests/test_rmm.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <gtest/gtest.h>
#include <reference_implementations/naive_rmm_tree.h>
#include <pixie/rmm_tree.h>
#include <reference_implementations/naive_rmm_tree.h>

#include <algorithm>
#include <array>
Expand Down
12 changes: 8 additions & 4 deletions src/tests/unittests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,9 +450,11 @@ TEST(LowerBoundDelta4x64, Random) {
cnt += fl;
}
if (cnt < 4) {
ASSERT_EQ(lower_bound_delta_4x64(x.data(), y, dlt_array, dlt_scalar), cnt);
ASSERT_EQ(lower_bound_delta_4x64(x.data(), y, dlt_array, dlt_scalar),
cnt);
} else {
ASSERT_GE(lower_bound_delta_4x64(x.data(), y, dlt_array, dlt_scalar), cnt);
ASSERT_GE(lower_bound_delta_4x64(x.data(), y, dlt_array, dlt_scalar),
cnt);
}
}
}
Expand All @@ -473,9 +475,11 @@ TEST(LowerBoundDelta8x64, Random) {
cnt += fl;
}
if (cnt < 8) {
ASSERT_EQ(lower_bound_delta_8x64(x.data(), y, dlt_array, dlt_scalar), cnt);
ASSERT_EQ(lower_bound_delta_8x64(x.data(), y, dlt_array, dlt_scalar),
cnt);
} else {
ASSERT_GE(lower_bound_delta_8x64(x.data(), y, dlt_array, dlt_scalar), cnt);
ASSERT_GE(lower_bound_delta_8x64(x.data(), y, dlt_array, dlt_scalar),
cnt);
}
}
}
Expand Down
60 changes: 60 additions & 0 deletions third_party/sdsl-lite/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
cmake_minimum_required (VERSION 3.2 FATAL_ERROR)
set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")

## (1) Read and set library version
include (ParseVersionFile)

## (2) CREATE PROJECT
cmake_policy (SET CMP0048 NEW) # no more project version warnings
project (sdsl
VERSION ${LIBRARY_VERSION_FULL}
LANGUAGES CXX C)
set (PROJECT_URL "https://github.com/xxsds/sdsl-lite")
set (PROJECT_DESCRIPTION "The Succinct Data Structure Library")

## (4) Build information. Default = Release
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE "Release")
endif ()

## (5) Options
option (CODE_COVERAGE "Set ON to add code coverage compile options" OFF)
option (SDSL_HEADER_TEST "Set ON to run header tests only" OFF)
option (GENERATE_DOC "Set ON to genrate doxygen API reference in build/doc directory" OFF)
option (USE_LIBCPP "Use the LLVM libc++ instead of GCC libstdc++ on OS X" ON)

## (6) Compiler requirements and compile options
include (CompilerFlags)

## (7) Configure scripts
configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/Make.helper.cmake" "${CMAKE_CURRENT_SOURCE_DIR}/Make.helper" @ONLY)

enable_testing ()

# (8) main library target
set (gtest_dir ${CMAKE_CURRENT_LIST_DIR}/external/googletest)
add_subdirectory (external)
add_subdirectory (lib)

set (sdsl_include_directory "${CMAKE_CURRENT_SOURCE_DIR}/include")
file (GLOB HEADERS "${sdsl_include_directory}/sdsl/*.hpp")
add_custom_target (sdsl SOURCES ${HEADERS})

# (9) test targets
if (SDSL_HEADER_TEST)
add_subdirectory (test/header)
return ()
endif ()
if (SDSL_BUILD_TESTS)
add_subdirectory (test)
endif ()

# (10) perform extra tasks such as doxygen / packaging and uninstall target
add_subdirectory (extras)

if (SDSL_BUILD_TUTORIAL)
add_subdirectory (tutorial)
endif ()
if (SDSL_BUILD_EXAMPLES)
add_subdirectory (examples)
endif ()
55 changes: 55 additions & 0 deletions third_party/sdsl-lite/patch.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
cmake_minimum_required(VERSION 3.18)

if (NOT DEFINED ROOT_SOURCE_DIR)
message(FATAL_ERROR "ROOT_SOURCE_DIR is required")
endif ()

if (NOT DEFINED SDSL_SOURCE_DIR)
message(FATAL_ERROR "SDSL_SOURCE_DIR is required")
endif ()

file(COPY "${ROOT_SOURCE_DIR}/third_party/sdsl-lite/CMakeLists.txt"
DESTINATION "${SDSL_SOURCE_DIR}")

set(memory_header "${SDSL_SOURCE_DIR}/include/sdsl/memory_management.hpp")

if (EXISTS "${SDSL_SOURCE_DIR}/.git")
execute_process(
COMMAND git checkout -- include/sdsl/memory_management.hpp
WORKING_DIRECTORY "${SDSL_SOURCE_DIR}"
RESULT_VARIABLE git_restore_result
)
if (NOT git_restore_result EQUAL 0)
message(WARNING "Failed to restore memory_management.hpp from git")
endif ()
endif ()

file(READ "${memory_header}" memory_content)

if (memory_content MATCHES "winsock2.h")
set(needs_windows_includes OFF)
else ()
set(needs_windows_includes ON)
endif ()

if (needs_windows_includes)
string(REPLACE "#include <unistd.h>"
"#ifdef _WIN32\n#include <winsock2.h>\n#include <windows.h>\n#include <io.h>\n#else\n#include <unistd.h>\n#endif"
memory_content
"${memory_content}")
endif ()

if (memory_content MATCHES "#ifndef _WIN32\\n#include <sys/mman.h>")
set(needs_mman_guard OFF)
else ()
set(needs_mman_guard ON)
endif ()

if (needs_mman_guard)
string(REPLACE "#include <sys/mman.h> // IWYU pragma: keep"
"#ifndef _WIN32\n#include <sys/mman.h> // IWYU pragma: keep\n#endif"
memory_content
"${memory_content}")
endif ()

file(WRITE "${memory_header}" "${memory_content}")