-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Bundle C++ extensions into a single executable #4335
Conversation
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.
Seems like a neat feature! I haven't read all of the cmake
:(
@@ -0,0 +1,9 @@ | |||
All the extensions made with the **add_osquery_extension_ex()** CMake function will be automatically bundled into a single executable. |
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.
Instead of this inline README
approach, can we add a section to the /docs/wiki
with similar content?
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.
Yes, that's better! I moved everything inside the wiki and deleted my README file
external/osquery_main.cpp.template
Outdated
* You may select, at your option, one of the above-listed licenses. | ||
*/ | ||
|
||
#include <osquery/sdk.h> |
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.
Maybe use the /tools/codegen
folder?
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.
Done! I moved it in the codegen folder and used a more meaningful name
@alessandrogario has updated the pull request. View: changes |
@alessandrogario has updated the pull request. |
@alessandrogario has updated the pull request. View: changes |
@alessandrogario has updated the pull request. |
@alessandrogario has updated the pull request. |
Hi, @alessandrogario, Is it still in progress? |
Hello @mkareta! I feel like this is complete and ready for review (thanks for looking at this!) I'm not really sure about the idea of merging extensions and osqueryd into a single executable, as I never really thought about this use case. We are maintaining an extension repository so we felt the need of bundling them together to make them easier to use, but we will keep using the official packages. One thing that I really like is that the maintainers are doing an awesome job at keeping the release quality high, so my preference would still be to avoid grouping extensions and core into a single executable. This may be really interesting for other user cases though (especially for heavy osqueryi users). |
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.
ok to test |
Introduction
This PR adds a new CMake function (add_osquery_extension_ex) that can be used to declare extension targets that will eventually get compiled into a single executable.
The executable name and version can be changed using the following two environment variables:
If they are not present, the executable will be called
osquery_extension_group.ext
and the version will be set to1.0
.How it works
First of all, old behavior is not modified in any way; extensions will have to be slightly modified to make use of this functionality. The two approaches can be mixed and will not conflict.
The new add_osquery_extension_ex() function aggregates all extension targets into global project properties. Once the
osquery/external
folder has been completely evaluated, a C++ file containing all the required includes andREGISTER_EXTERNAL
directives is generated. This file is then compiled with the user-supplied implementation files in order to form a single executable.