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.
This commit is contained in:
Rob Blanckaert 2024-02-14 23:26:38 -08:00
parent d6c2472f0c
commit 2c333b4bc8

View File

@ -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()