@@ -28,6 +28,7 @@ option(TPCH_ENABLE_ICEBERG "Enable Apache Iceberg table format support" OFF)
2828option (TPCH_ENABLE_LANCE "Enable Lance columnar format support (requires Rust)" OFF )
2929option (TPCH_ENABLE_PERF_COUNTERS "Enable performance counters instrumentation" OFF )
3030option (TPCH_ENABLE_MOLD "Enable mold linker if available (incompatible with GTest in this project)" ON )
31+ option (TPCDS_ENABLE "Enable TPC-DS data generation (tpcds_benchmark executable)" OFF )
3132
3233# Compiler configuration
3334include (cmake/CompilerWarnings.cmake )
@@ -258,6 +259,11 @@ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
258259add_subdirectory (third_party/dbgen EXCLUDE_FROM_ALL )
259260include_directories (${DBGEN_INCLUDE_DIRS} )
260261
262+ # TPC-DS dsdgen objects (built only when TPCDS_ENABLE=ON)
263+ if (TPCDS_ENABLE)
264+ add_subdirectory (third_party/dsdgen EXCLUDE_FROM_ALL )
265+ endif ()
266+
261267# Copy TPC-H distribution file to build directory
262268# Required by dbgen for loading nations, regions, and other lookup tables
263269configure_file (
@@ -559,6 +565,46 @@ if(TPCH_ENABLE_PERF_COUNTERS)
559565 target_compile_definitions (tpch_benchmark PRIVATE TPCH_ENABLE_PERF_COUNTERS )
560566endif ()
561567
568+ # TPC-DS benchmark executable
569+ if (TPCDS_ENABLE)
570+ add_executable (tpcds_benchmark
571+ src/tpcds_main.cpp
572+ src/dsdgen/dsdgen_wrapper.cpp
573+ src/dsdgen/dsdgen_converter.cpp
574+ ${DSDGEN_OBJECTS}
575+ )
576+ target_link_libraries (tpcds_benchmark PRIVATE tpch_core )
577+ target_include_directories (tpcds_benchmark PRIVATE ${DSDGEN_INCLUDE_DIRS} )
578+ # dsdgen upstream has several globals defined in multiple source files
579+ # (pCurrentFile in driver.c and grammar_support.c, etc.). Allow duplicates
580+ # at link time — the old GCC linker accepted these by default via -fcommon.
581+ target_link_options (tpcds_benchmark PRIVATE -Wl,--allow-multiple-definition )
582+ # dsdgen headers require LINUX=1 and TPCDS=1 to define ds_key_t and enable
583+ # 64-bit support (config.h/#ifdef LINUX). Also needed by dsdgen_wrapper.cpp
584+ # and dsdgen_converter.cpp which include dsdgen C headers.
585+ target_compile_definitions (tpcds_benchmark PRIVATE TPCDS_ENABLE LINUX =1 TPCDS=1 EMBEDDED_DSDGEN=1 )
586+ if (TPCH_ENABLE_ORC)
587+ target_compile_definitions (tpcds_benchmark PRIVATE TPCH_ENABLE_ORC )
588+ endif ()
589+ if (TPCH_ENABLE_PAIMON)
590+ target_compile_definitions (tpcds_benchmark PRIVATE TPCH_ENABLE_PAIMON )
591+ endif ()
592+ if (TPCH_ENABLE_ICEBERG)
593+ target_compile_definitions (tpcds_benchmark PRIVATE TPCH_ENABLE_ICEBERG )
594+ endif ()
595+ if (TPCH_ENABLE_LANCE)
596+ target_compile_definitions (tpcds_benchmark PRIVATE TPCH_ENABLE_LANCE )
597+ endif ()
598+ if (TPCH_ENABLE_ASYNC_IO AND Uring_FOUND)
599+ target_compile_definitions (tpcds_benchmark PRIVATE TPCH_ENABLE_ASYNC_IO )
600+ endif ()
601+ if (TPCH_ENABLE_PERF_COUNTERS)
602+ target_compile_definitions (tpcds_benchmark PRIVATE TPCH_ENABLE_PERF_COUNTERS )
603+ endif ()
604+ message (STATUS "TPC-DS support enabled: tpcds_benchmark target added" )
605+ install (TARGETS tpcds_benchmark RUNTIME DESTINATION bin)
606+ endif ()
607+
562608# Examples
563609if (TPCH_BUILD_EXAMPLES)
564610 add_subdirectory (examples )
0 commit comments