Skip to content

fix examples#229

Merged
1a1a11a merged 4 commits intodevelopfrom
1a1a11a/example_build
Jun 25, 2025
Merged

fix examples#229
1a1a11a merged 4 commits intodevelopfrom
1a1a11a/example_build

Conversation

@1a1a11a
Copy link
Copy Markdown
Owner

@1a1a11a 1a1a11a commented Jun 25, 2025

No description provided.

@1a1a11a 1a1a11a requested a review from haochengxia as a code owner June 25, 2025 02:56
@1a1a11a 1a1a11a requested a review from Copilot June 25, 2025 02:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR modernizes CMake setup across cores and examples by switching to OBJECT libraries, centralizing compile/link flags, and updating consumer CMake scripts. It also refactors the request API to use a nested kv field and tidies up example code formatting and casts.

  • Switched all modular add_library(...) to OBJECT libraries and unified them into static/shared targets in the top-level CMakeLists.
  • Introduced kv sub-struct in request_t and updated all reads to use req->kv.key_size/val_size.
  • Updated example code (printf format specifiers, binary_fmt_str casts, usage messages) and improved example CMakeLists to use pkg-config and proper find_package calls.

Reviewed Changes

Copilot reviewed 23 out of 31 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/CMakeLists.txt Link tests to unified ${PROJECT_NAME} and add includes
libCacheSim/utils/CMakeLists.txt Switch utils_lib to OBJECT library
libCacheSim/traceReader/customizedReader/twrNSBin.h Update req->val_size/key_size to nested kv
libCacheSim/traceReader/customizedReader/twrBin.h Same kv refactor
libCacheSim/traceReader/customizedReader/oracle/*.h Refactored kv accesses and fixed recursive return
libCacheSim/traceReader/CMakeLists.txt Switch traceReader_lib to OBJECT library
libCacheSim/traceAnalyzer/reuse.h Remove vtime_granularity_ field
libCacheSim/traceAnalyzer/CMakeLists.txt Switch to OBJECT library, add include dirs
libCacheSim/profiler/CMakeLists.txt Switch profiler_lib to OBJECT library
libCacheSim/mrcProfiler/CMakeLists.txt Switch mrcProfiler_lib to OBJECT library
libCacheSim/include/libCacheSim/request.h Introduce nested kv struct for key/val sizes
libCacheSim/dataStructure/CMakeLists.txt Switch dataStructure_lib to OBJECT library
libCacheSim/cache/CMakeLists.txt Switch cache_lib_c/cache_lib_cpp to OBJECT libs
example/cacheSimulatorConcurrent/main.cpp Updated %lu to %lld casts
example/cacheSimulatorConcurrent/CMakeLists.txt Modernized find_package, pkg-config usage
example/cacheSimulator/CMakeLists.txt Modernized find_package, pkg-config usage
example/cacheHierarchy/simulator.cpp Cast format string to (char*)
example/cacheHierarchy/main.cpp Tidy up usage message (./ removed)
example/cacheHierarchy/CMakeLists.txt Modernized find_package, pkg-config usage
example/cacheCluster/include/consistentHash.h Make weight parameter const double *
example/cacheCluster/CMakeLists.txt Modernized find_package, pkg-config usage
CMakeLists.txt (root) Enable PIC, centralize dependencies into lists
Comments suppressed due to low confidence (4)

example/cacheCluster/include/consistentHash.h:40

  • Since the signature now takes const double *weight, ensure the implementation in consistentHash.c is updated to match this const qualifier.
ring_t *ch_ring_create_ring(int n_server, const double *weight);

test/CMakeLists.txt:26

  • Before using GLib_INCLUDE_DIRS, ensure you've called find_package(GLib REQUIRED) or imported the pkg-config module, since global includes were removed from the top-level CMake.
    # Add include directories for test compilation

test/CMakeLists.txt:28

  • [nitpick] Using ${CMAKE_SOURCE_DIR} may break if this CMakeLists is included from elsewhere; consider using ${CMAKE_CURRENT_SOURCE_DIR}/../.. or the libCacheSim_include_dir variable defined at the top-level.
        ${CMAKE_SOURCE_DIR}/libCacheSim  # Add source dir to find utils/include/mymath.h

libCacheSim/traceAnalyzer/reuse.h:18

  • The vtime_granularity_param and vtime_granularity_ field were removed, but verify that no other methods reference vtime_granularity_; missing this may cause compilation errors or unintended behavior.
  explicit ReuseDistribution(std::string output_path,

Comment thread example/cacheHierarchy/CMakeLists.txt Outdated
Comment thread example/cacheHierarchy/simulator.cpp Outdated
@haochengxia
Copy link
Copy Markdown
Collaborator

LGTM!

1a1a11a added 3 commits June 24, 2025 23:31
…rity

- Set CMAKE_POSITION_INDEPENDENT_CODE to ON for better compatibility.
- Transitioned from global include directories to target-specific includes for better encapsulation.
- Changed library definitions from INTERFACE to OBJECT for modular libraries to avoid transitive dependencies.
- Updated target linking to use the unified PROJECT_NAME for consistency across executables.
- Enhanced installation targets for unified libraries and improved include directory management.
- Cleaned up unnecessary global includes and streamlined dependency management across various components.
@1a1a11a 1a1a11a force-pushed the 1a1a11a/example_build branch from 2ae89af to 8399b3c Compare June 25, 2025 03:31
@1a1a11a 1a1a11a force-pushed the 1a1a11a/example_build branch from 8399b3c to 11710d1 Compare June 25, 2025 03:33
@1a1a11a 1a1a11a merged commit 4950404 into develop Jun 25, 2025
9 checks passed
@1a1a11a 1a1a11a deleted the 1a1a11a/example_build branch June 25, 2025 03:36
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