diff --git a/base/BUILD.gn b/base/BUILD.gn index fd26200be2eee3d9bb19680163eeb26043449e1f..b122cc101ecba44ed3d1b4e93f8d48395cf3b8f2 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn @@ -29,6 +29,12 @@ config("utils_config") { if (current_os == "ios") { defines += [ "IOS_PLATFORM" ] } + if (current_os == "win" || current_os == "mingw") { + defines += [ "WINDOWS_PLATFORM" ] + } + if (current_os == "mac") { + defines += [ "MAC_PLATFORM" ] + } if (is_emulator == true) { defines += [ "EMULATOR_PLATFORM" ] } @@ -95,6 +101,24 @@ sources_utils = [ "src/rwlock.cpp", ] +if (current_os == "win" || current_os == "mingw") { + sources_utils_win = [ + "src/parcel.cpp", + "src/refbase.cpp", + "src/string_ex.cpp", + "src/unicode_ex.cpp", + ] +} + +if (current_os == "mac") { + sources_utils_mac = [ + "src/parcel.cpp", + "src/refbase.cpp", + "src/string_ex.cpp", + "src/unicode_ex.cpp", + ] +} + if (current_os == "ios") { sources_utils_ios = [ "src/directory_ex.cpp", @@ -155,7 +179,21 @@ ohos_shared_library("utils") { "platformsdk", "sasdk", ] - if (current_os == "ios") { + if (current_os == "win" || current_os == "mingw") { + sources = sources_utils_win + public_configs = [ ":utils_config" ] + public_external_deps = [ "bounds_checking_function:libsec_shared" ] + + subsystem_name = "commonlibrary" + part_name = "c_utils" + } else if (current_os == "mac") { + sources = sources_utils_mac + public_configs = [ ":utils_config" ] + public_external_deps = [ "bounds_checking_function:libsec_shared" ] + + subsystem_name = "commonlibrary" + part_name = "c_utils" + } else if (current_os == "ios") { sources = sources_utils_ios configs = [ ":utils_coverage_config" ] all_dependent_configs = [ ":utils_config" ] @@ -210,7 +248,7 @@ ohos_shared_library("utils") { ########## modules for `c_utils` in rust ########## # rust compiler is not supportted on mac -if (host_os == "linux" && host_cpu != "arm64" && !is_arkui_x) { +if (host_os == "linux" && host_cpu != "arm64" && !is_arkui_x && current_os != "mac") { import("//build/templates/rust/rust_cxx.gni") # used for templates rust_cxx() rust_cxx("cxx_rust_gen") { sources = [ @@ -243,7 +281,7 @@ if (host_os == "linux" && host_cpu != "arm64" && !is_arkui_x) { } } -if (!is_arkui_x && !(host_os == "linux" && host_cpu == "arm64")) { +if (!is_arkui_x && !(host_os == "linux" && host_cpu == "arm64") && current_os != "mac") { ohos_rust_shared_library("utils_rust") { if (host_os == "linux") { sources = [ diff --git a/base/include/flat_obj.h b/base/include/flat_obj.h index 1691998f83836aee00786717cf6cd36e1ebbbb20..a602173ae74d88c7b24bb28c76c678579b0c12c5 100644 --- a/base/include/flat_obj.h +++ b/base/include/flat_obj.h @@ -26,11 +26,11 @@ #include -#ifndef IOS_PLATFORM +#if !defined(IOS_PLATFORM) && !defined(WINDOWS_PLATFORM) && !defined(MAC_PLATFORM) #include #else - typedef u_int32_t __u32; - typedef u_int64_t __u64; + typedef uint32_t __u32; + typedef uint64_t __u64; #endif #ifdef BINDER_IPC_32BIT @@ -55,3 +55,4 @@ struct parcel_flat_binder_object { }; #endif +