luau-lang / luau

A fast, small, safe, gradually typed embeddable scripting language derived from Lua
https://luau-lang.org
MIT License
3.84k stars 354 forks source link

Add installation behaviors to CMakeLists.txt #1317

Open adamkewley opened 1 week ago

adamkewley commented 1 week ago

This isn't a PR you guys should necessarily merge, but just another datapoint on how to (potentially) handle installation packaging.

Background

Just for context, my use-case is that I'm experimenting with adding some sandboxed scripting to:

I really liked the vibe/design/portability of luau because I'm also in the middle of gradually porting the project's backend to wasm (WIP) and would eventually like users to be able to experiment with their own physics components etc. in a browser without a server-side backend and eventually provide a safe-to-distribute model format that includes scripted components.

Because I deploy to 3 (soon, 4) platforms, the way in which I handle dependencies is to provide a separate source-build of all of dependencies in third_party. The directory contains its own CMakeLists.txt, which uses ExternalProject_Add to build+install each dependency into a unified directory that can then be added to the CMAKE_PREFIX_PATH of some downstream project (for me, it's opensim-creator). The idea is that some dependencies can be disabled, layered over the OS-provided ones, etc. without having to have custom find_package steps in opensim-creator (i.e. it can all be handled from the top-level build bash script or similar).

Other PRs Like this

Testing I've Completed

I made these changes and now I can just find_package in my downstream branch. I'll report back once I have a branch building on all 4 (Win/MacOS/Linux/Emscripten) platforms.