-
Notifications
You must be signed in to change notification settings - Fork 381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add cmake install target #926
base: master
Are you sure you want to change the base?
Changes from all commits
1b8645c
f26d24f
97207ce
5f1b6a7
f13d86b
0264333
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ if(LUAU_STATIC_CRT) | |
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") | ||
endif() | ||
|
||
project(Luau LANGUAGES CXX C) | ||
project(Luau LANGUAGES CXX C VERSION 0.607) | ||
add_library(Luau.Common INTERFACE) | ||
add_library(Luau.Ast STATIC) | ||
add_library(Luau.Compiler STATIC) | ||
|
@@ -61,38 +61,65 @@ endif() | |
# Proxy target to make it possible to depend on private VM headers | ||
add_library(Luau.VM.Internals INTERFACE) | ||
|
||
include(CMakePackageConfigHelpers) | ||
include(GenerateExportHeader) | ||
include(GNUInstallDirs) | ||
include(Sources.cmake) | ||
|
||
target_include_directories(Luau.Common INTERFACE Common/include) | ||
target_include_directories(Luau.Common INTERFACE | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Common/include> | ||
$<INSTALL_INTERFACE:include> | ||
) | ||
|
||
target_compile_features(Luau.Ast PUBLIC cxx_std_17) | ||
target_include_directories(Luau.Ast PUBLIC Ast/include) | ||
target_include_directories(Luau.Ast PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Ast/include> | ||
$<INSTALL_INTERFACE:include> | ||
) | ||
target_link_libraries(Luau.Ast PUBLIC Luau.Common) | ||
|
||
target_compile_features(Luau.Compiler PUBLIC cxx_std_17) | ||
target_include_directories(Luau.Compiler PUBLIC Compiler/include) | ||
target_include_directories(Luau.Compiler PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Compiler/include> | ||
$<INSTALL_INTERFACE:include> | ||
) | ||
target_link_libraries(Luau.Compiler PUBLIC Luau.Ast) | ||
|
||
target_compile_features(Luau.Config PUBLIC cxx_std_17) | ||
target_include_directories(Luau.Config PUBLIC Config/include) | ||
target_include_directories(Luau.Config PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Config/include> | ||
$<INSTALL_INTERFACE:include> | ||
) | ||
target_link_libraries(Luau.Config PUBLIC Luau.Ast) | ||
|
||
target_compile_features(Luau.Analysis PUBLIC cxx_std_17) | ||
target_include_directories(Luau.Analysis PUBLIC Analysis/include) | ||
target_include_directories(Luau.Analysis PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Analysis/include> | ||
$<INSTALL_INTERFACE:include> | ||
) | ||
target_link_libraries(Luau.Analysis PUBLIC Luau.Ast Luau.Config) | ||
|
||
target_compile_features(Luau.CodeGen PRIVATE cxx_std_17) | ||
target_include_directories(Luau.CodeGen PUBLIC CodeGen/include) | ||
target_include_directories(Luau.CodeGen PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/CodeGen/include> | ||
$<INSTALL_INTERFACE:include> | ||
) | ||
target_link_libraries(Luau.CodeGen PRIVATE Luau.VM Luau.VM.Internals) # Code generation needs VM internals | ||
target_link_libraries(Luau.CodeGen PUBLIC Luau.Common) | ||
|
||
target_compile_features(Luau.VM PRIVATE cxx_std_11) | ||
target_include_directories(Luau.VM PUBLIC VM/include) | ||
target_include_directories(Luau.VM PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/VM/include> | ||
$<INSTALL_INTERFACE:include> | ||
) | ||
target_link_libraries(Luau.VM PUBLIC Luau.Common) | ||
|
||
target_include_directories(isocline PUBLIC extern/isocline/include) | ||
|
||
target_include_directories(Luau.VM.Internals INTERFACE VM/src) | ||
target_include_directories(Luau.VM.Internals INTERFACE | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/VM/src> | ||
$<INSTALL_INTERFACE:include> | ||
) | ||
|
||
set(LUAU_OPTIONS) | ||
|
||
|
@@ -271,3 +298,60 @@ foreach(LIB Luau.Ast Luau.Compiler Luau.Config Luau.Analysis Luau.CodeGen Luau.V | |
endif() | ||
endif() | ||
endforeach() | ||
|
||
configure_package_config_file( | ||
"${CMAKE_CURRENT_SOURCE_DIR}/LuauConfig.cmake.in" | ||
"${CMAKE_CURRENT_BINARY_DIR}/LuauConfig.cmake" | ||
INSTALL_DESTINATION "lib/cmake/Luau" | ||
) | ||
write_basic_package_version_file( | ||
"${CMAKE_CURRENT_BINARY_DIR}/LuauConfigVersion.cmake" | ||
VERSION "${PROJECT_VERSION}" | ||
COMPATIBILITY AnyNewerVersion | ||
) | ||
Comment on lines
+307
to
+311
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same problem for the version here I assume. |
||
export( | ||
TARGETS Luau.Ast Luau.Analysis Luau.CodeGen Luau.VM Luau.Compiler Luau.Config Luau.Common Luau.VM.Internals | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Luau.VM.Internals should not be included. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the problem I had before when it wasn't there was this:
I'm not sure what the best way to deal with this is yet. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like a bunch of headers, which would be exported with this, make use of VM internals. Until that gets resolved Luau.VM.Internals needs to be exported. |
||
FILE "${CMAKE_CURRENT_BINARY_DIR}/LuauExport.cmake" | ||
) | ||
|
||
install( | ||
TARGETS Luau.Ast Luau.Analysis Luau.CodeGen Luau.VM Luau.Compiler Luau.Config Luau.Common Luau.VM.Internals | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Luau.VM.Internals should not be included. |
||
EXPORT LuauTargets | ||
LIBRARY DESTINATION "lib" | ||
ARCHIVE DESTINATION "lib" | ||
INCLUDES DESTINATION "include" | ||
) | ||
install( | ||
EXPORT LuauTargets | ||
FILE LuauTargets.cmake | ||
NAMESPACE Luau:: | ||
DESTINATION "lib/cmake/Luau" | ||
) | ||
install( | ||
FILES | ||
"${CMAKE_CURRENT_BINARY_DIR}/LuauConfig.cmake" | ||
"${CMAKE_CURRENT_BINARY_DIR}/LuauConfigVersion.cmake" | ||
DESTINATION "lib/cmake/Luau" | ||
) | ||
install( | ||
DIRECTORY | ||
"${CMAKE_CURRENT_SOURCE_DIR}/Common/include/" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/Ast/include/" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/Compiler/include/" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/Config/include/" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/Analysis/include/" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/CodeGen/include/" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/VM/include/" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/VM/src/" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't include this |
||
"${CMAKE_CURRENT_SOURCE_DIR}/Common/include/" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/Config/include/" | ||
DESTINATION "include" | ||
FILES_MATCHING PATTERN "*.h" | ||
) | ||
|
||
if(LUAU_BUILD_CLI) | ||
install( | ||
TARGETS Luau.Repl.CLI Luau.Analyze.CLI Luau.Ast.CLI Luau.Reduce.CLI Luau.Compile.CLI Luau.Bytecode.CLI | ||
RUNTIME DESTINATION "bin" | ||
) | ||
endif() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@PACKAGE_INIT@ | ||
include(CMakeFindDependencyMacro) | ||
include("${CMAKE_CURRENT_LIST_DIR}/LuauTargets.cmake") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we can include a version.
Even with automation (worse with manual update) it will require a commit to this CMake file basically each week.