From 430030a6c3557a0fe7ba4cf6b9dec03592d8fe30 Mon Sep 17 00:00:00 2001 From: halx99 Date: Wed, 27 Apr 2022 19:39:12 +0800 Subject: [PATCH] Improve VS Ninja build again a. Auto copy webview2 dll for targets b. Fix cpp-tests compile error --- cmake/Modules/CocosBuildHelpers.cmake | 8 ++++++++ tests/cpp-tests/Classes/ChipmunkTestBed/demo/Example.c | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/cmake/Modules/CocosBuildHelpers.cmake b/cmake/Modules/CocosBuildHelpers.cmake index 800a9556f0..4609fdb668 100644 --- a/cmake/Modules/CocosBuildHelpers.cmake +++ b/cmake/Modules/CocosBuildHelpers.cmake @@ -228,6 +228,14 @@ function(cocos_copy_target_dll cocos_target) ${ADXE_ROOT_PATH}/${ADXE_THIRDPARTY_NAME}/angle/prebuilt/${ARCH_ALIAS}/d3dcompiler_47.dll $ ) + + # Copy webview2 for ninja + if(CMAKE_GENERATOR STREQUAL "Ninja") + add_custom_command(TARGET ${cocos_target} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${CMAKE_BINARY_DIR}/packages/Microsoft.Web.WebView2/build/native/${ARCH_ALIAS}/WebView2Loader.dll" + $) + endif() endfunction() function(cocos_copy_lua_dlls cocos_target) diff --git a/tests/cpp-tests/Classes/ChipmunkTestBed/demo/Example.c b/tests/cpp-tests/Classes/ChipmunkTestBed/demo/Example.c index d3436dda5a..43eb6ac0f9 100644 --- a/tests/cpp-tests/Classes/ChipmunkTestBed/demo/Example.c +++ b/tests/cpp-tests/Classes/ChipmunkTestBed/demo/Example.c @@ -19,9 +19,11 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ - #include #include +#if !defined(_USE_MATH_DEFINES) +# define _USE_MATH_DEFINES +#endif #include #include