From ec80ebd34459b69f34302b4ddb266b44e1407a72 Mon Sep 17 00:00:00 2001 From: halx99 Date: Tue, 4 Aug 2020 14:05:00 +0800 Subject: [PATCH] Optimize CMake scripts --- cmake/Modules/CocosBuildHelpers.cmake | 9 +++++++++ tests/cpp-tests/CMakeLists.txt | 11 ----------- tests/fairygui-tests/CMakeLists.txt | 13 +------------ tests/lua-tests/project/CMakeLists.txt | 11 ----------- 4 files changed, 10 insertions(+), 34 deletions(-) diff --git a/cmake/Modules/CocosBuildHelpers.cmake b/cmake/Modules/CocosBuildHelpers.cmake index c03eca8163..cdb826322b 100644 --- a/cmake/Modules/CocosBuildHelpers.cmake +++ b/cmake/Modules/CocosBuildHelpers.cmake @@ -167,6 +167,15 @@ function(cocos_copy_target_dll cocos_target) COMMAND ${CMAKE_COMMAND} -E copy_if_different ${cc_dll_file} "$/${cc_dll_name}" ) endforeach() + + # Copy win32 angle binaries + add_custom_command(TARGET ${cocos_target} + COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${COCOS2DX_ROOT_PATH}/external/angle/prebuilt/win32/libGLESv2.dll + ${COCOS2DX_ROOT_PATH}/external/angle/prebuilt/win32/libEGL.dll + ${COCOS2DX_ROOT_PATH}/external/angle/prebuilt/win32/d3dcompiler_47.dll + $ + ) endfunction() # mark `FILES` as resources, files will be put into sub-dir tree depend on its absolute path diff --git a/tests/cpp-tests/CMakeLists.txt b/tests/cpp-tests/CMakeLists.txt index 675a4abe7b..5db7d76577 100644 --- a/tests/cpp-tests/CMakeLists.txt +++ b/tests/cpp-tests/CMakeLists.txt @@ -430,14 +430,3 @@ if(WINDOWS) set_target_properties(${APP_NAME} PROPERTIES COMPILE_FLAGS "/Yuprecheader.h /FIprecheader.h") set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/Classes/precheader.cpp" PROPERTIES COMPILE_FLAGS "/Ycprecheader.h") endif() - -# Copy win32 angle binaries -if(WIN32) - add_custom_command(TARGET ${APP_NAME} - COMMAND ${CMAKE_COMMAND} -E copy_if_different - ${COCOS2DX_ROOT_PATH}/external/angle/prebuilt/win32/libGLESv2.dll - ${COCOS2DX_ROOT_PATH}/external/angle/prebuilt/win32/libEGL.dll - ${COCOS2DX_ROOT_PATH}/external/angle/prebuilt/win32/d3dcompiler_47.dll - $ - ) -endif() diff --git a/tests/fairygui-tests/CMakeLists.txt b/tests/fairygui-tests/CMakeLists.txt index 3d0f97b366..2a626362ae 100644 --- a/tests/fairygui-tests/CMakeLists.txt +++ b/tests/fairygui-tests/CMakeLists.txt @@ -23,7 +23,7 @@ # ****************************************************************************/ cmake_minimum_required(VERSION 3.6) -set(APP_NAME fairygui_tests) +set(APP_NAME fairygui-tests) project(${APP_NAME}) @@ -144,14 +144,3 @@ if(LINUX OR WINDOWS) cocos_get_resource_path(APP_RES_DIR ${APP_NAME}) cocos_copy_target_res(${APP_NAME} LINK_TO ${APP_RES_DIR} FOLDERS ${GAME_RES_FOLDER}) endif() - -# Copy win32 angle binaries -if(WIN32) - add_custom_command(TARGET ${APP_NAME} - COMMAND ${CMAKE_COMMAND} -E copy_if_different - ${COCOS2DX_ROOT_PATH}/external/angle/prebuilt/win32/libGLESv2.dll - ${COCOS2DX_ROOT_PATH}/external/angle/prebuilt/win32/libEGL.dll - ${COCOS2DX_ROOT_PATH}/external/angle/prebuilt/win32/d3dcompiler_47.dll - $ - ) -endif() diff --git a/tests/lua-tests/project/CMakeLists.txt b/tests/lua-tests/project/CMakeLists.txt index 775e7ea38c..0515f86f6a 100644 --- a/tests/lua-tests/project/CMakeLists.txt +++ b/tests/lua-tests/project/CMakeLists.txt @@ -145,14 +145,3 @@ if(LINUX OR WINDOWS) cocos_copy_lua_scripts(${APP_NAME} ${res_src_folders} ${APP_RES_DIR}/src ) cocos_copy_lua_scripts(${APP_NAME} ${res_script_folders} ${APP_RES_DIR}/src/cocos) endif() - -# Copy win32 angle binaries -if(WIN32) - add_custom_command(TARGET ${APP_NAME} - COMMAND ${CMAKE_COMMAND} -E copy_if_different - ${COCOS2DX_ROOT_PATH}/external/angle/prebuilt/win32/libGLESv2.dll - ${COCOS2DX_ROOT_PATH}/external/angle/prebuilt/win32/libEGL.dll - ${COCOS2DX_ROOT_PATH}/external/angle/prebuilt/win32/d3dcompiler_47.dll - $ - ) -endif()