From 488e83880efa01e9e9f40537eb002567ef0cdbfa Mon Sep 17 00:00:00 2001 From: Arnold <397136899@qq.com> Date: Tue, 31 Mar 2020 14:11:29 +0800 Subject: [PATCH] update source code --- android/CMakeLists.txt | 14 ++++++++++- cmake/CocosExternalConfig.cmake | 17 ------------- sources/CMakeLists.txt | 42 +++++++++++++++++++++++++-------- sources/pvmp3dec/CMakeLists.txt | 20 ++-------------- sources/xxtea/xxtea.h | 12 ++++++---- win32/include/jpeg/jmorecfg.h | 13 ---------- 6 files changed, 55 insertions(+), 63 deletions(-) diff --git a/android/CMakeLists.txt b/android/CMakeLists.txt index 5ed961be..23e2fb0e 100644 --- a/android/CMakeLists.txt +++ b/android/CMakeLists.txt @@ -51,6 +51,14 @@ set_target_properties(z PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${platform_spec_path}/include/zlib ) +add_library(android_platform + ${CMAKE_ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c + ${CMAKE_ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c +) +target_include_directories(android_platform PUBLIC + ${CMAKE_ANDROID_NDK}/sources/android/cpufeatures + ${CMAKE_ANDROID_NDK}/sources/android/native_app_glue +) set(se_libs_name) @@ -165,18 +173,22 @@ if(USE_SE_V8 AND USE_V8_DEBUGGER) ) endif() + list(APPEND CC_EXTERNAL_LIBS freetype jpeg png uv webp - OpenSLES ${se_libs_name} z + android_platform ) list(APPEND CC_EXTERNAL_INCLUDES ${platform_spec_path}/include + ${platform_spec_path}/include/v8 + ${platform_spec_path}/include/uv + ${CMAKE_ANDROID_NDK}/sources/android/native_app_glue ) \ No newline at end of file diff --git a/cmake/CocosExternalConfig.cmake b/cmake/CocosExternalConfig.cmake index 51dc1292..08dbcee4 100644 --- a/cmake/CocosExternalConfig.cmake +++ b/cmake/CocosExternalConfig.cmake @@ -1,22 +1,5 @@ # set friendly platform define - if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") - set(WINDOWS TRUE) - set(SYSTEM_STRING "Windows Desktop") - elseif(${CMAKE_SYSTEM_NAME} MATCHES "Android") - set(ANDROID TRUE) - set(SYSTEM_STRING "Android") - elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - if(IOS) - set(APPLE TRUE) - set(SYSTEM_STRING "IOS") - else() - set(APPLE TRUE) - set(MACOSX TRUE) - set(SYSTEM_STRING "Mac OSX") - endif() - endif() - if(IOS) set(platform_name ios) set(platform_spec_path ios) diff --git a/sources/CMakeLists.txt b/sources/CMakeLists.txt index e1fb5c85..c09e4d31 100644 --- a/sources/CMakeLists.txt +++ b/sources/CMakeLists.txt @@ -20,6 +20,37 @@ set(CC_EXTERNAL_SROUCES ${CMAKE_CURRENT_LIST_DIR}/ConvertUTF/ConvertUTF.c ${CMAKE_CURRENT_LIST_DIR}/ConvertUTF/ConvertUTF.h ${CMAKE_CURRENT_LIST_DIR}/ConvertUTF/ConvertUTFWrapper.cpp + + ${CMAKE_CURRENT_LIST_DIR}/tommyds/tommy.c + ${CMAKE_CURRENT_LIST_DIR}/tommyds/tommy.h + ${CMAKE_CURRENT_LIST_DIR}/tommyds/tommyalloc.c + ${CMAKE_CURRENT_LIST_DIR}/tommyds/tommyalloc.h + ${CMAKE_CURRENT_LIST_DIR}/tommyds/tommyarray.c + ${CMAKE_CURRENT_LIST_DIR}/tommyds/tommyarray.h + ${CMAKE_CURRENT_LIST_DIR}/tommyds/tommyarrayblk.c + ${CMAKE_CURRENT_LIST_DIR}/tommyds/tommyarrayblk.h + ${CMAKE_CURRENT_LIST_DIR}/tommyds/tommyarrayblkof.c + ${CMAKE_CURRENT_LIST_DIR}/tommyds/tommyarrayblkof.h + ${CMAKE_CURRENT_LIST_DIR}/tommyds/tommyarrayof.c + ${CMAKE_CURRENT_LIST_DIR}/tommyds/tommyarrayof.h + ${CMAKE_CURRENT_LIST_DIR}/tommyds/tommychain.h + ${CMAKE_CURRENT_LIST_DIR}/tommyds/tommyhash.c + ${CMAKE_CURRENT_LIST_DIR}/tommyds/tommyhash.h + ${CMAKE_CURRENT_LIST_DIR}/tommyds/tommyhashdyn.c + ${CMAKE_CURRENT_LIST_DIR}/tommyds/tommyhashdyn.h + ${CMAKE_CURRENT_LIST_DIR}/tommyds/tommyhashlin.c + ${CMAKE_CURRENT_LIST_DIR}/tommyds/tommyhashlin.h + ${CMAKE_CURRENT_LIST_DIR}/tommyds/tommyhashtbl.c + ${CMAKE_CURRENT_LIST_DIR}/tommyds/tommyhashtbl.h + ${CMAKE_CURRENT_LIST_DIR}/tommyds/tommylist.c + ${CMAKE_CURRENT_LIST_DIR}/tommyds/tommylist.h + ${CMAKE_CURRENT_LIST_DIR}/tommyds/tommytree.c + ${CMAKE_CURRENT_LIST_DIR}/tommyds/tommytree.h + ${CMAKE_CURRENT_LIST_DIR}/tommyds/tommytrie.c + ${CMAKE_CURRENT_LIST_DIR}/tommyds/tommytrie.h + ${CMAKE_CURRENT_LIST_DIR}/tommyds/tommytrieinp.c + ${CMAKE_CURRENT_LIST_DIR}/tommyds/tommytrieinp.h + ${CMAKE_CURRENT_LIST_DIR}/tommyds/tommytypes.h ) if(ANDROID) @@ -31,16 +62,7 @@ if(ANDROID) pvmp3dec vorbisidec ) - - if(ANDROID_NDK) - list(APPEND CC_EXTERNAL_SROUCES - ${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c - ) - list(APPEND CC_EXTERNAL_INCLUDES - ${ANDROID_NDK}/sources/android/cpufeatures - ) - endif() - + elseif(WINDOWS) set_source_files_properties(${CMAKE_CURRENT_LIST_DIR}/ConvertUTF/ConvertUTF.c PROPERTIES LANGUAGE C diff --git a/sources/pvmp3dec/CMakeLists.txt b/sources/pvmp3dec/CMakeLists.txt index 3ba4cd88..6098d32a 100644 --- a/sources/pvmp3dec/CMakeLists.txt +++ b/sources/pvmp3dec/CMakeLists.txt @@ -1,7 +1,6 @@ cmake_minimum_required(VERSION 3.8) - set(PVMP3SOURCE ${CMAKE_CURRENT_LIST_DIR}/src/pvmp3_normalize.cpp ${CMAKE_CURRENT_LIST_DIR}/src/pvmp3_alias_reduction.cpp @@ -31,10 +30,6 @@ set(PVMP3SOURCE ) - - -message(STATUS "-------------------abi for pvmp3:${ANDROID_ABI}------------------------------") - if("${ANDROID_ABI}" MATCHES "armeabi.*") message(STATUS "pvmp3dec compile with asm") set(PVMP3SOURCE_ASM @@ -56,9 +51,6 @@ else() ) endif() -message(STATUS "pvmp3dec source list ->") -message(STATUS "${PVMP3SOURCE}") - add_library(pvmp3dec ${PVMP3SOURCE}) target_include_directories(pvmp3dec PUBLIC @@ -66,18 +58,10 @@ target_include_directories(pvmp3dec PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include ) -# set_target_properties(pvmp3dec -# PROPERTIES LINK_LANGUAGE ASM -# ) - -file(WRITE ${CMAKE_CURRENT_LIST_DIR}/def.h "#pragma once\n#define OSCL_UNUSED_ARG(x) (void)(x)") - -# target_compile_definitions(pvmp3dec PRIVATE -# OSCL_UNUSED_ARG(x)=(void)(x) -# ) +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/pvmp3dec_tmp_def.h "#pragma once\n#define OSCL_UNUSED_ARG(x) (void)(x)") target_compile_options(pvmp3dec PRIVATE #-fsanitize=signed-integer-overflow - -include ${CMAKE_CURRENT_LIST_DIR}/def.h + -include ${CMAKE_CURRENT_BINARY_DIR}/pvmp3dec_tmp_def.h # ) \ No newline at end of file diff --git a/sources/xxtea/xxtea.h b/sources/xxtea/xxtea.h index 117d81ec..87f1d109 100644 --- a/sources/xxtea/xxtea.h +++ b/sources/xxtea/xxtea.h @@ -22,10 +22,14 @@ #include /* for size_t & NULL declarations */ #if defined(_WIN32) && defined(_WINDOWS) -#if defined(_USRDLL) -#define XXTEA_DLL __declspec(dllexport) -#else /* use a DLL library */ -#define XXTEA_DLL __declspec(dllimport) +#if CC_STATIC + #define XXTEA_DLL +#else + #if defined(_USRDLL) + #define XXTEA_DLL __declspec(dllexport) + #else /* use a DLL library */ + #define XXTEA_DLL __declspec(dllimport) + #endif #endif #else #define XXTEA_DLL diff --git a/win32/include/jpeg/jmorecfg.h b/win32/include/jpeg/jmorecfg.h index b19fba2a..a3a58878 100644 --- a/win32/include/jpeg/jmorecfg.h +++ b/win32/include/jpeg/jmorecfg.h @@ -263,19 +263,6 @@ typedef void noreturn_t; typedef enum { FALSE = 0, TRUE = 1 } boolean; #endif - -#if _WIN32 - -# ifdef FALSE /* in case these macros already exist */ -# undef FALSE /* values of boolean */ -# endif -# ifdef TRUE -# undef TRUE -# endif - -typedef enum { FALSE = 0, TRUE = 1 } boolean; -#endif - /* * The remaining options affect code selection within the JPEG library, * but they don't need to be visible to most applications using the library.