Skip to content
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

Overhaul cmake #137

Merged
merged 85 commits into from
Nov 6, 2024
Merged

Overhaul cmake #137

merged 85 commits into from
Nov 6, 2024

Conversation

inakleinbottle
Copy link
Contributor

I've made a lot of updates to the CMake for the project. There are still some outstanding issues, but these are not to do with CMake. See #136.

This PR closes #131.

This commit introduces a find_boost function to facilitate locating and importing Boost libraries. It parses arguments for Boost version and components, iteratively finds and includes the specified Boost libraries, and provides status messages for better debugging.
Updated the CMakeLists.txt to require CMake version 3.28 instead of 3.22. This change ensures compatibility with newer CMake features and improvements.
Replaced deprecated find_package with modern find_boost function. Updated Boost version from 1.81 to 1.83 and added necessary components to the configuration.
Deleted unused CMake includes such as GNUInstallDirs, GenerateExportHeader, and GoogleTest. This cleanup helps reduce unnecessary dependencies and simplifies the build configuration.
This change introduces an alias for the Boost headers library, aiding in the management of Boost dependencies. It improves readability and maintainability in CMake configuration files.
Replace `find_package(Boost)` with custom `find_boost` function to ensure proper components are located, avoiding conflicts with system libraries and ensuring compatibility with vcpkg installed versions. This change improves reliability in linking Boost components.
Reorder and consolidate `find_package` commands to ensure proper configuration and eliminate redundancy. This includes moving package searches to appropriate sections and correcting the `SndFile` package config specification.
Refactor the BLAS detection and setup logic from the main CMakeLists.txt for better modularity. This change centralizes BLAS-related settings within 'cmake/find_correct_blas.cmake', simplifying the main build configuration and improving maintainability.
Moved installation directory definitions to a new `setup_install_dirs.cmake` file for better modularity and maintenance. Included `GoogleTest` for testing and `GenerateExportHeader` for export header generation. Updated `CMakeLists.txt` to reflect these changes.
Rearrange sections in CMakeLists.txt to set up toolchain and versioning before the project call. Enhance documentation with comments to clarify intent and improve maintainability. Re-enable certain features like compile command generation and module path settings after the project definition.
Introduce a custom FindGMP.cmake module to locate and configure GMP library dependencies. This change streamlines GMP integration by handling both pkg-config and direct library searches, ensuring compatibility across different platforms and setups. The CMakeLists.txt is updated to use this new module for improved maintainability.
Removed the obsolete ROUGHPY_BUILD_DefaultLA_CONTEXTS option and associated code. This change also includes a fix for a typo in the LIBALGEBRA_LITE_RATIONAL_COEFFS setting. These adjustments help to streamline the CMake configuration for the project.
Raised minimum CMake version to 3.28 and replaced add_roughpy_component with add_library. Introduced alias RoughPy::Core and updated include directories and link libraries for better modularization. These changes enhance compatibility and maintainability of the build system.
Set the minimum required CMake version to 3.28 and establish the project configuration for RoughPy_Core. Additionally, remove an unnecessary blank line and add a new one to improve code readability.
Introduce a new CMake script to handle component path variables. This script helps to manage include directories systematically for RoughPy components. Updated the core CMakeLists to utilize this new functionality.
Introduced a `_do_set_variable` macro to streamline setting component path variables. This change improves code readability and reduces redundancy, as messages and cache descriptions are now encapsulated within the macro.
Extract device-specific CMakeLists into separate directories for better organization and maintainability. Adjusted main platform CMakeLists to link subdirectories and updated target definitions accordingly.
Previously, the code incorrectly checked for the GMP_LIBRARY_RELEASE variable instead of GMP_LIBRARY_DEBUG when setting properties for the debug target. This fix ensures that the debug configuration is properly appended only if GMP_LIBRARY_DEBUG is defined.
Added a new variable to set the main source directory for each component. This ensures that the source paths are consistently defined and can be easily referenced throughout the CMake configuration.
Eliminated unused and obsolete functions related to LaCtx from `roughpy_helpers.cmake`. This cleanup simplifies the file by removing over 200 lines of legacy code, maintaining only the necessary core functionalities.
Deleted the unused header file available_libraries.h.in from the project. Updated the corresponding CMakeLists.txt to include the correct source directory for better organization.
This update ensures compatibility with newer CMake features and improvements. It is necessary for upcoming changes and dependencies in the project.
This change introduces `setup_roughpy_component` to replace `set_component_path_variables`. The new function handles component setup and improves readability and maintainability by parsing arguments and setting properties appropriately.
Previously, the version of a component was not handled. This change introduces a check and sets the component version to match RoughPy's version if it's not already specified. Additionally, the version is now displayed in the status message and stored in a variable.
Updated 'set_library_version_properties' function to conditionally set the version only if versioning is enabled. Applied these changes to the RoughPy_Platform target and added comments for improved clarity on precompiling headers.
Correct the syntax in get_target_property call by removing erroneous 'PROPERTIES' keyword, ensuring the proper ROUGHPY_COMPONENT property is retrieved. This prevents fatal errors when setting the library version.
Renamed ROUGHPY_ENABLE_DBG_ASSERT to ROUGHPY_NO_VCPKG and reordered options in CMakeLists.txt. Introduced new options for better control over Python library and Numpy linking. Ensured consistent grouping and logical ordering of related settings.
Deleted outdated images (1.png, 2.png, 3.png, 4.png, and 5.png) from the static folder. These files were no longer referenced in the current documentation and were causing unnecessary clutter.
This commit introduces a new CMake script to integrate ccache into the build process. The script sets up the ccache executable and its environment for various compilers, enhancing build efficiency. The usage is conditional based on the ROUGHPY_USE_CCACHE setting.
Eliminated the `ROUGHPY_BUILD_PYMODULE_INPLACE` option and the dependent option `ROUGHPY_PREFER_ACCELERATE` for MacOS. These options are no longer necessary and their removal helps to simplify and clean up the configuration file.
Refactored CMake configuration to include Python module and ensure it is correctly placed for testing. Introduced conditional Python test execution with `pytest`, handling dependencies and DLL placement for Windows and other OS differences. Removed redundant target properties retrieval.
This change adds the missing include for the algebra context header file. It ensures that all dependencies are correctly referenced, potentially preventing compilation issues.
Included the `scalar.h` header to ensure the necessary declarations are available. This resolves potential compilation issues due to missing dependencies.
Change the BOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED definition from private to public for RoughPy_Platform on Apple systems. This ensures that projects linking against RoughPy_Platform can make use of this definition.
Separated CMakeLists for algebra, args, intervals, scalars, and streams into individual files under 'src'. This improves project structure and maintainability by modularizing the build configurations and making them easier to manage. Also, keep the main CMakeLists cleaner and more focused on high-level project settings.
Introduced `target_compile_definitions` to `RoughPy_Algebra`, `RoughPy_Streams`, `RoughPy_Intervals`, `RoughPy_Scalars`, and `RoughPy_Platform` to define the respective `RPY_COMPILING_*` macros. This should be reviewed for necessity and potential removal as indicated by the TODO comments.
Consolidated the use of Ninja across all platforms and added specific setup steps for msbuild and Ninja on Windows. This ensures a consistent build configuration and enhances the maintainability of the workflow.
The target include directories for the devices module were modified to use PUBLIC instead of INTERFACE, ensuring that dependent targets inherit compile definitions and include directories. This change improves build consistency and resolves potential linkage issues.
The function `setup_roughpy_tests` was renamed to `setup_roughpy_cpp_tests` across multiple CMakeLists.txt files to better indicate its purpose. This change also includes some placeholder code for Windows-specific configurations within the function.
This change ensures that DLL dependencies are copied alongside the test executable on Windows. It mitigates the issue of Windows DLLs lacking a built-in mechanism for locating dependencies. This fix may not be optimal but provides a necessary workaround.
Set VCPKG_INSTALL_OPTIONS to "--no-print-usage" to prevent excessive information output when installing in manifest mode. This change helps in keeping the build output cleaner and more focused.
Changed the POST_BUILD custom command to use the specific test target name instead of the RoughPy_PyModule. This ensures the runtime DLLs are correctly copied alongside the respective test executable.
Configured CMake to use Google's GTest pre-test discovery mode. This change aims to streamline the test discovery process and ensure that all tests are identified before execution.
Suppress the output and error messages when checking for pytest version in the build process. This ensures a cleaner log output and prevents unnecessary clutter during the configuration phase.
Add new GMP library names to search list and comment out redundant target properties settings. This enhances compatibility with different GMP library versions and simplifies the configuration process.
Moved 'enable_testing()' from testing/CMakeLists.txt to main CMakeLists.txt. This change ensures that CTest is initialized when tests are configured to be built. The setup now aligns with standard CMake practices for enabling testing.
Deleted common.cmake and its references in various triplet files for x64, x86, ARM, and ARM64 architectures. Updated some triplet configurations to set VCPKG_library_LINKAGE to static. Added new triplet configuration for arm64-osx with specific architecture and system name settings.
Instead of copying runtime DLLs to the current list directory, the new code copies them to the test executable's directory. This ensures all necessary DLLs are in the same location as the executable, facilitating better organization and potentially reducing runtime errors due to missing dependencies.
Moved Python header inclusion and related defines into a new wrapper file, `python.h`. This change centralizes the configuration for Python header inclusion, which ensures consistent handling of Python-related definitions across the project and resolves potential issues on Windows regarding auto-linking with the "correct" library version.
Renamed the python.h file to roughpy_python.h across the project for better clarity and to avoid naming conflicts. Adjusted all relevant include directives to reference the new filename.
Add logic to CMakeLists.txt to prevent automatic linking to Python libraries on Windows, enabling correct linking for both debug and release versions. Also streamline the file by removing redundant code.
Deleted obsolete test definitions from streams/CMakeLists.txt. Modified condition check for pytest in roughpy/CMakeLists.txt to ensure it evaluates correctly.
Updated from_chars call to use id_sub.data() and id_sub.size() for better readability and consistency with modern C++ practices. This change also makes the code more concise and easier to maintain.
Commented out test_brownian_stream.cpp due to a bug in the refine_accuracy function. The issue needs to be fixed before re-enabling this test to ensure reliability and correctness in test cases.
Ensure that the item_label iteration bounds are correctly set and handle the end of the ref_label comparison accurately. This fix prevents potential out-of-bounds errors in the label comparison logic.
Previously, if variant_begin equaled label.end(), it could cause issues in the subsequent operations. Adding a check and returning early ensures proper handling of this edge case, preventing potential errors.
Commented out the section for running Python tests with pytest as it was causing issues. Will revisit this implementation later to fix and re-enable the feature.
@inakleinbottle inakleinbottle merged commit 7a2c397 into main Nov 6, 2024
6 checks passed
@inakleinbottle inakleinbottle deleted the overhaul-cmake branch November 6, 2024 18:03
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.

Simplify CMake
1 participant