From 9d01bd8861f77829d9ec9c3fe2d7fe554a61830f Mon Sep 17 00:00:00 2001 From: Malkovsky Date: Wed, 11 Feb 2026 14:22:51 +0300 Subject: [PATCH 1/4] SDSL patch --- CMakeLists.txt | 29 +++++++------- third_party/sdsl-lite/CMakeLists.txt | 60 ++++++++++++++++++++++++++++ third_party/sdsl-lite/patch.cmake | 55 +++++++++++++++++++++++++ 3 files changed, 130 insertions(+), 14 deletions(-) create mode 100644 third_party/sdsl-lite/CMakeLists.txt create mode 100644 third_party/sdsl-lite/patch.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index d67ec9c..72f1f20 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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= + -P ${CMAKE_CURRENT_SOURCE_DIR}/third_party/sdsl-lite/patch.cmake + ) + FetchContent_MakeAvailable(sdsl_lite) endif() if(PIXIE_TESTS) @@ -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) diff --git a/third_party/sdsl-lite/CMakeLists.txt b/third_party/sdsl-lite/CMakeLists.txt new file mode 100644 index 0000000..d524e2f --- /dev/null +++ b/third_party/sdsl-lite/CMakeLists.txt @@ -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 () diff --git a/third_party/sdsl-lite/patch.cmake b/third_party/sdsl-lite/patch.cmake new file mode 100644 index 0000000..8387e24 --- /dev/null +++ b/third_party/sdsl-lite/patch.cmake @@ -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 " + "#ifdef _WIN32\n#include \n#include \n#include \n#else\n#include \n#endif" + memory_content + "${memory_content}") +endif () + +if (memory_content MATCHES "#ifndef _WIN32\\n#include ") + set(needs_mman_guard OFF) +else () + set(needs_mman_guard ON) +endif () + +if (needs_mman_guard) + string(REPLACE "#include // IWYU pragma: keep" + "#ifndef _WIN32\n#include // IWYU pragma: keep\n#endif" + memory_content + "${memory_content}") +endif () + +file(WRITE "${memory_header}" "${memory_content}") From 60baf58817ff44076f1a8cc3bcd2bbd4cb14d528 Mon Sep 17 00:00:00 2001 From: Malkovsky Date: Wed, 11 Feb 2026 14:39:05 +0300 Subject: [PATCH 2/4] fix: format --- src/tests/unittests.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/tests/unittests.cpp b/src/tests/unittests.cpp index 2e1b5ec..77a1b9e 100644 --- a/src/tests/unittests.cpp +++ b/src/tests/unittests.cpp @@ -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); } } } @@ -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); } } } From 8a6f433653054e0c99db7ced7cd33e10295a2b8e Mon Sep 17 00:00:00 2001 From: Malkovsky Date: Wed, 11 Feb 2026 14:39:35 +0300 Subject: [PATCH 3/4] fix format --- src/tests/test_rmm.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tests/test_rmm.cpp b/src/tests/test_rmm.cpp index c20b5bf..4516f6f 100644 --- a/src/tests/test_rmm.cpp +++ b/src/tests/test_rmm.cpp @@ -1,6 +1,6 @@ #include -#include #include +#include #include #include @@ -14,6 +14,7 @@ #include #include + using std::size_t; static std::string bits_to_parens(const std::string& bits) { From 58030c3442b6233a74b2a0df668e64163bdba035 Mon Sep 17 00:00:00 2001 From: Malkovsky Date: Wed, 11 Feb 2026 15:01:08 +0300 Subject: [PATCH 4/4] fix format --- src/tests/test_rmm.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/tests/test_rmm.cpp b/src/tests/test_rmm.cpp index 4516f6f..8bfbeb6 100644 --- a/src/tests/test_rmm.cpp +++ b/src/tests/test_rmm.cpp @@ -14,7 +14,6 @@ #include #include - using std::size_t; static std::string bits_to_parens(const std::string& bits) {