From de703adedff423d3b957ec04befab0216aca3e16 Mon Sep 17 00:00:00 2001 From: VisualGMQ <2142587070@qq.com> Date: Fri, 5 Aug 2022 23:15:31 +0800 Subject: [PATCH] let clang & msvc compile success --- CMakeLists.txt | 1 + ReadMe.md | 6 +++--- cmake/FindLua.cmake | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c1b8e18..40e6c92 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,6 +38,7 @@ add_subdirectory(test) # install install( TARGETS ${HAZEL_LUA_BRIDGE_NAME} lua ${HAZEL_EXECUTOR_NAME} ${HAZEL_CORE_NAME} + RUNTIME DESTINATION ${CMAKE_SOURCE_DIR}/install ) diff --git a/ReadMe.md b/ReadMe.md index 9cce073..b3b286e 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -3,7 +3,7 @@ # 下载 Github可以直接在Release界面找到Windows的可执行压缩包。 -Gitme可以在`版本发布`->`Git标签`下找到同样的压缩包。 +Gitme可以在`版本发布`下找到同样的压缩包。 # 编译 @@ -17,10 +17,10 @@ Gitme可以在`版本发布`->`Git标签`下找到同样的压缩包。 git submodule update --init --recursive ``` -然后使用cmake编译(**十分推荐使用MinGW编译,因为他编译出来的库名称是libhazel.dll和libhazel_core.dll,而MSVC和Clang是hazel.dll和hazel_core.dll,这意味着Lua会找不到对应的库(除非你重命名)**): +然后使用cmake编译(**如果你使用MSVC和Clang编译,需要将最后的hazel.dll重命名为libhazel.dll。如果是MinGW,那么他应当产出libhazel.dll**) ```bash -cmake -S . -B build -G"MinGW Makefiles" +cmake -S . -B build ``` 然后安装到`install`文件夹: diff --git a/cmake/FindLua.cmake b/cmake/FindLua.cmake index ae94e77..c0dfcbf 100644 --- a/cmake/FindLua.cmake +++ b/cmake/FindLua.cmake @@ -39,6 +39,6 @@ target_compile_features(lua PRIVATE c_std_99) # TODO if you use MinGW, maybe you need this # target_compile_options(lua PRIVATE LUA_USE_LINUX) -if (NOT WIN32) - target_compile_options(lua PRIVATE LUA_USE_LINUX) +if (WIN32) + target_compile_definitions(lua PRIVATE "LUA_BUILD_AS_DLL") endif()