Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upBundle C++ extensions into a single executable #4335
Conversation
|
Seems like a neat feature! I haven't read all of the |
| @@ -0,0 +1,9 @@ | |||
| All the extensions made with the **add_osquery_extension_ex()** CMake function will be automatically bundled into a single executable. | |||
theopolis
May 1, 2018
Member
Instead of this inline README approach, can we add a section to the /docs/wiki with similar content?
Instead of this inline README approach, can we add a section to the /docs/wiki with similar content?
alessandrogario
May 1, 2018
Author
Contributor
Yes, that's better! I moved everything inside the wiki and deleted my README file
Yes, that's better! I moved everything inside the wiki and deleted my README file
| * You may select, at your option, one of the above-listed licenses. | ||
| */ | ||
|
|
||
| #include <osquery/sdk.h> |
theopolis
May 1, 2018
Member
Maybe use the /tools/codegen folder?
Maybe use the /tools/codegen folder?
alessandrogario
May 1, 2018
Author
Contributor
Done! I moved it in the codegen folder and used a more meaningful name
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). |
|
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.extand 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/externalfolder has been completely evaluated, a C++ file containing all the required includes andREGISTER_EXTERNALdirectives is generated. This file is then compiled with the user-supplied implementation files in order to form a single executable.