Harmony port: Workflows (fix script error)

This commit is contained in:
Jack253-png 2025-05-30 19:54:09 +08:00
parent 95ccfa69e5
commit 8f0b9c1151
No known key found for this signature in database
GPG Key ID: 51EA61206B02D886
6 changed files with 35 additions and 2 deletions

View File

@ -51,6 +51,9 @@ jobs:
uses: ./.github/actions/setup-msvc-libusb
with:
arch: ${{ matrix.platform.setup-libusb-arch }}
- name: 'Set up Harmony toolchain'
if: ${{ matrix.platform.platform == 'harmony' }}
uses: ./.github/actions/setup-harmony-toolchain
- uses: mymindstorm/setup-emsdk@v14
if: ${{ matrix.platform.platform == 'emscripten' }}
with:

View File

@ -1502,7 +1502,28 @@ if(ANDROID)
endif()
endif()
endif()
elseif(OHOS)
# disable warnings from the toolchain
sdl_compile_options(PRIVATE "-Wno-unused-command-line-argument")
set(CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN "")
set(CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN "")
sdl_link_dependency(OHOS_LIBS LIBS ace_napi.z hilog_ndk.z ace_ndk.z rawfile.z pixelmap_ndk.z)
set(SDL_LOADSO_DLOPEN 1)
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/loadso/dlopen/*.c")
set(HAVE_SDL_LOADSO TRUE)
set(SDL_TIME_UNIX 1)
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/time/unix/*.c")
set(HAVE_SDL_TIME TRUE)
set(SDL_TIMER_UNIX 1)
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/timer/unix/*.c")
set(HAVE_SDL_TIMERS TRUE)
CheckPTHREAD()
elseif(EMSCRIPTEN)
# Hide noisy warnings that intend to aid mostly during initial stages of porting a new
# project. Uncomment at will for verbose cross-compiling -I/../ path info.

View File

@ -373,7 +373,7 @@ function(SDL_PrintSummary)
message(STATUS "")
endif()
if(UNIX AND NOT (ANDROID OR APPLE OR EMSCRIPTEN OR HAIKU OR RISCOS))
if(UNIX AND NOT (ANDROID OR APPLE OR EMSCRIPTEN OR HAIKU OR RISCOS OR OHOS))
if(NOT (HAVE_X11 OR HAVE_WAYLAND))
if(NOT SDL_UNIX_CONSOLE_BUILD)
message(FATAL_ERROR

View File

@ -112,6 +112,11 @@
#undef SDL_PLATFORM_LINUX
#endif
#if defined(OHOS) || defined(__OHOS__)
#define SDL_PLATFORM_OHOS 1
#undef SDL_PLATFORM_LINUX
#endif
#if defined(__unix__) || defined(__unix) || defined(unix)
/**

View File

@ -536,9 +536,11 @@ static void SDL_TARGETING("ssse3") SDL_Convert_Swap32_SSSE3(Uint32* dst, const U
// be guarded by the STDC FENV_ACCESS pragma; otherwise, it's undefined
// behavior. However, the compiler support for this pragma is bad.
#if defined(__clang__)
#ifndef SDL_PLATFORM_OHOS
#if __clang_major__ >= 12
#pragma STDC FENV_ACCESS ON
#endif
#endif
#elif defined(_MSC_VER)
#pragma fenv_access (on)
#elif defined(__GNUC__)
@ -813,9 +815,11 @@ static void SDL_Convert_Swap32_NEON(Uint32* dst, const Uint32* src, int num_samp
}
#if defined(__clang__)
#ifndef SDL_PLATFORM_OHOS
#if __clang_major__ >= 12
#pragma STDC FENV_ACCESS DEFAULT
#endif
#endif
#elif defined(_MSC_VER)
#pragma fenv_access (off)
#elif defined(__GNUC__)

View File

@ -169,7 +169,7 @@ void SDL_SYS_SetupThread(const char *name)
pthread_sigmask(SIG_BLOCK, &mask, 0);
#endif
#ifdef PTHREAD_CANCEL_ASYNCHRONOUS
#if defined(PTHREAD_CANCEL_ASYNCHRONOUS) && !defined(SDL_PLATFORM_OHOS)
// Allow ourselves to be asynchronously cancelled
{
int oldstate;