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
CMake: provide plugin name as compiler definition #2360
CMake: provide plugin name as compiler definition #2360
Conversation
Wow, great to see this. I am looking forward to review it soon. |
6edf868
to
2ca5555
Compare
Do you want to get rid of
to
? It should be possible with the changes in this PR. Do you prefer a small PR or should I just continue? |
Yes ELEKTRA_PLUGIN_FUNCTION(function) would be great!
Depends on your time budget. It would be good if the PR does not get stuck in the middle. |
OK let's mrege it then, to be sure. I'll use #1042 as follow-up task. |
559abd4
to
ca9fc6b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good as far as I can tell. Thank you for the update.
cmake/Modules/LibAddPlugin.cmake
Outdated
# Provides additional compiler definitions: | ||
# | ||
# - ELEKTRA_PLUGIN_NAME containing the short plugin name as string | ||
# - ELEKTRA_PLUGIN_NAME_C contai the short plugin name which can be used in function names |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling: contai
→ containing
cmake/Modules/LibAddPlugin.cmake
Outdated
|
||
# provide the plugin name as macro that can be used for building function names, etc. | ||
if (NOT "${ARG_COMPILE_DEFINITIONS}" MATCHES "ELEKTRA_PLUGIN_NAME_C") | ||
if (ADDITIONAL_COMPILE_DEFINITIONS_PART1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can replace this if
-statement with the following simpler code:
list (APPEND ADDITIONAL_COMPILE_DEFINITIONS_PART2 "ELEKTRA_PLUGIN_NAME_C=${shortname}")
.
@@ -256,7 +256,9 @@ you up to date with the multi-language support provided by Elektra. | |||
anymore, if it is unable to locate a Lua executable. *(René Schwaiger)* | |||
- We added code that makes sure you can compile [IO GLIB](https://www.libelektra.org/bindings/io_glib) on macOS, even if `pkg-config` | |||
erroneously reports that GLIB requires linking to the library `intl` (part of [GNU gettext](https://www.gnu.org/software/gettext)). | |||
*(René Schwaiger)* | |||
(René Schwaiger) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this line is already correct, no need to change it back again 😊.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sometimes rebase
messes with my brain 😆
@@ -256,7 +256,9 @@ you up to date with the multi-language support provided by Elektra. | |||
anymore, if it is unable to locate a Lua executable. *(René Schwaiger)* | |||
- We added code that makes sure you can compile [IO GLIB](https://www.libelektra.org/bindings/io_glib) on macOS, even if `pkg-config` | |||
erroneously reports that GLIB requires linking to the library `intl` (part of [GNU gettext](https://www.gnu.org/software/gettext)). | |||
*(René Schwaiger)* | |||
(René Schwaiger) | |||
- The plugin name is provided as compiler definition via CMake. See #1042 .*(Peter Nirschl)* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice, if you could also provide a link to issue #1042 here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And a link to the docu or ideally also say which compiler definitions were added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, great job!
@@ -1,6 +1,41 @@ | |||
include (LibAddMacros) | |||
include (LibAddTest) | |||
|
|||
# ~~~ | |||
# Provides additional compiler definitions: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to have this docu also in the API docu of plugins or even in the plugin writing tutorial. But this can also be done in a later PR.
@@ -256,7 +256,9 @@ you up to date with the multi-language support provided by Elektra. | |||
anymore, if it is unable to locate a Lua executable. *(René Schwaiger)* | |||
- We added code that makes sure you can compile [IO GLIB](https://www.libelektra.org/bindings/io_glib) on macOS, even if `pkg-config` | |||
erroneously reports that GLIB requires linking to the library `intl` (part of [GNU gettext](https://www.gnu.org/software/gettext)). | |||
*(René Schwaiger)* | |||
(René Schwaiger) | |||
- The plugin name is provided as compiler definition via CMake. See #1042 .*(Peter Nirschl)* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And a link to the docu or ideally also say which compiler definitions were added.
@@ -5,8 +5,6 @@ add_plugin (base64 | |||
base64_functions.c | |||
base64.h | |||
base64.c | |||
COMPILE_DEFINITIONS ELEKTRA_PLUGIN_NAME=\"base64\" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to see this simplification!
Similar changes can be done for gpgme, resolver, mmap* (@mpranj)
Maybe you can also rebase, the Jenkins build failure in master should hopefully be resolved by now #2351 |
Thank you both for the great feedback! |
Provides ELEKTRA_PLUGIN_NAME and ELEKTRA_PLUGIN_NAME_C as compiler definitions via CMake. See ElektraInitiative#1042 for details.
Simplify code by using ADD_TEST
Thanks to the feedback by @sanssecours ! See ElektraInitiative#1042 .
8f803b7
to
d6b34e8
Compare
Travis seems to be stuck. |
It is not stuck, but the Mac build jobs are just super slow 🐌. I currently work on transferring most of the Mac build jobs to Cirrus CI, which uses VMs that are much faster (about 5 times faster, as far as I can tell). |
Thank you for this great work! |
Provides
ELEKTRA_PLUGIN_NAME
andELEKTRA_PLUGIN_NAME_C
as compiler definitions via CMake.See #1042 .
EDIT: This PR does NOT close the issue #1042 .
Basics
Do not describe the purpose here but:
doc/news/_preparation_next_release.md which contains
*(my name)*
)Please always add something to the the release notes.
(first line should have
module: short statement
syntax)close #X
, should be in the commit messages.Checklist
Check relevant points but please do not remove entries.
For docu fixes, spell checking, and similar none of these points below
need to be checked.
Review
Remove the line below and add the "work in progress" label if you do
not want the PR to be reviewed:
@markus2330 please review my pull request