From 40e0ab05b8b6eaaefe0b992cf6848af29433d895 Mon Sep 17 00:00:00 2001 From: yangchao <1162485779@qq.com> Date: Sat, 28 May 2022 20:10:19 +0800 Subject: [PATCH] V3.5 nx (#257) * add nx support * fix nx external compiler error * format code * nx if use nvn, no need use tbb * windows cl.exe not support -include compile flag * update pvmp3dec cmake , support windows --- CMakeLists.txt | 4 ++-- sources/CMakeLists.txt | 19 ++++++++++++++----- sources/pvmp3dec/CMakeLists.txt | 9 ++++++++- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bf282bbf..a7ec211d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,8 +10,7 @@ list(APPEND CC_EXTERNAL_PRIVATE_DEFINITIONS MESSAGE(STATUS "platform path: ${platform_spec_path}") include(${CMAKE_CURRENT_LIST_DIR}/cmake/CocosExternalConfig.cmake) include(${CMAKE_CURRENT_LIST_DIR}/sources/CMakeLists.txt) - -if(WINDOWS) +if(WINDOWS OR NX_WINDOWS) if(${CMAKE_SIZEOF_VOID_P} STREQUAL "4") include(${CMAKE_CURRENT_LIST_DIR}/win32/CMakeLists.txt) else() @@ -32,4 +31,5 @@ elseif(EMSCRIPTEN) include(${CMAKE_CURRENT_LIST_DIR}/emscripten/CMakeLists.txt) elseif(LINUX) include(${CMAKE_CURRENT_LIST_DIR}/linux/CMakeLists.txt) +elseif(NX) endif() diff --git a/sources/CMakeLists.txt b/sources/CMakeLists.txt index e24782b7..87586f69 100644 --- a/sources/CMakeLists.txt +++ b/sources/CMakeLists.txt @@ -45,7 +45,9 @@ if(NOT USE_MODULES) endif() # add dependent boost libs -include(${CMAKE_CURRENT_LIST_DIR}/boost-source/boost.cmake) +if(NOT NX) + include(${CMAKE_CURRENT_LIST_DIR}/boost-source/boost.cmake) +endif() if(ANDROID AND CC_ENABLE_SWAPPY) @@ -57,7 +59,7 @@ add_definitions(-DCC_SWAPPY_ENABLED) endif() -if(ANDROID OR OHOS) +if(ANDROID OR OHOS OR NX) include(${CMAKE_CURRENT_LIST_DIR}/pvmp3dec/CMakeLists.txt) include(${CMAKE_CURRENT_LIST_DIR}/tremolo/CMakeLists.txt) @@ -75,11 +77,18 @@ elseif(APPLE) if(USE_SOCKET) include(${CMAKE_CURRENT_LIST_DIR}/SocketRocket/CMakeLists.txt) endif() +elseif(NX_WINDOWS) + include(${CMAKE_CURRENT_LIST_DIR}/pvmp3dec/CMakeLists.txt) + list(APPEND CC_EXTERNAL_LIBS + pvmp3dec + ) endif() -list(APPEND CC_EXTERNAL_INCLUDES - ${CMAKE_CURRENT_LIST_DIR} -) +if((NOT NX_WINDOWS) AND (NOT NX)) + list(APPEND CC_EXTERNAL_INCLUDES + ${CMAKE_CURRENT_LIST_DIR} + ) +endif() if(USE_PHYSICS_PHYSX) list(APPEND CC_EXTERNAL_INCLUDES diff --git a/sources/pvmp3dec/CMakeLists.txt b/sources/pvmp3dec/CMakeLists.txt index bf84a3fc..b7163c5e 100644 --- a/sources/pvmp3dec/CMakeLists.txt +++ b/sources/pvmp3dec/CMakeLists.txt @@ -62,9 +62,16 @@ if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/pvmp3dec_tmp_def.h) file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/pvmp3dec_tmp_def.h "#pragma once\n#define OSCL_UNUSED_ARG(x) (void)(x)") endif() +if(WINDOWS OR NX_WINDOWS) +target_compile_options(pvmp3dec PRIVATE + #-fsanitize=signed-integer-overflow + /FI ${CMAKE_CURRENT_BINARY_DIR}/pvmp3dec_tmp_def.h + # +) +else() target_compile_options(pvmp3dec PRIVATE #-fsanitize=signed-integer-overflow -include ${CMAKE_CURRENT_BINARY_DIR}/pvmp3dec_tmp_def.h # ) - +endif()