From 2c333b4bc8848520f676059f74c260c8a8ce8456 Mon Sep 17 00:00:00 2001 From: Rob Blanckaert Date: Wed, 14 Feb 2024 23:26:38 -0800 Subject: [PATCH] Added install commands to CMakeLists.txt Some package managers like vcpkg rely on CMake to install the built binaries. Adds the standard boilerplate to install headers, static libs, and binaries via the install target. --- CMakeLists.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0189fcd0a..96ff279c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -271,3 +271,22 @@ foreach(LIB Luau.Ast Luau.Compiler Luau.Config Luau.Analysis Luau.CodeGen Luau.V endif() endif() endforeach() + +# define the install steps +include(GNUInstallDirs) +install(DIRECTORY "${PROJECT_SOURCE_DIR}/VM/include/" "${PROJECT_SOURCE_DIR}/AST/include/" "${PROJECT_SOURCE_DIR}/Compiler/include/" + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + FILES_MATCHING + PATTERN "*.h" + PATTERN "*.hpp" + PATTERN "*.inl") + +install(TARGETS Luau.Ast Luau.Compiler Luau.Config Luau.Analysis Luau.CodeGen Luau.VM + EXPORT luau + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + +if (LUAU_BUILD_CLI) +install(TARGETS Luau.Repl.CLI Luau.Analyze.CLI Luau.Compile.CLI + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) +endif()