Compatible with Ninja

This commit is contained in:
Shatyuka 2022-04-26 15:16:02 +08:00
parent 82ecc7c9e3
commit d71c620fc1
11 changed files with 65 additions and 32 deletions

View File

@ -212,9 +212,12 @@ function(cocos_copy_target_dll cocos_target)
# copy thirdparty dlls to target bin dir
# copy_thirdparty_dlls(${cocos_target} $<TARGET_FILE_DIR:${cocos_target}>)
if(NOT CMAKE_GENERATOR STREQUAL "Ninja")
set(THIRD_PARTY_ARCH "\$\(Configuration\)/")
endif()
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/${THIRD_PARTY_ARCH}OpenAL32.dll"
$<TARGET_FILE_DIR:${cocos_target}>)
# Copy windows angle binaries
@ -229,9 +232,12 @@ endfunction()
function(cocos_copy_lua_dlls cocos_target)
if(NOT AX_USE_LUAJIT)
if(NOT CMAKE_GENERATOR STREQUAL "Ninja")
set(THIRD_PARTY_ARCH "\$\(Configuration\)/")
endif()
add_custom_command(TARGET ${cocos_target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_BINARY_DIR}/bin/\$\(Configuration\)/plainlua.dll"
"${CMAKE_BINARY_DIR}/bin/${THIRD_PARTY_ARCH}plainlua.dll"
$<TARGET_FILE_DIR:${cocos_target}>)
endif()
endfunction()

View File

@ -65,6 +65,7 @@ if (WIN32)
else()
add_definitions(-DNTCVT_CP_DEFAULT=CP_ACP)
endif()
add_definitions(-D_WINSOCKAPI_)
endif()
include(2d/CMakeLists.txt)
@ -180,7 +181,13 @@ if(WINDOWS)
exec_program(${NUGET_EXE}
ARGS install "Microsoft.Web.WebView2" -Version 1.0.992.28 -ExcludeVersion -OutputDirectory ${CMAKE_BINARY_DIR}/packages)
target_link_libraries(${ADXE_CORE_LIB} ${CMAKE_BINARY_DIR}/packages/Microsoft.Web.WebView2/build/native/Microsoft.Web.WebView2.targets)
if(CMAKE_GENERATOR STREQUAL "Ninja")
target_link_libraries(${ADXE_CORE_LIB} ${CMAKE_BINARY_DIR}/packages/Microsoft.Web.WebView2/build/native/${ARCH_ALIAS}/WebView2Loader.dll.lib)
target_include_directories(${ADXE_CORE_LIB} PUBLIC ${CMAKE_BINARY_DIR}/packages/Microsoft.Web.WebView2/build/native/include)
else()
target_link_libraries(${ADXE_CORE_LIB} ${CMAKE_BINARY_DIR}/packages/Microsoft.Web.WebView2/build/native/Microsoft.Web.WebView2.targets)
endif()
target_compile_definitions(${ADXE_CORE_LIB} PUBLIC ADXE_HAVE_WEBVIEW2)
endif()
endif()

View File

@ -45,6 +45,8 @@ __inline int IsEqualGUID(const GUID& rguid1, const GUID& rguid2)
{
return !::memcmp(&rguid1, &rguid2, sizeof(GUID));
}
#else
#include <guiddef.h>
#endif
namespace cocos2d

View File

@ -47,6 +47,7 @@ THE SOFTWARE.
#if defined(_WIN32)
# include "ntcvt/ntcvt.hpp"
# include "yasio/cxx17/string_view.hpp"
#endif
#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS

View File

@ -29,14 +29,14 @@
CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN) && \
!defined(CC_PLATFORM_OS_TVOS)
# undef ERROR
# include "ui/UIWidget.h"
# if CC_VIDEOPLAYER_DEBUG_DRAW
# include "2d/CCDrawNode.h"
# endif
# undef ERROR
/**
* @addtogroup ui
* @{

View File

@ -36,6 +36,7 @@
# include "rapidjson/document.h"
# include "rapidjson/stringbuffer.h"
# include "rapidjson/writer.h"
# include "base/ccUtils.h"
# define WIN32_LEAN_AND_MEAN
# include <Shlwapi.h>

View File

@ -179,14 +179,14 @@ elseif(WINDOWS)
endif()
endif()
if(WINDOWS)
if((WINDOWS AND (CMAKE_GENERATOR STREQUAL "Ninja")) OR LINUX)
cocos_get_resource_path(APP_RES_DIR ${APP_NAME})
cocos_copy_target_res(${APP_NAME} LINK_TO ${APP_RES_DIR} FOLDERS ${GAME_RES_FOLDER})
elseif(WINDOWS)
set_property(TARGET ${APP_NAME} PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "${GAME_RES_FOLDER}")
if(NOT DEFINED BUILD_ENGINE_DONE)
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT ${APP_NAME})
endif()
elseif(LINUX)
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()
# The optional thirdparties(not dependent by engine)
@ -315,13 +315,16 @@ if (_AX_USE_PREBUILT) # support windows only
if(WIN64)
set(ssl_dll_suffix "-${ARCH_ALIAS}")
endif()
if(NOT CMAKE_GENERATOR STREQUAL "Ninja")
set(THIRD_PARTY_ARCH "\$\(Configuration\)/")
endif()
add_custom_command(TARGET ${APP_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${ADXE_ROOT_PATH}/thirdparty/openssl/prebuilt/windows/${ARCH_ALIAS}/libcrypto-3${ssl_dll_suffix}.dll"
"${ADXE_ROOT_PATH}/thirdparty/openssl/prebuilt/windows/${ARCH_ALIAS}/libssl-3${ssl_dll_suffix}.dll"
"${ADXE_ROOT_PATH}/thirdparty/curl/prebuilt/windows/${ARCH_ALIAS}/libcurl.dll"
"${ADXE_ROOT_PATH}/thirdparty/zlib/prebuilt/windows/${ARCH_ALIAS}/zlib1.dll"
"${ADXE_ROOT_PATH}/${AX_PREBUILT_DIR}/bin/\$\(Configuration\)/OpenAL32.dll"
"${ADXE_ROOT_PATH}/${AX_PREBUILT_DIR}/bin/${THIRD_PARTY_ARCH}OpenAL32.dll"
$<TARGET_FILE_DIR:${APP_NAME}>)
# Copy windows angle binaries
@ -336,6 +339,11 @@ if (_AX_USE_PREBUILT) # support windows only
endif()
if (AX_ENABLE_MSEDGE_WEBVIEW2)
target_link_libraries(${APP_NAME} ${ADXE_ROOT_PATH}/${AX_PREBUILT_DIR}/packages/Microsoft.Web.WebView2/build/native/Microsoft.Web.WebView2.targets)
if(CMAKE_GENERATOR STREQUAL "Ninja")
target_link_libraries(${ADXE_CORE_LIB} ${CMAKE_BINARY_DIR}/packages/Microsoft.Web.WebView2/build/native/${ARCH_ALIAS}/WebView2Loader.dll.lib)
target_include_directories(${ADXE_CORE_LIB} PUBLIC ${CMAKE_BINARY_DIR}/packages/Microsoft.Web.WebView2/build/native/include)
else()
target_link_libraries(${ADXE_CORE_LIB} ${CMAKE_BINARY_DIR}/packages/Microsoft.Web.WebView2/build/native/Microsoft.Web.WebView2.targets)
endif()
endif()
endif()

View File

@ -184,18 +184,18 @@ elseif(WINDOWS)
endif()
endif()
# copy resource on linux or WINDOWS
if(WINDOWS)
if((WINDOWS AND (CMAKE_GENERATOR STREQUAL "Ninja")) OR LINUX)
cocos_get_resource_path(APP_RES_DIR ${APP_NAME})
cocos_copy_target_res(${APP_NAME} LINK_TO ${APP_RES_DIR}/res FOLDERS ${res_res_folders})
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)
elseif(WINDOWS)
set(my_res_folder "${CMAKE_CURRENT_SOURCE_DIR}")
cocos_copy_lua_scripts(${APP_NAME} ${res_script_folders} "${my_res_folder}/src/cocos")
set_property(TARGET ${APP_NAME} PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "${my_res_folder}")
if(NOT DEFINED BUILD_ENGINE_DONE)
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT ${APP_NAME})
endif()
elseif(LINUX)
cocos_get_resource_path(APP_RES_DIR ${APP_NAME})
cocos_copy_target_res(${APP_NAME} LINK_TO ${APP_RES_DIR}/res FOLDERS ${res_res_folders})
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()
# The optional thirdparties(not dependent by engine)
@ -329,14 +329,17 @@ if (_AX_USE_PREBUILT) # support windows only
if(WIN64)
set(ssl_dll_suffix "-${ARCH_ALIAS}")
endif()
if(NOT CMAKE_GENERATOR STREQUAL "Ninja")
set(THIRD_PARTY_ARCH "\$\(Configuration\)/")
endif()
add_custom_command(TARGET ${APP_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${ADXE_ROOT_PATH}/thirdparty/openssl/prebuilt/windows/${ARCH_ALIAS}/libcrypto-3${ssl_dll_suffix}.dll"
"${ADXE_ROOT_PATH}/thirdparty/openssl/prebuilt/windows/${ARCH_ALIAS}/libssl-3${ssl_dll_suffix}.dll"
"${ADXE_ROOT_PATH}/thirdparty/curl/prebuilt/windows/${ARCH_ALIAS}/libcurl.dll"
"${ADXE_ROOT_PATH}/thirdparty/zlib/prebuilt/windows/${ARCH_ALIAS}/zlib1.dll"
"${ADXE_ROOT_PATH}/${AX_PREBUILT_DIR}/bin/\$\(Configuration\)/OpenAL32.dll"
"${ADXE_ROOT_PATH}/${AX_PREBUILT_DIR}/bin/\$\(Configuration\)/plainlua.dll"
"${ADXE_ROOT_PATH}/${AX_PREBUILT_DIR}/bin/${THIRD_PARTY_ARCH}OpenAL32.dll"
"${ADXE_ROOT_PATH}/${AX_PREBUILT_DIR}/bin/${THIRD_PARTY_ARCH}plainlua.dll"
$<TARGET_FILE_DIR:${APP_NAME}>)
# Copy windows angle binaries
@ -351,6 +354,11 @@ if (_AX_USE_PREBUILT) # support windows only
endif()
if (AX_ENABLE_MSEDGE_WEBVIEW2)
target_link_libraries(${APP_NAME} ${ADXE_ROOT_PATH}/${AX_PREBUILT_DIR}/packages/Microsoft.Web.WebView2/build/native/Microsoft.Web.WebView2.targets)
if(CMAKE_GENERATOR STREQUAL "Ninja")
target_link_libraries(${ADXE_CORE_LIB} ${CMAKE_BINARY_DIR}/packages/Microsoft.Web.WebView2/build/native/${ARCH_ALIAS}/WebView2Loader.dll.lib)
target_include_directories(${ADXE_CORE_LIB} PUBLIC ${CMAKE_BINARY_DIR}/packages/Microsoft.Web.WebView2/build/native/include)
else()
target_link_libraries(${ADXE_CORE_LIB} ${CMAKE_BINARY_DIR}/packages/Microsoft.Web.WebView2/build/native/Microsoft.Web.WebView2.targets)
endif()
endif()
endif()

View File

@ -571,11 +571,11 @@ elseif(WINDOWS)
cocos_copy_target_dll(${APP_NAME})
endif()
if(WINDOWS)
set_property(TARGET ${APP_NAME} PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "${GAME_RES_FOLDER}")
elseif(LINUX)
if((WINDOWS AND (CMAKE_GENERATOR STREQUAL "Ninja")) OR LINUX)
cocos_get_resource_path(APP_RES_DIR ${APP_NAME})
cocos_copy_target_res(${APP_NAME} LINK_TO ${APP_RES_DIR} FOLDERS ${GAME_RES_FOLDER})
elseif(WINDOWS)
set_property(TARGET ${APP_NAME} PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "${GAME_RES_FOLDER}")
endif()
if(WINDOWS)

View File

@ -147,9 +147,9 @@ elseif(WINDOWS)
cocos_copy_target_dll(${APP_NAME})
endif()
if(WINDOWS)
set_property(TARGET ${APP_NAME} PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "${GAME_RES_FOLDER}")
elseif(LINUX)
if((WINDOWS AND (CMAKE_GENERATOR STREQUAL "Ninja")) OR LINUX)
cocos_get_resource_path(APP_RES_DIR ${APP_NAME})
cocos_copy_target_res(${APP_NAME} LINK_TO ${APP_RES_DIR} FOLDERS ${GAME_RES_FOLDER})
elseif(WINDOWS)
set_property(TARGET ${APP_NAME} PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "${GAME_RES_FOLDER}")
endif()

View File

@ -155,14 +155,14 @@ elseif(WINDOWS)
cocos_copy_lua_dlls(${APP_NAME})
endif()
if(WINDOWS)
set(my_res_folder "${CMAKE_CURRENT_SOURCE_DIR}/..")
cocos_copy_lua_scripts(${APP_NAME} ${res_script_folders} "${my_res_folder}/src/cocos")
cocos_copy_target_res(${APP_NAME} LINK_TO "${my_res_folder}/res" FOLDERS "${ADXE_ROOT_PATH}/tests/cpp-tests/Resources")
set_property(TARGET ${APP_NAME} PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "${my_res_folder}")
elseif(LINUX)
if((WINDOWS AND (CMAKE_GENERATOR STREQUAL "Ninja")) OR LINUX)
cocos_get_resource_path(APP_RES_DIR ${APP_NAME})
cocos_copy_target_res(${APP_NAME} LINK_TO ${APP_RES_DIR}/res FOLDERS ${res_res_folders})
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)
elseif(WINDOWS)
set(my_res_folder "${CMAKE_CURRENT_SOURCE_DIR}/..")
cocos_copy_lua_scripts(${APP_NAME} ${res_script_folders} "${my_res_folder}/src/cocos")
cocos_copy_target_res(${APP_NAME} LINK_TO "${my_res_folder}/res" FOLDERS "${ADXE_ROOT_PATH}/tests/cpp-tests/Resources")
set_property(TARGET ${APP_NAME} PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "${my_res_folder}")
endif()