cmake: fix building UWP with non-MSVC generator

This commit is contained in:
Anonymous Maarten 2024-07-18 22:32:49 +02:00 committed by Anonymous Maarten
parent ccebbb6c6e
commit 2d1d3d9fb2
2 changed files with 24 additions and 13 deletions

View File

@ -411,8 +411,8 @@ if (LIBC_IS_GLIBC AND CMAKE_SIZEOF_VOID_P EQUAL 4)
endif()
if(WINDOWS_STORE)
sdl_compile_definitions(PRIVATE "SDL_BUILDING_WINRT=1")
sdl_compile_options(PRIVATE "-ZW")
sdl_compile_definitions(PRIVATE "SDL_BUILDING_WINRT=1" "WINAPI_FAMILY=WINAPI_FAMILY_APP")
sdl_compile_options(PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:/ZW>" "$<$<COMPILE_LANGUAGE:CXX>:-EHsc>")
endif()
check_linker_supports_version_file(HAVE_WL_VERSION_SCRIPT)
@ -1937,16 +1937,27 @@ elseif(WINDOWS)
set(SDL_THREAD_GENERIC_COND_SUFFIX 1)
set(SDL_THREAD_GENERIC_RWLOCK_SUFFIX 1)
set(SDL_THREAD_WINDOWS 1)
sdl_sources(
"${SDL3_SOURCE_DIR}/src/thread/generic/SDL_syscond.c"
"${SDL3_SOURCE_DIR}/src/thread/generic/SDL_sysrwlock.c"
"${SDL3_SOURCE_DIR}/src/thread/windows/SDL_syscond_cv.c"
"${SDL3_SOURCE_DIR}/src/thread/windows/SDL_sysmutex.c"
"${SDL3_SOURCE_DIR}/src/thread/windows/SDL_sysrwlock_srw.c"
"${SDL3_SOURCE_DIR}/src/thread/windows/SDL_syssem.c"
"${SDL3_SOURCE_DIR}/src/thread/windows/SDL_systhread.c"
"${SDL3_SOURCE_DIR}/src/thread/windows/SDL_systls.c"
)
if(WINDOWS_STORE)
sdl_sources(
"${SDL3_SOURCE_DIR}/src/thread/stdcpp/SDL_syscond.cpp"
"${SDL3_SOURCE_DIR}/src/thread/stdcpp/SDL_sysmutex.cpp"
"${SDL3_SOURCE_DIR}/src/thread/stdcpp/SDL_sysrwlock.cpp"
"${SDL3_SOURCE_DIR}/src/thread/stdcpp/SDL_systhread.cpp"
"${SDL3_SOURCE_DIR}/src/thread/generic/SDL_syssem.c"
)
else()
sdl_sources(
"${SDL3_SOURCE_DIR}/src/thread/generic/SDL_syscond.c"
"${SDL3_SOURCE_DIR}/src/thread/generic/SDL_sysrwlock.c"
"${SDL3_SOURCE_DIR}/src/thread/windows/SDL_syscond_cv.c"
"${SDL3_SOURCE_DIR}/src/thread/windows/SDL_sysmutex.c"
"${SDL3_SOURCE_DIR}/src/thread/windows/SDL_sysrwlock_srw.c"
"${SDL3_SOURCE_DIR}/src/thread/windows/SDL_syssem.c"
"${SDL3_SOURCE_DIR}/src/thread/windows/SDL_systhread.c"
"${SDL3_SOURCE_DIR}/src/thread/windows/SDL_systls.c"
)
endif()
set(HAVE_SDL_THREADS TRUE)
if(SDL_SENSOR AND HAVE_SENSORSAPI_H AND NOT WINDOWS_STORE)

View File

@ -8,7 +8,7 @@ message(STATUS "CMAKE_SYSTEM_PROCESSOR= ${CMAKE_SYSTEM_PROCESSOR}")
if(WINDOWS_STORE)
enable_language(CXX)
add_compile_options(/ZW)
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:/ZW>")
set_source_files_properties(ain_cli.c main_gui.c PROPERTIES LANGUAGE CXX)
endif()