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

Fix #438, add three PDI deactivation option through CMake #543

Open
wants to merge 44 commits into
base: main
Choose a base branch
from

Conversation

JAuriac
Copy link
Contributor

@JAuriac JAuriac commented Feb 20, 2025

Missing the case where paraconf is missing.

List of things to check before making a PR

Before merging your code, please check the following:

  • you have added a line describing your changes to the Changelog;
  • you have added unit tests for any new or improved feature;
  • In case you updated dependencies, you have checked pdi/docs/CheckList.md
  • you have checked your code format:
    • you have checked that you respect all conventions specified in CONTRIBUTING.md;
    • you have checked that the indentation and formatting conforms to the .clang-format;
    • you have documented with doxygen any new or changed function / class;
  • you have correctly updated the copyright headers:
    • your institution is in the copyright header of every file you (substantially) modified;
    • you have checked that the end-year of the copyright there is the current one;
  • you have updated the AUTHORS file:
    • you have added yourself to the AUTHORS file;
    • if this is a new contribution, you have added it to the AUTHORS file;
  • you have added everything to the user documentation:
    • any new CMake configuration option;
    • any change in the yaml config;
    • any change to the public or plugin API;
    • any other new or changed user-facing feature;
    • any change to the dependencies;
  • you have correctly linked your MR to one or more issues:
    • your MR solves an identified issue;
    • your commit contain the Fix #issue keyword to autoclose the issue when merged.

@JAuriac JAuriac linked an issue Feb 20, 2025 that may be closed by this pull request
@jbigot
Copy link
Member

jbigot commented Feb 24, 2025

Warning you're updating the tutorial. This is unrelated

Use a `CMakeLists.txt` similar to `no-pdi_exampleTargetCMakeLists_findpackage.txt` for your target,
then use the following:
```bash
cmake . -DCMAKE_MODULE_PATH="/<full>/<path>/<to>/pdi/no-pdi/cmake"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
cmake . -DCMAKE_MODULE_PATH="/<full>/<path>/<to>/pdi/no-pdi/cmake"
cmake . -PDI_ROOT="/<full>/<path>/<to>/pdi/no-pdi/cmake"

When switching from FindPDI to PDIConfig

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This method implies modifying the user target CMakeLists, using :
include(${PDI_ROOT}/PDIConfig.cmake)
instead of :
find_package(PDI 1.0.0 REQUIRED COMPONENTS C)

cmake . -DCMAKE_MODULE_PATH="/<full>/<path>/<to>/pdi/no-pdi/cmake"
```

Alternatively, you can use the `include`/`target_include_directories` method,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Alternatively, you can use the `include`/`target_include_directories` method,
Alternatively, you can use the `add_subdirectory` method,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The example file does not have the text add_subdirectory but include.


Alternatively, you can use the `include`/`target_include_directories` method,
which does not require to pass an additional argument at compilation
but requires to add ad option to the target `CMakeLists.txt`,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
but requires to add ad option to the target `CMakeLists.txt`,
but requires to slightly modify your `CMakeLists.txt`,

Copy link
Contributor Author

@JAuriac JAuriac Mar 4, 2025

Choose a reason for hiding this comment

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

Less precise. Needs to indicate the part of file which is concerned by the change. Edited for typo.

*/
static inline const char* PDI_errmsg(void)
{
return 0;
Copy link
Member

Choose a reason for hiding this comment

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

If the result of the function is passed to printf, a null pointer will make it crash

Comment on lines 41 to 44
set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

# Find the PDI package
find_package(PDI REQUIRED)
Copy link
Member

Choose a reason for hiding this comment

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

or just include() it, it will be simpler

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is possible to change toward include(cmake/PDIConfig.cmake) in this case, but to a target application's CMakeLists, an additional argument will be needed such as include(${PDI_ROOT}/PDIConfig.cmake), where previously find_package was used.

Copy link
Member

@benoitmartin88 benoitmartin88 left a comment

Choose a reason for hiding this comment

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

A lot of files have moved. I don't think we need to separate the pdi/no-pdi tests.
Also, there seems to be a lot of commented out code which should be removed.

Comment on lines +62 to +64
/** \addtogroup error
* \{
*/
Copy link
Member

Choose a reason for hiding this comment

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

What is this ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The Doxygen group, the same as pdi/include/pdi.h

Comment on lines +114 to +122
static const PDI_errhandler_t PDI_NULL_HANDLER = {NULL, NULL};

/** Prints the error message and aborts if the status is invalid
*/
static const PDI_errhandler_t PDI_ASSERT_HANDLER = PDI_NULL_HANDLER;

/** Prints the error message and continue if the status is invalid
*/
static const PDI_errhandler_t PDI_WARN_HANDLER = PDI_NULL_HANDLER;
Copy link
Member

Choose a reason for hiding this comment

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

These are the default handlers right ? If this is the case, I don't think the values should be NULL as it cause a segfault. Is this tested ?

Copy link
Member

Choose a reason for hiding this comment

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

remove this file

Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need to separate the pdi and no-pdi tests. This can be done inside the cmakelists.txt.

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.

Provide a mechanism to deactivate PDI on demand
3 participants