File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 1919# TODO: this is a hack, how do we tell cmake that we can't compile to object files?
2020# TODO: how do we respect <DEFINES> and <INCLUDES>, CMake will only fill that in for CMAKE_*_COMPILER_OBJECT
2121set (CMAKE_CHPL_COMPILE_OBJECT "test -f <OBJECT> || ln -s <SOURCE> <OBJECT>" )
22+
23+ # Support for CMAKE_EXPORT_CHPL_COMMANDS (similar to CMAKE_EXPORT_COMPILE_COMMANDS)
2224set (CMAKE_CHPL_LINK_EXECUTABLE "<CMAKE_CHPL_COMPILER> -o <TARGET> <OBJECTS> <FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>" )
25+ if (CMAKE_EXPORT_CHPL_COMMANDS)
26+ # Get the directory containing the chpl compiler to find chpl-shim
27+ get_filename_component (CHPL_BIN_DIR "${CMAKE_CHPL_COMPILER} " DIRECTORY )
28+ set (CHPL_SHIM_SCRIPT "${CHPL_BIN_DIR} /chpl-shim" )
29+
30+ message (STATUS "CMAKE_EXPORT_CHPL_COMMANDS is ON, checking for chpl-shim at ${CHPL_SHIM_SCRIPT} " )
31+
32+ if (EXISTS "${CHPL_SHIM_SCRIPT} " )
33+ # Use chpl-shim as a wrapper to generate .cls-commands.json
34+ # Note: chpl-shim expects to be called as 'chpl-shim chpl <args>', not with full path
35+ message (STATUS "Using chpl-shim to generate .cls-commands.json" )
36+ set (CMAKE_CHPL_LINK_EXECUTABLE "<CMAKE_COMMAND> -E env CHPL_SHIM_REAL_COMPILER_PATH=${CMAKE_CHPL_COMPILER} ${CHPL_SHIM_SCRIPT} chpl -o <TARGET> <OBJECTS> <FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>" )
37+ else ()
38+ message (WARNING "CMAKE_EXPORT_CHPL_COMMANDS is set but chpl-shim not found at ${CHPL_SHIM_SCRIPT} " )
39+ endif ()
40+ endif ()
2341
2442# TODO: support --library directly to build Chapel shared libs for interoperability
2543# CMAKE_*_CREATE_SHARED_LIBRARY
You can’t perform that action at this time.
0 commit comments