Skip to content

Commit 8f0b9c1

Browse files
committed
Harmony port: Workflows (fix script error)
1 parent 95ccfa6 commit 8f0b9c1

File tree

6 files changed

+35
-2
lines changed

6 files changed

+35
-2
lines changed

.github/workflows/generic.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ jobs:
5151
uses: ./.github/actions/setup-msvc-libusb
5252
with:
5353
arch: ${{ matrix.platform.setup-libusb-arch }}
54+
- name: 'Set up Harmony toolchain'
55+
if: ${{ matrix.platform.platform == 'harmony' }}
56+
uses: ./.github/actions/setup-harmony-toolchain
5457
- uses: mymindstorm/setup-emsdk@v14
5558
if: ${{ matrix.platform.platform == 'emscripten' }}
5659
with:

CMakeLists.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,7 +1502,28 @@ if(ANDROID)
15021502
endif()
15031503
endif()
15041504
endif()
1505+
elseif(OHOS)
1506+
# disable warnings from the toolchain
1507+
sdl_compile_options(PRIVATE "-Wno-unused-command-line-argument")
15051508

1509+
set(CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN "")
1510+
set(CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN "")
1511+
1512+
sdl_link_dependency(OHOS_LIBS LIBS ace_napi.z hilog_ndk.z ace_ndk.z rawfile.z pixelmap_ndk.z)
1513+
1514+
set(SDL_LOADSO_DLOPEN 1)
1515+
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/loadso/dlopen/*.c")
1516+
set(HAVE_SDL_LOADSO TRUE)
1517+
1518+
set(SDL_TIME_UNIX 1)
1519+
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/time/unix/*.c")
1520+
set(HAVE_SDL_TIME TRUE)
1521+
1522+
set(SDL_TIMER_UNIX 1)
1523+
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/timer/unix/*.c")
1524+
set(HAVE_SDL_TIMERS TRUE)
1525+
1526+
CheckPTHREAD()
15061527
elseif(EMSCRIPTEN)
15071528
# Hide noisy warnings that intend to aid mostly during initial stages of porting a new
15081529
# project. Uncomment at will for verbose cross-compiling -I/../ path info.

cmake/macros.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ function(SDL_PrintSummary)
373373
message(STATUS "")
374374
endif()
375375

376-
if(UNIX AND NOT (ANDROID OR APPLE OR EMSCRIPTEN OR HAIKU OR RISCOS))
376+
if(UNIX AND NOT (ANDROID OR APPLE OR EMSCRIPTEN OR HAIKU OR RISCOS OR OHOS))
377377
if(NOT (HAVE_X11 OR HAVE_WAYLAND))
378378
if(NOT SDL_UNIX_CONSOLE_BUILD)
379379
message(FATAL_ERROR

include/SDL3/SDL_platform_defines.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@
112112
#undef SDL_PLATFORM_LINUX
113113
#endif
114114

115+
#if defined(OHOS) || defined(__OHOS__)
116+
#define SDL_PLATFORM_OHOS 1
117+
#undef SDL_PLATFORM_LINUX
118+
#endif
119+
115120
#if defined(__unix__) || defined(__unix) || defined(unix)
116121

117122
/**

src/audio/SDL_audiotypecvt.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,9 +536,11 @@ static void SDL_TARGETING("ssse3") SDL_Convert_Swap32_SSSE3(Uint32* dst, const U
536536
// be guarded by the STDC FENV_ACCESS pragma; otherwise, it's undefined
537537
// behavior. However, the compiler support for this pragma is bad.
538538
#if defined(__clang__)
539+
#ifndef SDL_PLATFORM_OHOS
539540
#if __clang_major__ >= 12
540541
#pragma STDC FENV_ACCESS ON
541542
#endif
543+
#endif
542544
#elif defined(_MSC_VER)
543545
#pragma fenv_access (on)
544546
#elif defined(__GNUC__)
@@ -813,9 +815,11 @@ static void SDL_Convert_Swap32_NEON(Uint32* dst, const Uint32* src, int num_samp
813815
}
814816

815817
#if defined(__clang__)
818+
#ifndef SDL_PLATFORM_OHOS
816819
#if __clang_major__ >= 12
817820
#pragma STDC FENV_ACCESS DEFAULT
818821
#endif
822+
#endif
819823
#elif defined(_MSC_VER)
820824
#pragma fenv_access (off)
821825
#elif defined(__GNUC__)

src/thread/pthread/SDL_systhread.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ void SDL_SYS_SetupThread(const char *name)
169169
pthread_sigmask(SIG_BLOCK, &mask, 0);
170170
#endif
171171

172-
#ifdef PTHREAD_CANCEL_ASYNCHRONOUS
172+
#if defined(PTHREAD_CANCEL_ASYNCHRONOUS) && !defined(SDL_PLATFORM_OHOS)
173173
// Allow ourselves to be asynchronously cancelled
174174
{
175175
int oldstate;

0 commit comments

Comments
 (0)