Skip to content

Refactor CMake #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 84 commits into
base: main
Choose a base branch
from
Draft

Refactor CMake #90

wants to merge 84 commits into from

Conversation

victor1234
Copy link
Collaborator

@victor1234 victor1234 commented Jun 27, 2025

Why?

  • CMake doesn't properly use targets
  • Installation is broken, and example compilation fails
  • CI is missing some essential checks

What?

  • Modernize and refactor CMake scripts
  • Add missing checks to CI
  • Add vcpkg support

Details

  • CI
    • Improve CI setup
    • Add example builds
    • Add unit tests
  • CMake
    • Add comments
    • Refactor use of CMake targets
    • Remove legacy CMake code
    • Adjust concurrentqueue include path for dependency managers
    • Add support for finding cpp-httplib via pkg-config
    • Add vcpkg support
    • Add REDUCT_CPP_USE_FETCHCONTENT option
    • Remove REDUCT_CPP_USE_CONAN
    • Add FetchContent support to examples
    • Create reductcpp-config.cmake.in template with proper dependency finders
    • Remove ReductCppConfigVersion.cmake.in; let CMake generate it
    • Make InstallDependencies consistent across different dependency sources
    • Set C++20 standard via CMake target
  • Tests
    • fix license-related tests
  • README.md
    • fix dependencies list
    • update example usage
  • add actionlint to pre-commit hooks

This pull request introduces significant updates to the build system, dependency management, and CI workflows for the project. The changes include the addition of FetchContent for dependency management, new actions for Conan and vcpkg integration, updates to the CMake configuration, and enhancements to the CI pipeline. These changes aim to improve flexibility, streamline dependency handling, and modernize the build process.

Build System and Dependency Management Improvements:

  • Introduced REDUCT_CPP_USE_FETCHCONTENT to enable FetchContent for managing dependencies, replacing the previous Conan-based approach. This allows automatic downloading of dependencies like fmt, nlohmann_json, and httplib when FetchContent is enabled (CMakeLists.txt, cmake/InstallDependencies.cmake, [1] [2].
  • Added support for detecting vcpkg usage via CMAKE_TOOLCHAIN_FILE and integrating vcpkg dependencies (CMakeLists.txt, cmake/InstallDependencies.cmake, CMakeLists.txtL8-R71).
  • Removed outdated Conan-specific dependency management logic and replaced it with a more flexible system based on FetchContent and vcpkg (cmake/InstallDependencies.cmake, cmake/InstallDependencies.cmakeL67-R107).

New GitHub Actions for Build and Dependency Management:

  • Added new GitHub Actions for building packages with Conan (build-package-conan) and vcpkg (build-package-vcpkg) to support multiple dependency management approaches (.github/actions/build-package-conan/action.yml, .github/actions/build-package-vcpkg/action.yml, [1] [2].
  • Introduced an action for installing vcpkg and verifying its version (.github/actions/install-vcpkg/action.yml, .github/actions/install-vcpkg/action.ymlR1-R21).

CI Workflow Enhancements:

  • Updated the cpplint job in the CI workflow to correctly handle file paths with spaces using -print0 and xargs -0 (.github/workflows/ci.yml, .github/workflows/ci.ymlL18-R130).
  • Simplified the check-example job by focusing on Linux builds and removing redundant configurations (.github/workflows/ci.yml, .github/workflows/ci.ymlL18-R130).
  • Commented out unused unit test configurations in the CI workflow to streamline the pipeline (.github/workflows/ci.yml, .github/workflows/ci.ymlL18-R130).

CMake Configuration Updates:

  • Added support for detecting and using std::chrono or the date library based on the REDUCT_CPP_USE_STD_CHRONO flag (CMakeLists.txt, cmake/InstallDependencies.cmake, [1] [2].
  • Introduced a new reductcpp-config.cmake.in file to modernize the CMake configuration for downstream projects (cmake/reductcpp-config.cmake.in, cmake/reductcpp-config.cmake.inR1-R24).
  • Removed outdated CMake configuration files (cmake/ReductCppConfig.cmake.in, cmake/ReductCppConfigVersion.cmake.in, [1] [2].

Documentation Updates:

  • Updated the README to reflect changes in dependency management and provide guidance for using FetchContent and CMake integration (README.md, [1] [2].

These updates collectively enhance the project's build system, improve flexibility in dependency management, and modernize the CI pipeline for better maintainability and scalability.

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.

1 participant