Skip to content

1a1a11a/cleanup CMakeList#203

Merged
1a1a11a merged 17 commits intodevelopfrom
1a1a11a/cleanup_cmake
Jun 21, 2025
Merged

1a1a11a/cleanup CMakeList#203
1a1a11a merged 17 commits intodevelopfrom
1a1a11a/cleanup_cmake

Conversation

@1a1a11a
Copy link
Copy Markdown
Owner

@1a1a11a 1a1a11a commented Jun 19, 2025

No description provided.

@1a1a11a 1a1a11a requested review from Copilot and haochengxia June 19, 2025 20:48

This comment was marked as outdated.

@1a1a11a 1a1a11a marked this pull request as draft June 19, 2025 20:51
cursor[bot]

This comment was marked as outdated.

Comment thread scripts/install_dependency.sh Outdated
popd > /dev/null
}

install_dev() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we want to remove dev dep like clang-tidy from setup_ubuntu and only preserve it in install_dev? Now both of them have it.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

will update

@1a1a11a
Copy link
Copy Markdown
Owner Author

1a1a11a commented Jun 19, 2025

This one depends on #201.

@1a1a11a 1a1a11a force-pushed the 1a1a11a/cleanup_cmake branch from c54e4ff to f40c56f Compare June 20, 2025 00:41
@1a1a11a 1a1a11a self-assigned this Jun 20, 2025
@sonarqubecloud
Copy link
Copy Markdown

@1a1a11a 1a1a11a marked this pull request as ready for review June 20, 2025 02:32
@1a1a11a 1a1a11a changed the title 1a1a11a/cleanup cmake 1a1a11a/cleanup cMakeList Jun 20, 2025
cursor[bot]

This comment was marked as outdated.

@1a1a11a 1a1a11a requested a review from Copilot June 20, 2025 02:35

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@1a1a11a 1a1a11a force-pushed the 1a1a11a/cleanup_cmake branch from 12639df to 91899c8 Compare June 20, 2025 03:12
@1a1a11a 1a1a11a requested a review from Copilot June 20, 2025 03:13

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@1a1a11a 1a1a11a force-pushed the 1a1a11a/cleanup_cmake branch from 91899c8 to 67e8b48 Compare June 20, 2025 03:28
@haochengxia haochengxia changed the title 1a1a11a/cleanup cMakeList 1a1a11a/cleanup CMakeList Jun 20, 2025
@haochengxia
Copy link
Copy Markdown
Collaborator

haochengxia commented Jun 20, 2025

Some thoughts:

  1. Is it necessary to reduce the usage of global set?
    e.g.,

    set(LIBS ${LIBS} ${GLib_LIBRARY})
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra ...")
    
    ->
    
    target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Werror ...)
    target_link_libraries(${PROJECT_NAME} PRIVATE ${GLib_LIBRARIES})
    
  2. Should we use set(... PARENT_SCOPE) in subdir's CMakeLists.txt to expose the file to compile in subdir instead of organize the code via manually gathering all source code in the main CMakeLists.txt?
    e.g.,

    # libCacheSim/dataStructure/CMakeLists.txt
    
    set(DATASTRUCTURE_SOURCES
        pqueue.c
        splay.c
        bloom.c
        minimalIncrementCBF.c
        histogram.c
        splay_tuple.c
       ...
        PARENT_SCOPE
    )
    
    # CMakeLists.txt
    add_library(${PROJECT_NAME} 
        ${DATASTRUCTURE_SOURCES}
    ...)
    
    
  3. Do we want to export libCacheSimConfig.cmake?

@1a1a11a
Copy link
Copy Markdown
Owner Author

1a1a11a commented Jun 21, 2025

Some thoughts:

  1. Is it necessary to reduce the usage of global set?
    e.g.,
    set(LIBS ${LIBS} ${GLib_LIBRARY})
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra ...")
    
    ->
    
    target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Werror ...)
    target_link_libraries(${PROJECT_NAME} PRIVATE ${GLib_LIBRARIES})
    
  2. Should we use set(... PARENT_SCOPE) in subdir's CMakeLists.txt to expose the file to compile in subdir instead of organize the code via manually gathering all source code in the main CMakeLists.txt?
    e.g.,
    # libCacheSim/dataStructure/CMakeLists.txt
    
    set(DATASTRUCTURE_SOURCES
        pqueue.c
        splay.c
        bloom.c
        minimalIncrementCBF.c
        histogram.c
        splay_tuple.c
       ...
        PARENT_SCOPE
    )
    
    # CMakeLists.txt
    add_library(${PROJECT_NAME} 
        ${DATASTRUCTURE_SOURCES}
    ...)
    
  3. Do we want to export libCacheSimConfig.cmake?

1 . good point, updated. I used a global variable to allow use change, but I set the property on each lib, so we can change independently.
2. I agree, updated and also cleaned up more, which causes the changes in this PR to be huge
3. added libCacheSimTargets.cmake to cmake

because I added a global include, so I will also update the various header include not to use relative path.
But I will do it in the next PR to avoid making too many changes in this PR...

cursor[bot]

This comment was marked as outdated.

@1a1a11a
Copy link
Copy Markdown
Owner Author

1a1a11a commented Jun 21, 2025

I temporarily removed mrcProfiler from the test because the plugin system needs more work and will be addressed separately.

@1a1a11a
Copy link
Copy Markdown
Owner Author

1a1a11a commented Jun 21, 2025

@haochengxia ready to review

@1a1a11a 1a1a11a requested review from Copilot and haochengxia June 21, 2025 00:21
@1a1a11a 1a1a11a force-pushed the 1a1a11a/cleanup_cmake branch 2 times, most recently from 47895fa to afb7b49 Compare June 21, 2025 00:56
Copy link
Copy Markdown
Collaborator

@haochengxia haochengxia left a comment

Choose a reason for hiding this comment

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

LGTM!

P.S.: I noticed that in some places, such as admission, we used include_directories to include header files, so we no longer need relative paths. Should we apply this to the project scope? If yes, I'd like to create one PR using target_include_directories/include_directories.

cursor[bot]

This comment was marked as outdated.

@1a1a11a 1a1a11a force-pushed the 1a1a11a/cleanup_cmake branch from 2603247 to 0b14d66 Compare June 21, 2025 15:23
@1a1a11a
Copy link
Copy Markdown
Owner Author

1a1a11a commented Jun 21, 2025

I think with the current structure, we include the libCacheSim header path include/libCacheSim for every target, and we add target_include_directory for others if needed.
The CMakeLists in admission is not needed any more (and just removed in the new commit), it is merged into a higher-level CMakeLists, which reduces the number of lib and avoids circular dependency.

@1a1a11a 1a1a11a requested a review from Copilot June 21, 2025 15:24
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 cleans up and refactors multiple CMakeLists and associated build scripts while updating target names, include paths, and dependency handling across the project.

  • Refactored test executable creation and linking in CMakeLists.txt for better maintainability.
  • Removed outdated files (e.g. .travis.yml and lint.sh) and improved consistency in shell scripts and library targets.
  • Updated source file include paths and target properties for various modules (e.g. traceReader, profiler, eviction algorithms).

Reviewed Changes

Copilot reviewed 26 out of 64 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/CMakeLists.txt Refactored test executable function and updated target linkage.
scripts/lint.sh Removed; likely replaced by new linting mechanisms.
scripts/install_dev_dependency.sh New script for development dependency installation with logging improvements.
scripts/install_dependency.sh Improved syntax with modern bash practices and removed the verbose option.
libCacheSim/utils/CMakeLists.txt Updated target creation for the utils library with modern flags and include paths.
libCacheSim/traceReader/CMakeLists.txt Improved naming for source variables and updated linking for the traceReader library.
libCacheSim/traceAnalyzer/* Updated include paths and formatting consistency in traceAnalyzer sources.
libCacheSim/profiler/CMakeLists.txt Refactored profiler library target with updated compiler flags and linking.
libCacheSim/mrcProfiler/CMakeLists.txt Standardized C++ target properties and dependency linking.
libCacheSim/include/libCacheSim/evictionAlgo.h Formatted function declarations for consistency and readability.
libCacheSim/dataStructure/CMakeLists.txt Added new sources and improved target configuration for the data structure library.
libCacheSim/cache/prefetch/CMakeLists.txt Removed legacy prefetch target as part of cleanup.
libCacheSim/cache/eviction/priv/myMQv1.c Removed unfinished eviction algorithm implementation.
libCacheSim/cache/eviction/other/S3LRU.c Corrected include paths for consistency.
libCacheSim/cache/eviction/RandomLRU.c Added allocation and cleanup for eviction candidates and improved formatting.
libCacheSim/cache/eviction/CMakeLists.txt Removed unused eviction algorithm C source file list.
libCacheSim/cache/admission/* Updated include paths in admission algorithms and removed obsolete CMakeLists.
libCacheSim/cache/CMakeLists.txt Reorganized modular libraries and unified dependency management; added install rules.
CMakeLists.txt Consolidated compiler flags, dependency resolution, and installation targets; removed outdated options.
.travis.yml Removed CI configuration file; likely migrated to a different CI system.
Comments suppressed due to low confidence (1)

// qsort(obj_to_evict, N, sizeof(cache_obj_t *), compare);

// if (obj_to_evict1->Random.last_access_vtime < obj_to_evict2->Random.last_access_vtime)
// if (obj_to_evict1->Random.last_access_vtime <
Copy link

Copilot AI Jun 21, 2025

Choose a reason for hiding this comment

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

Consider removing obsolete commented-out code in the sorting comparator section to improve code clarity and maintainability.

Copilot uses AI. Check for mistakes.
cursor[bot]

This comment was marked as outdated.

@1a1a11a 1a1a11a force-pushed the 1a1a11a/cleanup_cmake branch from 98a17c5 to ccd9465 Compare June 21, 2025 15:32
@1a1a11a 1a1a11a merged commit 6aede7f into develop Jun 21, 2025
9 checks passed
@1a1a11a 1a1a11a mentioned this pull request Jun 22, 2025
@1a1a11a 1a1a11a deleted the 1a1a11a/cleanup_cmake branch June 22, 2025 14:49
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