-
Notifications
You must be signed in to change notification settings - Fork 495
Add cmake setting to build as dll #1741
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
base: master
Are you sure you want to change the base?
Add cmake setting to build as dll #1741
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. |




Adds
LUAU_EXPORT_DLLtoCMakeLists.txt.