From 846231e2f102f774f8127196bfa0d31c683b3bb6 Mon Sep 17 00:00:00 2001 From: halx99 Date: Tue, 12 Oct 2021 13:16:27 +0800 Subject: [PATCH] Fix #522 --- cmake/Modules/CocosBuildHelpers.cmake | 8 +++++++- templates/lua-template-default/CMakeLists.txt | 1 + tests/lua-tests/project/CMakeLists.txt | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/cmake/Modules/CocosBuildHelpers.cmake b/cmake/Modules/CocosBuildHelpers.cmake index 8b9ff3cc04..99cc3f8b2b 100644 --- a/cmake/Modules/CocosBuildHelpers.cmake +++ b/cmake/Modules/CocosBuildHelpers.cmake @@ -215,7 +215,6 @@ function(cocos_copy_target_dll cocos_target) add_custom_command(TARGET ${cocos_target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_BINARY_DIR}/bin/\$\(Configuration\)/OpenAL32.dll" - "${CMAKE_BINARY_DIR}/bin/\$\(Configuration\)/plainlua.dll" $) # Copy windows angle binaries @@ -228,6 +227,13 @@ function(cocos_copy_target_dll cocos_target) ) endfunction() +function(cocos_copy_lua_dlls cocos_target) + add_custom_command(TARGET ${cocos_target} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${CMAKE_BINARY_DIR}/bin/\$\(Configuration\)/plainlua.dll" + $) +endfunction() + # mark `FILES` as resources, files will be put into sub-dir tree depend on its absolute path function(cocos_mark_resources) set(oneValueArgs BASEDIR RESOURCEBASE) diff --git a/templates/lua-template-default/CMakeLists.txt b/templates/lua-template-default/CMakeLists.txt index 821af314ed..c05f05c8e2 100644 --- a/templates/lua-template-default/CMakeLists.txt +++ b/templates/lua-template-default/CMakeLists.txt @@ -161,6 +161,7 @@ if(APPLE) endif() elseif(WINDOWS) cocos_copy_target_dll(${APP_NAME}) + cocos_copy_lua_dlls(${APP_NAME}) endif() # copy resource on linux or WINDOWS if(WINDOWS) diff --git a/tests/lua-tests/project/CMakeLists.txt b/tests/lua-tests/project/CMakeLists.txt index e31ab664fc..d99dc3cf97 100644 --- a/tests/lua-tests/project/CMakeLists.txt +++ b/tests/lua-tests/project/CMakeLists.txt @@ -146,6 +146,7 @@ if(APPLE) #set_xcode_property(${APP_NAME} DEVELOPMENT_TEAM "GRLXXXX2K9") elseif(WINDOWS) cocos_copy_target_dll(${APP_NAME}) + cocos_copy_lua_dlls(${APP_NAME}) endif() if(WINDOWS)