Add cmake setting to build as dll#1741
Add cmake setting to build as dll#1741TheGreatSageEqualToHeaven wants to merge 2 commits intoluau-lang:masterfrom
Conversation
|
This doesn't really work in practice, and shared linking to the Analysis target will require a little more spice. In my build setup I compile add_subdirectory(pkg/luau)
add_library(Luau.Shared SHARED
pkg/luau/VM/src/lapi.cpp
pkg/luau/VM/src/laux.cpp
pkg/luau/VM/src/lstate.cpp
pkg/luau/VM/src/linit.cpp
pkg/luau/VM/src/ldo.cpp
pkg/luau/VM/src/lbaselib.cpp
pkg/luau/VM/src/lvmload.cpp
pkg/luau/CodeGen/src/lcodegen.cpp
pkg/luau/Compiler/src/lcode.cpp
)
target_link_libraries(Luau.Shared PRIVATE Luau.VM Luau.Compiler Luau.CodeGen)
target_link_libraries(Luau.Shared PUBLIC Luau.Common Luau.Ast)
IF (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_definitions(Luau.Shared PRIVATE "LUA_API=__declspec(dllexport)")
target_compile_definitions(Luau.Shared PRIVATE "LUACODE_API=__declspec(dllexport)")
target_compile_definitions(Luau.Shared PRIVATE "LUACODEGEN_API=__declspec(dllexport)")
target_compile_definitions(Luau.Shared INTERFACE "LUA_API=__declspec(dllimport)")
target_compile_definitions(Luau.Shared INTERFACE "LUACODE_API=__declspec(dllimport)")
target_compile_definitions(Luau.Shared INTERFACE "LUACODEGEN_API=__declspec(dllimport)")
ENDIF()PS: This uses a local patch to remove the |
This does work in practice and has worked in practice for the past nearly 4 years, however I only use it purely for linking with C# (without Analysis at all) so perhaps for your cases it wouldn't work. |
It doesn't even compile. |
|
The branch itself seems to have been deleted here or GitHub is otherwise having a bad time, but we merged this functionality in #2208. |
I think I deleted the repository when moving it to our private workflow (which isn't on github) so that we could build it easier, my bad 😆 |
|
no worries! |




Adds
LUAU_EXPORT_DLLtoCMakeLists.txt.