feat(cmake): migrate build utility modules by zjw1111 · Pull Request #4 · apache/paimon-cpp · GitHub
Skip to content

feat(cmake): migrate build utility modules - #4

Merged
leaves12138 merged 2 commits into
apache:mainfrom
zjw1111:migrate/cmake-modules
May 22, 2026
Merged

feat(cmake): migrate build utility modules#4
leaves12138 merged 2 commits into
apache:mainfrom
zjw1111:migrate/cmake-modules

Conversation

@zjw1111

@zjw1111 zjw1111 commented May 22, 2026

Copy link
Copy Markdown
Collaborator

Purpose

Linked issue: N/A

Migrate CMake build utility modules from Alibaba Paimon C++ repository into the Apache repository:

  • cmake_modules/BuildUtils.cmake
  • cmake_modules/DefineOptions.cmake
  • cmake_modules/SetupCxxFlags.cmake
  • cmake_modules/san-config.cmake

No extra dependency files were migrated. These files are listed in the source repository LICENSE as Apache Arrow build system modules, so their existing Apache/Arrow attribution was preserved.

Tests

  • python3 /home/jinli.zjw/.codex/skills/paimon-cpp-migrate/scripts/check_migration_batch.py --files cmake_modules/BuildUtils.cmake cmake_modules/DefineOptions.cmake cmake_modules/SetupCxxFlags.cmake cmake_modules/san-config.cmake
  • git diff --check --cached
  • cmake -P cmake_modules/BuildUtils.cmake
  • cmake -P cmake_modules/DefineOptions.cmake

SetupCxxFlags.cmake and san-config.cmake require normal CMake project/configure context and are not script-mode standalone modules.

API and Format

No API, storage format, or protocol changes.

Documentation

No user-facing documentation changes.

Generative AI tooling

Migrate-by: OpenAI Codex

@zjw1111
zjw1111 marked this pull request as ready for review May 22, 2026 09:07
Copilot AI review requested due to automatic review settings May 22, 2026 09:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a set of CMake helper modules to standardize Paimon build options, compiler/linker flags, and sanitizer integration.

Changes:

  • Introduces configurable build options (including sanitizers) and a build configuration summary.
  • Adds a compiler/linker flags setup module including platform-specific warning levels and linker selection.
  • Adds build utilities for creating shared/static libraries and registering unit tests, and wires in sanitizer flags via an interface target.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 17 comments.

File Description
cmake_modules/san-config.cmake Defines paimon_sanitizer_flags interface target and toggles ASAN/UBSAN flags.
cmake_modules/SetupCxxFlags.cmake Centralizes compiler/linker flags per build type and compiler, plus optional gold linker selection.
cmake_modules/DefineOptions.cmake Adds option/category macros, validation, and configuration summary output.
cmake_modules/BuildUtils.cmake Adds helper functions for building libs/tests and applies sanitizer flags to produced targets.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +26 to +35
function(check_description_length name description)
foreach(description_line ${description})
string(LENGTH ${description_line} line_length)
if(${line_length} GREATER 80)
message(FATAL_ERROR "description for ${name} contained a\n\
line ${line_length} characters long!\n\
(max is 80). Split it into more lines with semicolons")
endif()
endforeach()
endfunction()
Comment on lines +55 to +59
macro(define_option name description default)
check_description_length(${name} ${description})
list_join(description "\n" multiline_description)

option(${name} "${multiline_description}" ${default})
Comment on lines +21 to +24
macro(set_option_category name)
set(PAIMON_OPTION_CATEGORY ${name})
list(APPEND "PAIMON_OPTION_CATEGORIES" ${name})
endmacro()

option(${name} "${multiline_description}" ${default})

list(APPEND "PAIMON_${PAIMON_OPTION_CATEGORY}_OPTION_NAMES" ${name})
# Top level cmake dir
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
#----------------------------------------------------------------------
set_option_category("Compile and link")
Comment on lines +111 to +114
if(LIB_INCLUDES)
target_include_directories(${LIB_NAME}_shared SYSTEM
PUBLIC ${ARG_EXTRA_INCLUDES})
endif()
Comment on lines +164 to +167
if(LIB_INCLUDES)
target_include_directories(${LIB_NAME}_static SYSTEM
PUBLIC ${ARG_EXTRA_INCLUDES})
endif()
Comment on lines +142 to +147
target_link_options(${LIB_NAME}_shared
PRIVATE
-Wl,--exclude-libs,ALL
-Wl,-Bsymbolic
-Wl,-z,defs
-Wl,--gc-sections)

add_library(paimon_sanitizer_flags INTERFACE)

if(PAIMON_USE_ASAN)

@leaves12138 leaves12138 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for migrating these CMake utility modules. I compared the files with the existing source snapshot and they are effectively the same migrated content.

One small blocker before merge: cmake_modules/san-config.cmake still has a non-standard license header, while the other newly added CMake modules use the standard ASF header. Please update san-config.cmake to the same ASF header style used by the other files in this PR.

Non-blocking note: some helpers reference build files that are expected to arrive in later migration PRs, such as build_support/run-test.sh and top-level CMake variables. That looks fine for a staged migration.

@leaves12138 leaves12138 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update. The sanitizer config now uses the standard ASF header, and the migrated CMake utility modules match the source snapshot aside from the expected header normalization. LGTM.

@leaves12138
leaves12138 merged commit 7f56988 into apache:main May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants