Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow config #defines to be written out to custom config/defines.hpp …
…files The existing cmake macro can be used to generate #defines for the global hpx/config/defines.hpp file by using hpx_add_config_define(HPX_HAVE_LOGGING) hpx_add_config_define(HPX_HAVE_MAX_CPU_COUNT ${HPX_WITH_MAX_CPU_COUNT}) ... and then written to hpx/config/defines.hpp using a new macro and specifying the default namespace write_config_defines_file( TEMPLATE "${PROJECT_SOURCE_DIR}/cmake/templates/config_defines.hpp.in" NAMESPACE default FILENAME "${CMAKE_BINARY_DIR}/hpx/config/defines.hpp") This keeps the existing behaviour unchanged. However a new NAMESPACE feature is supported to allow the user to add hpx_add_config_define_namespace( DEFINE HPX_PARCELPORT_VERBS_DEVICE VALUE "\"${HPX_PARCELPORT_VERBS_DEVICE}\"" NAMESPACE parcelport_verbs) hpx_add_config_define_namespace( DEFINE HPX_PARCELPORT_VERBS_INTERFACE VALUE "\"${HPX_PARCELPORT_VERBS_INTERFACE}\"" NAMESPACE parcelport_verbs) and then to generate a defines.hpp file as follows write_config_defines_file( TEMPLATE "" NAMESPACE "parcelport_verbs" FILENAME "${CMAKE_BINARY_DIR}/hpx/config/parcelport_verbs_defines.hpp") when no template is specified, the function will generate a copyright block, and include guard #ifndef...#endif section with the #defines between. In the above example, the following would be generated from the variables #define HPX_PARCELPORT_VERBS_DEVICE "mlx5_0" #define HPX_PARCELPORT_VERBS_INTERFACE "ib0" This feature allows a module (e.g. parcelport) to generate #defines without writing to the global defines.hpp file and triggering full rebuilds on every change.
- Loading branch information