This is an automated email from the ASF dual-hosted git repository.

jooger pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


The following commit(s) were added to refs/heads/main by this push:
     new c91c153499a IGNITE-28454 C++3.0: Reduce generated files names and 
paths (#7929)
c91c153499a is described below

commit c91c153499a709004709f7dfd0f0468a2f6e43c0
Author: Dmitriy Zabotlin <[email protected]>
AuthorDate: Mon Apr 6 12:31:09 2026 +0300

    IGNITE-28454 C++3.0: Reduce generated files names and paths (#7929)
    
    Co-authored-by: dzabotlin <[email protected]>
---
 modules/platforms/cpp/CMakeLists.txt               |  6 ++++
 .../cpp/cmake/ignite_collect_public_headers.cmake  | 39 ++++++++++++++++++++++
 .../cpp/cmake/ignite_compile_headers.cmake         | 34 +++++++++++++------
 modules/platforms/cpp/ignite/client/CMakeLists.txt |  3 +-
 modules/platforms/cpp/ignite/common/CMakeLists.txt |  4 ++-
 modules/platforms/cpp/ignite/common/detail/bytes.h |  2 +-
 .../platforms/cpp/ignite/network/CMakeLists.txt    |  2 ++
 modules/platforms/cpp/ignite/odbc/CMakeLists.txt   |  2 ++
 .../platforms/cpp/ignite/protocol/CMakeLists.txt   |  2 ++
 modules/platforms/cpp/ignite/tuple/CMakeLists.txt  |  2 ++
 .../compile_public_headers/CMakeLists.txt          | 20 +++++++----
 11 files changed, 94 insertions(+), 22 deletions(-)

diff --git a/modules/platforms/cpp/CMakeLists.txt 
b/modules/platforms/cpp/CMakeLists.txt
index 3b5d1b75e1d..43bb8437890 100644
--- a/modules/platforms/cpp/CMakeLists.txt
+++ b/modules/platforms/cpp/CMakeLists.txt
@@ -159,6 +159,7 @@ include(CPack)
 message(STATUS "IGNITE_INCLUDEDIR=${IGNITE_INCLUDEDIR}")
 include(ignite_install_headers)
 include(ignite_check_headers)
+include(ignite_collect_public_headers)
 
 # Turn on DLL export directives.
 add_definitions(-DIGNITE_IMPL)
@@ -203,6 +204,11 @@ endif()
 
 include(ignite_test)
 
+# Accumulated list of all installed public headers (relative to the include
+# root, e.g. "ignite/common/big_integer.h"). Each module appends its own
+# headers below; ignite_compile_headers.cmake reads this list.
+set(IGNITE3_ALL_PUBLIC_HEADERS "")
+
 # Add common libraries along with their unit tests if any.
 add_subdirectory(ignite/common)
 add_subdirectory(ignite/tuple)
diff --git a/modules/platforms/cpp/cmake/ignite_collect_public_headers.cmake 
b/modules/platforms/cpp/cmake/ignite_collect_public_headers.cmake
new file mode 100644
index 00000000000..0add38021d6
--- /dev/null
+++ b/modules/platforms/cpp/cmake/ignite_collect_public_headers.cmake
@@ -0,0 +1,39 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# ignite_collect_public_headers(<MODULE> <HEADERS_VAR>)
+#
+# Registers public headers for compile-time checking.
+#
+# Arguments:
+#   <MODULE>      The module name (e.g. "common", "tuple", "client").
+#   <HEADERS_VAR> Name of a variable containing the list of headers as paths
+#                 relative to the module source directory
+#                 (e.g. "big_integer.h", "compute/compute.h").
+#
+# Appends "ignite/<MODULE>/<header>" to the IGNITE3_ALL_PUBLIC_HEADERS list
+# and propagates the updated list to the parent scope.
+#
+# Implemented as a macro (not a function) so that PARENT_SCOPE resolves to
+# the scope above the calling subdirectory — i.e. the top-level CMakeLists.txt
+# — rather than only one level above the call site.
+macro(ignite_collect_public_headers MODULE HEADERS_VAR)
+    foreach(H IN LISTS ${HEADERS_VAR})
+        list(APPEND IGNITE3_ALL_PUBLIC_HEADERS "ignite/${MODULE}/${H}")
+    endforeach()
+    set(IGNITE3_ALL_PUBLIC_HEADERS "${IGNITE3_ALL_PUBLIC_HEADERS}" 
PARENT_SCOPE)
+endmacro()
diff --git a/modules/platforms/cpp/cmake/ignite_compile_headers.cmake 
b/modules/platforms/cpp/cmake/ignite_compile_headers.cmake
index a2f1b8dd8b0..3fbb100a36e 100644
--- a/modules/platforms/cpp/cmake/ignite_compile_headers.cmake
+++ b/modules/platforms/cpp/cmake/ignite_compile_headers.cmake
@@ -15,10 +15,11 @@
 # limitations under the License.
 #
 
-# Compile-time check for public headers (always enabled when ENABLE_CLIENT=ON).
+# Compile-time check for all public headers (always enabled when 
ENABLE_CLIENT=ON).
 #
-# For every public header of ignite3-client, compiles a minimal .cpp that
-# includes ONLY that header against the INSTALLED package.  This catches:
+# For every public header registered via ignite_collect_public_headers(), 
compiles
+# a minimal .cpp that includes ONLY that header against the INSTALLED package.
+# This catches:
 #   1. Headers missing their own #include dependencies.
 #   2. Public headers that #include internal (non-installed) headers.
 #   3. Headers missing from the installed package.
@@ -33,19 +34,21 @@
 #   compile-public-headers
 
 if (NOT ENABLE_CLIENT)
+    # The sub-project links against the installed ignite::client target, so
+    # the check requires the client to be built even for common/tuple headers.
     message(STATUS "compile-public-headers: ENABLE_CLIENT=OFF, skipping.")
-elseif (NOT IGNITE3_CLIENT_PUBLIC_HEADERS)
-    message(WARNING "compile-public-headers: IGNITE3_CLIENT_PUBLIC_HEADERS is 
empty. "
-                    "Check ignite/client/CMakeLists.txt.")
+elseif (NOT IGNITE3_ALL_PUBLIC_HEADERS)
+    message(WARNING "compile-public-headers: IGNITE3_ALL_PUBLIC_HEADERS is 
empty. "
+                    "Check ignite_collect_public_headers() calls in module 
CMakeLists.txt files.")
 else()
-    set(CPH_DIR "${CMAKE_BINARY_DIR}/compile-public-headers")
+    set(CPH_DIR "${CMAKE_BINARY_DIR}/cph")
 
     # Write the list of public headers to a cmake file that the
     # sub-project will include. This avoids command-line quoting
     # issues when passing a list with semicolons.
     set(CPH_LIST_FILE "${CPH_DIR}/headers_list.cmake")
     set(CPH_LIST_CONTENT "set(IGNITE_PUBLIC_HEADERS\n")
-    foreach(H IN LISTS IGNITE3_CLIENT_PUBLIC_HEADERS)
+    foreach(H IN LISTS IGNITE3_ALL_PUBLIC_HEADERS)
         string(APPEND CPH_LIST_CONTENT "    \"${H}\"\n")
     endforeach()
     string(APPEND CPH_LIST_CONTENT ")\n")
@@ -65,8 +68,17 @@ else()
         list(APPEND CPH_GENERATOR_ARGS -A "${CMAKE_GENERATOR_PLATFORM}")
     endif()
 
-    # Use add_custom_command so the check is skipped when ignite3-client has
-    # not been rebuilt since the last successful run (stamp file is 
up-to-date).
+    # Build the list of absolute source paths for all public headers so that
+    # the stamp is invalidated whenever any header file is edited, not only
+    # when the ignite3-client target is rebuilt (which may not recompile a
+    # header-only change in common/tuple that is not included by any TU).
+    set(CPH_HEADER_SOURCES)
+    foreach(H IN LISTS IGNITE3_ALL_PUBLIC_HEADERS)
+        list(APPEND CPH_HEADER_SOURCES "${CMAKE_SOURCE_DIR}/${H}")
+    endforeach()
+
+    # Use add_custom_command so the check is skipped when neither
+    # ignite3-client nor any public header has changed since the last run.
     add_custom_command(
         OUTPUT  "${CPH_STAMP}"
         # Install the already-built client to a temp prefix.
@@ -88,7 +100,7 @@ else()
                     "-B${CPH_SUB_BIN}"
         COMMAND ${CMAKE_COMMAND} --build "${CPH_SUB_BIN}"
         COMMAND ${CMAKE_COMMAND} -E touch "${CPH_STAMP}"
-        DEPENDS ignite3-client
+        DEPENDS ignite3-client ${CPH_HEADER_SOURCES}
         COMMENT "compile-public-headers: compiling each public header against 
installed package"
         VERBATIM
     )
diff --git a/modules/platforms/cpp/ignite/client/CMakeLists.txt 
b/modules/platforms/cpp/ignite/client/CMakeLists.txt
index e7e9f132af1..e3fb884728e 100644
--- a/modules/platforms/cpp/ignite/client/CMakeLists.txt
+++ b/modules/platforms/cpp/ignite/client/CMakeLists.txt
@@ -115,8 +115,7 @@ set(PRIVATE_HEADERS
 
 ignite_check_headers(SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} PUBLIC 
${PUBLIC_HEADERS} PRIVATE ${PRIVATE_HEADERS})
 
-# Expose the public header list to the parent scope for cmake/abi_check.cmake.
-set(IGNITE3_CLIENT_PUBLIC_HEADERS "${PUBLIC_HEADERS}" PARENT_SCOPE)
+ignite_collect_public_headers(client PUBLIC_HEADERS)
 
 add_library(${TARGET}-obj OBJECT ${SOURCES})
 target_include_directories(${TARGET}-obj PUBLIC ${IGNITE_CMAKE_TOP_DIR})
diff --git a/modules/platforms/cpp/ignite/common/CMakeLists.txt 
b/modules/platforms/cpp/ignite/common/CMakeLists.txt
index a0a01cf1586..7d898348c9b 100644
--- a/modules/platforms/cpp/ignite/common/CMakeLists.txt
+++ b/modules/platforms/cpp/ignite/common/CMakeLists.txt
@@ -55,6 +55,8 @@ set(PRIVATE_HEADERS
 
 ignite_check_headers(SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} PUBLIC 
${PUBLIC_HEADERS} PRIVATE ${PRIVATE_HEADERS})
 
+ignite_collect_public_headers(common PUBLIC_HEADERS)
+
 set(SOURCES
     big_decimal.cpp
     big_integer.cpp
@@ -65,7 +67,7 @@ set(SOURCES
     uuid.cpp
     detail/hash_calculator.cpp
     detail/hash_utils.cpp
-        detail/murmur3_hash.cpp
+    detail/murmur3_hash.cpp
 )
 
 add_library(${TARGET} STATIC ${SOURCES})
diff --git a/modules/platforms/cpp/ignite/common/detail/bytes.h 
b/modules/platforms/cpp/ignite/common/detail/bytes.h
index d35ef776ad9..58d504295a1 100644
--- a/modules/platforms/cpp/ignite/common/detail/bytes.h
+++ b/modules/platforms/cpp/ignite/common/detail/bytes.h
@@ -17,7 +17,7 @@
 
 #pragma once
 
-#include "detail/config.h"
+#include "config.h"
 
 #include <cstddef>
 #include <cstdint>
diff --git a/modules/platforms/cpp/ignite/network/CMakeLists.txt 
b/modules/platforms/cpp/ignite/network/CMakeLists.txt
index 2a13751a540..656f69534bf 100644
--- a/modules/platforms/cpp/ignite/network/CMakeLists.txt
+++ b/modules/platforms/cpp/ignite/network/CMakeLists.txt
@@ -60,6 +60,8 @@ set(PRIVATE_HEADERS
 
 ignite_check_headers(SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} PUBLIC 
${PUBLIC_HEADERS} PRIVATE ${PRIVATE_HEADERS})
 
+ignite_collect_public_headers(network PUBLIC_HEADERS)
+
 find_package(OpenSSL)
 if (EXISTS ${OPENSSL_INCLUDE_DIR})
     message(STATUS "OPENSSL_INCLUDE_DIR: " ${OPENSSL_INCLUDE_DIR})
diff --git a/modules/platforms/cpp/ignite/odbc/CMakeLists.txt 
b/modules/platforms/cpp/ignite/odbc/CMakeLists.txt
index 2676cfcab13..1f16abe423f 100644
--- a/modules/platforms/cpp/ignite/odbc/CMakeLists.txt
+++ b/modules/platforms/cpp/ignite/odbc/CMakeLists.txt
@@ -58,6 +58,8 @@ set(PRIVATE_HEADERS
 
 ignite_check_headers(SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} PUBLIC 
${PUBLIC_HEADERS} PRIVATE ${PRIVATE_HEADERS})
 
+ignite_collect_public_headers(odbc PUBLIC_HEADERS)
+
 include(find_odbc)
 find_package(ODBC REQUIRED)
 
diff --git a/modules/platforms/cpp/ignite/protocol/CMakeLists.txt 
b/modules/platforms/cpp/ignite/protocol/CMakeLists.txt
index e69033eb06e..9867672bd1d 100644
--- a/modules/platforms/cpp/ignite/protocol/CMakeLists.txt
+++ b/modules/platforms/cpp/ignite/protocol/CMakeLists.txt
@@ -37,6 +37,8 @@ set(PRIVATE_HEADERS
 
 ignite_check_headers(SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} PUBLIC 
${PUBLIC_HEADERS} PRIVATE ${PRIVATE_HEADERS})
 
+ignite_collect_public_headers(protocol PUBLIC_HEADERS)
+
 set(SOURCES
     sql/column_meta.cpp sql/column_meta.h
     bitset_span.h
diff --git a/modules/platforms/cpp/ignite/tuple/CMakeLists.txt 
b/modules/platforms/cpp/ignite/tuple/CMakeLists.txt
index db6548ed500..f55d0e736d4 100644
--- a/modules/platforms/cpp/ignite/tuple/CMakeLists.txt
+++ b/modules/platforms/cpp/ignite/tuple/CMakeLists.txt
@@ -32,6 +32,8 @@ set(PRIVATE_HEADERS)
 
 ignite_check_headers(SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} PUBLIC 
${PUBLIC_HEADERS} PRIVATE ${PRIVATE_HEADERS})
 
+ignite_collect_public_headers(tuple PUBLIC_HEADERS)
+
 add_library(${TARGET} STATIC ${SOURCES})
 
 target_link_libraries(${TARGET} ignite-common)
diff --git 
a/modules/platforms/cpp/tests/package-test/compile_public_headers/CMakeLists.txt
 
b/modules/platforms/cpp/tests/package-test/compile_public_headers/CMakeLists.txt
index e17ab41624a..297065335f1 100644
--- 
a/modules/platforms/cpp/tests/package-test/compile_public_headers/CMakeLists.txt
+++ 
b/modules/platforms/cpp/tests/package-test/compile_public_headers/CMakeLists.txt
@@ -48,14 +48,20 @@ find_package(ignite REQUIRED COMPONENTS client)
 # Load the list of public headers (variable: IGNITE_PUBLIC_HEADERS).
 include("${IGNITE_HEADERS_LIST_FILE}")
 
+set(CPH_INDEX 0)
 foreach(H IN LISTS IGNITE_PUBLIC_HEADERS)
-    # Derive a CMake-identifier-safe target name from the header path.
-    string(MAKE_C_IDENTIFIER "${H}" CPH_SAFE_NAME)
-
-    set(CPH_CPP "${CMAKE_CURRENT_BINARY_DIR}/${CPH_SAFE_NAME}.cpp")
-    file(WRITE "${CPH_CPP}" "#include <ignite/client/${H}>\n")
+    # Use a sequence number as the target/file name to keep paths short.
+    # A full MAKE_C_IDENTIFIER name can exceed 260-char Windows path limits
+    # when combined with MSBuild's .tlog directory structure (VS 2017 does not
+    # honour the LongPathsEnabled registry key).
+    set(CPH_CPP "${CMAKE_CURRENT_BINARY_DIR}/cph_${CPH_INDEX}.cpp")
+    # The comment makes the generated file identifiable when inspecting build
+    # artefacts or compiler error messages.
+    file(WRITE "${CPH_CPP}" "// Header under test: ${H}\n#include <${H}>\n")
 
     # Compile the generated file as an object (no link step needed).
-    add_library(cph_${CPH_SAFE_NAME} OBJECT "${CPH_CPP}")
-    target_link_libraries(cph_${CPH_SAFE_NAME} PRIVATE ignite::client)
+    add_library(cph_${CPH_INDEX} OBJECT "${CPH_CPP}")
+    target_link_libraries(cph_${CPH_INDEX} PRIVATE ignite::client)
+
+    math(EXPR CPH_INDEX "${CPH_INDEX} + 1")
 endforeach()

Reply via email to