-
-
Notifications
You must be signed in to change notification settings - Fork 40.7k
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
Add support for out-of-tree userspace #11269
Closed
Closed
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
acb519f
Add support for out-of-tree userspace
Erovia a60707b
Add external-userspace support to CLI
Erovia f631eed
Add external userspace docs
Erovia 08ae565
No need for a 'keymaps' dir in external userspace
Erovia 9455ae1
Update check for split doctor code
Erovia 85b0b08
Add support for the 5-dir depth support for External Userspace
Erovia ca5206b
Add rules.mk support for external json keymaps
Erovia a9d7f6f
Documentation work
Erovia e4ade44
Refactor 'qmk doctor' to reduce complexity
Erovia 6b2cb61
A bit more doctor refactor
Erovia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# External Userspace: Store your code outside the QMK repo | ||
|
||
Store your [keymaps](keymap.md), [community layouts](feature_layouts.md) and [userspace](feature_userspace.md) outside the `qmk_firmware` repository and automatically link it during build time. | ||
This allows you to store your code in a separate `git` repository and manage it separately. | ||
Updating the QMK repo should be easier as well, as the chance of code conflict is basically non-existent. | ||
|
||
## Directory structure | ||
*Note*: all directories and files are optional, create only what you actually need | ||
|
||
* `/my_qmk_stuff/` (put it anywhere you'd like and name is whatever you want (no whitespaces, please)) | ||
* `common/` (content will be always included, equivalent of [userspace](feature_userspace.md))) | ||
* `rules.mk` | ||
* `config.h` | ||
* `<name>.h` | ||
* `<name>.c` | ||
* `cool_rgb_stuff.c` | ||
* `cool_rgb_stuff.h` | ||
* `keyboards/` (keyboard-specific [keymaps](keymap.md)) | ||
* `planck/` | ||
* `my_planck_keymap/` (keymaps for all Planck revisions) | ||
* `keymap.c` | ||
* `config.h` | ||
* `rev6` (keymaps only for the `planck/rev6`) | ||
* `my_rev6_keymap/` | ||
* `keymap.json` | ||
* `rules.mk` | ||
* `layouts/` (layout specific keymaps, equivalent of [community layouts](feature_layouts.md)) | ||
* `ortho_4x12/` | ||
* `my_grid_keymap/` | ||
* `keymap.c` | ||
|
||
## Configuration | ||
|
||
qmk config user.userspace=/path/to/external_userspace | ||
|
||
**Note**: It's important to specify absolute path. | ||
|
||
*Example*: I created my external userspace in `/home/erovia/qmk/my_qmk_stuff`, so I have to run this command: | ||
|
||
qmk config user.userspace=/home/erovia/qmk/my_qmk/stuff | ||
|
||
`qmk doctor` will check if the directory exists and if the provided path is an absolute one. | ||
|
||
## Additional source files | ||
|
||
You can add additional source files to the compilation with the EXT_SRC option, which is very similar to [SRC](config_options?id=build-options) used in in-tree keymaps. | ||
You need to add the EXT_SRC in `rules.mk` like this: | ||
|
||
EXT_SRC += <filename>.c | ||
|
||
Additional files may be added in the same way. | ||
|
||
Similarly to [userspace](feature_userspace.md), the `common/rules.mk` file will be included in the build _after_ the `rules.mk` from your keymap. This allows you to have features in your userspace `rules.mk` that depend on individual QMK features that may or may not be available on a specific keyboard. | ||
|
||
For example, if you have RGB control features shared between all your keyboards that support RGB lighting, you can add support for that if the RGBLIGHT feature is enabled: | ||
```make | ||
ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) | ||
# Include my fancy rgb functions source here | ||
EXT_SRC += cool_rgb_stuff.c | ||
endif | ||
``` | ||
|
||
Alternatively, you can `define RGB_ENABLE` in your keymap's `rules.mk` and then check for the variable in your userspace's `rules.mk` like this: | ||
```make | ||
ifdef RGB_ENABLE | ||
# Include my fancy rgb functions source here | ||
EXT_SRC += cool_rgb_stuff.c | ||
endif | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Would it make sense to also document how to use this with plain
make
invocations?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 don't think so.
While it can be used with
make
, absolutely... the overall goal is to remove the dependency onmake
as much as possible, and push everyone toqmk
.Because of that, I don't think that adding documentation for make, well, makes any sense.
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!