-
Notifications
You must be signed in to change notification settings - Fork 445
CMake: generate chpl-language-server .cls-commands.json
#28427
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
Merged
DanilaFe
merged 7 commits into
chapel-lang:main
from
DanilaFe:cmake-generate-cls-commands
Feb 23, 2026
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
16ec0a4
Adjust chpl-shim to work with files generated by CMake
DanilaFe 74e840d
Tweak chpl-shim.py to be workable from CMake
DanilaFe 6a39d30
Make final tweaks to CHPL_SHIM
DanilaFe 04d9e15
Add CMake support for chpl-shim
DanilaFe c31e72d
Add docs
DanilaFe f06de24
Apply reviewer feedback
DanilaFe 698da29
Fix cls_commands.json -> cls-commands.json
DanilaFe 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -19,7 +19,26 @@ | |
| # TODO: this is a hack, how do we tell cmake that we can't compile to object files? | ||
| # TODO: how do we respect <DEFINES> and <INCLUDES>, CMake will only fill that in for CMAKE_*_COMPILER_OBJECT | ||
| set(CMAKE_CHPL_COMPILE_OBJECT "test -f <OBJECT> || ln -s <SOURCE> <OBJECT>") | ||
| set(CMAKE_CHPL_LINK_EXECUTABLE "<CMAKE_CHPL_COMPILER> -o <TARGET> <OBJECTS> <FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>") | ||
|
|
||
| # Support for CMAKE_EXPORT_CHPL_COMMANDS (similar to CMAKE_EXPORT_COMPILE_COMMANDS) | ||
| set(CHPL_COMPILER_FLAGS "-o <TARGET> <OBJECTS> <FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>") | ||
| set(CMAKE_CHPL_LINK_EXECUTABLE "<CMAKE_CHPL_COMPILER> ${CHPL_COMPILER_FLAGS}") | ||
| if(CMAKE_EXPORT_CHPL_COMMANDS) | ||
| # Get the directory containing the chpl compiler to find chpl-shim | ||
| get_filename_component(CHPL_BIN_DIR "${CMAKE_CHPL_COMPILER}" DIRECTORY) | ||
| set(CHPL_SHIM_SCRIPT "${CHPL_BIN_DIR}/chpl-shim") | ||
|
|
||
| message(STATUS "CMAKE_EXPORT_CHPL_COMMANDS is ON, checking for chpl-shim at ${CHPL_SHIM_SCRIPT}") | ||
|
|
||
| if(EXISTS "${CHPL_SHIM_SCRIPT}") | ||
| # Use chpl-shim as a wrapper to generate .cls-commands.json | ||
| # Note: chpl-shim expects to be called as 'chpl-shim chpl <args>', not with full path | ||
|
Comment on lines
+34
to
+35
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😭
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Feels like that's a hard limitation without dynamic loading magic (whatever |
||
| message(STATUS "Found chpl-shim. Configuring build command to use chpl-shim to generate .cls-commands.json") | ||
| set(CMAKE_CHPL_LINK_EXECUTABLE "<CMAKE_COMMAND> -E env CHPL_SHIM_REAL_COMPILER_PATH=${CMAKE_CHPL_COMPILER} ${CHPL_SHIM_SCRIPT} chpl ${CHPL_COMPILER_FLAGS}") | ||
| else() | ||
| message(WARNING "CMAKE_EXPORT_CHPL_COMMANDS is set but chpl-shim not found at ${CHPL_SHIM_SCRIPT}") | ||
| endif() | ||
| endif() | ||
|
|
||
| # TODO: support --library directly to build Chapel shared libs for interoperability | ||
| # CMAKE_*_CREATE_SHARED_LIBRARY | ||
|
|
||
This file contains hidden or 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
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.
this needs updates too :)