Skip to content

cmake: Use CMAKE_CURRENT_SOURCE_DIR to allow lute to build against slua - #113

Open
tapple wants to merge 1 commit into
secondlife:mainfrom
tapple:lute-build-fixes
Open

tapple wants to merge 1 commit into
secondlife:mainfrom
tapple:lute-build-fixes

Conversation

@tapple

@tapple tapple commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Small edit to cmake build system that allows slua to be built into lute

SLua still builds properly, but now it also builds as a subdirectory in lute

This change is AI-generated using pi and qwen. it's suggested PR text is below:


When extern/luau is added as a subdirectory (e.g., when lute builds against slua), CMAKE_SOURCE_DIR points to the parent project root, not the luau directory. This causes the builtins embedding to fail because it can't find builtins.txt and
builtins_embedded.h.in in the wrong location.

Using CMAKE_CURRENT_SOURCE_DIR ensures the paths are correct regardless of whether luau is built as a standalone project or as a subdirectory.

Changes:

  • CMakeLists.txt: Changed CMAKE_SOURCE_DIR to CMAKE_CURRENT_SOURCE_DIR for the builtins embedding paths (lines 59 and 62)

This fix allows lute to build against slua when using the subdirectory approach.

@HaroldCindy HaroldCindy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems broadly reasonable to me, thanks! Just a couple fixups needed, the web failure is unrelated and probably due to an SDK upgrade.

For future ref, you needn't (and shouldn't) include LLM-generated prose in issues or PRs. I trust your judgment and I'd much prefer a terse human-written issue description than read LLM output.

Comment thread CMakeLists.txt
configure_file(
"${CMAKE_SOURCE_DIR}/LSLBuiltins/src/builtins_embedded.h.in"
"${CMAKE_CURRENT_SOURCE_DIR}/LSLBuiltins/src/builtins_embedded.h.in"
"${CMAKE_BINARY_DIR}/builtins_embedded.h"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This (and the other CMAKE_BINARY_DIR instance should also be CMAKE_CURRENT_BINARY_DIR so we don't pollute the root project's build dir

Comment thread CMakeLists.txt

target_compile_features(Luau.LSLBuiltins PUBLIC cxx_std_17)
target_include_directories(Luau.LSLBuiltins PUBLIC LSLBuiltins/include)
target_include_directories(Luau.LSLBuiltins PRIVATE ${CMAKE_BINARY_DIR}) # For builtins_embedded.h

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CMAKE_CURRENT_BINARY_DIR here also, or we would be pulling in headers from the project root

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants